:root{
  --bg:#eef2f7;--surface:#fff;--surface2:#f7f9fc;--text:#152033;--muted:#6b7280;--line:#dde3ec;
  --navy:#15233d;--blue:#2f6fed;--blue2:#eaf1ff;--green:#18815d;--red:#b83a3a;--amber:#a46b10;
  --shadow:0 10px 30px rgba(21,35,61,.08);--radius:22px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;min-height:100%;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,sans-serif;background:var(--bg);color:var(--text)}
button,input{font:inherit}button{cursor:pointer;touch-action:manipulation}.hidden{display:none!important}h1,h2,h3,p{margin-top:0}
.app-shell{min-height:100vh;padding:18px;max-width:1440px;margin:auto}.topbar{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:16px}.eyebrow{font-size:11px;letter-spacing:.13em;font-weight:850;color:var(--muted)}h1{font-size:28px;margin-bottom:0}.top-actions{display:flex;gap:9px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.device-badge,.sync-badge{background:#fff;border:1px solid var(--line);padding:10px 13px;border-radius:999px;font-size:13px;font-weight:800}.sync-badge{color:var(--green)}
.nav-button{min-height:46px;border:1px solid var(--line);border-radius:14px;padding:0 16px;background:#fff;font-weight:850;color:var(--text)}.nav-button.strong{background:var(--navy);color:#fff;border-color:var(--navy)}
.main-grid{display:grid;grid-template-columns:minmax(330px,.86fr) minmax(0,2fr);gap:16px}.products-panel,.cart-panel{background:#fff;border:1px solid #e7ebf2;border-radius:var(--radius);box-shadow:var(--shadow);padding:18px;min-height:calc(100vh - 100px)}.section-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}.section-head h2{font-size:21px;margin:0}
.product-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.product-button{min-height:145px;border:1px solid rgba(0,0,0,.08);border-radius:18px;padding:17px;display:flex;flex-direction:column;justify-content:space-between;text-align:left;box-shadow:0 3px 12px rgba(21,35,61,.05)}.product-button:active{transform:scale(.985)}.product-icon{font-size:31px}.product-name{font-size:19px;font-weight:900}.product-price{font-size:18px;font-weight:900}
.special-row{display:flex;gap:10px;margin-top:14px}.special-button,.secondary-button,.text-button{border:1px solid var(--line);background:#fff;border-radius:14px;min-height:48px;font-weight:850;color:var(--text)}.special-button{flex:1}.secondary-button{width:100%;padding:0 14px}.text-button{border:0;color:var(--muted);padding:0 8px}
.cart-panel{display:flex;flex-direction:column}.cart-items{display:flex;flex-direction:column;gap:9px;min-height:180px}.empty-state{align-items:center;justify-content:center;border:1px dashed var(--line);border-radius:16px;color:var(--muted)}.cart-item{border:1px solid var(--line);border-radius:15px;padding:11px}.cart-item-top{display:flex;justify-content:space-between;gap:10px}.cart-item-name,.cart-item-price{font-weight:900}.qty-row{display:flex;align-items:center;gap:7px;margin-top:9px;flex-wrap:wrap}.qty-btn{width:40px;height:40px;border-radius:11px;border:1px solid var(--line);background:#fff;font-weight:900;font-size:18px}.qty-value{min-width:32px;text-align:center;font-weight:900}.mini-action{border:0;background:transparent;color:var(--blue);font-weight:800;padding:8px}.cart-summary{margin-top:auto;border-top:1px solid var(--line);padding-top:14px}.cart-summary>div{display:flex;justify-content:space-between;margin:8px 0}.cart-summary strong{font-size:18px}
.primary-button{border:0;background:var(--navy);color:#fff;border-radius:16px;min-height:60px;padding:0 18px;font-size:17px;font-weight:950;box-shadow:0 6px 16px rgba(21,35,61,.18)}.primary-button:disabled{opacity:.35}.pay-button{width:100%;margin-top:13px}.full{width:100%}
.modal-backdrop{position:fixed;inset:0;background:rgba(21,32,51,.42);display:flex;align-items:center;justify-content:center;padding:16px;z-index:100}.modal{width:min(640px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:24px;padding:20px;box-shadow:0 30px 80px rgba(0,0,0,.28)}.modal.wide{width:min(920px,100%)}.modal-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px}.modal-head h3{margin:0;font-size:22px}.modal-head-actions{display:flex;gap:8px}.icon-button{width:44px;height:44px;border-radius:50%;border:1px solid var(--line);background:#fff;font-size:24px}.back-button{border:1px solid var(--line);background:#fff;border-radius:12px;padding:0 12px;min-height:44px;font-weight:850}.amount-big{text-align:center;font-size:44px;font-weight:950;margin:20px 0}.payment-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.payment-option{min-height:118px;border:1px solid var(--line);border-radius:18px;background:var(--surface2);font-size:23px;font-weight:950}.display-box{background:var(--surface2);border-radius:17px;padding:16px;margin-bottom:13px}.display-row{display:flex;justify-content:space-between;gap:12px;margin:8px 0}.display-row.change{font-size:26px;font-weight:950}.cash-shortcuts{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin:14px 0}.shortcut{min-height:52px;border:1px solid var(--line);border-radius:13px;background:#fff;font-weight:900}.keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.key{min-height:62px;border:1px solid var(--line);border-radius:15px;background:#fff;font-size:22px;font-weight:900}.key:active,.shortcut:active{background:var(--blue2)}
.money-display{font-size:36px;font-weight:950;text-align:right;padding:14px 16px;border:1px solid var(--line);border-radius:15px;background:#fff;margin-bottom:12px}.field-label{font-size:12px;font-weight:900;color:var(--muted);letter-spacing:.08em;margin:12px 0 7px}.plain-input{width:100%;min-height:52px;border:1px solid var(--line);border-radius:13px;padding:0 13px;font-size:17px}.note{font-size:13px;color:var(--muted)}
.success-card{text-align:center}.success-mark{font-size:52px;color:var(--green)}
.history-list,.admin-list{display:flex;flex-direction:column;gap:9px}.history-item,.admin-row{border:1px solid var(--line);border-radius:15px;padding:13px;background:#fff}.history-item{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;text-align:left}.history-main strong{display:block}.history-meta{font-size:13px;color:var(--muted);margin-top:3px}.pill{font-size:12px;font-weight:850;border-radius:999px;padding:6px 9px;background:var(--surface2)}
.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.admin-card{border:1px solid var(--line);border-radius:17px;padding:15px;background:var(--surface2)}.admin-card h4{margin:0 0 8px}.admin-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.small-button{border:1px solid var(--line);background:#fff;border-radius:12px;min-height:44px;font-weight:800;padding:0 12px}.danger{color:var(--red);border-color:#efcaca}.warning{color:var(--amber)}
.product-admin-row{display:grid;grid-template-columns:auto 1fr auto auto;gap:10px;align-items:center}.drag{font-size:22px;color:var(--muted)}.switch{border:1px solid var(--line);background:#fff;border-radius:999px;padding:7px 10px;font-weight:800}.switch.off{opacity:.5}.muted{color:var(--muted)}
.summary-table{width:100%;border-collapse:collapse}.summary-table td{padding:9px 0;border-bottom:1px solid var(--line)}.summary-table td:last-child{text-align:right;font-weight:850}.summary-table tr.total td{font-size:18px;font-weight:950;border-top:2px solid var(--text)}
.pin-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-top:14px}.pin-dot-row{display:flex;justify-content:center;gap:10px;margin:16px}.pin-dot{width:14px;height:14px;border-radius:50%;background:#d8dde6}.pin-dot.filled{background:var(--navy)}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:var(--navy);color:#fff;padding:13px 18px;border-radius:999px;font-weight:850;z-index:200;box-shadow:var(--shadow)}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.form-grid .span-2{grid-column:1/-1}.palette{display:flex;flex-wrap:wrap;gap:8px}.swatch{width:38px;height:38px;border-radius:11px;border:2px solid #fff;box-shadow:0 0 0 1px var(--line)}.preview-card{border:1px solid var(--line);border-radius:18px;padding:16px}.preview-button{min-height:130px;border-radius:16px;padding:16px;display:flex;flex-direction:column;justify-content:space-between;border:1px solid rgba(0,0,0,.08)}.contrast-warning{margin-top:8px;font-size:13px;color:var(--amber);font-weight:800}.icon-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:7px}.icon-choice{height:44px;border:1px solid var(--line);background:#fff;border-radius:10px;font-size:22px}.icon-choice.selected{outline:3px solid var(--blue2);border-color:var(--blue)}.row-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.audit-box{border-left:4px solid var(--blue);padding:10px 12px;background:var(--blue2);border-radius:10px;margin-top:12px}
@media(max-width:900px){.main-grid{grid-template-columns:1fr}.cart-panel,.products-panel{min-height:auto}.product-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.topbar{align-items:flex-start;flex-direction:column}.top-actions{justify-content:flex-start}.cart-panel{order:1}.products-panel{order:2}}
@media(max-width:520px){.app-shell{padding:10px}.product-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.product-button{min-height:118px;padding:12px}.product-name{font-size:16px}.product-price{font-size:16px}.payment-grid,.admin-grid,.form-grid{grid-template-columns:1fr}.form-grid .span-2{grid-column:auto}.cash-shortcuts{grid-template-columns:repeat(2,1fr)}.modal{padding:16px;border-radius:18px}.icon-grid{grid-template-columns:repeat(6,1fr)}}

/* V2.2 */
@media(min-width:901px){
  .cart-panel{height:calc(100vh - 100px);max-height:calc(100vh - 100px);overflow:hidden}
  .cart-items{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-right:4px}
  .cart-summary{margin-top:0;flex:0 0 auto;background:#fff}
  .pay-button{flex:0 0 auto}
}
.cart-item.compact{padding:9px 10px}
.cart-compact-main{display:flex;justify-content:space-between;gap:10px;align-items:center}
.cart-item-meta{display:block;font-size:12px;color:var(--muted);margin-top:2px;font-weight:700}
.compact-actions{margin-top:6px;gap:5px}
.compact-actions .qty-btn{width:34px;height:34px;border-radius:9px;font-size:16px}
.compact-actions .mini-action{padding:6px 7px}
.cart-summary{background:#fff;z-index:2}
.cart-summary .secondary-button{margin-top:6px}
.editor-layout{display:grid;grid-template-columns:220px 1fr;gap:14px;align-items:start}
.editor-preview{position:sticky;top:0;padding:12px}
.preview-label{font-size:11px;font-weight:900;color:var(--muted);letter-spacing:.08em;margin-bottom:7px}
.compact-preview{min-height:155px;padding:14px}
.editor-fields{min-width:0}
.editor-two{display:grid;grid-template-columns:1.35fr .65fr;gap:10px}
.emoji-section{margin-top:8px}
.emoji-caption{font-size:11px;font-weight:900;color:var(--muted);letter-spacing:.06em}
.emoji-strip{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.emoji-strip .icon-choice{width:42px;height:40px}
.no-icon{font-size:18px;color:var(--muted)}
.color-row{display:grid;grid-template-columns:82px 1fr auto;gap:8px;align-items:center;margin-top:10px}
.color-title{font-size:11px;font-weight:900;color:var(--muted);letter-spacing:.06em}
.compact-palette{gap:5px;flex-wrap:nowrap;overflow-x:auto;padding:2px}
.compact-palette .swatch{width:32px;height:32px;border-radius:9px;flex:0 0 auto;position:relative}
.swatch.selected{box-shadow:0 0 0 3px #fff,0 0 0 5px var(--blue);border-color:transparent}
.swatch span{font-size:16px;font-weight:950;text-shadow:0 1px 2px rgba(0,0,0,.35)}
.hex-inline{display:flex;align-items:center;gap:7px}
.hex-input{width:116px;min-height:42px;padding:0 10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:14px}
.custom-swatch{width:42px;height:42px;border-radius:10px;border:2px solid #fff;box-shadow:0 0 0 1px var(--line);flex:0 0 auto}
.full-switch{width:100%;min-height:52px}
.sticky-actions{position:sticky;bottom:-20px;background:#fff;padding:10px 0 2px;z-index:4}
@media(max-width:760px){
  .editor-layout{grid-template-columns:1fr}
  .editor-preview{position:sticky;top:-20px;z-index:3;background:#fff}
  .compact-preview{min-height:110px;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px}
  .compact-preview .product-icon{font-size:26px}.compact-preview .product-name{font-size:17px}.compact-preview .product-price{font-size:16px}
  .editor-two{grid-template-columns:1fr 1fr}
  .color-row{grid-template-columns:1fr;gap:5px}
  .hex-inline{justify-content:flex-start}
}


/* V2.3 */
@media(min-width:901px){
  .products-panel{height:calc(100vh - 100px);max-height:calc(100vh - 100px);overflow:hidden;display:flex;flex-direction:column}
  .products-panel .section-head{flex:0 0 auto}
  .product-grid{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;grid-template-columns:repeat(5,minmax(0,1fr));grid-auto-rows:minmax(108px,1fr);align-content:start;padding-right:4px}
  .product-button{min-height:108px;padding:11px 12px;border-radius:15px}
  .product-icon{font-size:25px}.product-name{font-size:16px}.product-price{font-size:15px}
  .special-row{flex:0 0 auto;margin-top:12px;padding-top:10px;border-top:1px solid var(--line);background:#fff}
}
.category-button{background:linear-gradient(180deg,#f8fafc,#eef3f9);color:var(--text);border:1px dashed #c9d3e2}
.category-button .product-price{color:var(--muted)!important;font-size:13px}
.product-head-left{display:flex;align-items:center;gap:10px}
.product-head-left h2{margin:0}
.category-back{min-height:38px;border:1px solid var(--line);background:#fff;border-radius:11px;padding:0 10px;font-weight:850;color:var(--text)}
.cash-error{margin:10px 0;padding:10px 12px;border-radius:12px;background:#fff1f1;color:var(--red);font-weight:850;border:1px solid #f2caca}
.cash-display{margin-bottom:10px}
.select-input{appearance:auto;background:#fff}
.category-editor-row{margin-top:8px}
@media(max-width:1100px) and (min-width:901px){
  .product-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;grid-auto-rows:minmax(100px,1fr)}
  .product-button{min-height:100px;padding:9px}.product-icon{font-size:23px}.product-name{font-size:15px}.product-price{font-size:14px}
}

/* V2.4 */
@media(min-width:901px){
  .product-grid{
    grid-template-columns:repeat(var(--grid-cols,5),minmax(0,1fr));
    grid-template-rows:repeat(var(--grid-rows,3),minmax(0,1fr));
    grid-auto-rows:minmax(0,1fr);
    overflow:hidden;
    align-content:stretch;
  }
  .product-grid.scrolling{
    grid-template-rows:none;
    grid-auto-rows:minmax(100px,1fr);
    overflow-y:auto;
  }
  .product-grid:not(.scrolling) .product-button{min-height:0;height:100%}
  .product-grid:not(.scrolling) .product-icon{font-size:clamp(26px,3.1vh,42px)}
  .product-grid:not(.scrolling) .product-name{font-size:clamp(16px,2vh,23px)}
  .product-grid:not(.scrolling) .product-price{font-size:clamp(15px,1.7vh,20px)}
}
.summary-section{margin-top:14px;border:1px solid var(--line);border-radius:16px;padding:12px 14px;background:#fff}
.summary-section:first-of-type{margin-top:0}
.summary-title{font-size:11px;font-weight:950;letter-spacing:.09em;color:var(--muted);margin-bottom:5px}
.summary-table tr.subrow td{border-bottom:0;padding:4px 0;color:var(--muted);font-size:14px}
.summary-table tr.subrow td:first-child{padding-left:18px}


/* V2.4.1 – iPhone landscape + tablet breakpoints */
@media (orientation:landscape) and (max-width:900px) and (max-height:600px){
  html,body{height:100%;overflow:hidden}
  .app-shell{height:100dvh;min-height:0;max-width:none;padding:7px 9px;padding-left:max(9px,env(safe-area-inset-left));padding-right:max(9px,env(safe-area-inset-right));padding-bottom:max(7px,env(safe-area-inset-bottom));overflow:hidden}
  .topbar{height:50px;margin-bottom:7px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:8px;overflow:hidden}
  .topbar>div:first-child{min-width:0}.eyebrow{display:none}h1{font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:210px}
  .top-actions{flex-wrap:nowrap;gap:5px;min-width:0}.device-badge,.sync-badge{padding:6px 8px;font-size:10px;white-space:nowrap}.sync-badge{display:none}
  .nav-button{min-height:36px;height:36px;padding:0 9px;border-radius:10px;font-size:11px}
  .main-grid{height:calc(100dvh - 64px);min-height:0;grid-template-columns:minmax(235px,34%) minmax(0,66%);gap:8px}
  .cart-panel,.products-panel{order:initial;min-height:0;height:100%;max-height:100%;padding:9px;border-radius:15px;overflow:hidden}
  .cart-panel{display:flex;flex-direction:column}
  .products-panel{display:flex;flex-direction:column}
  .section-head{margin-bottom:6px;min-height:31px}.section-head h2{font-size:16px}.text-button{min-height:30px;font-size:11px}
  .cart-items{flex:1;min-height:0;overflow-y:auto;gap:5px;padding-right:2px}.cart-item.compact{padding:6px 7px}.cart-item-name{font-size:12px}.cart-item-meta{font-size:10px}.cart-item-price{font-size:12px}.compact-actions{margin-top:3px}.compact-actions .qty-btn{width:28px;height:28px}.compact-actions .mini-action{padding:4px 5px;font-size:10px}
  .cart-summary{margin-top:0;padding-top:5px;flex:0 0 auto}.cart-summary>div{margin:3px 0;font-size:11px}.cart-summary strong{font-size:13px}.cart-summary .secondary-button{min-height:30px;height:30px;font-size:10px;margin-top:3px}
  .pay-button{min-height:38px;height:38px;margin-top:5px;font-size:12px;border-radius:11px;flex:0 0 auto}
  .product-grid{flex:1;min-height:0;display:grid;grid-template-columns:repeat(var(--grid-cols,5),minmax(0,1fr));grid-template-rows:repeat(var(--grid-rows,3),minmax(0,1fr));grid-auto-rows:minmax(58px,1fr);gap:6px;overflow:hidden;align-content:stretch}
  .product-grid.scrolling{grid-template-rows:none;overflow-y:auto;grid-auto-rows:minmax(62px,1fr)}
  .product-grid:not(.scrolling) .product-button{height:100%;min-height:0}
  .product-button{min-height:58px;padding:6px 7px;border-radius:11px}.product-icon{font-size:18px}.product-name{font-size:12px}.product-price{font-size:11px}
  .category-button .product-price{font-size:10px}.product-head-left{gap:5px}.category-back{min-height:30px;height:30px;font-size:10px;padding:0 7px}
  .special-row{flex:0 0 auto;margin-top:6px;padding-top:5px;gap:6px;border-top:1px solid var(--line)}.special-button{min-height:34px;height:34px;font-size:11px;border-radius:10px}
}

/* iPad/tablet portrait keeps the POS split view instead of stacking. */
@media (orientation:portrait) and (min-width:700px) and (max-width:900px){
  .app-shell{padding:12px;max-width:none}
  .topbar{flex-direction:row;align-items:center}.top-actions{justify-content:flex-end}.topbar h1{font-size:22px}
  .main-grid{grid-template-columns:minmax(270px,36%) minmax(0,64%);gap:10px}
  .cart-panel,.products-panel{order:initial;min-height:calc(100dvh - 92px);height:calc(100dvh - 92px);max-height:calc(100dvh - 92px);overflow:hidden;padding:12px}
  .cart-panel,.products-panel{display:flex;flex-direction:column}
  .cart-items{flex:1;min-height:0;overflow-y:auto}.cart-summary{margin-top:0;flex:0 0 auto}.pay-button{flex:0 0 auto}
  .product-grid{flex:1;min-height:0;grid-template-columns:repeat(var(--grid-cols,5),minmax(0,1fr));grid-template-rows:repeat(var(--grid-rows,3),minmax(0,1fr));overflow:hidden;gap:8px}
  .product-grid.scrolling{grid-template-rows:none;grid-auto-rows:minmax(92px,1fr);overflow-y:auto}
  .product-grid:not(.scrolling) .product-button{min-height:0;height:100%}
  .special-row{flex:0 0 auto;margin-top:8px;padding-top:7px;border-top:1px solid var(--line)}
}

/* V2.5 – Google Drive connection + responsive monetary controls */
.drive-status{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:16px}
.drive-dot{width:10px;height:10px;border-radius:50%;background:#9aa5b5;box-shadow:0 0 0 3px rgba(154,165,181,.16)}
.drive-status.ok .drive-dot{background:#2f9e62;box-shadow:0 0 0 3px rgba(47,158,98,.16)}
.sync-badge.connected{background:#e7f7ed;color:#17623a}
.money-display,.amount-big{font-size:clamp(30px,5.2vw,54px);line-height:1.05}
.keypad{grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(7px,1.2vw,12px)}
.keypad .key,.pin-grid .key{font-size:clamp(20px,3.2vw,32px);min-height:clamp(54px,8.2vh,82px);border-radius:clamp(10px,1.5vw,16px)}
.modal h3{font-size:clamp(20px,2.8vw,28px)}
.summary-table td{font-size:clamp(14px,1.65vw,18px)}
.summary-table tr.total td{font-size:clamp(16px,2vw,21px)}
@media (max-width:600px) and (orientation:portrait){
  .money-display,.amount-big{font-size:clamp(30px,10vw,44px)}
  .keypad .key,.pin-grid .key{font-size:clamp(21px,7vw,28px);min-height:clamp(54px,15vw,68px)}
}
@media (orientation:landscape) and (max-height:600px){
  .money-display,.amount-big{font-size:clamp(25px,6vh,38px);margin:7px 0}
  .keypad{gap:5px}
  .keypad .key,.pin-grid .key{font-size:clamp(17px,4.5vh,24px);min-height:clamp(38px,9.2vh,52px);border-radius:9px}
  .field-label{font-size:10px}
}
