@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-display: swap; src: url("/fonts/open-sans-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-display: swap; src: url("/fonts/open-sans-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: dark;
  --bg: #12131a; --bg-deep: #0c0d12; --bg-raised: #1a1c24; --card: #1e2029; --hover: #252833; --input: #15161d;
  --line: rgba(243, 239, 230, 0.09); --line-strong: rgba(196, 165, 116, 0.32);
  --text: #f3efe6; --soft: #c9c3b6; --muted: #8f8a80;
  --accent: #0f6b3a; --glow: #1fd17a; --accent-dim: #0b4d2a; --brass: #c4a574; --brass-soft: #dcc6a0;
  --btn: #0f6b3a; --btn-hover: #128047; --btn-text: #f3efe6;
  --danger: #e0685a; --warn: #e3b341; --ok: #1fd17a; --info: #6aa7ff;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  --font: "Open Sans", "Segoe UI", system-ui, sans-serif;
  --side: 232px; --top: 58px;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f3; --bg-deep: #e6e9ee; --bg-raised: #f3f4f6; --card: #ffffff; --hover: #e9ecf0; --input: #ffffff;
  --line: rgba(43, 47, 56, 0.11); --line-strong: rgba(201, 138, 76, 0.45);
  --text: #2b2f38; --soft: #3d424d; --muted: #5b616c;
  --accent: #0f6b3a; --glow: #0f8a4a; --accent-dim: #d8efe2; --brass: #c98a4c; --brass-soft: #a86c33;
  --btn: #f39200; --btn-hover: #ffa21f; --btn-text: #1a1208;
  --danger: #c4402f; --warn: #b7791f; --ok: #0f7a40; --info: #2f6fd6;
  --shadow: 0 14px 40px rgba(43, 47, 56, 0.14);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; }
body { -webkit-tap-highlight-color: transparent; }
a { color: var(--glow); }
html[data-theme="light"] a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h1 { font-size: 1.45rem; font-weight: 700; } h2 { font-size: 1.15rem; font-weight: 700; } h3 { font-size: 1rem; font-weight: 700; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; } .r { text-align: right; } .c { text-align: center; } .nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: .75rem; }
.grid { display: grid; gap: .9rem; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--line); background: var(--bg-raised); color: var(--text); padding: .55rem .95rem; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; text-decoration: none; min-height: 40px; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--hover); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--btn); border-color: transparent; color: var(--btn-text); }
.btn.primary:hover { background: var(--btn-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: .3rem .6rem; min-height: 32px; font-size: .85rem; }
.btn.lg { padding: .85rem 1.2rem; font-size: 1.05rem; min-height: 52px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; padding: 0; }
label.f { display: block; } label.f > span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.inp, select.inp, textarea.inp { width: 100%; background: var(--input); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .7rem; min-height: 40px; outline: none; }
.inp:focus { border-color: var(--glow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--glow) 22%, transparent); }
textarea.inp { min-height: 70px; resize: vertical; }
.check { display: inline-flex; gap: .5rem; align-items: center; cursor: pointer; } .check input { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: transparent; padding: .45rem .8rem; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--btn); color: var(--btn-text); }
.help { font-size: .78rem; color: var(--muted); margin-top: .25rem; }

/* cards, tables, badges */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card.pad0 { padding: 0; overflow: hidden; }
.card h2 { margin-bottom: .75rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat .k { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v.accent { color: var(--glow); }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--bg-raised); position: sticky; top: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--hover); }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; background: var(--bg-raised); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid var(--line); background: var(--bg-raised); color: var(--soft); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.badge.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, transparent); }
.badge.ni { color: var(--brass-soft); border-color: var(--line-strong); }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty .big { font-size: 2rem; margin-bottom: .4rem; }
.notice { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: .7rem .9rem; color: var(--soft); background: color-mix(in srgb, var(--brass) 6%, transparent); font-size: .88rem; }
.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 1rem; scrollbar-width: none; }
.tabs a, .tabs button { padding: .6rem .85rem; text-decoration: none; color: var(--muted); font-weight: 600; border: 0; background: none; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs .on { color: var(--text); border-bottom-color: var(--glow); }
html[data-theme="light"] .tabs .on { border-bottom-color: var(--btn); }

/* layout */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--bg-deep); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; text-decoration: none; color: var(--text); }
.brand img { width: 34px; height: 34px; filter: drop-shadow(0 0 8px rgba(31, 209, 122, .35)); }
.brand b { font-size: 1rem; } .brand span { color: var(--brass-soft); }
.nav { padding: .3rem .5rem 1rem; display: flex; flex-direction: column; gap: 2px; }
.nav .sec { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .8rem .7rem .3rem; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .5rem .7rem; border-radius: 9px; color: var(--soft); text-decoration: none; font-weight: 600; font-size: .92rem; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.on { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text); box-shadow: inset 3px 0 0 var(--glow); }
html[data-theme="light"] .nav a.on { background: #fff3e0; box-shadow: inset 3px 0 0 var(--btn); }
.nav a .ico { width: 20px; text-align: center; opacity: .9; }
.nav a .cnt { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 .4rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: var(--top); display: flex; align-items: center; gap: .6rem; padding: 0 1rem; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 30; }
.top .title { font-weight: 700; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top select.inp { width: auto; min-height: 36px; padding: .3rem .5rem; max-width: 180px; }
.shift-pill { font-size: .78rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); white-space: nowrap; }
.shift-pill.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.content { padding: 1.1rem; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.menu-btn { display: none; }
.bottom-nav { display: none; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 270px; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 55; }
  .menu-btn { display: inline-flex; }
  .content { padding: .8rem .8rem 5.2rem; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--bg-deep); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; text-align: center; padding: .45rem 0 .5rem; font-size: .7rem; text-decoration: none; color: var(--muted); font-weight: 600; }
  .bottom-nav a .ico { display: block; font-size: 1.15rem; line-height: 1.3; }
  .bottom-nav a.on { color: var(--glow); }
  html[data-theme="light"] .bottom-nav a.on { color: var(--btn); }
  .top .hide-sm { display: none; }
}

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 6, 9, .6); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fade .12s; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 2rem); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { width: min(900px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font-size: 1.05rem; }
.modal-b { padding: 1rem; overflow-y: auto; }
.modal-f { padding: .8rem 1rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 560px) { .modal-bg { align-items: flex-end; padding: 0; } .modal { border-radius: 16px 16px 0 0; max-height: 92vh; } }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; z-index: 200; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--glow); padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; animation: fade .15s; }
.toast.err { border-left-color: var(--danger); }
@media (max-width: 980px) { .toasts { bottom: 4.6rem; left: 1rem; } }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; background: radial-gradient(900px 500px at 80% -10%, rgba(15, 107, 58, .22), transparent 60%), radial-gradient(700px 420px at -10% 20%, rgba(196, 165, 116, .1), transparent 55%), var(--bg); }
html[data-theme="light"] .auth { background: radial-gradient(900px 500px at 80% -10%, rgba(243, 146, 0, .14), transparent 60%), var(--bg); }
.auth-card { width: min(440px, 100%); }
.auth-card .brand { justify-content: center; padding: 0 0 1rem; }
.auth-card .brand img { width: 46px; height: 46px; }
.auth-card .brand b { font-size: 1.3rem; }
.auth-tools { position: fixed; top: .8rem; right: .8rem; display: flex; gap: .4rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pinpad button { min-height: 54px; font-size: 1.2rem; }
.pin-dots { display: flex; justify-content: center; gap: .6rem; margin: .4rem 0 1rem; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.on { background: var(--glow); border-color: var(--glow); }

/* POS */
.pos { display: grid; grid-template-columns: 1fr 390px; gap: 1rem; height: calc(100vh - var(--top) - 2.2rem); }
.pos-left { display: flex; flex-direction: column; min-height: 0; }
.pos-tools { display: flex; gap: .5rem; margin-bottom: .6rem; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; scrollbar-width: thin; }
.chip { border: 1px solid var(--line); background: var(--bg-raised); padding: .35rem .8rem; border-radius: 999px; white-space: nowrap; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--soft); }
.chip.on { background: var(--btn); color: var(--btn-text); border-color: transparent; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; overflow-y: auto; padding-bottom: 1rem; align-content: start; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; text-align: left; padding: 0; transition: border-color .12s, transform .05s; }
.pcard:hover { border-color: var(--line-strong); } .pcard:active { transform: scale(.98); }
.pcard .ph { aspect-ratio: 4 / 3; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 35%, var(--bg-raised)), var(--bg-raised)); display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: var(--brass-soft); overflow: hidden; }
html[data-theme="light"] .pcard .ph { background: linear-gradient(135deg, #fde7c4, #f3f4f6); color: #a86c33; }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.pcard .pi { padding: .5rem .6rem .6rem; }
.pcard .pn { font-weight: 600; font-size: .88rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.2em; }
.pcard .pp { font-weight: 700; color: var(--glow); font-size: .9rem; margin-top: .2rem; }
html[data-theme="light"] .pcard .pp { color: var(--accent); }
.pcard .ps { font-size: .72rem; color: var(--muted); }
.pcard .ps.low { color: var(--danger); font-weight: 700; }
.cart { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.cart-h { padding: .7rem .8rem; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .5rem; }
.cart-items { flex: 1; overflow-y: auto; padding: .3rem .4rem; }
.ci { display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; padding: .55rem .45rem; border-bottom: 1px dashed var(--line); cursor: pointer; border-radius: 8px; }
.ci:hover { background: var(--hover); }
.ci .n { font-weight: 600; font-size: .9rem; } .ci .m { font-size: .76rem; color: var(--muted); } .ci .t { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 30px; height: 30px; border: 0; background: var(--bg-raised); cursor: pointer; font-weight: 700; }
.qty span { min-width: 34px; text-align: center; font-weight: 700; font-size: .9rem; }
.cart-f { border-top: 1px solid var(--line); padding: .7rem .8rem; }
.sumline { display: flex; justify-content: space-between; font-size: .88rem; padding: .1rem 0; font-variant-numeric: tabular-nums; }
.sumline.tot { font-size: 1.2rem; font-weight: 800; padding-top: .4rem; }
.sumline.disc { color: var(--glow); } html[data-theme="light"] .sumline.disc { color: var(--accent); }
.cart-fab { display: none; }
@media (max-width: 980px) {
  .pos { grid-template-columns: 1fr; height: auto; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); overflow: visible; }
  .cart { position: fixed; inset: 0; z-index: 70; border-radius: 0; transform: translateY(102%); transition: transform .2s; }
  .cart.open { transform: none; }
  .cart-fab { display: flex; position: fixed; left: .8rem; right: .8rem; bottom: 4.4rem; z-index: 45; justify-content: space-between; box-shadow: var(--shadow); }
}
.paybox .amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .4rem; }
.methods button.on { outline: 2px solid var(--glow); }
.big-total { font-size: 2rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.success-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 2rem; margin: 0 auto .6rem; }

/* tables map */
.tmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.tcell { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; background: var(--card); cursor: pointer; text-align: left; }
.tcell.busy { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, var(--card)); }
.tcell b { display: block; font-size: 1.05rem; }

/* charts */
.chart { width: 100%; height: 220px; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .bar { fill: var(--accent); } html[data-theme="light"] .chart .bar { fill: var(--btn); }
.chart .bar:hover { fill: var(--glow); }
.chart .grid-l { stroke: var(--line); }
.hbar { display: grid; grid-template-columns: 140px 1fr auto; gap: .5rem; align-items: center; font-size: .85rem; margin: .3rem 0; }
.hbar .track { height: 10px; background: var(--bg-raised); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--glow); border-radius: 99px; } html[data-theme="light"] .hbar .fill { background: var(--btn); }
.onb li { margin: .35rem 0; } .onb li.done { color: var(--muted); text-decoration: line-through; }

/* labels print */
.labels { display: grid; grid-template-columns: repeat(auto-fill, 52mm); gap: 3mm; }
.label { width: 52mm; border: 1px dashed var(--line); padding: 2mm; text-align: center; background: #fff; color: #000; border-radius: 4px; }
.label .ln { font-size: 9pt; font-weight: 700; line-height: 1.15; } .label .lp { font-size: 10pt; font-weight: 800; } .label svg { width: 100%; height: 14mm; }
#scanner video { width: 100%; border-radius: 10px; background: #000; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .label { border: 0; break-inside: avoid; }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  html, body, .main, .content { background: #fff !important; color: #000 !important; }
  .print-area .card, .print-area.card, .print-area .tbl th, .print-area .tbl td { background: #fff !important; color: #000 !important; border-color: #bbb !important; box-shadow: none !important; }
  .print-area .muted, .print-area .tiny { color: #333 !important; }
  .side, .top, .bottom-nav, .toasts { display: none !important; }
}
.print-only { display: none; }

/* prevent grid/flex min-content blowout on narrow screens */
.main, .content, .pos > *, .pos-left, .grid > * { min-width: 0; }
.pos { grid-template-columns: minmax(0, 1fr) 390px; }
@media (max-width: 980px) { .app { grid-template-columns: minmax(0, 1fr); } .pos { grid-template-columns: minmax(0, 1fr); } }
#cats, .cats { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.tabs { overflow-x: auto; scrollbar-width: none; }
