/* VOICE calm back-office tool · IDEA a shop's docket book · PICTURE the working forms themselves
   COLOUR navy ground, warm mattress-tan accent · TYPE system sans · LAYOUT phone-first, bottom tabs */
:root {
  color-scheme: light;
  --ink: #1d2433; --muted: #6b7385; --line: #e4e6ec; --bg: #f5f4f1; --card: #fff;
  --brand: #23395b; --brand-2: #3b5b8c; --accent: #c9822b; --good: #2f7d4f; --warn: #b7791f; --bad: #b3352f;
  --topbar: #23395b; --soft: #eef2f8; --field: #fff; --tabbar: #fff; --hover: #f3f5f9; --track: #ece9e2; --seg: #e9e7e1; --seg-on: #fff;
  --warn-bg: #fff6e6; --warn-ink: #7a4d0b; --bad-bg: #fdeceb; --good-bg: #eaf5ee; --shadow: var(--shadow);
  --login: linear-gradient(160deg, #23395b, #3b5b8c);
  --radius: 14px; --nav-h: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Dark mode: follows the phone's setting ("auto"), or forced via More › Appearance. */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7eaf0; --muted: #99a2b4; --line: #2b3346; --bg: #0f131b; --card: #1a202d;
  --brand: #4a6dab; --brand-2: #93b3ea; --accent: #d9953f; --good: #5cbf85; --warn: #e0a64a; --bad: #ef7b73;
  --topbar: #161c29; --soft: #243049; --field: #121722; --tabbar: #161b26; --hover: #222a3a; --track: #2b3346; --seg: #222a38; --seg-on: #34405a;
  --warn-bg: #3a2c12; --warn-ink: #f1c77d; --bad-bg: #3d1f1f; --good-bg: #173527; --shadow: rgba(0,0,0,.35);
  --login: linear-gradient(160deg, #0f1522, #23395b);
}
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) {
  color-scheme: dark;
  --ink: #e7eaf0; --muted: #99a2b4; --line: #2b3346; --bg: #0f131b; --card: #1a202d;
  --brand: #4a6dab; --brand-2: #93b3ea; --accent: #d9953f; --good: #5cbf85; --warn: #e0a64a; --bad: #ef7b73;
  --topbar: #161c29; --soft: #243049; --field: #121722; --tabbar: #161b26; --hover: #222a3a; --track: #2b3346; --seg: #222a38; --seg-on: #34405a;
  --warn-bg: #3a2c12; --warn-ink: #f1c77d; --bad-bg: #3d1f1f; --good-bg: #173527; --shadow: rgba(0,0,0,.35);
  --login: linear-gradient(160deg, #0f1522, #23395b);
} }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; -webkit-text-size-adjust: 100%; }
/* Nothing may make the page wider than the screen (clip, unlike hidden, keeps the sticky top bar working). */
html, body { overflow-x: clip; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--topbar); color: #fff; padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; display: flex; align-items: center; gap: 10px; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { background: none; border: 0; color: #fff; font-size: 22px; padding: 0 6px 0 0; cursor: pointer; }
.topbar .badge { font-size: 11px; background: rgba(255,255,255,.16); padding: 3px 8px; border-radius: 99px; }

main { padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); max-width: 880px; margin: 0 auto; }

nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--tabbar); border-top: 1px solid var(--line); display: flex; z-index: 6; }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11.5px; }
nav.tabs a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
nav.tabs a.on { color: var(--brand); font-weight: 600; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 2px var(--shadow); margin-bottom: 14px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px var(--shadow); }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .v { font-size: 19px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }

.bar { height: 10px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.bar > i { display: block; height: 100%; background: var(--good); border-radius: 99px; }
.bar.watch > i { background: var(--warn); } .bar.register > i { background: var(--bad); }
.alert { padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13.5px; margin-top: 8px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .right { text-align: right; } .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.quick a { background: var(--card); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); display: flex; align-items: center; gap: 10px; }
.quick a span { width: 32px; height: 32px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; color: var(--brand); font-size: 18px; }

.list { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px var(--shadow); margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.row:last-child { border-bottom: 0; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--brand-2); white-space: nowrap; }
.pill.cn { background: var(--bad-bg); color: var(--bad); } .pill.low { background: var(--warn-bg); color: var(--warn); }
.pill.super { background: #f6e7b0; color: #6b4e00; }
html[data-theme="dark"] .pill.super { background: #4a3c10; color: #f3d77a; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .pill.super { background: #4a3c10; color: #f3d77a; } }

label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; }
/* 16px stops iPhone Safari zooming in when a box is tapped (it stays zoomed and the page slides sideways). */
input, select, textarea { font-size: 16px; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; border-color: transparent; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.line-item { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 12px; margin-top: 10px; position: relative; }
.line-item .x { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
.line-item .lt { text-align: right; font-weight: 600; margin-top: 8px; font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 18px; min-height: 46px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.block { width: 100%; } .btn.ghost { background: var(--soft); color: var(--brand-2); } .btn.warn { background: var(--bad-bg); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.fab { position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: #fff; font-size: 30px; display: grid; place-items: center; text-decoration: none; box-shadow: 0 6px 16px rgba(0,0,0,.18); z-index: 4; }

.seg { display: flex; background: var(--seg); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg a { flex: 1; text-align: center; padding: 8px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg a.on { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.totals { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { font-size: 18px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 24px); background: #1d2433; color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.3); padding: 11px 16px; border-radius: 12px; z-index: 20; max-width: 90vw; font-size: 14px; }
.toast.err { background: #b3352f; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--login); }
.login .card { width: 100%; max-width: 380px; padding: 24px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }

/* Printable document */
.doc { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 2px var(--shadow); }
.doc .hd { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 14px; }
.doc .title { font-size: 22px; font-weight: 800; letter-spacing: .04em; }
.doc .co { font-weight: 700; font-size: 16px; }
@media print {
  .topbar, nav.tabs, .fab, .noprint, .toast { display: none !important; }
  main { padding: 0; max-width: none; } html, body { background: #fff !important; }
  html { --ink: #1d2433; --muted: #6b7385; --line: #e4e6ec; --card: #fff; --bg: #fff; color-scheme: light; }
  .doc { box-shadow: none; padding: 0; }
}

/* reports */
table.rpt { font-size: 13.5px; min-width: 100%; }
table.rpt td, table.rpt th { white-space: nowrap; }
table.rpt td:first-child { white-space: normal; min-width: 150px; }
tr.lnk { cursor: pointer; }
tr.lnk:hover td { background: var(--hover); }
tr.lnk td:first-child { color: var(--brand-2); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
details summary { list-style: none; } details summary::-webkit-details-marker { display: none; }
details summary::after { content: ' ▾'; color: var(--muted); }
@media print { details { display: none; } .scroll { overflow: visible; } table.rpt { font-size: 11px; } }

/* settings: role ticks, theme picker */
.ticks { display: grid; grid-template-columns: 1fr; gap: 2px; }
.tick { display: flex; align-items: center; gap: 10px; margin: 0; padding: 9px 2px; color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--line); }
.tick:last-child { border-bottom: 0; }
.tick input { width: 20px; height: 20px; min-height: 0; flex: none; accent-color: var(--brand); }
.grp { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 2px; }
.temp { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: .04em; background: var(--soft); padding: 10px 12px; border-radius: 10px; user-select: all; word-break: break-all; }
.ok-bg { background: var(--good-bg); color: var(--good); }

/* Home: Needs your attention — coloured by urgency (red urgent, amber warning, blue to-do) */
:root { --info-bg: #e8f0fb; --info-ink: #1f4f8f; --bad-ink: #8f2621; }
html[data-theme="dark"] { --info-bg: #1b2a44; --info-ink: #a9c4f0; --bad-ink: #f6b0aa; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { --info-bg: #1b2a44; --info-ink: #a9c4f0; --bad-ink: #f6b0aa; } }
.attn-h { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--warn); }
.attn-h span { background: var(--warn); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 12px; letter-spacing: 0; }
.attn { display: grid; gap: 8px; margin-bottom: 16px; }
.attn a { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 12px; text-decoration: none; border-left: 5px solid; font-size: 14.5px; line-height: 1.35; }
.attn a .tx { flex: 1; min-width: 0; }
.attn a .ch { font-size: 20px; opacity: .7; }
.attn a .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.attn-bad { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad) !important; font-weight: 600; }
.attn-bad .ic { background: var(--bad); }
.attn-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn) !important; }
.attn-warn .ic { background: var(--warn); }
.attn-info { background: var(--info-bg); color: var(--info-ink); border-color: var(--brand-2) !important; }
.attn-info .ic { background: var(--brand-2); }

/* crop by hand: big, easy-to-grab corner handles */
.crop-h { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 3px solid #fff;
  background: rgba(90,160,255,.35); box-shadow: 0 1px 6px rgba(0,0,0,.6); touch-action: none; cursor: grab; }
.crop-h::after { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #fff; }

/* files cabinet */
.alert.ok { background: var(--good-bg); color: var(--good); }
.pill.ok { background: var(--good-bg); color: var(--good); }
.row.file .thumb { width: 44px; height: 58px; flex: none; border-radius: 6px; background: var(--soft); overflow: hidden; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); }
.row.file .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.row .main .bar { margin-top: 6px; height: 4px; }
form.search { display: flex; gap: 8px; margin-bottom: 10px; }
form.search input { flex: 1; margin: 0; }
form.search .btn { flex: none; }
.paper { background: #fff; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; box-shadow: 0 1px 2px var(--shadow); }
.paper canvas.page { display: block; border-bottom: 1px solid #ddd; }
.paper .empty { color: #555; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 6px; }
table.cmp th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 4px 6px; }
table.cmp td { padding: 7px 6px; border-top: 1px solid var(--line); vertical-align: top; word-break: break-word; }
table.cmp td:first-child { color: var(--muted); white-space: nowrap; }
table.cmp tr.diff td { background: var(--warn-bg); color: var(--warn-ink); }
details summary { cursor: pointer; margin-top: 10px; font-size: 13.5px; color: var(--brand-2); }
.actbar { position: sticky; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: flex-end;
  background: var(--card); padding: 10px; border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.18); z-index: 3; }
.actbar #rev { flex: 1; }
table.cmp.adj td:first-child { white-space: normal; color: inherit; }
table.cmp.adj td { padding: 6px 4px; }
.cochip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: #fff; background: var(--co, #2f6f4f); padding: 3px 9px; border-radius: 99px; text-decoration: none; white-space: nowrap; box-shadow: 0 0 0 1px rgba(255,255,255,.35); }
