/* Essentials admin: phone-first, follows the phone's light/dark setting. */
:root {
  --bg: #f4f3f7; --surface: #ffffff; --surface-2: #efedf3; --line: #e2dfe9; --text: #16141b; --muted: #676176;
  --accent: #d81b62; --accent-ink: #ffffff;
  --good: #11805a; --good-bg: #dff5ec; --warn: #a86400; --warn-bg: #fff1d6; --bad: #c9352a; --bad-bg: #fde4e1;
  --s-cash: #1baf7a; --s-card: #2a78d6; --s-split: #eb6834; --bar: #2a78d6;
  --shadow: 0 10px 40px rgba(22, 20, 27, .12);
  --f-display: "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif;
  --f-body: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e13; --surface: #1a1820; --surface-2: #24212c; --line: #302c3a; --text: #f3f1f6; --muted: #a39db1;
    --accent: #ff3d7f; --accent-ink: #16020a;
    --good: #34d399; --good-bg: #0f2b22; --warn: #ffc83d; --warn-bg: #2e240c; --bad: #ff6b5e; --bad-bg: #331512;
    --s-cash: #199e70; --s-card: #3987e5; --s-split: #d95926; --bar: #3987e5;
    --shadow: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--f-body); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.money, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 700; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
header.top { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.logo { font-family: var(--f-display); font-weight: 900; font-size: 24px; letter-spacing: .04em; }
.logo span { color: var(--accent); } .logo small { color: var(--muted); font-size: 16px; }
main { flex: 1; padding: 4px max(16px, env(safe-area-inset-right, 0px)) calc(100px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
h1 { font-family: var(--f-display); font-weight: 900; font-size: 36px; line-height: .95; margin: 0; text-transform: uppercase; }
h2 { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.link { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 0; font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.pad { padding: 14px 16px; }
.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-width: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { color: var(--muted); font-size: 13px; }
button.row { width: 100%; background: none; border: 0; text-align: left; }
.chev { color: var(--muted); flex: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 8px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 11px 16px; font-weight: 700; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill.good { color: var(--good); background: var(--good-bg); } .pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); } .pill.neutral { color: var(--muted); background: var(--surface-2); }
.b21 { font-family: var(--f-mono); font-size: 11px; font-weight: 700; color: var(--warn); border: 1px solid currentColor; border-radius: 5px; padding: 0 4px; }
.thumb { width: 44px; height: 44px; border-radius: 10px; flex: none; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; } .dot.on { background: var(--good); } .dot.off { background: var(--bad); } .dot.never { background: var(--muted); }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--text); }

.hero { padding: 18px 16px; display: flex; flex-direction: column; gap: 6px; }
.hero .big { font-family: var(--f-mono); font-weight: 700; font-size: 42px; line-height: 1; }
.alert { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 12px 14px; }
.alert .t { font-weight: 700; } .alert .s { color: var(--muted); font-size: 13px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { padding: 12px 14px; } .kpi .l { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-family: var(--f-mono); font-weight: 700; font-size: 22px; margin-top: 2px; } .kpi .n { font-size: 12px; color: var(--muted); }

.tray { display: grid; grid-template-columns: 26px repeat(var(--cols, 3), 1fr); gap: 6px; }
.tray .tl { font-family: var(--f-mono); font-size: 11px; color: var(--muted); display: grid; place-items: center; font-weight: 700; }
.slot { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.slot img { width: 40px; height: 40px; object-fit: contain; }
.slot .c { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.slot .q { font-family: var(--f-mono); font-weight: 700; font-size: 16px; line-height: 1; }
.slot .nm { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .fb { width: 70%; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.slot .fb i { display: block; height: 100%; background: var(--good); }
.slot.low { border-color: var(--warn); } .slot.low .fb i { background: var(--warn); }
.slot.out { border-color: var(--bad); background: var(--bad-bg); } .slot.out .q { color: var(--bad); }
.slot.empty { opacity: .5; border-style: dashed; } .slot.jam { border: 2px solid var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.mix { display: flex; height: 22px; border-radius: 6px; overflow: hidden; gap: 2px; }
.mix i { display: block; height: 100%; }
.chart { position: relative; } .chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--f-mono); } .chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--bar); } .chart .hit { fill: transparent; cursor: pointer; } .chart .bar.hl { fill: var(--accent); }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; transform: translate(-50%, -100%); }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.fstep .fl { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.fstep .fbar { height: 12px; background: var(--surface-2); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.fstep .fbar i { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }
.fdrop { font-size: 12px; color: var(--muted); } .fdrop.worst { color: var(--bad); font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lab { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input[type=text], .field input[type=number], .field input[type=password], .field input[type=tel], .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 12px; font-size: 16px; }
.field .hint { font-size: 12px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.switch .t { font-weight: 700; } .switch .s { font-size: 13px; color: var(--muted); }
.tog { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.tog:checked { background: var(--good); } .tog:checked::after { transform: translateX(18px); }
.breakdown { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.breakdown .tot { font-weight: 800; border-top: 1px solid var(--line); padding-top: 6px; }
.breakdown span:nth-child(even) { text-align: right; font-family: var(--f-mono); font-weight: 700; }
.photo { display: flex; gap: 14px; align-items: center; } .photo .thumb { width: 84px; height: 84px; border-radius: 14px; }
.upload { display: block; border: 1.5px dashed var(--accent); color: var(--accent); border-radius: 12px; padding: 12px; text-align: center; font-weight: 700; cursor: pointer; position: relative; }
.upload input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.search { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 11px 14px; font-size: 16px; }
.code { font-family: var(--f-mono); font-size: 40px; font-weight: 700; letter-spacing: .2em; text-align: center; padding: 12px; }
.err { color: var(--bad); font-weight: 700; font-size: 14px; }

nav.tabs { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
nav.tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 6px 0; position: relative; }
nav.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button.on { color: var(--accent); }
nav.tabs .badge { position: absolute; top: 2px; left: 56%; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; border-radius: 999px; min-width: 16px; height: 16px; padding: 0 4px; display: grid; place-items: center; }

.scrim { position: fixed; inset: 0; background: rgba(10, 9, 14, .5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; margin-bottom: 4px; }
.sheet h3 { font-family: var(--f-display); font-weight: 900; font-size: 26px; text-transform: uppercase; margin: 0; line-height: 1; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 24px; font-weight: 700; }
.stepper .num { font-size: 32px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 10px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; opacity: 0; transition: .2s; z-index: 30; pointer-events: none; max-width: 90%; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.login { max-width: 360px; margin: 10vh auto 0; display: flex; flex-direction: column; gap: 14px; }
