:root{
  --bg:#0f1115;--surface:#171a21;--surface-2:#1e222b;--surface-3:#262b36;--border:#2c313d;
  --text:#e7eaf0;--text-dim:#9aa3b2;--text-faint:#6b7383;
  --brand:#33bca8;--brand-dim:#288f7f;--brand-lite:#7ad9ca;--green:#38b26f;--green-dim:#2a8a55;
  --amber:#f0a835;--red:#e5484d;--blue:#4f8ef7;--purple:#9a6bff;
  --radius:12px;--radius-sm:8px;--shadow:0 8px 30px rgba(0,0,0,.4);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
:root[data-theme="light"]{
  --bg:#eef3fb;--surface:#ffffff;--surface-2:#f2f6fc;--surface-3:#e6edf8;--border:#d3deec;
  --text:#0f1e33;--text-dim:#516074;--text-faint:#8894a5;
  --green:#1f9d57;--green-dim:#188046;--amber:#9a6a12;--red:#d5383d;--blue:#2f6fe0;--purple:#7c4dff;
  --shadow:0 10px 30px rgba(0,32,80,.12);
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:14px;-webkit-font-smoothing:antialiased;overflow:hidden}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,select,textarea{font-family:inherit;font-size:14px;background:var(--surface-2);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-sm);padding:10px 12px;width:100%;outline:none}
input:focus,select:focus,textarea:focus{border-color:var(--brand)}
label{display:block;font-size:12px;color:var(--text-dim);margin-bottom:6px;font-weight:600}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:10px}
::-webkit-scrollbar-track{background:transparent}

#app{display:flex;height:100vh}
.sidebar{width:92px;background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;align-items:center;padding:16px 0;flex-shrink:0;overflow-y:auto}
.logo{width:48px;height:48px;border-radius:50%;background:linear-gradient(135deg,var(--brand),#4fd1bd);display:grid;place-items:center;margin-bottom:18px;flex-shrink:0;overflow:hidden}
.logo img{width:100%;height:100%;object-fit:cover}
.logo-wm{font-size:11px;font-weight:800;color:var(--text-dim);margin-bottom:16px;letter-spacing:-.2px}
.logo-wm b{color:var(--brand)}
.nav{display:flex;flex-direction:column;gap:4px;width:100%;align-items:center;flex:1}
.nav-item{position:relative;width:80px;padding:9px 4px;border-radius:10px;display:flex;flex-direction:column;align-items:center;gap:3px;color:var(--text-faint);font-size:10px;font-weight:600;transition:all .15s;text-align:center}
.nav-item .ico{font-size:19px}
.nav-item:hover{background:var(--surface-2);color:var(--text-dim)}
.nav-item.active{background:var(--surface-3);color:var(--brand)}
.net-status{display:inline-flex;align-items:center;gap:7px;padding:5px 12px;border-radius:999px;background:var(--surface-2);font-size:11px;font-weight:700;color:var(--text-dim);letter-spacing:.2px;white-space:nowrap}
.net-dot{width:8px;height:8px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.18);flex-shrink:0}
.net-status.off{color:#ef4444;background:rgba(239,68,68,.10)}
.net-status.off .net-dot{background:#ef4444;box-shadow:0 0 0 3px rgba(239,68,68,.18);animation:netpulse 1.1s infinite}
@keyframes netpulse{50%{opacity:.35}}
.nav-item .nav-badge{position:absolute;top:4px;right:14px;min-width:16px;height:16px;padding:0 4px;background:var(--red);color:#fff;font-size:9px;line-height:1;border-radius:9px;font-weight:800;display:flex;align-items:center;justify-content:center;box-shadow:0 0 0 2px var(--surface)}
.main{flex:1;display:flex;flex-direction:column;overflow:hidden}
.topbar{height:60px;border-bottom:1px solid var(--border);display:flex;align-items:center;padding:0 20px;gap:14px;flex-shrink:0;background:var(--surface)}
.topbar h1{font-size:18px;font-weight:700}
.topbar .clock{color:var(--text-dim);font-variant-numeric:tabular-nums;font-size:13px}
.pill{background:var(--surface-3);padding:6px 12px;border-radius:20px;font-size:12px;color:var(--text-dim);display:inline-flex;align-items:center;gap:6px}
.pill.warn{background:rgba(240,168,53,.15);color:var(--amber)}
.pill.ok{background:rgba(56,178,111,.15);color:var(--green)}
.pill.bad{background:rgba(229,72,77,.15);color:var(--red)}
.spacer{margin-left:auto}
.content{flex:1;overflow:auto;padding:20px}
.app-footer{flex-shrink:0;height:30px;display:flex;align-items:center;justify-content:center;gap:4px;border-top:1px solid var(--border);background:var(--surface);font-size:11px;color:var(--text-faint);letter-spacing:.2px}
.app-footer b{color:var(--brand);font-weight:700}
.help-fab{position:fixed;right:22px;bottom:44px;z-index:90;width:54px;height:54px;border-radius:50%;background:var(--brand);color:#fff;font-size:24px;display:grid;place-items:center;box-shadow:0 8px 22px rgba(0,0,0,.32);border:none;cursor:pointer;transition:transform .12s,background .12s}
.help-fab:hover{transform:translateY(-2px);background:var(--brand-dim);box-shadow:0 12px 28px rgba(0,0,0,.4)}
.help-fab:active{transform:scale(.96)}
.help-fab::after,#ai-fab::after{content:attr(data-tip);position:absolute;right:66px;top:50%;transform:translateY(-50%) translateX(6px);background:var(--surface-3);color:var(--text);border:1px solid var(--border);padding:7px 12px;border-radius:9px;font-size:12px;font-weight:600;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .16s,transform .16s;box-shadow:var(--shadow)}
.help-fab:hover::after,#ai-fab:hover::after{opacity:1;transform:translateY(-50%) translateX(0)}

.row{display:flex;gap:12px}
.grid{display:grid;gap:16px}
.wrap{flex-wrap:wrap}
.btn{background:var(--surface-3);color:var(--text);padding:10px 16px;border-radius:var(--radius-sm);font-weight:600;font-size:13px;display:inline-flex;align-items:center;gap:8px;transition:all .15s;border:1px solid transparent}
.btn:hover{background:var(--border)}
.btn.primary{background:var(--brand);color:#fff}.btn.primary:hover{background:var(--brand-dim)}
.btn.green{background:var(--green);color:#fff}.btn.green:hover{background:var(--green-dim)}
.btn.ghost{background:transparent;border:1px solid var(--border)}.btn.ghost:hover{background:var(--surface-2)}
.btn.danger{background:transparent;border:1px solid var(--red);color:var(--red)}.btn.danger:hover{background:var(--red);color:#fff}
.btn.sm{padding:6px 10px;font-size:12px}
.btn.block{width:100%;justify-content:center}
.btn:disabled{opacity:.4;cursor:not-allowed}
.badge{padding:3px 9px;border-radius:20px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.3px;display:inline-flex;align-items:center;gap:4px}
.badge.green{background:rgba(56,178,111,.15);color:var(--green)}
.badge.amber{background:rgba(240,168,53,.15);color:var(--amber)}
.badge.red{background:rgba(229,72,77,.15);color:var(--red)}
.badge.blue{background:rgba(79,142,247,.15);color:var(--blue)}
.badge.purple{background:rgba(154,107,255,.15);color:var(--purple)}
.badge.brand{background:rgba(51,188,168,.15);color:var(--brand)}
.badge.gray{background:var(--surface-3);color:var(--text-dim)}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px}
.muted{color:var(--text-dim)}.faint{color:var(--text-faint)}
.section-title{font-size:13px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--text-faint);margin-bottom:12px}
.page-head{display:flex;align-items:center;gap:12px;margin-bottom:18px;flex-wrap:wrap}
.page-head h2{font-size:22px;font-weight:800;letter-spacing:-.4px}
.empty{text-align:center;padding:48px;color:var(--text-faint)}
.empty .big{font-size:40px;margin-bottom:8px}

/* pharmacy tags */
.rx-badge{background:rgba(79,142,247,.16);color:var(--blue);font-weight:800;font-size:10px;padding:2px 7px;border-radius:6px}
.ctrl-badge{background:rgba(229,72,77,.16);color:var(--red);font-weight:800;font-size:10px;padding:2px 7px;border-radius:6px}
.cold-badge{background:rgba(79,142,247,.12);color:#63b3ff;font-weight:700;font-size:10px;padding:2px 7px;border-radius:6px}
.exp-pill{font-size:11px;font-weight:700;padding:3px 9px;border-radius:20px;font-variant-numeric:tabular-nums;white-space:nowrap;display:inline-block}
.exp-ok{background:rgba(56,178,111,.15);color:var(--green)}
.exp-soon{background:rgba(240,168,53,.16);color:var(--amber)}
.exp-bad{background:rgba(229,72,77,.16);color:var(--red)}

.stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:20px}
.stat{background:linear-gradient(160deg,var(--surface-2),var(--surface));border:1px solid var(--border);border-radius:var(--radius);padding:18px}
.stat.link{cursor:pointer;transition:transform .12s,border-color .12s}.stat.link:hover{transform:translateY(-2px);border-color:var(--brand)}
.stat .label{font-size:12px;color:var(--text-dim);font-weight:600;margin-bottom:8px;display:flex;align-items:center;gap:6px}
.stat .value{font-size:26px;font-weight:800;letter-spacing:-.5px}
.stat .sub{font-size:12px;color:var(--text-faint);margin-top:4px}
.stat.warn{border-color:rgba(240,168,53,.4)}.stat.bad{border-color:rgba(229,72,77,.4)}
.two-col{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.two-col>*{min-width:0}
.rx-stack{display:flex;flex-direction:column;gap:16px}
.three-col{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.bar-row{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.bar-row .name{width:150px;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bar-track{flex:1;height:10px;background:var(--surface-3);border-radius:6px;overflow:hidden}
.bar-fill{height:100%;background:linear-gradient(90deg,var(--brand),var(--brand-lite));border-radius:6px}
.bar-row .num{width:90px;text-align:right;font-weight:700;font-variant-numeric:tabular-nums}
.spark{display:flex;align-items:flex-end;gap:6px;height:120px;padding-top:10px}
.spark .col{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%;justify-content:flex-end}
.spark .col .b{width:100%;max-width:34px;background:linear-gradient(180deg,var(--brand-lite),var(--brand));border-radius:6px 6px 0 0;min-height:3px}
.spark .col .lbl{font-size:11px;color:var(--text-faint)}

/* POS */
.pos{display:grid;grid-template-columns:1fr 400px;gap:16px;height:100%}
.pos-menu{display:flex;flex-direction:column;overflow:hidden}
.pos-search{display:flex;gap:10px;margin-bottom:12px;flex-shrink:0}
.pos-search input{font-size:16px;padding:14px 16px}
.cat-bar{display:flex;gap:8px;overflow-x:auto;padding-bottom:12px;flex-shrink:0}
.cat-chip{padding:9px 15px;border-radius:10px;background:var(--surface-2);border:1px solid var(--border);white-space:nowrap;font-weight:600;font-size:13px;color:var(--text-dim);display:flex;align-items:center;gap:6px}
.cat-chip.active{background:var(--brand);color:#fff;border-color:var(--brand)}
.item-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(172px,1fr));grid-auto-rows:min-content;gap:16px;overflow:auto;padding:6px 6px 18px;align-content:start;align-items:start}
.item-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:22px 22px 24px;text-align:left;transition:all .12s;position:relative;display:flex;flex-direction:column;gap:6px;min-height:150px;height:auto}
.item-card:hover{border-color:var(--brand);transform:translateY(-2px)}
.item-card:active{transform:scale(.98)}
.item-card .top{display:flex;justify-content:space-between;align-items:flex-start;gap:6px}
.item-card .emoji{font-size:22px}
.item-card .nm{font-weight:700;font-size:13px;line-height:1.25;margin-top:4px}
.item-card .gn{font-size:11px;color:var(--text-faint);line-height:1.2}
.item-card .pr{color:var(--brand);font-weight:800;margin-top:auto;font-size:15px;padding-top:12px}
.item-card .stk{font-size:11px;font-weight:600}
.item-card.out{opacity:.5}
.item-card.out::after{content:"OUT";position:absolute;top:10px;right:10px;font-size:10px;background:var(--red);color:#fff;padding:2px 6px;border-radius:6px;font-weight:800}
.tag-row{display:flex;gap:4px;flex-wrap:wrap;margin-top:4px}

/* POS list view (pharmacy-style dense rows) + view toggle */
.pos-view-toggle{display:flex;gap:3px;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:3px;flex-shrink:0}
.pos-view-toggle button{padding:0 12px;height:100%;min-height:40px;border-radius:8px;font-size:16px;color:var(--text-dim);display:grid;place-items:center}
.pos-view-toggle button.on{background:var(--brand);color:#fff}
.cfd-btn{flex-shrink:0;padding:0 14px;min-height:46px;border:1px solid var(--border);background:var(--surface);color:var(--brand);border-radius:10px;font-size:14px;font-weight:700;cursor:pointer;white-space:nowrap;transition:background .12s,border-color .12s}
.cfd-btn:hover{background:rgba(51,188,168,.08);border-color:var(--brand)}
.msg-banner{background:#fff7e6;border:1px solid #f0d9a8;color:#7a5a12;border-radius:12px;padding:12px 16px;font-size:13px;margin-bottom:16px}
.msg-banner a{color:var(--brand);font-weight:700;cursor:pointer;text-decoration:underline}
:root[data-theme="dark"] .msg-banner{background:#2a2410;border-color:#4a3f1a;color:#e6cf8a}
.chk{display:flex;align-items:center;gap:10px;font-size:13.5px;cursor:pointer;padding:6px 0}
.chk input{width:18px;height:18px;flex:0 0 auto;accent-color:var(--brand)}
.med-list{display:flex;flex-direction:column;gap:8px;overflow:auto;padding:2px 2px 16px}
.med-row{display:grid;grid-template-columns:38px minmax(0,1fr) 104px 80px 36px 40px;gap:12px;align-items:center;background:var(--surface);border:1px solid var(--border);border-left:3px solid transparent;border-radius:12px;padding:16px 20px;cursor:pointer;transition:border-color .12s,transform .12s,box-shadow .12s}
.med-row .rinfo{width:34px;height:34px;border-radius:9px;background:var(--surface-2);border:1px solid var(--border);color:var(--text-dim);font-size:15px;display:grid;place-items:center;cursor:pointer;transition:color .12s,border-color .12s}
.med-row .rinfo:hover{color:var(--brand);border-color:var(--brand)}
.item-card .cinfo{position:absolute;bottom:16px;right:14px;width:28px;height:28px;border-radius:8px;background:var(--surface-2);border:1px solid var(--border);color:var(--text-dim);font-size:14px;display:grid;place-items:center;cursor:pointer;z-index:2;transition:color .12s,border-color .12s}
.item-card .cinfo:hover{color:var(--brand);border-color:var(--brand)}
.med-row:hover{border-color:var(--brand);border-left-color:var(--brand);transform:translateX(3px);box-shadow:var(--shadow)}
.med-row:active{transform:scale(.995)}
.med-row.out{opacity:.5}
.med-row .ic{font-size:24px;text-align:center}
.med-row .nm{font-weight:700;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:6px}
.med-row .gn{font-size:12px;color:var(--text-faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.med-row .rstk{text-align:right}
.med-row .rprice{text-align:right;font-weight:800;color:var(--brand);font-size:15px}
.med-row .radd{width:38px;height:38px;border-radius:10px;background:var(--brand);color:#fff;font-size:22px;font-weight:700;display:grid;place-items:center;transition:background .12s}
.med-row:hover .radd{background:var(--brand-dim)}
@media (max-width:900px){.med-row{grid-template-columns:34px minmax(0,1fr) auto 34px 40px}.med-row .rstk{display:none}}

.cart{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);display:flex;flex-direction:column;overflow:hidden}
.cart-head{padding:14px 16px;border-bottom:1px solid var(--border);flex-shrink:0}
/* POS customer section */
.cust-card{background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:10px 12px}
.cust-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.cust-name{font-weight:700;font-size:14px}
.cust-sub{font-size:12px;color:var(--text-dim);margin-top:1px}
.cust-stats{display:flex;gap:16px}
.cust-stats>div{display:flex;flex-direction:column;font-size:11px;color:var(--text-dim)}
.cust-stats>div b{font-size:14px;color:var(--text);margin-top:2px}
.cust-stats>div b.warn{color:var(--amber)}
.pick-list{max-height:46vh;overflow-y:auto}
.pick-row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:10px;margin-bottom:6px;cursor:pointer;transition:border-color .12s,background .12s}
.pick-row:hover{border-color:var(--brand);background:rgba(51,188,168,.08)}
.cart-items{flex:1 1 auto;min-height:0;padding:8px 16px;overflow-y:auto}
.cart-line{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--border)}
.cart-line .info{flex:1;min-width:0}
.cart-line .info .nm{font-weight:600;font-size:13px}
.cart-line .info .meta{font-size:11px;color:var(--text-dim);margin-top:2px}
.qty-ctl{display:flex;align-items:center;gap:8px}
.qty-btn{width:26px;height:26px;border-radius:7px;background:var(--surface-3);display:grid;place-items:center;font-weight:800;font-size:16px}
.qty-btn:hover{background:var(--border)}
.qty-num{min-width:22px;text-align:center;font-weight:700}
.cart-foot{padding:16px;border-top:1px solid var(--border);background:var(--surface-2);flex-shrink:0}
.totals-line{display:flex;justify-content:space-between;margin-bottom:8px;font-size:13px;color:var(--text-dim)}
.totals-line.grand{font-size:22px;font-weight:800;color:var(--text);margin:10px 0}
.cart-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}

.mgmt-table{width:100%;border-collapse:collapse}
.mgmt-table th{text-align:left;padding:10px 12px;font-size:11px;text-transform:uppercase;color:var(--text-faint);letter-spacing:.5px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--surface)}
.mgmt-table td{padding:11px 12px;border-bottom:1px solid var(--border);font-size:13px;vertical-align:middle}
.mgmt-table tr:hover td{background:var(--surface-2)}
.table-wrap{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:auto;max-height:calc(100vh - 220px)}
.num{text-align:right;font-variant-numeric:tabular-nums}
.sum-table td{padding:6px 4px;font-size:13px}
.sum-table td:first-child{color:var(--text-dim)}
tr.strong td,.totals-line.strong{font-weight:800;color:var(--text)}
tr.strong td{border-top:1px solid var(--border)}
.totals-line.strong{border-top:1px solid var(--border);padding-top:6px}

.settings-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:14px;max-width:940px}
.settings-tile{position:relative;display:flex;flex-direction:column;gap:6px;align-items:flex-start;text-align:left;background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:20px 18px;transition:transform .12s,border-color .12s,box-shadow .12s;cursor:pointer}
.settings-tile:hover{border-color:var(--brand);transform:translateY(-3px);box-shadow:var(--shadow)}
.settings-tile .ico{font-size:28px;line-height:1}
.settings-tile .tl{font-weight:700;font-size:15px}
.settings-tile .ds{font-size:12px;color:var(--text-dim);line-height:1.4}

.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.6);backdrop-filter:blur(4px);display:grid;place-items:center;z-index:100;padding:24px}
.modal{background:var(--surface);border:1px solid var(--border);border-radius:16px;width:100%;max-width:480px;box-shadow:var(--shadow);max-height:92vh;overflow:auto}
.modal.wide{max-width:640px}.modal.xwide{max-width:860px}
.modal-head{padding:18px 22px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;background:var(--surface);z-index:1}
.modal-head h2{font-size:18px}
.modal-body{padding:22px}
.modal-foot{padding:16px 22px;border-top:1px solid var(--border);display:flex;gap:10px;justify-content:flex-end;position:sticky;bottom:0;background:var(--surface)}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:14px}
.form-grid.three{grid-template-columns:1fr 1fr 1fr}
.form-grid .full{grid-column:1/-1}
.close-x{font-size:22px;color:var(--text-dim);width:32px;height:32px;border-radius:8px}
.close-x:hover{background:var(--surface-3)}
.chk{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--text-dim);cursor:pointer;padding:8px 0}
.chk input{width:auto}

.pay-total{text-align:center;padding:18px;background:var(--surface-2);border-radius:12px;margin-bottom:16px}
.pay-total .amt{font-size:38px;font-weight:800;color:var(--brand)}
.pay-methods{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:16px}
.pay-method{padding:14px 8px;border-radius:12px;background:var(--surface-2);border:2px solid var(--border);text-align:center;font-weight:700;font-size:12px}
.pay-method.active{border-color:var(--brand);background:rgba(51,188,168,.1)}
.pay-method .ico{font-size:22px;display:block;margin-bottom:6px}
.pay-method img{height:20px;display:block;margin:0 auto 6px}
.quick-cash{display:flex;gap:8px;margin-bottom:14px;flex-wrap:wrap}

.receipt{position:relative;overflow:hidden;background:#fff;color:#111;font-family:'Consolas','SF Mono','Menlo','DejaVu Sans Mono',ui-monospace,monospace;padding:12px 2px;border-radius:8px;max-width:340px;margin:0 auto;font-size:13px}
.receipt .r-watermark{position:absolute;inset:0;display:grid;place-items:center;opacity:.06;pointer-events:none}
.receipt .r-watermark img{width:78%;max-width:260px}
.receipt .r-content{position:relative}
.receipt h3{text-align:center;font-size:20px;letter-spacing:1px;margin-bottom:4px}
.receipt .r-center{text-align:center}
.receipt .r-line{border-top:1px dashed #999;margin:10px 0}
.receipt .r-row{display:flex;justify-content:space-between;margin:2px 0}
.receipt .r-total{font-weight:800;font-size:19px}
.receipt .r-sub{font-size:11px;color:#666}
.receipt .r-title{text-align:center;font-size:12px;font-weight:700;letter-spacing:2px;margin-bottom:2px}
.receipt .r-cols{display:grid;grid-template-columns:34px 1fr auto;gap:10px;margin:5px 0;align-items:start}
.receipt .r-cols .amt{text-align:right;white-space:nowrap}
.receipt .r-cols.head{font-weight:700;letter-spacing:.5px}
.receipt .r-submod{font-size:11px;color:#666;margin-top:1px}
.receipt .r-thanks{text-align:center;font-size:11px;font-weight:600;letter-spacing:1px;margin-top:8px}
/* FBR logo: full colour on screen, solid black silhouette when printing so it
   stays crisp on 1-bit thermal paper (the yellow star/arc won't print faint). */
@media print{.receipt .auth-logo{filter:brightness(0) contrast(2)!important;-webkit-filter:brightness(0) contrast(2)!important}}

.login-wrap{display:flex;flex-direction:column;align-items:center;justify-content:safe center;min-height:100vh;min-height:100dvh;overflow-y:auto;padding:clamp(10px,3vh,28px) 16px;background:radial-gradient(1200px 600px at 50% -10%,rgba(51,188,168,.14),transparent),var(--bg)}
.login-card{width:370px;max-width:100%;background:var(--surface);border:1px solid var(--border);border-radius:20px;padding:clamp(18px,3vh,34px) clamp(20px,4vw,30px);box-shadow:var(--shadow);text-align:center}
.login-card h2{margin:0;font-size:clamp(18px,3.2vh,24px)}
.login-card .sub{font-size:12px;color:var(--text-faint);margin-top:4px}
.login-card select{margin-top:16px}
.login-logo{width:clamp(52px,8vh,68px);height:clamp(52px,8vh,68px);border-radius:18px;overflow:hidden;background:#fff;display:grid;place-items:center;margin:0 auto clamp(8px,1.6vh,14px);box-shadow:0 4px 14px rgba(0,0,0,.12)}
.login-logo img{width:100%;height:100%;object-fit:cover}
.login-split{display:flex;height:100vh;height:100dvh}.login-brand{flex:0 0 42%;max-width:540px;background:linear-gradient(155deg,#3fc9b4,#2aa595 55%,#178a7a);display:flex;flex-direction:column;justify-content:center;align-items:center;padding:40px 34px;color:#fff;text-align:center}.login-brand-inner{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:center}.login-brand-inner .login-logo{background:#fff;margin-bottom:24px}.login-brand-inner h1{font-size:clamp(28px,5vh,40px);margin:0;font-weight:900}.login-brand-inner h1 span{color:#fff}.login-brand-inner p{font-size:14px;margin-top:8px;opacity:.9}.login-brand-foot{font-size:12px;opacity:.8;width:100%;text-align:center}.login-panel{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:40px;position:relative;overflow-y:auto}.login-theme{position:absolute;top:16px;right:16px;z-index:2;width:40px;height:40px;border-radius:12px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);cursor:pointer;display:grid;place-items:center;transition:background .15s,transform .1s}.login-theme svg{width:20px;height:20px;display:block}.login-theme:hover{background:var(--surface-3)}.login-theme:active{transform:scale(.94)}.login-theme .th-light{display:none}:root[data-theme="light"] .login-theme .th-dark{display:none}:root[data-theme="light"] .login-theme .th-light{display:inline}.login-panel-inner{width:100%;max-width:360px}.login-panel-inner h2{margin:0 0 8px;font-size:clamp(20px,3vh,26px)}.login-panel-inner .faint{margin-bottom:16px}.login-panel-inner select{width:100%;margin-bottom:12px;padding:10px;border:1px solid var(--border);border-radius:8px;background:var(--surface);font-size:14px}
.pin-display{font-size:clamp(24px,4vh,32px);letter-spacing:12px;height:clamp(34px,4.8vh,48px);margin:clamp(8px,1.6vh,16px) 0;font-weight:800;color:var(--brand);text-align:center}
.keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:clamp(6px,1.2vh,10px);margin-bottom:clamp(4px,1vh,8px)}
.key{padding:clamp(10px,2vh,18px);background:var(--surface-2);border-radius:12px;font-size:clamp(16px,2.6vh,20px);font-weight:700;border:1px solid var(--border);cursor:pointer}
.key:hover{background:var(--surface-3)}
.key-alt{background:var(--surface-3);color:var(--red)}
.key-alt:hover{background:var(--surface-2)}
.key-enter{background:var(--brand);color:#fff;border-color:var(--brand)}
.key-enter:hover{opacity:.9}
.staff-hint{margin-top:14px;font-size:11px;color:var(--text-faint);line-height:1.6}

.toast-wrap{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);z-index:200;display:flex;flex-direction:column;gap:8px;align-items:center}
.toast{background:var(--surface-3);border:1px solid var(--border);padding:12px 20px;border-radius:10px;font-weight:600;box-shadow:var(--shadow);animation:slideup .3s;max-width:90vw}
.toast.success{border-color:var(--green)}
.toast.error{border-color:var(--red)}
.toast.info{border-color:var(--blue)}
@keyframes slideup{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
.offline-banner{position:fixed;bottom:0;left:0;right:0;background:var(--amber);color:#111;text-align:center;padding:6px;font-weight:700;font-size:12px;z-index:300}

.pm-logo{display:inline-flex;align-items:center}
/* Salary slip (payslip) — an A4-style document that reuses .receipt print isolation */
.ps-netbar{margin-top:14px;padding:12px 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}
.payslip{max-width:720px;font-family:'Segoe UI',Arial,sans-serif;font-size:13px;color:#1a1a1a;padding:28px 32px;text-align:left}
.payslip .ps-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;border-bottom:2px solid var(--brand);padding-bottom:12px;margin-bottom:16px}
.payslip .ps-title{text-align:right}
.payslip .ps-title h2{font-size:22px;margin:0;letter-spacing:1px;color:var(--brand-dim)}
.payslip .ps-grid{display:grid;grid-template-columns:1fr 1fr;gap:2px 28px;margin-bottom:16px}
.payslip .ps-grid>div{display:flex;justify-content:space-between;gap:10px;font-size:12px;border-bottom:1px dotted #ddd;padding:5px 0}
.payslip .ps-grid span{color:#777}
.payslip table{width:100%;border-collapse:collapse;margin-bottom:12px}
.payslip th,.payslip td{padding:8px 10px;font-size:12px;border-bottom:1px solid #eee;text-align:left}
.payslip th.amt,.payslip td.amt{text-align:right}
.payslip thead.ps-earn th{background:#f4f2ff;color:var(--brand-dim);border-bottom:1px solid #e2ddff}
.payslip tr.ps-tot td{border-top:2px solid #ddd;border-bottom:none}
.payslip .ps-net{display:flex;justify-content:space-between;align-items:center;background:#f4f2ff;border:1px solid #ded8ff;border-radius:8px;padding:12px 18px;font-weight:800;font-size:17px;color:var(--brand-dim)}
.payslip .ps-sign{display:flex;justify-content:space-between;margin-top:40px;gap:24px}
.payslip .ps-sign .sig{border-top:1px solid #999;padding-top:5px;width:190px;text-align:center;font-size:11px;color:#666}
.payslip .ps-foot{display:flex;justify-content:space-between;gap:12px;margin-top:22px;padding-top:10px;border-top:1px dashed #ccc;font-size:10px;color:#888}
@media print{body *{visibility:hidden}.receipt,.receipt *{visibility:visible}.receipt{position:fixed;top:0;left:0;box-shadow:none;font-size:11px}.payslip{max-width:100%}}

@media (max-width:900px){
  .sidebar{width:68px}
  .logo{width:42px;height:42px;font-size:20px;border-radius:50%;margin-bottom:14px}
  .nav-item{width:60px;padding:8px 2px;font-size:9px;gap:2px}
  .nav-item .ico{font-size:18px}
  .topbar{padding:8px 12px;gap:8px;height:auto;min-height:56px;flex-wrap:wrap}
  .topbar h1{font-size:16px}
  .content{padding:14px}
  .pos{grid-template-columns:1fr;height:auto}
  .pos-menu{overflow:visible}.item-grid{overflow:visible}.cart{overflow:visible}
  .cart-scroll{overflow:visible;flex:none;display:block}
  .cart-items{flex:none;max-height:none;overflow:visible}
  .stat-grid{grid-template-columns:repeat(2,1fr)}.two-col,.three-col{grid-template-columns:1fr}
  .form-grid,.form-grid.three{grid-template-columns:1fr}
  .settings-grid{max-width:none}
}
@media (max-width:560px){
  /* Phone: flip the left icon rail into a bottom tab bar — content full width, nav thumb-reachable
     (same mobile UX as the restaurant POS). Nav items are already icon-over-label. */
  #app{flex-direction:column;height:100dvh}
  .main{order:1;min-height:0}
  .sidebar{order:2;width:100%;height:auto;flex-direction:row;align-items:stretch;
    border-right:none;border-top:1px solid var(--border);
    padding:4px 4px calc(4px + env(safe-area-inset-bottom));
    overflow-x:auto;overflow-y:hidden;gap:2px}
  .sidebar .logo{display:none}
  .nav{flex-direction:row;width:auto;flex:1;gap:2px}
  .nav-item{width:auto;min-width:56px;flex:1 0 auto;padding:6px 4px;font-size:9px}
  .nav-item .ico{font-size:19px}
  .nav-item span:last-child{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
  .content{padding:10px}
  .stat-grid{grid-template-columns:1fr 1fr}
  .item-grid{grid-template-columns:repeat(auto-fill,minmax(46%,1fr))}
  .form-grid,.form-grid.three{grid-template-columns:1fr}
  .modal{max-width:100%}
  .modal-head,.modal-body,.modal-foot{padding-left:16px;padding-right:16px}
  .modal-foot{flex-wrap:wrap}
  .stat .value{font-size:20px}
  .topbar .clock{display:none}
}
@media (max-width:400px){
  .stat-grid{grid-template-columns:1fr}
  .content{padding:8px}
  .card,.stat,.item-card{padding-left:14px;padding-right:14px}
  .nav-item{min-width:52px}
}

/* License registration card (same design as the restaurant POS) */
.lic-plate{background:linear-gradient(135deg,#15241f,#0e1a22 58%,#1a1330);border:1px solid var(--border);border-radius:16px;padding:18px;color:#fff;position:relative;overflow:hidden}
.lic-plate::after{content:"";position:absolute;right:-50px;top:-50px;width:180px;height:180px;background:radial-gradient(circle,rgba(51,188,168,.25),transparent 70%);pointer-events:none}
.lic-plate-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;position:relative}
.lic-plate-brand{font-weight:800;font-size:14px}
.lic-plate-status{font-size:10px;font-weight:800;letter-spacing:1px;background:rgba(56,178,111,.18);color:#7ef0b0;border:1px solid rgba(56,178,111,.4);padding:3px 10px;border-radius:20px}
.lic-plate-name{font-size:20px;font-weight:800;line-height:1.15}
.lic-plate-sub{font-size:11px;color:rgba(255,255,255,.6);margin:2px 0 14px}
.lic-plate-key{font-family:monospace;font-size:13px;letter-spacing:1px;background:rgba(255,255,255,.06);border:1px dashed rgba(255,255,255,.22);border-radius:10px;padding:11px 12px;margin-bottom:14px;word-break:break-all;text-align:center}
.lic-plate-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px 14px;margin-bottom:12px}
.lic-plate-grid>div{display:flex;flex-direction:column;gap:2px}
.lic-plate-grid span{font-size:10px;color:rgba(255,255,255,.5);text-transform:uppercase;letter-spacing:.5px}
.lic-plate-grid b{font-size:13px;font-weight:700}
.lic-plate-id{font-size:10px;color:rgba(255,255,255,.45);border-top:1px solid rgba(255,255,255,.1);padding-top:10px;position:relative}
@media (max-width:520px){.lic-plate-grid{grid-template-columns:repeat(2,1fr)}}

.login-brand .login-wm{width:min(88%,340px);height:150px;margin:0 auto 18px;overflow:hidden;border-radius:16px;background:#fff;box-shadow:0 12px 46px rgba(0,0,0,.18)}.login-brand .login-wm img{width:100%;height:100%;object-fit:contain}

.tb-brand{display:flex;align-items:center;gap:10px;cursor:pointer;padding:4px 4px 4px 0;border-radius:10px;transition:opacity .12s}
.tb-brand:hover{opacity:.85}
.tb-brand img{max-height:34px;width:auto;object-fit:contain}   /* hard cap: the topbar logo can never blow out the layout */
.tb-brand img.tb-wordmark{width:auto;height:30px;max-width:210px;object-fit:contain;display:block;border-radius:7px;box-shadow:none}
.tb-sep{width:1px;height:26px;background:var(--border);flex-shrink:0;margin-right:2px}

#ai-fab{opacity:0;transition:transform .14s ease,box-shadow .14s ease,opacity .2s}#ai-fab:hover,#ai-fab:focus-visible{opacity:1;transform:translateY(-3px) scale(1.04);box-shadow:0 14px 30px rgba(0,0,0,.42)}
