/* MasalaDesk client demo. Theme: Mirch (locked). Single deliberate light look. */
:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --base: 15px;
  --radius: 6px;
  --radius-sm: 4px;
  --side-w: 248px;
  --shadow: 0 1px 2px rgba(36, 22, 21, .05);

  --bg: #F8F5F4; --surface: #FFFFFF; --surface-2: #F3ECEA; --text: #241615; --muted: #6F5F5D; --line: #E9DDDB;
  --accent: #A8231C; --accent-ink: #FFFFFF; --accent-text: #A8231C; --accent-soft: #FBE7E4; --spark: #F2B705;
  --side-bg: #8C1A15; --side-text: #FBE9E6; --side-muted: #E3ADA7; --side-line: rgba(255, 255, 255, .16); --side-hover: rgba(255, 255, 255, .1);
  --side-active-bg: #FFFFFF; --side-active-text: #8C1A15; --top-bg: #FFFFFF;
  --good: #1F7A4D; --good-soft: #E0F2E8; --warn: #9A5B00; --warn-soft: #FFEFD0; --bad: #B0271F; --bad-soft: #FBE4E1;
  --info: #2B4C8F; --info-soft: #E5ECFA;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 400 var(--base)/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, select, input, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.small { font-size: .85rem; }

/* ---------- Frame ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100%; }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { font-size: .78rem; color: var(--side-muted); }
.logo-ring { fill: none; stroke: currentColor; stroke-width: 2; }
.logo-dot { fill: currentColor; }
.logo-mid { fill: var(--spark); }

.nav { padding: 4px 10px 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--side-muted); padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); font-weight: 500; color: var(--side-text); }
.nav a:hover { background: var(--side-hover); }
.nav a.on { background: var(--side-active-bg); color: var(--side-active-text); font-weight: 600; }
.nav svg, .ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .count { margin-left: auto; background: var(--spark); color: #241615; font-size: .74rem; font-weight: 700; min-width: 22px; padding: 1px 6px; border-radius: 99px; text-align: center; }

.side-foot { margin: 0 10px 12px; padding: 12px 10px 4px; border-top: 1px solid var(--side-line); display: flex; flex-direction: column; gap: 10px; }
.side-user { display: flex; gap: 10px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #8C1A15; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.side-user b { display: block; font-size: .9rem; line-height: 1.2; }
.side-user span span { font-size: .78rem; color: var(--side-muted); }
.side-reset { background: none; border: 1px solid var(--side-line); color: var(--side-text); border-radius: var(--radius-sm); padding: 7px 10px; font-size: .82rem; font-weight: 500; cursor: pointer; text-align: left; display: flex; gap: 8px; align-items: center; }
.side-reset:hover { background: var(--side-hover); }
.side-reset .ico { width: 16px; height: 16px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { background: var(--top-bg); border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 15; }
.top-title { flex: 1; min-width: 160px; }
.top-title h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.top-title p { font-size: .84rem; color: var(--muted); }
.field { display: flex; flex-direction: column; font-size: .7rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; gap: 2px; }
.field-l { display: flex; align-items: center; gap: 4px; }
.field-l .ico { width: 12px; height: 12px; stroke-width: 2.2; }
.field select { text-transform: none; letter-spacing: 0; font-size: .88rem; font-weight: 500; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }
.field select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; opacity: 1; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 500; cursor: pointer; padding: 6px 4px; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.net { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--good-soft); color: var(--good); font-weight: 600; font-size: .82rem; padding: 6px 11px; border-radius: 99px; cursor: default; white-space: nowrap; }
.net::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.net.off { background: var(--warn-soft); color: var(--warn); }
.bell { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; }
.bell i { position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; font-style: normal; font-size: .7rem; font-weight: 700; min-width: 19px; height: 19px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; }
.menu-btn { display: none; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer; place-items: center; }

.content { padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 18px; max-width: 1360px; width: 100%; }
.scope-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .9rem; }
.scope-chip { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; padding: 4px 12px; border-radius: 99px; font-size: .84rem; }

/* ---------- Building blocks ---------- */
.row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.row.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; }
.kpi-l { font-size: .82rem; color: var(--muted); font-weight: 500; }
.kpi-v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: .82rem; color: var(--muted); }
.kpi-s.bad { color: var(--bad); font-weight: 600; } .kpi-s.good { color: var(--good); font-weight: 600; } .kpi-s.warn { color: var(--warn); font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px 0; }
.panel-h h2 { font-size: 1.02rem; font-weight: 600; margin-right: auto; }
.panel-b { padding: 12px 16px 16px; }
.panel-b.flush { padding: 8px 0 4px; }
.panel-foot { padding: 10px 16px 14px; color: var(--muted); font-size: .88rem; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.story-chip { font-size: .7rem; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); border: 1px dashed var(--accent-text); border-radius: 4px; padding: 1px 6px; cursor: help; white-space: nowrap; }
.story-line { margin: 8px 16px 0; padding: 7px 10px; font-size: .84rem; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); }
.story-line b { color: var(--accent-text); font-weight: 600; margin-right: 4px; }
.no-stories .story-chip, .no-stories .story-line { display: none; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 8px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th + th, td + td { padding-left: 8px; }
tr:last-child td { border-bottom: 0; }
td b { font-weight: 600; }
td:first-child b { white-space: nowrap; }
td small { display: block; color: var(--muted); font-size: .8rem; }
tr.flag td { background: var(--bad-soft); }
tr.diff td { background: var(--warn-soft); }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
tr.group td { background: var(--surface-2); padding-top: 8px; padding-bottom: 8px; font-size: .88rem; }
tr.dim td { color: var(--muted); }
tr.dim td s { color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 8px 14px; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; min-height: 38px; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #8C1A15; }
.btn.good { background: var(--good); color: #fff; border-color: var(--good); }
.btn.big { padding: 13px 20px; font-size: 1.02rem; min-height: 50px; }
.btn.block { width: 100%; }
.btn .ico { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.meter { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

.note { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--info-soft); color: var(--text); border-radius: var(--radius); padding: 12px 14px; font-size: .92rem; }
.note > span { flex: 1 1 260px; }
.note.warn { background: var(--warn-soft); } .note.bad { background: var(--bad-soft); } .note.good { background: var(--good-soft); }
.note b { font-weight: 600; }
.note .x { background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }

/* ---------- My day tracker ---------- */
.day { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.day-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.day-step.now { border: 2px solid var(--accent); padding: 13px; }
.day-step.done { background: var(--surface); }
.day-top { display: flex; align-items: center; gap: 10px; }
.day-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--surface-2); color: var(--muted); flex: none; }
.day-step.now .day-n { background: var(--accent); color: #fff; }
.day-step.done .day-n { background: var(--good); color: #fff; }
.day-step b { font-size: 1rem; font-weight: 600; }
.day-step p { font-size: .86rem; color: var(--muted); min-height: 2.6em; }
.day-step .btn { margin-top: auto; align-self: flex-start; }

.actions { display: grid; gap: 12px; grid-template-columns: 1.6fr 1fr 1fr 1fr; }
.action { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; cursor: pointer; box-shadow: var(--shadow); text-align: left; }
.action:hover { border-color: var(--accent); }
.action.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.action.primary:hover { background: #8C1A15; }
.action .ico { width: 30px; height: 30px; }
.action b { display: block; font-size: 1.08rem; font-weight: 600; }
.action span span { font-size: .84rem; opacity: .85; }

/* ---------- Alerts ---------- */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.alerts li:last-child { border-bottom: 0; }
.alerts .sev { width: 78px; flex: none; padding-top: 1px; }
.alert-main { flex: 1 1 220px; min-width: 0; }
.alert-main b { font-weight: 600; }
.alert-main div { font-size: .88rem; color: var(--muted); }
.empty { color: var(--muted); padding: 22px 16px; text-align: center; }

/* ---------- Charts ---------- */
.vbars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 22px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 5px; min-width: 0; }
.vbar i { width: 100%; max-width: 52px; background: var(--accent); opacity: .35; border-radius: 4px 4px 0 0; min-height: 3px; }
.vbar.peak i { opacity: 1; }
.vbar .v { font-size: .74rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vbar .l { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.hbars { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 10px 12px; align-items: center; font-size: .9rem; }
.hbars .track { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbars .track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.split { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 6px 0 10px; }
.split i { display: block; height: 100%; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .88rem; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--c); vertical-align: -1px; }

/* ---------- New order (POS) ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.pos-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.search { flex: 1 1 200px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); min-height: 42px; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; }
.cat { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 14px; font-weight: 600; font-size: .88rem; cursor: pointer; }
.cat.on { background: var(--text); color: #fff; border-color: var(--text); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
/* Every menu card has the same four rows: picture + name + description, stock, price buttons. Buttons always sit at the bottom. */
.tile { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 12px; display: grid; grid-template-rows: auto auto 1fr; gap: 10px; }
.tile.out { background: var(--surface-2); }
.tile-top { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: start; }
.tile-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-t b { font-weight: 600; line-height: 1.25; }
.tile-note { font-size: .78rem; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.tile-stock { display: flex; }
.food-ic { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.food-ic svg { width: 34px; height: 34px; display: block; }
.tile.out .food-ic { opacity: .55; }
.vbtns { display: flex; gap: 6px; align-self: end; }
.vbtn { flex: 1; border: 1px solid var(--accent); background: var(--surface); color: var(--accent-text); border-radius: var(--radius-sm); padding: 9px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.2; min-height: 52px; justify-content: center; }
.vbtn:hover { background: var(--accent-soft); }
.vbtn:active { background: var(--accent); color: #fff; }
.vbtn { position: relative; }
.vbtn.has { background: var(--accent); color: #fff; }
.vbtn.has:hover { background: #8C1A15; }
.vq { position: absolute; top: -9px; right: -9px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; background: var(--spark); color: #241615; font-size: .82rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); font-variant-numeric: tabular-nums; }
.tile.picked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
/* Each size: the count sits on the top-right corner and [−] on the bottom-left corner of the price button.
   Both float, so the button never changes size or moves while the operator taps. */
.vwrap { flex: 1; position: relative; min-width: 0; display: flex; }
.vwrap .vbtn { flex: 1; min-width: 0; }
.vwrap .vq { pointer-events: none; }
.vminus { position: absolute; left: -10px; bottom: -10px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); background: var(--text); color: #fff; font-size: 1.15rem; font-weight: 700; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); z-index: 1; }
.vminus:hover { background: #000; }
.vbtn:disabled { border-color: var(--line); color: var(--muted); background: var(--surface-2); cursor: not-allowed; }
.vbtn:disabled:hover, .vbtn:disabled:active { background: var(--surface-2); color: var(--muted); }
.vbtns { gap: 10px; padding: 0 0 4px 4px; }
.vbtn small { font-size: .74rem; font-weight: 500; }
.vbtn b { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.ticket { position: sticky; top: 76px; }
.ticket-sum { display: none; }
.ticket-lines { list-style: none; margin: 0; padding: 0; }
.ticket-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ticket-lines li small { display: block; color: var(--muted); font-size: .8rem; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: var(--surface-2); font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.qty span { min-width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.ticket-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.35rem; font-weight: 700; margin: 12px 0; font-variant-numeric: tabular-nums; }
.pay { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay .btn { min-height: 58px; font-size: 1.05rem; }
.pay .split-btn { grid-column: 1 / -1; min-height: 40px; font-size: .9rem; }
.change { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.change button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 4px 9px; font-weight: 600; cursor: pointer; font-size: .85rem; }
.change button.on { background: var(--text); color: #fff; border-color: var(--text); }
.change strong { color: var(--text); margin-left: auto; }

/* ---------- Home ---------- */
.action { min-height: 92px; }
.action.alert { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.act-n { font-style: normal; background: var(--spark); color: #241615; border-radius: 99px; padding: 0 8px; font-size: .85rem; margin-left: 4px; vertical-align: 2px; }
.todo { display: flex; flex-direction: column; gap: 8px; }
.todo-i { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); padding: 12px 14px; }
.todo-i.info { border-left-color: var(--info); }
.todo-i > span { flex: 1 1 240px; display: flex; flex-direction: column; }
.todo-i > span span { font-size: .88rem; color: var(--muted); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.amini { list-style: none; margin: 0; padding: 0; }
.amini li { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.amini li:last-child { border-bottom: 0; }
.amini-no { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.amini-no b { font-size: 1.05rem; }
.amini-items { font-size: .9rem; }
.sales-card .panel-b { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.sc-top { display: flex; justify-content: space-between; align-items: center; }
.linkish { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent-text); font-size: .86rem; }
.linkish:hover { background: none; text-decoration: underline; }
.sc-v { font-size: 2.2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sc-sub { font-size: .88rem; color: var(--muted); }
.sc-sub .up { color: var(--good); } .sc-sub .down { color: var(--bad); }
.meter.big { height: 10px; margin-top: 8px; }
.sc-target { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 56px; margin-top: 12px; padding-top: 4px; border-bottom: 1px solid var(--line); }
.spark i { flex: 1; background: var(--accent); opacity: .3; border-radius: 3px 3px 0 0; }
.spark i.now { opacity: 1; }
.spark-l { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); }
.lowlist { list-style: none; margin: 0; padding: 0; }
.lowlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.lowlist li:last-child { border-bottom: 0; }
.lowlist small { display: block; color: var(--muted); font-size: .8rem; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .amini li { grid-template-columns: minmax(0, 1fr) auto; } .amini-items { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Deliveries ---------- */
.section-h { font-size: 1.1rem; font-weight: 700; margin-top: 6px; }
.filters { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.filters .form { grid-template-columns: repeat(auto-fit, minmax(180px, 220px)); align-items: end; }
.filters .form .link { align-self: center; justify-self: start; padding: 10px 0; }
.dl-items { display: flex; flex-wrap: wrap; gap: 4px 6px; min-width: 220px; }
.dl-item { font-size: .82rem; background: var(--surface-2); border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.dl-item b { font-weight: 700; font-variant-numeric: tabular-nums; }
.dl-item.off { background: var(--warn-soft); color: var(--warn); }

/* Top-up popup */
.stack-field { display: flex; flex-direction: column; gap: 8px; }
.stack-field .lbl { font-size: .84rem; font-weight: 600; color: var(--muted); }
.inline-in { flex-direction: row !important; align-items: center; gap: 10px !important; }
.unit-in { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.unit-in input { border: 0 !important; width: 110px; min-height: 40px; padding: 8px 10px; text-align: right; font-weight: 600; }
.unit-in input:focus { outline: none; }
.unit-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.unit-in span { padding: 0 10px; color: var(--muted); font-size: .85rem; background: var(--surface-2); align-self: stretch; display: grid; place-items: center; }
.unit-in.sm input { width: 76px; min-height: 36px; padding: 6px 8px; }
.unit-in.sm span { padding: 0 8px; font-size: .8rem; }
.unit-in.diff { border-color: var(--warn); background: var(--warn-soft); }
.unit-in.diff input { background: var(--warn-soft); }
td .meter { max-width: 140px; }
.meter.warn i { background: var(--warn); } .meter.bad i { background: var(--bad); }
.left-v { white-space: nowrap; }
.stack textarea { resize: vertical; min-height: 64px; font-weight: 500; }

/* ---------- Active orders ---------- */
.ocards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); align-items: stretch; }
.ocard { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--good); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ocard.warn { border-top-color: var(--warn); }
.ocard.bad { border-top-color: var(--bad); background: #FFFBFA; }
.ocard-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ocard-h b { font-size: 1.2rem; font-weight: 700; }
.ocard-meta { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ocard-items { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; }
.ocard .ocard-items { height: 98px; overflow: hidden; }
.ocard-items li { display: grid; grid-template-columns: 34px 36px minmax(0, 1fr); align-items: center; gap: 8px; font-weight: 600; height: 36px; }
.ocard-items li.ph { visibility: hidden; }
.ocard-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ocard-items.full li { grid-template-columns: 34px 36px minmax(0, 1fr) auto; height: auto; }
.ocard-items.full .ocard-n { white-space: normal; }
.ocard-more { align-self: stretch; border: 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); background: none; color: var(--accent-text); font-weight: 600; font-size: .88rem; padding: 9px 0; cursor: pointer; text-align: left; margin-top: auto; }
.ocard-more:hover { text-decoration: underline; }
.ocard-items small { color: var(--muted); font-weight: 500; }
.ocard-items .food-ic { width: 36px; height: 36px; border-radius: 8px; }
.ocard-items .food-ic svg { width: 28px; height: 28px; }
.ocard-q { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ocard-a { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* ---------- Inputs ---------- */
.cell-in { width: 84px; padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; min-height: 38px; }
.cell-in:focus { border-color: var(--accent); }
.cell-in.diff { border-color: var(--warn); background: var(--warn-soft); }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.form label, .stack label { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.form input, .form select, .stack input, .stack select, .stack textarea { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 500; min-height: 42px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio-list label { flex-direction: row; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); font-weight: 500; cursor: pointer; }
.radio-list input { accent-color: var(--accent); width: 18px; height: 18px; min-height: 0; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 8px 12px; font-weight: 600; cursor: pointer; }
.quick button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Day close steps ---------- */
.steps { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.steps button { flex: 1; border: 0; background: var(--surface); padding: 12px 10px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; border-right: 1px solid var(--line); color: var(--muted); }
.steps button:last-child { border-right: 0; }
.steps button.on { background: var(--accent); color: #fff; }
.steps button.ok:not(.on) { color: var(--good); }
.steps i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; border: 2px solid currentColor; }

/* ---------- Modal and PIN ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(36, 22, 21, .5); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.modal-h { display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px 6px; }
.modal-h h2 { font-size: 1.15rem; font-weight: 700; flex: 1; }
.modal-h p { font-size: .88rem; color: var(--muted); margin-top: 2px; }
.modal-b { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-x { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; padding: 6px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.pin-err { text-align: center; color: var(--bad); font-weight: 600; font-size: .9rem; min-height: 1.4em; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pinpad button { height: 58px; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius); font-size: 1.35rem; font-weight: 600; cursor: pointer; }
.pinpad button:active { background: var(--line); }
.pin-hint { text-align: center; font-size: .82rem; color: var(--muted); }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 12px 10px 18px; border-radius: 99px; font-weight: 600; font-size: .9rem; z-index: 70; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); }
.toast button { background: rgba(255, 255, 255, .16); color: #fff; border: 0; border-radius: 99px; padding: 5px 12px; font-weight: 600; cursor: pointer; }
.toast:not(:has(button)) { padding-right: 18px; }

.scrim { display: none; }
.tabbar { display: none; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
  .row.wide-left { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 960px) {
  .day { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: min(280px, 86vw); transform: translateX(-100%); transition: transform .2s; }
  .nav-open .side { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 30; }
  .menu-btn { display: grid; }
  .top { padding: 8px 16px; gap: 8px; }
  .top .field, .top .toggle { display: none; }
  .top-title p { display: none; }
  .content { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 96px max(16px, env(safe-area-inset-left, 0px)); }
  th, td { padding-left: 12px; padding-right: 12px; }

  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: .72rem; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer; position: relative; }
  .tabbar .on { color: var(--accent-text); }
  .tabbar .tab-main .ico { background: var(--accent); color: #fff; border-radius: 50%; width: 34px; height: 34px; padding: 7px; margin-top: -2px; }
  .tabbar i { position: absolute; top: 3px; left: calc(50% + 6px); background: var(--bad); color: #fff; font-style: normal; font-size: .65rem; min-width: 16px; height: 16px; border-radius: 99px; display: grid; place-items: center; padding: 0 3px; }

  .pos { grid-template-columns: minmax(0, 1fr); }
  .ticket { position: fixed; top: auto; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); z-index: 18; border-radius: 12px 12px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, .15); max-height: 72vh; overflow-y: auto; }
  .ticket .panel-h, .ticket .story-line, .ticket .panel-b { display: none; }
  .ticket.open .panel-h, .ticket.open .story-line, .ticket.open .panel-b { display: flex; }
  .ticket.open .panel-b { display: block; }
  .ticket.open .story-line { display: block; }
  .ticket-sum { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; border-radius: 12px 12px 0 0; }
  .ticket.open .ticket-sum { background: var(--text); }
  .pos-pad { height: 70px; }
  .day-step p { min-height: 0; }
  .toast { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 520px) {
  .day { grid-template-columns: minmax(0, 1fr); }
  .actions { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi-v { font-size: 1.3rem; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tile-note { min-height: 0; }
  .steps button span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } .shake { animation: none; } }
