:root{
  --ink:#1B2340; --ink-2:#262F52; --paper:#F5F6F8; --card:#fff; --line:#E2E5EC;
  --text:#1D2433; --muted:#5B647A; --gold:#F2A900; --gold-d:#B97F00;
  --leaf:#1E8E5A; --brick:#C23B2E;
  --r:10px; --font:'Public Sans',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --head:'Bricolage Grotesque','Public Sans',system-ui,sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--text);font:400 15px/1.5 var(--font);font-variant-numeric:tabular-nums}
h1,h2{font-family:var(--head);margin:0;font-weight:700;letter-spacing:-.01em}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.ic{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* shell */
.shell{display:flex;min-height:100vh}
.side{width:236px;background:var(--ink);color:#C9CFE3;display:flex;flex-direction:column;padding:18px 12px;position:sticky;top:0;height:100vh;flex:none}
.brand{display:flex;align-items:center;gap:10px;font:700 22px var(--head);color:#fff;padding:2px 10px 18px}
.mark{width:22px;height:22px;border-radius:6px;background:var(--gold);box-shadow:inset -7px 0 0 rgba(0,0,0,.18)}
.side nav{display:flex;flex-direction:column;gap:2px;flex:1;overflow:auto}
.nav{display:flex;align-items:center;gap:12px;padding:9px 12px;border-radius:8px;color:inherit;text-decoration:none;font-weight:500}
.nav:hover{background:var(--ink-2);color:#fff}
.nav.on{background:var(--gold);color:var(--ink);font-weight:600}
.nav.soon{opacity:.5;cursor:default}
.nav.soon:hover{background:none;color:inherit}
.nav em{margin-left:auto;font-size:12px;font-style:normal;background:var(--ink-2);padding:1px 8px;border-radius:99px}
.signout{display:flex;align-items:center;gap:8px;border-top:1px solid var(--ink-2);padding:14px 6px 0;margin:10px 0 0}
.who{flex:1;display:flex;flex-direction:column;line-height:1.25;color:#fff}
.who small{color:#9AA3C2}
.icon-btn{background:none;border:0;color:inherit;padding:8px;border-radius:8px;cursor:pointer;display:inline-flex}
.icon-btn:hover{background:var(--ink-2)}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.top{display:flex;align-items:center;gap:12px;padding:14px 28px;background:var(--card);border-bottom:1px solid var(--line)}
.top h1{font-size:20px}
.top .menu{display:none;color:var(--ink)}
.top .menu:hover{background:var(--paper)}
.clock{margin-left:auto;color:var(--muted);font-size:14px}
.page{padding:24px 28px 48px;max-width:1400px;width:100%}

/* dashboard */
.filters{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:14px;margin-bottom:18px}
.hello{margin:0;font:700 26px var(--head)}
.filter-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:12px}
.fld{display:flex;flex-direction:column;gap:3px;font-size:13px;color:var(--muted)}
.fld select,.fld input,#tSearch{height:38px;padding:0 10px;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--text)}
.seg{display:inline-flex;background:var(--card);border:1px solid var(--line);border-radius:8px;padding:3px;gap:2px}
.seg button{border:0;background:none;padding:6px 12px;border-radius:6px;cursor:pointer;color:var(--muted);font-weight:500;min-height:32px}
.seg button.on{background:var(--ink);color:#fff}
.alert{background:#FBECEA;color:#8C2A20;border:1px solid #F1C4BE;border-radius:8px;padding:10px 14px;margin-bottom:14px}

.ledger{display:grid;grid-template-columns:minmax(260px,1fr) 2.4fr;background:var(--card);border:1px solid var(--line);border-radius:var(--r);margin-bottom:18px;overflow:hidden}
.ledger-hero{background:var(--ink);color:#fff;padding:24px 26px;display:flex;flex-direction:column;justify-content:center;gap:4px}
.lbl{color:#B9C0DB;font-size:14px}
.big{font:700 clamp(28px,3.4vw,40px)/1.1 var(--head);color:var(--gold)}
.ledger-hero small{color:#9AA3C2}
.ledger-grid{margin:0;display:grid;grid-template-columns:repeat(4,1fr)}
.ledger-grid>div{padding:16px 20px;border-left:1px solid var(--line);border-bottom:1px solid var(--line)}
.ledger-grid>div:nth-child(n+5){border-bottom:0}
.ledger-grid>div:nth-child(4n+1){border-left:0}
.ledger-grid dt{color:var(--muted);font-size:13px}
.ledger-grid dd{margin:2px 0 0;font:600 18px var(--font)}
.ledger-grid dd.warn{color:var(--brick)}

.panel{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:18px 20px;margin-bottom:18px}
.panel-head{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;margin-bottom:14px}
.panel-head h2{font-size:18px}
.chart-wrap{position:relative;height:320px}
.tabs{display:flex;flex-wrap:wrap;gap:4px}
.tabs button{border:0;background:none;padding:8px 12px;border-radius:8px;cursor:pointer;font-weight:500;color:var(--muted)}
.tabs button:hover{background:var(--paper)}
.tabs button[aria-selected=true]{background:var(--paper);color:var(--ink);font-weight:600;box-shadow:inset 0 -3px 0 var(--gold)}
.tabs .n{display:inline-block;margin-left:6px;min-width:22px;padding:0 6px;border-radius:99px;background:var(--line);font-size:12px;line-height:20px;text-align:center}
.tabs .n.hot{background:var(--brick);color:#fff}
.tools{display:flex;gap:8px}
#tSearch{min-width:180px}
.btn{display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 18px;border:0;border-radius:8px;background:var(--gold);color:var(--ink);font-weight:600;cursor:pointer}
.btn:hover{background:#FFB91F}
.btn.ghost{background:var(--card);border:1px solid var(--line);height:38px;color:var(--text)}
.btn.ghost:hover{background:var(--paper)}
.table-wrap{overflow-x:auto;max-height:440px;overflow-y:auto}
table{width:100%;border-collapse:collapse;font-size:14px}
th{position:sticky;top:0;background:var(--card);text-align:left;font-weight:600;color:var(--muted);padding:9px 12px;border-bottom:1px solid var(--line);white-space:nowrap}
td{padding:10px 12px;border-bottom:1px solid var(--line)}
tbody tr:hover{background:#FAFBFC}
.r{text-align:right}
.tag{display:inline-block;padding:1px 10px;border-radius:99px;font-size:13px;font-weight:500;background:var(--paper)}
.tag.ok{background:#E3F4EB;color:#14663F}.tag.warn{background:#FFF1D0;color:#7A5200}.tag.bad{background:#FBECEA;color:#8C2A20}
.empty{padding:34px 12px;text-align:center;color:var(--muted)}

/* login */
body.login{display:grid;grid-template-columns:1.1fr 1fr;min-height:100vh}
.login-art{background:var(--ink);color:#fff;padding:48px;display:flex;flex-direction:column;justify-content:space-between}
.login-art .brand{font-size:30px;padding:0}
.login-art p{font:600 clamp(24px,3vw,36px)/1.25 var(--head);max-width:16em;margin:0;color:#E9ECF7}
.login-form{display:grid;place-items:center;padding:32px}
.login-form form{width:100%;max-width:340px;display:flex;flex-direction:column;gap:14px}
.login-form h1{font-size:28px;margin-bottom:6px}
.login-form label{display:flex;flex-direction:column;gap:4px;font-weight:500}
.login-form input{height:44px;padding:0 12px;border:1px solid var(--line);border-radius:8px;background:#fff}
.login-form .btn{height:46px;margin-top:6px}

@media (max-width:1000px){
  .ledger{grid-template-columns:1fr}
  .ledger-grid{grid-template-columns:repeat(2,1fr)}
  .ledger-grid>div{border-left:0;border-bottom:1px solid var(--line)}
  .ledger-grid>div:nth-child(even){border-left:1px solid var(--line)}
  .ledger-grid>div:nth-child(n+5){border-bottom:1px solid var(--line)}
  .ledger-grid>div:last-child{border-bottom:0}
}
@media (max-width:820px){
  .side{position:fixed;left:0;top:0;z-index:20;transform:translateX(-100%);transition:transform .2s}
  .side.open{transform:none}
  .top .menu{display:inline-flex}
  .top,.page{padding-left:16px;padding-right:16px}
  body.login{grid-template-columns:1fr}
  .login-art{padding:24px;gap:24px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* phase 2: lists, forms, pagination */
.flash{padding:10px 14px;border-radius:8px;margin-bottom:16px;background:#E3F4EB;color:#14663F;border:1px solid #BFE3CF}
.flash.err{background:#FBECEA;color:#8C2A20;border-color:#F1C4BE}
.bar{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;justify-content:space-between;margin-bottom:16px}
.bar form{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end}
.btn.sm{height:32px;padding:0 12px;font-size:13px}
.btn.sec{background:var(--ink);color:#fff}.btn.sec:hover{background:var(--ink-2)}
a.btn{text-decoration:none}
.seg a{padding:6px 14px;border-radius:6px;color:var(--muted);font-weight:500;text-decoration:none;min-height:32px;display:inline-flex;align-items:center}
.seg a.on{background:var(--ink);color:#fff}
td a,.crumb a{color:#1B4FBF;text-decoration:none;font-weight:500}td a:hover{text-decoration:underline}
td small,.muted{color:var(--muted);font-size:13px;display:block}
.panel table td.r,.panel table th.r{text-align:right}
.pager{display:flex;gap:4px;justify-content:flex-end;margin-top:14px}
.pager a{min-width:34px;height:34px;display:grid;place-items:center;border:1px solid var(--line);border-radius:8px;text-decoration:none;color:var(--text)}
.pager a.on{background:var(--ink);color:#fff;border-color:var(--ink)}
.form{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px 18px;max-width:900px}
.form .full{grid-column:1/-1}
.form label{display:flex;flex-direction:column;gap:4px;font-weight:500;font-size:14px}
.form input,.form select,.form textarea{height:40px;padding:0 10px;border:1px solid var(--line);border-radius:8px;background:#fff}
.form .hint{font-weight:400;color:var(--muted);font-size:13px}
.form .chk{flex-direction:row;align-items:center;gap:8px}.form .chk input{height:auto}
.form h3{margin:8px 0 0;font:700 16px var(--head)}
.actions{display:flex;gap:10px;margin-top:6px}
.ac{position:relative}
.ac-list{position:absolute;z-index:10;left:0;right:0;top:100%;background:#fff;border:1px solid var(--line);border-radius:8px;box-shadow:0 8px 24px rgba(27,35,64,.14);max-height:280px;overflow:auto}
.ac-list button{display:block;width:100%;text-align:left;background:none;border:0;padding:9px 12px;cursor:pointer}
.ac-list button:hover,.ac-list button:focus{background:var(--paper)}
.lines input{height:36px;width:100%;min-width:80px;padding:0 8px;border:1px solid var(--line);border-radius:6px;text-align:right}
.lines td:first-child{min-width:220px}
.totals{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin-top:16px;max-width:900px}
.totals div{background:var(--paper);border-radius:8px;padding:10px 14px}
.totals b{display:block;font:700 20px var(--head)}
.kv{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin-bottom:18px}
.kv div{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:12px 16px}
.kv dt{color:var(--muted);font-size:13px}.kv dd{margin:2px 0 0;font:600 18px var(--font)}
.kv{margin-left:0}

/* phase 3: point of sale */
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
body.pos{background:var(--paper)}
.pos-app{min-height:100vh;display:flex;flex-direction:column}
.pos-top{display:flex;align-items:center;gap:12px;padding:10px 20px;background:var(--ink);color:#fff;flex-wrap:wrap}
.pos-back,.pos-brand{display:inline-flex;align-items:center;gap:8px;color:#fff;text-decoration:none;font:700 18px var(--head)}
.pos-loc{color:#C9CFE3;display:flex;align-items:center;gap:8px}
.pos-loc select{height:34px;border-radius:8px;border:0;padding:0 8px;background:var(--ink-2);color:#fff}
.pos-status{flex:1;min-width:160px;color:var(--gold);font-weight:500}
.pos-top .clock{color:#9AA3C2}
.pos-top .btn.ghost{background:var(--ink-2);border-color:var(--ink-2);color:#fff}
.pos-top .btn.ghost:hover{background:#33406B}
.pos-top .n{background:var(--gold);color:var(--ink);border-radius:99px;padding:0 7px;margin-left:4px;font-size:12px}
.pos-out{margin:0}.pos-out .icon-btn{color:#C9CFE3}
.pos-grid{flex:1;display:grid;grid-template-columns:minmax(0,1.6fr) minmax(320px,1fr);gap:16px;padding:16px 20px;align-items:start}
.pos-left,.pos-right{display:flex;flex-direction:column;gap:12px;min-width:0}
.pos-right{position:sticky;top:12px}
.pos-search input{width:100%;height:52px;font-size:17px;padding:0 16px;border:2px solid var(--line);border-radius:10px;background:#fff}
.pos-search input:focus{border-color:var(--gold);outline:0}
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}
.tile{text-align:left;background:#fff;border:1px solid var(--line);border-radius:10px;padding:10px 12px;cursor:pointer;display:flex;flex-direction:column;gap:2px;min-height:76px}
.tile:hover{border-color:var(--gold)}
.tile b{font-weight:600;line-height:1.25}
.tile span{color:var(--muted);font-size:13px}
.tile.out{opacity:.55}
.cart.panel{padding:6px 12px;margin:0}
.cart .table-wrap{max-height:calc(100vh - 360px);min-height:180px}
.cart input{height:36px;border:1px solid var(--line);border-radius:6px;text-align:right;padding:0 6px}
.cart .qty{display:inline-flex;align-items:center;gap:4px;justify-content:flex-end}
.cart .qty input{width:64px}
.cart .qty button{width:34px;height:34px;border:1px solid var(--line);background:#fff;border-radius:6px;cursor:pointer;font-size:18px}
.cart .pr{width:92px}
.cart td{vertical-align:middle}
.panel .row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:5px 0}
.pos-right .panel{margin:0;padding:12px 16px}
.cust{display:flex;justify-content:space-between;align-items:center;gap:10px}
.cust b{display:block;font-size:16px}
.disc-in{display:inline-flex;gap:4px;margin-left:auto}
.disc-in select,.disc-in input{height:34px;border:1px solid var(--line);border-radius:6px;padding:0 6px;background:#fff}
.disc-in input{width:84px;text-align:right}
.grand{display:flex;justify-content:space-between;align-items:center;margin:8px -16px -12px;padding:14px 16px;background:var(--ink);color:#fff;border-radius:0 0 var(--r) var(--r)}
.grand strong{font:700 30px var(--head);color:var(--gold)}
.pay-methods{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-bottom:8px}
.pay-methods button{height:42px;border:1px solid var(--line);background:#fff;border-radius:8px;font-weight:600;cursor:pointer}
.pay-methods button:hover{border-color:var(--gold);background:#FFF8E6}
.prow{display:flex;align-items:center;gap:8px;padding:4px 0}
.prow span{flex:1;font-weight:500}
.prow input{width:120px;height:38px;border:1px solid var(--line);border-radius:6px;text-align:right;padding:0 8px}
.prow button{width:34px;height:34px;border:0;background:none;cursor:pointer;font-size:20px;color:var(--muted)}
.row.bad b{color:var(--brick)}.row.good b{color:var(--leaf)}
.pos-actions{display:grid;grid-template-columns:1fr 2.2fr;gap:8px}
.pos-actions .btn{height:54px;font-size:16px}
.btn.charge{font:700 18px var(--head)}
.btn:disabled{opacity:.45;cursor:not-allowed}
.dlg{border:0;border-radius:14px;padding:22px 24px;width:min(460px,92vw);box-shadow:0 20px 60px rgba(27,35,64,.35)}
.dlg::backdrop{background:rgba(27,35,64,.55)}
.dlg h2{margin-bottom:10px}
.dlg input[type=search]{width:100%;height:42px;border:1px solid var(--line);border-radius:8px;padding:0 12px;margin-bottom:8px}
.pick{max-height:240px;overflow:auto;margin-bottom:10px}
.pick button,.heldrow{display:flex;justify-content:space-between;align-items:center;gap:8px;width:100%;text-align:left;background:none;border:0;border-bottom:1px solid var(--line);padding:10px 4px;cursor:pointer}
.pick button:hover{background:var(--paper)}
.heldrow{cursor:default}
.dlg details{margin:6px 0 12px}.dlg summary{cursor:pointer;font-weight:500;padding:6px 0}
@media (max-width:900px){
  .pos-grid{grid-template-columns:1fr;padding:12px}
  .pos-right{position:static}
  .cart .table-wrap{max-height:none}
}

/* phase 4 */
.tabsbar{margin-bottom:16px}
.tag.mute{background:var(--paper);color:var(--muted)}
.inline-form{display:inline}
.link-btn{background:none;border:0;padding:0;color:var(--brick);cursor:pointer;font-weight:500}
.link-btn:hover{text-decoration:underline}
.chg.up{color:var(--leaf);font-weight:600}.chg.down{color:var(--brick);font-weight:600}

/* contacts */
[hidden]{display:none!important}
.more>summary{list-style:none;cursor:pointer;display:inline-flex}
.more>summary::-webkit-details-marker{display:none}
.more>summary::after{content:"\25BE";margin-left:8px}
.more[open]>summary::after{content:"\25B4"}

/* customer ledger report and printing */
.paper{background:#fff;border:1px solid var(--line);border-radius:10px;padding:22px 26px;margin-bottom:18px}
.paper .biz{text-align:center;font:700 26px var(--head);margin:0}
.rep-title{text-align:center;font:600 16px var(--font);margin:4px 0 14px}
.rep-cust{margin:0 0 6px;line-height:1.6}
.rep-meta{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:13px;color:var(--muted);margin-bottom:8px}
.ledger-tbl{width:100%;border-collapse:collapse;font-size:12.5px}
.ledger-tbl th{background:#F1F3F7;color:var(--text);position:static;border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:6px 8px}
.ledger-tbl td{padding:4px 8px;border-bottom:1px solid #EEF0F4}
.ledger-tbl tfoot td{border-top:2px solid var(--ink);border-bottom:0;padding:8px}
.ledger-tbl .nw{white-space:nowrap}
.rep-grand{text-align:right;margin:12px 0 0;font-size:14px}
@media print{
  .side,.top,.bar,.tabsbar,.flash,.noprint,.crumb{display:none!important}
  .shell,.main{display:block}.page{padding:0;max-width:none}
  body{background:#fff}
  .paper{border:0;padding:0;margin:0}
  .ledger-tbl thead{display:table-header-group}.ledger-tbl tr{page-break-inside:avoid}
  .ledger-tbl{font-size:10.5px}.ledger-tbl td,.ledger-tbl th{padding:3px 5px}
  @page{size:A4;margin:10mm}
}

/* kitchen and orders boards */
.board-tools{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end}
.chk-inline{display:inline-flex;align-items:center;gap:6px;height:38px;font-size:14px}
.bcount b{font:700 28px var(--head)}
.ocards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.ocard{background:#fff;border:1px solid var(--line);border-top:5px solid #5B8DEF;border-radius:10px;padding:12px 14px;display:flex;flex-direction:column}
.ocard.st-cooked{border-top-color:var(--gold)}.ocard.st-served{border-top-color:var(--leaf);opacity:.8}
.ocard.is-new{box-shadow:0 0 0 3px rgba(242,169,0,.5)}
.ocard h3{margin:0 0 6px;font:700 17px var(--head);text-align:center}
.ocard dl{margin:0;display:grid;grid-template-columns:auto 1fr;gap:3px 12px;font-size:14px;flex:1}
.ocard dt{font-weight:600}.ocard dd{margin:0;min-width:0;overflow-wrap:anywhere}
.obadge{display:inline-block;padding:0 9px;border-radius:5px;font-size:12px;font-weight:600;color:#fff;background:#3B6FD8}
.obadge.st-cooked{background:var(--gold);color:var(--ink)}.obadge.st-served{background:var(--leaf)}
.age{color:var(--muted);font-size:12px}.age.late{color:var(--brick);font-weight:700}
.oacts{display:flex;flex-direction:column;gap:4px;margin-top:10px}
.oacts button{height:38px;border:0;border-radius:6px;font-weight:600;cursor:pointer;color:#fff}
.b-cook{background:#F59E0B}.b-serve{background:#F59E0B}.b-print{background:#22A06B}
.oacts button:disabled{opacity:.5;cursor:wait}
.order-opts{display:grid;grid-template-columns:1fr 1fr;gap:8px 10px;align-items:end}
.order-opts label{display:flex;flex-direction:column;gap:3px;font-size:13px;color:var(--muted)}
.order-opts select{height:38px;border:1px solid var(--line);border-radius:6px;padding:0 6px;background:#fff;color:var(--text)}
.order-opts .chk{grid-column:1/-1;flex-direction:row;align-items:center;gap:8px;font-size:14px;color:var(--text)}
.cart .note{width:100%;min-width:140px;text-align:left;margin-top:4px;height:30px;font-size:13px}

/* permissions */
.permgrp{border:1px solid var(--line);border-radius:8px;padding:8px 14px 10px;margin:0 0 10px;display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:2px 16px}
.permgrp legend{font-weight:600;padding:0 6px;font-size:14px}
.permgrp .chk{display:flex;align-items:center;gap:8px;font-weight:400}.permgrp .chk input{height:auto}
.permtbl .c{text-align:center}.permtbl tr.grp td{background:var(--paper)}
.permtbl input{width:18px;height:18px}

/* report printing */
.print-head{display:none}
.top .icon-btn.prt{color:var(--ink)}.top .icon-btn.prt:hover{background:var(--paper)}
@media print{
  .print-head{display:block;margin:0 0 12px;padding-bottom:6px;border-bottom:2px solid #000}
  .print-head h2{margin:0;font:700 20px var(--head)}.ph-title{font:600 15px var(--font)}.ph-filters,.ph-meta{font-size:11px;color:#333}
  .table-wrap{max-height:none!important;overflow:visible!important}
  .panel{border:0!important;box-shadow:none!important;padding:0!important;margin-bottom:10px}
  .pager,.actions,.link-btn,.icon-btn,.btn,button{display:none!important}
  a{color:#000!important;text-decoration:none!important}
  .kv{margin-bottom:8px}.kv div{border:1px solid #bbb;padding:4px 8px}
  .paper .print-head{display:none}
  th{position:static!important}
}
@media print{ main.page:has(.paper) .print-head{display:none!important} }
