:root{
  --bg:#121521;--panel:#1a1f2f;--panel2:#202638;--line:#30384f;--text:#f5f7fb;--muted:#98a0b5;
  --accent:#7468ff;--accent2:#5bd0b7;--danger:#ef6b73;--gold:#e5c36b;--white:#fff;
  --screen-w:1024px;--screen-h:768px;
  font-family:"Segoe UI",Arial,sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
html,body{
  margin:0;width:100%;height:100%;overflow:hidden;
  background:#0b0e16;color:var(--text);
}
button,input{font:inherit}
button,[data-add],[data-action],[data-payment],[data-category]{cursor:pointer;border:0;color:inherit}
button:hover,.cat-btn:hover,.pay-btn:hover,.bottom-btn:hover,.top-btn:hover,.qty-btn:hover,.round-btn:hover,.link-btn:hover,.product-card:hover{filter:brightness(1.08)}
button:active,.product-card:active{transform:scale(.985)}

.stage{
  width:100vw;height:100vh;display:grid;place-items:center;
  background:#0b0e16;
}
.app-shell{
  width:var(--screen-w);height:var(--screen-h);
  display:grid;grid-template-rows:64px 1fr 68px;
  background:linear-gradient(180deg,#111521 0,#151928 100%);
  overflow:hidden;box-shadow:0 0 0 1px #222838;
}

.topbar{display:flex;align-items:center;justify-content:space-between;padding:8px 14px;border-bottom:1px solid var(--line);background:#111521;gap:10px}
.brand-wrap{display:flex;gap:10px;align-items:center;min-width:0}
.brand-mark{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:var(--accent);font-size:22px;font-weight:800;flex:0 0 auto}
.brand{font-size:20px;font-weight:800;letter-spacing:.08em;line-height:1}
.subbrand{font-size:10px;color:var(--muted);letter-spacing:.14em}
.status-wrap{display:flex;gap:8px;align-items:center;flex-wrap:nowrap}
.shift-chip,.online-chip,.finance-chip{padding:8px 10px;border-radius:10px;background:var(--panel);border:1px solid var(--line);font-size:12px;white-space:nowrap}
.shift-chip.open{border-color:#356d5f;color:#a8f0db;background:#17302a}
.online-chip{color:var(--muted)}
.finance-chip{color:var(--muted);cursor:pointer;max-width:220px;overflow:hidden;text-overflow:ellipsis}
.finance-chip.ok{border-color:#356d5f;color:#a8f0db;background:#17302a}
.finance-chip.warn{border-color:#8a6a2f;color:#f0d39a;background:#2a2214}
.finance-chip.err{border-color:#8a3a3a;color:#f0a8a8;background:#2a1414}
.finance-chip .dot{background:#888}
.finance-chip.ok .dot{background:#3dd6a5}
.finance-chip.warn .dot{background:#e6b84d}
.finance-chip.err .dot{background:#e06b6b}
.dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--accent2);margin-right:6px}
.top-btn{min-height:40px;padding:0 12px;border-radius:10px;background:var(--accent);font-weight:700;font-size:13px;white-space:nowrap}
.top-btn.ghost{background:var(--panel2);border:1px solid var(--line)}
.top-btn.expand{background:#1a3a4a;border:1px solid #2a6f88;color:#9fe7ff}

.main-grid{display:grid;grid-template-columns:1.45fr .9fr;gap:10px;padding:10px;min-height:0}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:14px;min-height:0;overflow:hidden}
.menu-panel{display:flex;flex-direction:column}
.panel-head{padding:10px 12px 4px;display:flex;align-items:flex-start;justify-content:space-between}
.eyebrow{font-size:10px;letter-spacing:.14em;color:var(--muted);font-weight:700}
.panel h1,.panel h2{margin:2px 0 0;font-size:20px}
.terminal-id{padding:6px 8px;border-radius:8px;background:var(--panel2);color:var(--muted);font-size:12px}
.category-row{display:flex;gap:8px;padding:6px 10px 8px;overflow:auto}
.cat-btn{min-height:36px;padding:0 12px;background:var(--panel2);border:1px solid var(--line);border-radius:10px;font-weight:700;white-space:nowrap;font-size:13px}
.cat-btn.active{background:var(--accent);border-color:transparent}

.product-grid{padding:0 10px 10px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;overflow:auto}
.product-card{
  min-height:118px;border:1px solid var(--line);border-radius:12px;
  background:linear-gradient(180deg,#22293b,#1d2332);padding:10px;
  display:flex;flex-direction:column;justify-content:space-between;cursor:pointer;user-select:none
}
.product-card:hover{border-color:#4a5473}
.product-top{display:flex;justify-content:space-between;gap:6px}
.product-tag{font-size:10px;color:var(--muted)}
.product-name{font-size:15px;font-weight:800;line-height:1.15}
.product-desc{color:var(--muted);font-size:11px;margin-top:4px}
.product-price{font-size:16px;font-weight:800;margin-top:8px}

.order-panel{display:flex;flex-direction:column}
.order-head{padding:10px 12px 2px;display:flex;align-items:flex-start;justify-content:space-between}
.order-head-actions{display:flex;gap:8px}
.round-btn{width:40px;height:40px;border-radius:12px;background:var(--accent);font-size:22px}
.round-btn.danger{background:#5a2a32;border:1px solid #ef6b73}
.order-meta{padding:0 12px 6px;color:var(--muted);display:flex;justify-content:space-between;font-size:12px}
.order-list{flex:1;overflow:auto;padding:2px 8px}
.empty-order{text-align:center;color:var(--muted);padding:24px 12px;line-height:1.45;font-size:13px}
.empty-order span{font-size:11px}
.order-item{display:grid;grid-template-columns:1fr auto;gap:8px;padding:8px;border-bottom:1px solid var(--line)}
.order-item-name{font-weight:800;font-size:13px}
.order-item-sub{font-size:11px;color:var(--muted);margin-top:2px}
.qty-row{display:flex;gap:6px;align-items:center;margin-top:6px}
.qty-btn{width:30px;height:30px;border-radius:8px;background:var(--panel2);font-size:16px}
.qty{min-width:18px;text-align:center;font-weight:800;font-size:13px}
.order-item-price{font-weight:800;font-size:13px;white-space:nowrap}
.order-summary{border-top:1px solid var(--line);padding:8px 12px}
.summary-row{display:flex;justify-content:space-between;gap:8px;padding:3px 0;color:var(--muted);font-size:12px}
.summary-row strong{color:var(--text)}
.summary-row.total{font-size:18px;color:var(--text);padding-top:6px}
.link-btn{background:none;color:#b6b0ff;padding:0;font-weight:800;font-size:12px}
.pay-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:8px 10px 10px}
.pay-btn{min-height:46px;border-radius:12px;font-size:13px;font-weight:900}
.cash{background:#2b4b45}.card{background:#304063}.mixed{background:#4d3553}

.bottom-nav{display:flex;align-items:center;gap:8px;padding:8px 10px;border-top:1px solid var(--line);background:#111521}
.bottom-btn{min-width:88px;min-height:50px;border-radius:12px;background:var(--panel2);border:1px solid var(--line);font-weight:800;font-size:11px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.bottom-btn span{font-size:16px}
.bottom-spacer{flex:1}

.modal-backdrop{position:fixed;inset:0;background:#05070dcc;display:grid;place-items:center;z-index:50;padding:16px;pointer-events:auto}
.modal-backdrop.hidden{display:none!important;pointer-events:none}
.modal{width:min(820px,94vw);max-height:92dvh;overflow:auto;border-radius:18px;background:#181d2b;border:1px solid var(--line);box-shadow:0 30px 80px #0008;padding:18px}
.modal:empty{display:none}
.modal h3{font-size:20px;margin:0 0 12px}
.modal-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:11px;color:var(--muted)}
.field input,.field select{height:42px;border-radius:10px;border:1px solid var(--line);background:#0f1320;color:#fff;padding:0 12px}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}
.modal-actions button{min-height:44px;padding:0 16px;border-radius:12px;font-weight:800}
.modal-primary{background:var(--accent)}
.modal-secondary{background:var(--panel2);border:1px solid var(--line)}
.modal-danger{background:#5a2a32;border:1px solid #ef6b73;color:#ffd6da}
.pay-switch{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:10px 0 12px}
.pay-switch-btn{min-height:40px;border-radius:10px;background:#2a3144;font-weight:800;font-size:13px;border:1px solid var(--line)}
.pay-switch-btn.active{background:var(--accent);border-color:transparent}
.receipt{background:#fff;color:#111;padding:18px;border-radius:8px;width:320px;margin:auto;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.receipt .center{text-align:center}
.receipt .line{border-top:1px dashed #777;margin:8px 0}
.receipt .row{display:flex;justify-content:space-between;gap:8px}
.receipt small{font-size:10px;line-height:1.35;display:block}
.receipt .total{font-size:17px;font-weight:900;margin-top:6px}
.receipt-actions{display:flex;gap:8px;justify-content:center;margin-top:14px}
.receipt-actions button{min-height:44px;padding:0 14px;border-radius:10px;font-weight:900}
.order-history{display:grid;gap:8px}
.history-card{padding:10px;border:1px solid var(--line);border-radius:12px;background:var(--panel2);display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.history-card strong{font-size:15px}
.pay-badge{display:inline-block;margin-top:6px;padding:4px 8px;border-radius:8px;font-size:11px;font-weight:800;letter-spacing:.04em}
.pay-cash{background:#2b4b45;color:#b8f0df}
.pay-card{background:#304063;color:#c5d8ff}
.pay-mixed{background:#4d3553;color:#f0c9ff}
.muted{color:var(--muted)}
.notice{padding:12px 14px;border-radius:12px;background:#2a2232;color:#ddd1ff;border:1px solid #4a3c63;margin-bottom:10px}
.danger{color:#ffb1b7}
.expand-info{display:grid;gap:8px;font-size:13px;line-height:1.45}
.expand-info b{color:#9fe7ff}

@media print{
  body{background:#fff}
  .stage,.app-shell{display:none}
  .modal-backdrop{position:static;background:none;padding:0}
  .modal{box-shadow:none;border:0;width:100%;max-height:none;overflow:visible;padding:0}
  .receipt{width:100%;box-shadow:none}
  .receipt-actions{display:none}
}
