/*
VOICE: calm workshop logbook — plain, exact, fast to scan on a phone in a yard.
IDEA: the job sheet on a clipboard: black ink on white, concrete-grey panels, one safety-yellow tag.
PICTURE: the live work itself — lists, timers and job cards are the page.
COLOUR and TYPE: white / black / concrete #d8d8d4, safety yellow #ffe600 for the primary action only; Hanken Grotesk.
LAYOUT: sidebar on wide screens, bottom tab bar on phones; tables become stacked cards under 760px.
*/
:root {
  color-scheme: light dark;
  --bg: light-dark(#f4f4f1, #141413);
  --panel: light-dark(#ffffff, #1d1d1c);
  --panel2: light-dark(#ebebe7, #262624);
  --line: light-dark(#d8d8d4, #34342f);
  --ink: light-dark(#111111, #f1f1ec);
  --ink2: light-dark(#55554f, #a9a9a1);
  --ink3: light-dark(#7a7a72, #85857d);
  --yellow: #ffe600;
  --yellow-ink: #111;
  --red: light-dark(#c4261d, #ff6b5e);
  --red-bg: light-dark(#fdecea, #3a1d1a);
  --amber: light-dark(#a35d00, #ffb547);
  --amber-bg: light-dark(#fff3dc, #3a2c14);
  --green: light-dark(#18794e, #4cc38a);
  --green-bg: light-dark(#e6f4ec, #16301f);
  --blue: light-dark(#1f5fbf, #7aa7ff);
  --blue-bg: light-dark(#e8f0fc, #1a2740);
  --grey-bg: light-dark(#efefeb, #2a2a27);
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .04);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overflow-x: clip; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 650; text-wrap: balance; }
h1 { font-size: clamp(22px, 3.2vw, 30px); letter-spacing: -.01em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; flex: none; display: block; }
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand b { display: block; font-size: 16px; line-height: 1.1; }
.brand span { font-size: 12px; color: var(--ink2); }
.nav-group { font-size: 12px; color: var(--ink3); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink2); font-weight: 500; min-height: 38px; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--panel2); color: var(--ink); }
.nav a.on { background: var(--ink); color: var(--panel); }
.nav a .count { margin-left: auto; font-size: 12px; background: var(--panel2); color: var(--ink); border-radius: 99px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.nav a.on .count { background: var(--yellow); color: var(--yellow-ink); }
.nav a .count.red { background: var(--red-bg); color: var(--red); }
.side-foot { margin-top: auto; padding: 16px 10px 0; font-size: 12px; color: var(--ink3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--sat)) clamp(14px, 3vw, 32px) 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .brand { display: none; padding: 0; }
.search { flex: 1; max-width: 440px; position: relative; }
.search input { width: 100%; height: 40px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 0 12px 0 36px; font-size: 15px; }
.search svg { position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; color: var(--ink3); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; z-index: 30; }
.search-results a { display: flex; gap: 10px; justify-content: space-between; padding: 10px 12px; text-decoration: none; border-bottom: 1px solid var(--line); }
.search-results a:last-child { border: 0; }
.search-results a:hover, .search-results a.hl { background: var(--panel2); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 650; cursor: pointer; font-size: 14px; }
.view { padding: clamp(16px, 3vw, 32px); padding-bottom: calc(96px + var(--sab)); max-width: 1320px; width: 100%; }
.crumbs { font-size: 13px; color: var(--ink2); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.tabbar { display: none; }

/* ---------- page head ---------- */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 18px; }
.head .t { flex: 1 1 260px; }
.head .sub { color: var(--ink2); margin-top: 4px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; font-size: 14px; }
.btn:hover { border-color: var(--ink3); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--yellow); color: var(--yellow-ink); border-color: #e0ca00; }
.btn.primary:hover { filter: brightness(.97); }
.btn.dark { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.stack-v { display: grid; gap: 16px; }

.kpi { padding: 14px 16px; }
.kpi .l { font-size: 13px; color: var(--ink2); }
.kpi .v { font-size: clamp(22px, 2.6vw, 28px); font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .d { font-size: 12.5px; color: var(--ink2); margin-top: 4px; }
a.kpi { text-decoration: none; display: block; }
a.kpi:hover { border-color: var(--ink3); }
.kpi.alert .v { color: var(--red); }
.kpi.warn .v { color: var(--amber); }
.kpi.good .v { color: var(--green); }

/* ---------- badges ---------- */
.b { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; background: var(--grey-bg); color: var(--ink2); line-height: 1.5; }
.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.dark { background: var(--ink); color: var(--panel); }
.b.yellow { background: var(--yellow); color: #111; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters .grow { flex: 1 1 220px; }
.input, select.input, textarea.input { height: 40px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 0 10px; font-size: 15px; width: 100%; }
textarea.input { height: auto; min-height: 84px; padding: 10px; resize: vertical; }
select.input { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.filters .input { width: auto; }
.filters .grow .input, .filters .input.grow { width: 100%; }
.seg { display: inline-flex; background: var(--panel2); border-radius: 9px; padding: 3px; gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg button { flex: none; border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 13.5px; color: var(--ink2); cursor: pointer; white-space: nowrap; min-height: 34px; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.seg button .c { font-size: 12px; color: var(--ink3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.clear { font-size: 13px; }

/* ---------- table ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink2); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); white-space: nowrap; position: sticky; top: 0; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel2); }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
td .sub { font-size: 12.5px; color: var(--ink2); }
th.num, td.num { text-align: right; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink2); flex-wrap: wrap; }
.pager .pg { display: flex; gap: 6px; align-items: center; }
.empty { padding: 40px 16px; text-align: center; color: var(--ink2); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel2), var(--grey-bg), var(--panel2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- details ---------- */
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.dl dt { color: var(--ink2); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dl dd.missing { color: var(--amber); font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; font-size: 13.5px; }
.timeline li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink3); margin-top: 6px; }
.timeline .when { color: var(--ink3); font-size: 12px; }

/* ---------- bars ---------- */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar { height: 10px; background: var(--panel2); border-radius: 99px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--ink); }
.bar i.y { background: #c9b400; }
.bar i.r { background: var(--red); }
.bar i.g { background: var(--green); }
.bar i.a { background: var(--amber); }
.bar i.b { background: var(--blue); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.meter { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--green); }
.heat { border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.heat td, .heat th { padding: 0; border: 0; text-align: center; position: static; background: none; }
.heat td.c { width: 34px; height: 30px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.heat th { font-weight: 500; color: var(--ink3); font-size: 11px; padding: 2px; }
.heat td.name { text-align: left; padding-right: 10px; white-space: nowrap; font-size: 13px; }

/* ---------- module grid (dashboard) ---------- */
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mod { display: flex; flex-direction: column; gap: 10px; padding: 14px; text-decoration: none; min-height: 104px; }
.mod:hover { border-color: var(--ink3); }
.mod .ic { width: 34px; height: 34px; border-radius: 8px; background: var(--panel2); display: grid; place-items: center; }
.mod .ic svg { width: 18px; height: 18px; }
.mod b { font-size: 14.5px; }
.mod span { font-size: 12.5px; color: var(--ink2); margin-top: -8px; }
.attention a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.attention a:last-child { border-bottom: 0; }
.attention a:hover { background: var(--panel2); }

/* ---------- ticket list cards ---------- */
.tk-list { display: grid; gap: 8px; }
.tk { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; text-decoration: none; }
.tk:hover { border-color: var(--ink3); }
.tk .top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tk .reg { font-weight: 650; font-size: 15px; }
.tk .rep { grid-column: 1 / -1; color: var(--ink2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk .meta { grid-column: 1 / -1; display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink3); }
.timer { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 13px; }

/* ---------- forms / modal ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12.5px; color: var(--ink2); }
.field .err { font-size: 12.5px; color: var(--red); }
.field.bad .input { border-color: var(--red); }
.form { display: grid; gap: 14px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; gap: 8px; align-items: center; min-height: 36px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.dim { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
.modal.wide { width: min(820px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-b { padding: 18px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.x { width: 36px; height: 36px; border: 0; background: var(--panel2); border-radius: 8px; cursor: pointer; display: grid; place-items: center; flex: none; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--sab)); z-index: 80; display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); }
.toast { background: #111; color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); display: flex; gap: 10px; align-items: center; animation: fade .15s; }
.toast.err { background: var(--red); }
.menu { position: absolute; right: 0; top: 46px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); width: 260px; padding: 8px; z-index: 40; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu button, .menu a { display: flex; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 14px; gap: 8px; align-items: center; }
.menu button:hover, .menu a:hover { background: var(--panel2); }
.menu .lbl { font-size: 12px; color: var(--ink3); padding: 8px 10px 2px; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--amber-bg); color: var(--amber); font-size: 14px; }
.notice.blue { background: var(--blue-bg); color: var(--blue); }
.notice.red { background: var(--red-bg); color: var(--red); }
.notice.green { background: var(--green-bg); color: var(--green); }
.install { display: none; }
.install.show { display: inline-flex; }
.wi { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; }
.wi + .wi { margin-top: 10px; }
.wi-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.line-list { display: grid; gap: 6px; }
.line-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel2); border-radius: 8px; font-size: 13.5px; }
.progress { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green); }
.sidetabs { display: grid; gap: 2px; align-content: start; }
.sidetabs button { text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--ink2); min-height: 40px; }
.sidetabs button.on { background: var(--ink); color: var(--panel); }
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.improve li { margin-bottom: 8px; }
.improve { padding-left: 18px; margin: 8px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 5px 11px; font-size: 13px; cursor: pointer; font-weight: 500; min-height: 32px; }
.chip.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.toggle { position: relative; width: 44px; height: 26px; flex: none; }
.toggle input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 1; }
.toggle span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .15s; }
.toggle span::after { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::after { transform: translateX(18px); }
.rate { display: inline-flex; gap: 4px; }
.rate button { border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 4px 9px; cursor: pointer; font-size: 12.5px; font-weight: 600; min-height: 32px; }
.rate button.on.Good { background: var(--green-bg); color: var(--green); border-color: transparent; }
.rate button.on.Okay { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.rate button.on.Poor { background: var(--red-bg); color: var(--red); border-color: transparent; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- tablets ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
/* ---------- phones ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar .brand { display: flex; }
  .topbar .brand > span:not(.brand-mark) { display: none; }
  .search { max-width: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--panel); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + var(--sab)); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; text-decoration: none; color: var(--ink3); padding: 6px 0; border: 0; background: none; cursor: pointer; min-height: 52px; justify-content: center; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .on { color: var(--ink); }
  .tabbar .on svg { background: var(--yellow); color: #111; border-radius: 8px; padding: 2px; width: 30px; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .sidetabs { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .sidetabs button { white-space: nowrap; flex: none; }
}
@media (max-width: 760px) {
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row2, .row3 { grid-template-columns: minmax(0, 1fr); }
  .search .hide-sm, .hide-sm { display: none; }
  .filters > select.input, .filters > .input { flex: 1 1 150px; width: auto !important; max-width: none !important; }
  .filters .grow { flex-basis: 100%; }
  /* tables become cards */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr { display: block; width: 100%; }
  table.stack tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  table.stack td::before { content: attr(data-l); color: var(--ink3); font-size: 12.5px; text-align: left; flex: none; max-width: 45%; }
  table.stack td.lead { display: block; text-align: left; font-size: 15px; padding-bottom: 4px; }
  table.stack td.lead::before { display: none; }
  table.stack td:empty, table.stack td.hide-sm { display: none; }
  table.stack td.num { text-align: right; }
  tr.overdue td:first-child { box-shadow: none; }
  table.stack tr.overdue { box-shadow: inset 3px 0 0 var(--red); }
  .bar-row { grid-template-columns: 90px minmax(0, 1fr) 54px; }
  .modal { border-radius: 14px 14px 0 0; align-self: end; max-height: 92vh; }
  .dim { padding: 0; place-items: end stretch; }
  .modal-f .btn { flex: 1; }
  .head .actions { width: 100%; }
  .head .actions .btn { flex: 1; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .toasts { bottom: calc(76px + var(--sab)); }
}
@media (max-width: 380px) { .g4 { grid-template-columns: minmax(0, 1fr); } }
@media print { .side, .topbar, .tabbar { display: none !important; } .app { display: block; } }

/* ---------- theme picker ---------- */
.theme-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 560px; }
.theme-pick button { border: 2px solid var(--line); background: var(--panel); border-radius: 12px; padding: 10px; cursor: pointer; text-align: left; font-weight: 600; display: grid; gap: 8px; }
.theme-pick button.on { border-color: var(--ink); }
.theme-pick .sw { height: 64px; border-radius: 8px; border: 1px solid var(--line); display: grid; grid-template-columns: 30% 1fr; overflow: hidden; }
.theme-pick .sw.l { background: #f4f4f1; } .theme-pick .sw.l i { background: #fff; border-right: 1px solid #d8d8d4; }
.theme-pick .sw.d { background: #141413; } .theme-pick .sw.d i { background: #1d1d1c; border-right: 1px solid #34342f; }
.theme-pick .sw.s { background: linear-gradient(135deg, #f4f4f1 50%, #141413 50%); }
.theme-pick .sw b { display: block; margin: 12px 10px; height: 8px; width: 50%; border-radius: 4px; background: #ffe600; }
@media (max-width: 480px) { .theme-pick { grid-template-columns: minmax(0, 1fr); } .theme-pick .sw { height: 44px; } }
