:root {
  --bg: #070d1a; --panel: #0e1626; --panel-2: #131d31; --line: #1f2b42; --text: #e6ebf5; --muted: #8a97ad;
  --accent: #f97316; --accent-2: #fb923c; --blue: #3b82f6; --green: #22c55e; --red: #ef4444; --amber: #f59e0b; --purple: #a855f7;
  --red-bg: rgba(239,68,68,.14); --amber-bg: rgba(245,158,11,.14); --green-bg: rgba(34,197,94,.14); --blue-bg: rgba(59,130,246,.14); --purple-bg: rgba(168,85,247,.14);
  --shadow: 0 10px 30px rgba(0,0,0,.35); --radius: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5f9; --panel: #ffffff; --panel-2: #f7f8fb; --line: #e3e7ef; --text: #0f172a; --muted: #5b6678;
  --red-bg: #fde8e8; --amber-bg: #fef3dc; --green-bg: #e3f7ea; --blue-bg: #e5efff; --purple-bg: #f2e8ff;
  --shadow: 0 8px 24px rgba(15,23,42,.08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, Segoe UI, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* icons */
i[data-i] { display: inline-flex; width: 18px; height: 18px; flex: none; }
i[data-i] svg { width: 100%; height: 100%; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand b { font-size: 19px; display: block; line-height: 1.1; }
.brand small { font-size: 9.5px; letter-spacing: .18em; color: var(--muted); font-weight: 600; }
.logo { width: 38px; height: 38px; flex: none; background: no-repeat center/contain url("brand/mark.svg"); }
.brand.big b { font-size: 24px; }

/* auth */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(800px 400px at 20% 0%, rgba(249,115,22,.12), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; margin: 6px 0 4px; }
.auth-card form { display: grid; gap: 12px; margin-top: 18px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 13px; }
.msg { min-height: 18px; font-size: 13px; margin: 12px 0 0; }
.msg.err { color: var(--red); } .msg.ok { color: var(--green); }

/* forms */
label { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 40px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(249,115,22,.5); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 13.5px; padding: 6px 0; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }

.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 9px 14px; min-height: 38px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ea6a0c; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; min-height: 30px; font-size: 12.5px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { background: none; border: 0; color: var(--text); cursor: pointer; padding: 8px; border-radius: 10px; display: inline-flex; position: relative; }
.icon-btn:hover { background: var(--panel-2); text-decoration: none; }
.select { width: auto; min-width: 180px; }

/* layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
#nav { display: grid; gap: 3px; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 500; text-decoration: none; }
#nav a:hover { background: var(--panel-2); }
#nav a.active { background: var(--blue); color: #fff; }
.badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.badge:empty { display: none; }
.theme-box { margin-top: auto; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--panel-2); border-radius: 10px; padding: 4px; }
.seg button { font: inherit; font-size: 13px; border: 0; background: none; color: var(--muted); padding: 7px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

.main { min-width: 0; }
.scrim { display: none; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 24px 10px; }
.title-wrap { flex: 1; min-width: 0; }
.title-wrap h1 { font-size: 24px; }
.title-wrap p { margin: 2px 0 0; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.bell .dot { position: absolute; top: 2px; right: 2px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 4px; }
.bell .dot:empty { display: none; }
.menu-btn { display: none; }
.user { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.user-text b { display: block; font-size: 13px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text small { color: var(--muted); text-transform: capitalize; }
.user-pop { display: none; position: absolute; right: 0; top: 48px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-width: 200px; box-shadow: var(--shadow); z-index: 30; }
.user-pop a { display: block; padding: 8px; border-radius: 8px; color: var(--text); }
.user:focus-within .user-pop, .user:hover .user-pop { display: block; }
.banner { margin: 4px 24px 0; padding: 10px 14px; border-radius: 10px; background: var(--amber-bg); color: var(--text); border: 1px solid rgba(245,158,11,.4); font-size: 13px; }
.view { padding: 14px 24px 40px; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.overview { grid-template-columns: minmax(0,1fr) 320px; align-items: start; }
.g3 > .card { min-width: 0; }
.kpi { display: flex; gap: 14px; align-items: flex-start; }
.kpi .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.kpi .ic i { width: 22px; height: 22px; }
.kpi .label { font-weight: 600; font-size: 13.5px; }
.kpi .val { font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 2px; }
.kpi .val small { font-size: 15px; font-weight: 500; color: var(--muted); }
.kpi .foot { font-size: 12.5px; margin-top: 4px; }
.c-red { color: var(--red); } .c-amber { color: var(--amber); } .c-green { color: var(--green); } .c-blue { color: var(--blue); } .c-purple { color: var(--purple); } .c-accent { color: var(--accent); }
.b-red { background: var(--red-bg); color: var(--red); } .b-amber { background: var(--amber-bg); color: var(--amber); } .b-green { background: var(--green-bg); color: var(--green); } .b-blue { background: var(--blue-bg); color: var(--blue); } .b-purple { background: var(--purple-bg); color: var(--purple); }
.gauge { width: 92px; flex: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.list { display: grid; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); min-width: 0; }
.item .grow { min-width: 0; }
.item b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.item .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .btn { margin-top: 12px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--text); border-color: var(--accent); }

/* insights */
.insight { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--panel-2); }
.insight h3 { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.insight p { margin: 0; color: var(--muted); font-size: 13px; }

/* floor plan */
.plan-wrap { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel-2); user-select: none; }
.plan-wrap img { display: block; width: 100%; height: auto; }
.plan-wrap.placing { cursor: crosshair; outline: 2px dashed var(--accent); }
.plan-empty { aspect-ratio: 16/9; display: grid; place-items: center; color: var(--muted); background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 32px 32px; }
.pin { position: absolute; transform: translate(-50%, -100%); width: 26px; height: 32px; cursor: pointer; border: 0; background: none; padding: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.pin svg { width: 100%; height: 100%; }
.pin-pop { position: absolute; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 240px; box-shadow: var(--shadow); font-size: 12.5px; }
.pin-pop b { font-size: 14px; display: block; margin-bottom: 4px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* field inspection (phone-first) */
.banner.sync { background: var(--blue-bg); border-color: rgba(59,130,246,.4); }
.field { display: grid; gap: 14px; padding-bottom: 84px; }
.field-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.field-head b { display: block; font-size: 18px; }
.field-head .pill i { width: 14px; height: 14px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stepper li { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); position: relative; }
.stepper li::after { content: ''; position: absolute; top: 18px; left: calc(50% + 22px); right: calc(-50% + 22px); height: 2px; background: var(--line); }
.stepper li:last-child::after { display: none; }
.stepper li.done::after { background: var(--accent); }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.stepper li.on { color: var(--accent); font-weight: 600; }
.stepper li.on button { border-color: var(--accent); color: var(--accent); }
.stepper li.done button { background: var(--accent); border-color: var(--accent); color: #fff; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.photo-card { display: grid; gap: 12px; }
.capture { display: grid; place-items: center; gap: 8px; text-align: center; aspect-ratio: 4/3; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; color: var(--text); padding: 16px; }
.capture i { width: 40px; height: 40px; color: var(--accent); }
.photo-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #000; }
.photo-wrap img { display: block; width: 100%; height: auto; }
.ai-box { position: absolute; border: 2px solid var(--amber); border-radius: 6px; }
.ai-box span { position: absolute; left: -2px; top: -24px; white-space: nowrap; font-size: 11px; font-weight: 700; padding: 3px 6px; border-radius: 5px; background: rgba(11,18,32,.88); color: #fff; border: 1px solid currentColor; }
.ai-box.s-ok { border-color: var(--green); } .ai-box.s-ok span { color: #4ade80; }
.ai-box.s-fail { border-color: var(--red); } .ai-box.s-fail span { color: #f87171; }
.ai-box.s-review span { color: #fbbf24; }
.ai-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ai-row b { display: flex; gap: 6px; align-items: center; }
.check-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel-2); display: grid; gap: 10px; }
.check-item b { font-size: 14px; }
.cam { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; justify-content: center; align-items: center; flex: none; overflow: hidden; padding: 0; }
.cam svg { width: 22px; height: 22px; } .cam img { width: 100%; height: 100%; object-fit: cover; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg3 button { font: inherit; font-size: 13px; font-weight: 600; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.seg3 button.on { border-color: currentColor; }
.seg3 button.on.b-green { background: var(--green-bg); color: var(--green); }
.seg3 button.on.b-amber { background: var(--amber-bg); color: var(--amber); }
.seg3 button.on.b-red { background: var(--red-bg); color: var(--red); }
.field-mode .topbar .title-wrap, .field-mode #site-filter, .field-mode #trial-banner { display: none !important; }
.field-mode .topbar { justify-content: space-between; flex-wrap: nowrap; }
.field-mode .top-actions { width: auto; order: 0; margin-left: auto; }
.field-bar { position: fixed; left: 240px; right: 0; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); z-index: 20; }
.field-bar .btn { min-height: 46px; padding: 10px 18px; }
@media (max-width: 900px) { .field-grid { grid-template-columns: 1fr; } .field-bar { left: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); } }

/* health at a glance (overview bars) */
.hb-list { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); column-gap: 28px; }
.hb { display: grid; gap: 7px; padding: 10px 8px; border-radius: 10px; color: inherit; text-decoration: none !important; }
.hb:hover { background: var(--panel-2); }
.hb-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hb-label { font-weight: 600; font-size: 14px; }
.hb-val { font-size: 20px; font-variant-numeric: tabular-nums; }
.hb-track { height: 12px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; display: flex; }
.hb-track span { display: block; height: 100%; border-radius: 99px; transition: width .4s; }
.hb-track.hb-seg span { border-radius: 0; } .hb-track.hb-seg span + span { border-left: 2px solid var(--panel); }
.hb-note { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.hb-note.legend { justify-content: flex-start; gap: 14px; }
.hb-note.legend i, .dotc { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
@media (prefers-reduced-motion: reduce) { .hb-track span { transition: none; } }

/* photos & logos */
.avatar { overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.big { width: 64px; height: 64px; font-size: 24px; }
.logo-box { width: 160px; height: 64px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: #fff; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rep-logo { max-height: 64px; max-width: 180px; object-fit: contain; }

/* password eye */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 52px; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 8px; }
.pw-eye:hover { color: var(--text); }
.pw-eye svg { width: 20px; height: 20px; }
/* iPhone zooms in on inputs smaller than 16px — keep them at 16px on phones */
@media (max-width: 900px) { input, select, textarea { font-size: 16px; } }

/* maps */
.map { height: 260px; border-radius: 12px; border: 1px solid var(--line); position: relative; z-index: 0; background: var(--panel-2); }
.map.tall { height: 340px; }
.leaflet-popup-content { color: #0f172a; font: 13px/1.45 Inter, system-ui, sans-serif; }
.leaflet-popup-content a { color: #c2410c; }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgba(2,6,16,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; box-shadow: var(--shadow); }
.modal-card h2 { font-size: 18px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; transition: transform .25s; z-index: 60; max-width: calc(100vw - 32px); }
.toast.show { transform: translateX(-50%) translateY(0); }
.thumb { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: var(--panel-2); margin-top: 8px; }
.cal-day { font-weight: 700; font-size: 18px; line-height: 1; }
.cal-box { width: 44px; text-align: center; border-radius: 10px; padding: 6px 0; background: var(--blue-bg); color: var(--blue); flex: none; }
.cal-box small { display: block; font-size: 10px; text-transform: uppercase; font-weight: 700; }

/* report (printable) */
.report { background: #fff; color: #111; border-radius: 12px; padding: 28px; }
.report h1 { font-size: 22px; } .report h2 { margin: 18px 0 8px; }
.report table td, .report table th { border-color: #ddd; color: #111; }
.report .muted { color: #555; }

@media (max-width: 1200px) { .overview { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; }
  .scrim { display: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px 6px; flex-wrap: wrap; }
  .title-wrap h1 { font-size: 20px; }
  .user-text { display: none; }
  .top-actions { width: 100%; order: 3; }
  .top-actions .select { flex: 1; min-width: 0; }
  .view { padding: 10px 16px 32px; }
  .banner { margin: 4px 16px 0; }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .toolbar input, .toolbar select { flex: 1; min-width: 0; }
}
/* ---- store room ---- */
.scan-box { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-aim { position: absolute; inset: 24% 12%; border: 3px solid var(--accent); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.stat { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; min-width: 0; }
.stat i { width: 20px; height: 20px; flex: none; color: var(--accent); }
.stat b { display: block; font-size: 22px; color: var(--text); line-height: 1.1; }
.stat.on { border-color: var(--accent); }
.stock-row { color: inherit; text-decoration: none; }
.stock-row:hover { border-color: var(--accent); }
.qty-col { text-align: right; display: grid; justify-items: end; gap: 3px; flex: none; }
.qty-col .qty { font-size: 18px; font-weight: 700; white-space: nowrap; }
.qty-big { font-size: 44px; font-weight: 700; line-height: 1.05; }
.qty-step { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; margin-top: 6px; }
.qty-step input { text-align: center; font-size: 24px; font-weight: 700; }
.qty-step .btn { font-size: 24px; justify-content: center; padding: 0; min-height: 48px; }
.move-btns button { font-size: 14px; }
.count-row input { width: 92px; flex: none; text-align: center; font-weight: 700; }
.count-row .diff { flex: none; min-width: 52px; text-align: right; font-weight: 600; }
.flash { outline: 2px solid var(--accent); outline-offset: 2px; }
.q-line { display: grid; grid-template-columns: 1fr 84px 92px; gap: 8px; }
.qr-mini { width: 64px; height: 64px; border-radius: 6px; overflow: hidden; }
.qr-mini svg { width: 100%; height: 100%; display: block; }
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.label-card { display: flex; gap: 10px; align-items: center; border: 1px dashed #9aa4b2; border-radius: 8px; padding: 10px; background: #fff; color: #111; break-inside: avoid; }
.label-card svg { width: 84px; height: 84px; flex: none; }
.label-card b { display: block; font-size: 14px; line-height: 1.2; }
.label-card small { display: block; font-size: 11px; color: #444; margin-top: 3px; word-break: break-all; }
.stats.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stats.four .stat { cursor: default; }
.stats.four .stat b { font-size: 19px; }
.stats:not(.four) { grid-template-columns: repeat(4, minmax(0,1fr)); }
.money-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin: 0 0 12px; }
.money-row > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.money-row small { display: block; color: var(--muted); font-size: 11.5px; }
.money-row b { font-size: 15px; }
.mbars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 170px; align-items: end; }
.mbar { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; gap: 4px; min-width: 0; }
.mbar .mv { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbar .mfill { align-self: end; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.mbar small { color: var(--muted); font-size: 11.5px; }
.read-quote { width: 100%; justify-content: center; border-style: dashed; min-height: 48px; }
.read-quote.busy { opacity: .6; pointer-events: none; }
.q-head { display: grid; grid-template-columns: 1fr 70px 84px 78px; gap: 8px; }
.q-line { grid-template-columns: 1fr 70px 84px 78px !important; }
@media (max-width: 640px) {
  .stats:not(.four), .stats.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .q-head { display: none; }
  .q-line { grid-template-columns: 1fr 1fr 1fr !important; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .q-line [name=n] { grid-column: 1 / -1; }
  .stock-tb input[type=search] { flex-basis: 100%; order: 5; min-width: 0; }
  .stock-tb select { order: 6; flex-basis: 100%; min-width: 0; }
  .stats { gap: 6px; } .stat { padding: 10px 8px; flex-direction: column; align-items: flex-start; gap: 4px; } .stat b { font-size: 20px; }
  .q-line { grid-template-columns: 1fr 70px 80px; }
  .job-t .btn.sm { padding: 5px 8px; }
}
/* traffic-light tiles on the overview */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.tile { display: grid; justify-items: center; align-content: center; gap: 4px; padding: 16px 8px; border-radius: 16px; color: #fff !important; text-decoration: none !important; text-align: center; min-height: 128px; transition: transform .15s; }
.tile:hover { transform: translateY(-2px); }
.tile i { width: 30px; height: 30px; } .tile i svg { stroke-width: 2.2; }
.tile span { font-weight: 600; font-size: 14px; line-height: 1.2; }
.tile b { font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; }
.tl-red { background: #b91c1c; } .tl-orange { background: #c2620a; } .tl-green { background: #15803d; } .tl-blue { background: #1d4ed8; }
@media (max-width: 640px) { .tiles { gap: 7px; } .tile { padding: 12px 4px; min-height: 112px; border-radius: 14px; } .tile span { font-size: 12.5px; } .tile b { font-size: 30px; } .tile i { width: 26px; height: 26px; } }

@media print {
  .tabs { display: none !important; }
  .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .label-card { border: 1px solid #999; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .banner, .toolbar, .no-print, .modal, .toast { display: none !important; }
  .app { display: block; } .view { padding: 0; }
  .report { padding: 0; border: 0; }
}

/* plan & billing */
.banner.bill { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bill-seg { max-width: 360px; margin: 6px 0 14px; }
.bill-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.bill-plan { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--panel-2); }
.bill-plan.hot { border-color: var(--accent); }
.bill-plan h3 { margin: 0; font-size: 15px; }
.bill-plan .btn { margin-top: auto; }
.bill-amt { font-size: 26px; font-weight: 800; }
.bill-amt small { font-size: 13px; font-weight: 500; color: var(--muted); }
.bill-badge { position: absolute; top: -10px; right: 12px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
@media (max-width: 700px) { .bill-plans { grid-template-columns: 1fr; } }

/* monthly record sheets */
.seg a { font-size: 13px; text-decoration: none; color: var(--muted); padding: 7px; border-radius: 8px; text-align: center; }
.seg a.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sheet { font-family: Arial, Helvetica, sans-serif; }
.sheet-head { display: flex; gap: 16px; align-items: center; justify-content: center; text-align: center; color: #1a3fbf; font-size: 13px; line-height: 1.4; }
.sheet-head .sheet-co { font: italic 700 18px Georgia, serif; }
.sheet-logo { max-height: 64px; max-width: 120px; }
.sheet-title { text-align: center; margin: 14px 0 10px; }
.sheet-title h2 { margin: 6px 0 0; font-size: 16px; } .sheet-title h3 { margin: 2px 0 0; font-size: 15px; }
.sheet-meta td { padding: 3px 8px; font-size: 13px; }
.sheet-tbl { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.sheet-tbl th { text-align: left; text-decoration: underline; padding: 6px; }
.sheet-tbl td { padding: 6px; border-bottom: 1px dotted #999; vertical-align: middle; height: 34px; }
.sig-cell img { height: 30px; vertical-align: middle; margin-right: 6px; }
.sig-cell span { font-size: 11px; color: #555; }
.sheet-red { color: #d00; text-align: center; font-weight: 700; margin: 16px 0 0; }
@media print { .no-print, .seg { display: none !important; } .sheet { break-after: page; page-break-after: always; margin: 0; } .sheet:last-child { break-after: auto; } }
