:root {
  --bg: #0d0f13; --surface: #14171d; --surface-2: #1a1e26; --surface-3: #212631;
  --line: rgba(236,232,222,.08); --line-strong: rgba(236,232,222,.15);
  --text: #ece8de; --text-2: #cfcabd; --muted: #9a968c; --dim: #6e6c66;
  --accent: #e9a23b; --accent-ink: #1b1306; --accent-tint: rgba(233,162,59,.12); --accent-line: rgba(233,162,59,.35);
  --pos: #43c59e; --pos-tint: rgba(67,197,158,.12); --neg: #f0776d; --neg-tint: rgba(240,119,109,.12); --steel: #9db4d6;
  --r: 12px; --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f3ee; --surface: #ffffff; --surface-2: #f8f6f1; --surface-3: #efece4;
    --line: rgba(28,27,25,.08); --line-strong: rgba(28,27,25,.16);
    --text: #1c1b19; --text-2: #3a3833; --muted: #6b675f; --dim: #8e8a81;
    --accent: #c9821a; --accent-ink: #fff; --accent-tint: rgba(201,130,26,.1); --accent-line: rgba(201,130,26,.35);
    --pos: #1f8a66; --pos-tint: rgba(31,138,102,.1); --neg: #c4473d; --neg-tint: rgba(196,71,61,.1); --steel: #4a6a96;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 500 14.5px/1.5 var(--sans); }
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.3px; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); margin: 0; font-size: 13.5px; }
.fine { color: var(--dim); font-size: 11.5px; margin: 14px 0 0; text-align: center; }
.screen { min-height: 100vh; }
.center { display: grid; place-items: center; padding: 16px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
.logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px; }

.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: 0 24px 60px -24px rgba(0,0,0,.6); }
.auth-card .brand { margin-bottom: 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
input, select, textarea {
  font: 600 14.5px var(--sans); color: var(--text); background: var(--surface-2);
  border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 0 12px; height: 44px; width: 100%;
}
textarea { height: auto; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.code-input { text-align: center; font-size: 26px; letter-spacing: 10px; height: 58px; font-variant-numeric: tabular-nums; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 12px; width: 204px; margin: 4px auto; }
.qr svg { width: 180px; height: 180px; }
.secret { display: block; text-align: center; font-size: 12px; color: var(--muted); word-break: break-all; }
.msg { min-height: 20px; margin: 12px 0 0; color: var(--neg); font-size: 13px; font-weight: 600; }

.btn { font: 700 14px var(--sans); height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { border-color: var(--accent-line); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.danger { color: var(--neg); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
#nav button { font: 700 13px var(--sans); color: var(--muted); background: none; border: 0; padding: 8px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
#nav button.on { color: var(--text); background: var(--surface-2); }
main { padding: 20px 18px 40px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat b { display: block; font-size: 22px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); } .neg { color: var(--neg); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.tag.ok { background: var(--pos-tint); color: var(--pos); } .tag.bad { background: var(--neg-tint); color: var(--neg); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* POS */
.search { height: 52px; font-size: 16px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; max-height: 60vh; overflow: auto; }
.tile { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px; cursor: pointer; color: var(--text); font: inherit; }
.tile:hover { border-color: var(--accent-line); }
.tile b { display: block; font-size: 13px; }
.tile span { color: var(--accent); font-weight: 800; }
.cart-line { display: grid; grid-template-columns: 1fr 92px 70px 24px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cart-line input { height: 32px; text-align: center; padding: 0 4px; }
.cart-line .x { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 15px; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.total b { font-size: 30px; color: var(--pos); font-variant-numeric: tabular-nums; }
.pay3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface-3); color: var(--text); border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 10px; font-weight: 700; z-index: 99; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); }

@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .top { flex-wrap: wrap; } #nav { order: 3; width: 100%; } main { padding: 14px 12px 32px; } }

/* boards (tables / rooms) */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.slot { text-align: left; border-radius: 14px; padding: 14px; min-height: 96px; cursor: pointer; font: inherit; color: var(--text); border: 1.5px solid var(--line-strong); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.slot b { font-size: 20px; }
.slot span { font-weight: 700; }
.slot small { color: var(--muted); font-size: 12px; }
.slot.free { border-color: rgba(67,197,158,.45); }
.slot.free span { color: var(--pos); }
.slot.busy, .slot.occupied { border-color: var(--accent-line); background: var(--accent-tint); }
.slot.busy span, .slot.occupied span { color: var(--accent); }
.slot.cleaning { border-color: rgba(157,180,214,.5); }
.slot.cleaning span { color: var(--steel); }
.slot.blocked { opacity: .55; }
.scan-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.scan-wrap video { width: min(92vw, 520px); border-radius: 14px; border: 2px solid var(--accent); }
#print-area { display: none; }
@media print {
  body * { visibility: hidden !important; }
  #print-area, #print-area * { visibility: visible !important; }
  #print-area { display: block !important; position: absolute; left: 0; top: 0; width: 72mm; color: #000; font: 12px/1.35 system-ui, sans-serif; }
  #print-area h3 { margin: 0 0 4px; font-size: 15px; text-align: center; }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area td { padding: 3px 0; border-bottom: 1px dashed #999; vertical-align: top; color: #000; }
  #print-area .r { text-align: right; }
  @page { margin: 4mm; }
}

/* ---------------- vault ---------------- */
:root { --vault: #7aa7ff; --vault-tint: rgba(122,167,255,.12); }
.logo.v { background: linear-gradient(135deg, #e9a23b, #c9821a); }
.auth-card.wide { max-width: 480px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--neg); transition: width .2s, background .2s; }
.meter-label { font-size: 12px; color: var(--muted); margin-top: -6px; }
.reckey { font: 700 17px/1.6 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 1px; text-align: center; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1.5px dashed var(--accent-line); user-select: all; word-break: break-word; }
.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 600; }
.check input { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.linkrow { text-align: center; margin-top: 12px; font-size: 13px; }
.busy-note { font-size: 12.5px; color: var(--muted); text-align: center; min-height: 18px; margin: 4px 0 0; }

.vtop { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.vtop .grow { flex: 1; }
.timer { font-size: 12px; font-weight: 700; color: var(--muted); padding: 5px 10px; border-radius: 999px; background: var(--surface-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer.warn { color: var(--neg); background: var(--neg-tint); }
.vwrap { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; max-width: 1240px; margin: 0 auto; padding: 20px 18px 48px; }
.vnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 74px; align-self: start; }
.vnav button { display: flex; justify-content: space-between; align-items: center; text-align: left; font: 700 13.5px var(--sans); color: var(--muted); background: none; border: 0; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.vnav button.on { color: var(--text); background: var(--surface-2); }
.vnav button i { font-style: normal; font-size: 11.5px; color: var(--dim); }
.vnav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; width: 100%; }
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.ins { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.ins span { font-size: 12px; font-weight: 700; color: var(--muted); }
.ins b { display: block; font-size: 20px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ins small { color: var(--muted); font-size: 12px; }
.ins.bad b { color: var(--neg); } .ins.good b { color: var(--pos); }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; height: 46px; font-size: 15px; }
.newmenu { position: relative; }
.newmenu .menu { position: absolute; right: 0; top: 50px; z-index: 20; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; min-width: 190px; box-shadow: 0 20px 40px -16px rgba(0,0,0,.5); }
.newmenu .menu button { text-align: left; font: 600 14px var(--sans); color: var(--text); background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.newmenu .menu button:hover { background: var(--surface-2); }
.list { display: flex; flex-direction: column; gap: 6px; }
.it { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; text-align: left; font: inherit; color: var(--text); width: 100%; }
.it:hover { border-color: var(--accent-line); }
.ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--surface-3); color: var(--text-2); }
.ico.login { background: var(--vault-tint); color: var(--vault); } .ico.doc { background: var(--accent-tint); color: var(--accent); }
.ico.note { background: var(--surface-3); } .ico.money { background: var(--pos-tint); color: var(--pos); }
.it b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it .right { text-align: right; font-size: 13px; font-weight: 700; white-space: nowrap; }
.flag { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.flag.bad { background: var(--neg-tint); color: var(--neg); } .flag.warn { background: var(--accent-tint); color: var(--accent); } .flag.ok { background: var(--pos-tint); color: var(--pos); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--line-strong); z-index: 41; display: flex; flex-direction: column; box-shadow: -30px 0 60px -30px rgba(0,0,0,.6); }
.drawer header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font-size: 17px; }
.drawer .body { flex: 1; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.drawer footer { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.drawer footer .btn { flex: 1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field .k { font-size: 12px; font-weight: 700; color: var(--muted); }
.field .v { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; min-height: 42px; }
.field .v span { flex: 1; min-width: 0; word-break: break-word; white-space: pre-wrap; }
.field .v .mono { font-family: ui-monospace, Menlo, monospace; }
.mini { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; flex: none; }
.pwrow { display: flex; gap: 6px; }
.pwrow input { flex: 1; }
.files { display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.drop input { display: none; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.sec-grid .card h2 { margin-bottom: 10px; }
.log { font-size: 12.5px; }
.log td { padding: 7px 6px; }
.log .ua { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-bad { color: var(--neg); font-weight: 700; } .ev-ok { color: var(--pos); font-weight: 700; }
.hidden-amt { filter: blur(6px); }
@media (max-width: 800px) {
  .vwrap { grid-template-columns: 1fr; padding: 12px 12px 40px; }
  .vnav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .vnav button { white-space: nowrap; }
  .vnav hr { display: none; }
}
.vwrap main { margin: 0; padding: 0; max-width: none; width: 100%; min-width: 0; }
.ins b .hidden-amt, .ins b span { font-size: inherit; color: inherit; font-weight: inherit; }
.hq .busy-note:empty { display: none; }

/* hisab-kitab */
.hq { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; padding: 12px; }
.hq #hq-in { flex: 1; min-width: 220px; height: 46px; font-size: 15px; }
.hq .btn { height: 46px; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; height: 46px; }
.seg button { font: 700 13px var(--sans); border: 0; background: none; color: var(--muted); padding: 0 12px; border-radius: 8px; cursor: pointer; }
.seg button.on.out { background: var(--neg-tint); color: var(--neg); }
.seg button.on.in { background: var(--pos-tint); color: var(--pos); }
.hgrid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
.hday { margin-bottom: 10px; }
.hday-h { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 6px 2px; border-bottom: 1px solid var(--line); }
.hday-h b { color: var(--text-2); }
.hrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 9px 2px; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.hrow:hover { background: var(--surface-2); }
.hrow span { min-width: 0; }
.hrow b { font-size: 14px; white-space: nowrap; }
.hrow small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { margin-bottom: 10px; }
.bar-h { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar i { display: block; height: 8px; border-radius: 99px; background: var(--neg); opacity: .75; }
@media (max-width: 900px) { .hgrid { grid-template-columns: 1fr; } }
