/* Field Sales Assistant: mobile-first, light + dark, WCAG AA colours, system fonts only.
   No inline styles anywhere (strict CSP): every look comes from a class here. */

:root {
  color-scheme: light dark;
  --brand: #0b3d5c;
  --brand-ink: #ffffff;
  --accent: #1f8a70;
  --accent-strong: #176e5a;
  --on-accent: #ffffff;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --border: #d3dbe2;
  --text: #13202b;
  --muted: #4b5b69;
  --link: #0b5c8c;
  --focus: #2b7fff;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --warn: #8a5300;
  --warn-bg: #fff4e0;
  --ok: #176e5a;
  --ok-bg: #e3f4ee;
  --info: #0b5c8c;
  --info-bg: #e5f1fa;
  --rec: #c62828;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 10%);
  --radius: 12px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1620;
    --surface: #15212c;
    --surface-2: #1c2a37;
    --border: #2e3e4d;
    --text: #e6edf3;
    --muted: #a6b4c1;
    --link: #8cc8ff;
    --accent-strong: #5cc8a8;
    --on-accent: #08241c;
    --focus: #8cc8ff;
    --danger: #ff8a80;
    --danger-bg: #3a1714;
    --warn: #ffc56b;
    --warn-bg: #36270b;
    --ok: #6fd3b3;
    --ok-bg: #0f2f26;
    --info: #8cc8ff;
    --info-bg: #10283c;
    --rec: #c62828;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; }
p { margin: 0 0 8px; }
code { font-family: var(--mono); }
img { max-width: 100%; }
mark { background: #ffe58a; color: #1a1300; border-radius: 3px; padding: 0 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 2000;
  background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: calc(8px + var(--safe-top)); }

/* ---- shell ------------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 900;
  display: flex; align-items: center; gap: 8px;
  min-height: calc(52px + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  background: var(--brand); color: var(--brand-ink);
}
.topbar-title { flex: 1; margin: 0; font-size: 1.05rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-back {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-left: -8px;
  border: 0; border-radius: 10px; background: transparent; color: inherit; cursor: pointer;
}
.topbar-back:hover { background: rgb(255 255 255 / 12%); }
.topbar-status { display: flex; gap: 6px; align-items: center; }
.badge {
  display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px;
  border-radius: 999px; font-size: 0.8rem; font-weight: 650; text-decoration: none;
}
.badge-outbox { background: #fff4e0; color: #5c3a00; }
.badge-offline { background: #fdecea; color: #7a1a12; }

.pill-slot { position: sticky; top: calc(52px + var(--safe-top)); z-index: 850; }
.tracking-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 12px; background: var(--accent-strong); color: var(--on-accent);
  font-weight: 650; font-size: 0.9rem; line-height: 1.25; box-shadow: var(--shadow);
}
.tracking-pill-paused { background: var(--warn-bg); color: var(--warn); }
.pill-text { flex: 1 1 auto; min-width: 0; }
.pill-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.pill-btn {
  flex: none; min-height: 44px; min-width: 60px; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 2px solid currentColor; background: transparent; color: inherit; font: inherit; font-weight: 700;
}
.pill-btn:disabled { opacity: 0.6; }
.pill-problem { margin: 0; padding: 6px 12px; background: var(--warn-bg); color: var(--text); font-size: 0.85rem; box-shadow: var(--shadow); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.view {
  max-width: 760px; margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 32px);
  outline: none;
}
.boot-msg { padding: 32px 16px; text-align: center; color: var(--muted); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar-h); min-width: 44px; color: var(--muted); text-decoration: none;
  font-size: 0.75rem; font-weight: 600;
}
.tab[aria-current="page"] { color: var(--brand); }
.tab-icon { display: inline-grid; place-items: center; }
.tab-primary .tab-icon {
  width: 56px; height: 56px; margin-top: -22px; border-radius: 50%;
  background: var(--accent-strong); color: var(--on-accent); box-shadow: 0 4px 12px rgb(0 0 0 / 22%);
  border: 4px solid var(--surface);
}
.tab-primary[aria-current="page"] { color: var(--accent-strong); }

@media (prefers-color-scheme: dark) {
  .tab[aria-current="page"] { color: #8cc8ff; }
  .tab-primary[aria-current="page"] { color: var(--accent-strong); }
}

/* ---- icons ------------------------------------------------------------------------------- */
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-dots { stroke-width: 3.2; }
.icon-flip .icon { transform: scaleX(-1); }

/* ---- page structure ---------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-title { margin: 0; font-size: 1.45rem; font-weight: 700; overflow-wrap: anywhere; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.page-actions { display: flex; gap: 8px; flex: none; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 0 0 12px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 10px; font-size: 1.05rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
fieldset.card { min-width: 0; }

.stack { display: grid; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.actions-center { justify-content: center; }
.actions-sticky {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); z-index: 5;
  background: var(--bg); padding: 8px 0; margin: 12px 0 0;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.center { text-align: center; }
.block { display: block; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.eyebrow { margin: 0 0 2px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.next-name { display: block; font-size: 1.15rem; font-weight: 700; text-decoration: none; color: var(--text); margin-bottom: 2px; }
.picked { margin: 8px 0; }
.empty { padding: 24px 8px; text-align: center; color: var(--muted); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 16px 0; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 3px solid var(--surface-2); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- notices ----------------------------------------------------------------------------- */
.notice { border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; border: 1px solid transparent; }
.notice p:last-child { margin-bottom: 0; }
.notice-info { background: var(--info-bg); color: var(--text); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.notice-warn { background: var(--warn-bg); color: var(--text); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.notice-error { background: var(--danger-bg); color: var(--text); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.notice-ok { background: var(--ok-bg); color: var(--text); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.form-error { color: var(--danger); font-weight: 600; min-height: 0; margin: 4px 0; }
.form-error:empty { display: none; }

/* ---- buttons ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 16px; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 650; text-decoration: none; line-height: 1.2;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent-strong); border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent-strong) 88%, #000); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--link); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.btn-sm { min-height: 44px; padding: 6px 12px; font-size: 0.9rem; }
.btn-lg { min-height: 56px; font-size: 1.1rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }

.seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 0 0 10px; background: var(--surface); }
.seg button {
  flex: 1; min-height: 44px; border: 0; background: transparent; color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; padding: 6px 8px;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #ffffff; }

/* ---- forms ------------------------------------------------------------------------------- */
.field { display: grid; gap: 4px; margin: 0 0 12px; min-width: 0; }
.field-label { font-weight: 600; font-size: 0.92rem; }
.field-hint { color: var(--muted); font-size: 0.82rem; }
.field-required .field-label::after { content: " (required)"; color: var(--danger); font-weight: 500; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
textarea { resize: vertical; line-height: 1.4; }
input[readonly], textarea[readonly] { background: var(--surface-2); }
input[type="checkbox"], input[type="radio"] {
  width: 24px; height: 24px; min-height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--accent-strong);
}
.check-row, .radio-row {
  display: flex; gap: 12px; align-items: flex-start; min-height: 44px; padding: 10px 0; cursor: pointer;
}
.check-label { font-weight: 600; }
.radio-list { display: grid; gap: 2px; margin-bottom: 8px; }
.radio-row { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.radio-row:has(input:checked) { border-color: var(--accent-strong); background: var(--ok-bg); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.inline-form .field { flex: 1; margin: 0; }
.filters { display: grid; gap: 8px; margin-bottom: 12px; }
.filter-more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--link); font-weight: 600; }
details summary { cursor: pointer; }
details.typed-note summary { font-weight: 650; min-height: 32px; }
details[open].typed-note summary { margin-bottom: 12px; }

/* ---- lists ------------------------------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.card .list > li { padding-left: 0; padding-right: 0; }
.list-link {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 4px;
  color: inherit; text-decoration: none;
}
.list-link:hover .list-title { text-decoration: underline; }
.list-nav .list-link { min-height: 64px; }
.list-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--brand); flex: none; }
@media (prefers-color-scheme: dark) { .list-icon { color: #8cc8ff; } }
.list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.list-title { font-weight: 650; overflow-wrap: anywhere; }
.list-sub { color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.list-empty { padding: 10px 4px; color: var(--muted); font-size: 0.9rem; }
.list-btn {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 48px; padding: 8px 4px;
  border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.list-btn:hover .list-title { text-decoration: underline; }
.list-link-inline { font-weight: 650; }
.contact-row, .queue-row, .consent-row, .customer-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0;
}
.customer-row .list-link { flex: 1; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.address-row, .user-row { padding: 10px 0; }
.address-row .actions, .user-row .actions { margin: 8px 0 0; }
.picker { position: relative; margin-bottom: 8px; }
.picker-results { margin-top: 4px; }
.plain { margin: 0; padding-left: 18px; }
.snippet { display: block; margin-top: 4px; font-size: 0.92rem; color: var(--text); overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }

.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.9rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---- chips ------------------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; min-height: 24px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 650; background: var(--surface-2); color: var(--text); white-space: nowrap;
}
.chip-planned { background: var(--surface-2); color: var(--text); }
.chip-checked_in, .chip-open { background: var(--info-bg); color: var(--info); }
.chip-done { background: var(--ok-bg); color: var(--ok); }
.chip-skipped, .chip-closed { background: var(--surface-2); color: var(--muted); }
.chip-prio-high { background: var(--danger-bg); color: var(--danger); }
.chip-prio-medium, .chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-prio-low { background: var(--surface-2); color: var(--muted); }
.chip-note-drafted { background: var(--warn-bg); color: var(--warn); }
.chip-note-posted { background: var(--ok-bg); color: var(--ok); }
.chip-note-failed { background: var(--danger-bg); color: var(--danger); }
.chip-note-queued, .chip-note-transcribing, .chip-note-transcribed, .chip-note-drafting { background: var(--info-bg); color: var(--info); }
.chip-role-admin { background: var(--danger-bg); color: var(--danger); }
.chip-role-manager { background: var(--info-bg); color: var(--info); }

/* ---- today / visits ---------------------------------------------------------------------- */
.date-nav { display: flex; align-items: center; gap: 2px; }
.day-links a { white-space: nowrap; }
.visit-list { list-style: none; margin: 0 0 12px; padding: 0; }
.visit-row {
  display: grid; grid-template-columns: 28px 30px 1fr auto; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 6px 8px 4px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.visit-row.dragging { opacity: 0.85; outline: 2px dashed var(--accent); }
.visit-done .visit-main, .visit-skipped .visit-main { opacity: 0.72; }
.grip { display: grid; place-items: center; height: 44px; color: var(--muted); cursor: grab; touch-action: none; }
.visit-num {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #ffffff; font-weight: 700; font-size: 0.85rem;
}
.visit-checked_in .visit-num { background: var(--accent-strong); color: var(--on-accent); }
.visit-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; color: inherit; text-decoration: none; padding: 4px 0; }
.visit-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.visit-move { display: flex; flex-direction: column; }
.apply-bar {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); z-index: 20;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-radius: var(--radius); background: var(--surface);
  border: 2px solid var(--accent-strong); box-shadow: 0 6px 18px rgb(0 0 0 / 18%);
}
.apply-bar > span { flex: 1; font-weight: 650; }
.plan-list { margin: 0 0 8px; padding-left: 22px; }
.plan-list li { padding: 6px 0; }
.plan-list .list-title, .plan-list .list-sub { display: block; }

/* ---- maps -------------------------------------------------------------------------------- */
.map-wrap { margin: 0 0 12px; }
.map {
  position: relative; height: 320px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 8px;
}
.map-canvas { position: absolute; inset: 0; }
.map-attrib {
  position: absolute; right: 0; bottom: 0; z-index: 1000; padding: 2px 6px;
  background: rgb(255 255 255 / 88%); color: #1d2733; font-size: 11px; line-height: 1.4; border-top-left-radius: 6px;
}
.map-attrib a { color: #0b4f7a; }
.map-fallback { padding: 16px; color: var(--muted); }
.num-pin {
  display: grid !important; place-items: center; border-radius: 50%;
  background: var(--brand); color: #ffffff; font: 700 13px/1 var(--font);
  border: 2px solid #ffffff; box-shadow: 0 1px 4px rgb(0 0 0 / 40%);
}
.num-pin-done { background: #66737f; }
.num-pin-here { background: #176e5a; }
.drag-pin span {
  display: block; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: #c62828; border: 3px solid #ffffff; box-shadow: 0 2px 6px rgb(0 0 0 / 45%);
}
.popup { display: grid; gap: 4px; font: 14px/1.35 var(--font); color: #13202b; }
.leaflet-container { font-family: var(--font); }

/* ---- record ------------------------------------------------------------------------------ */
.record-hint {
  padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); font-weight: 600;
}
.recorder { display: grid; justify-items: center; gap: 10px; padding: 16px 0 8px; }
.rec-btn {
  display: grid; place-items: center; align-content: center; gap: 4px;
  width: 168px; height: 168px; border-radius: 50%; cursor: pointer;
  border: 6px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-strong); color: var(--on-accent); font: inherit; font-weight: 700;
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
}
.rec-btn .rec-icon { width: 56px; height: 56px; }
.rec-btn.recording {
  background: var(--rec); color: #ffffff; border-color: color-mix(in srgb, var(--rec) 40%, transparent);
  animation: recpulse 1.4s ease-in-out infinite;
}
.rec-btn:disabled { opacity: 0.7; }
.rec-label { font-size: 0.95rem; }
@keyframes recpulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(198 40 40 / 45%); } 50% { box-shadow: 0 0 0 16px rgb(198 40 40 / 0%); } }
.rec-timer { font: 700 1.6rem/1 var(--mono); margin: 0; font-variant-numeric: tabular-nums; }
.rec-timer-warn { color: var(--danger); }
.meter { width: min(320px, 100%); height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left center; transition: transform 80ms linear; }
.rec-status { min-height: 1.4em; text-align: center; font-weight: 600; }

/* ---- draft review ------------------------------------------------------------------------ */
.stepper { list-style: none; display: flex; gap: 4px; margin: 0 0 12px; padding: 0; counter-reset: step; }
.stepper li {
  flex: 1; position: relative; padding-top: 30px; text-align: center; font-size: 0.78rem; color: var(--muted); counter-increment: step;
}
.stepper li::before {
  content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); font-weight: 700;
}
.stepper li.done { color: var(--ok); }
.stepper li.done::before { content: "✓"; background: var(--ok-bg); color: var(--ok); }
.stepper li.current { color: var(--text); font-weight: 700; }
.stepper li.current::before { background: var(--accent-strong); color: var(--on-accent); }
.diff-row { border-top: 1px solid var(--border); padding: 6px 0; }
.diff-row.diff-off .diff { opacity: 0.55; }
.diff { padding-left: 36px; }
.diff-current { margin: 0 0 6px; }
.diff del { color: var(--danger); text-decoration-thickness: 2px; overflow-wrap: anywhere; }
.result { display: grid; justify-items: center; gap: 8px; padding: 12px 0; text-align: center; }
.result-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); }
.result-icon .icon { width: 36px; height: 36px; stroke-width: 3; }
.result-big { font-size: 1.25rem; font-weight: 700; margin: 0; }

/* ---- consent ----------------------------------------------------------------------------- */
.consent-card legend { padding: 0 6px; margin-left: -6px; font-weight: 700; font-size: 1.05rem; }
.consent-body { white-space: pre-line; overflow-wrap: anywhere; }
.consent-rule { font-weight: 650; }

/* ---- team -------------------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 0 12px; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { display: grid; gap: 2px; padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.stat-value { font-size: 1.5rem; font-weight: 750; color: var(--brand); }
.stat-label { color: var(--muted); font-size: 0.82rem; }
@media (prefers-color-scheme: dark) { .stat-value { color: #8cc8ff; } }
.progress { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 6px 0; }
.progress-seg { flex: 1 1 0; min-width: 4px; }
.seg-done { background: #2e9e7c; }
.seg-checked_in { background: #2b7fff; }
.seg-planned { background: #9aa7b3; }
.seg-skipped { background: #d6dde3; }
.trail-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.trail-list li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.trail-time { font-weight: 650; font-variant-numeric: tabular-nums; }
.trail-gap { color: var(--warn); font-weight: 600; font-size: 0.88rem; }

/* ---- admin ------------------------------------------------------------------------------- */
.secret {
  display: block; padding: 10px 12px; margin: 8px 0; border-radius: 8px; font-size: 1.15rem;
  background: var(--surface); border: 1px dashed var(--border); user-select: all; overflow-wrap: anywhere;
}
.audit-row { display: grid; gap: 2px; padding: 8px 0; }
.audit-detail { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }

/* ---- sign in ----------------------------------------------------------------------------- */
.signin { max-width: 420px; margin: 24px auto 0; display: grid; justify-items: center; gap: 8px; }
.signin-logo { border-radius: 18px; }
.signin-title { margin: 4px 0 8px; }
.signin-card { width: 100%; }

/* ---- toasts ------------------------------------------------------------------------------ */
.toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1500;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  display: grid; gap: 8px; width: min(480px, calc(100% - 24px));
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: 12px;
  background: #1f2b36; color: #ffffff; box-shadow: 0 8px 24px rgb(0 0 0 / 28%); font-weight: 550;
}
.toast-ok { background: #145c4b; }
.toast-error { background: #8f1d14; }
.toast-msg { flex: 1; }
.toast-action { color: #ffffff; font-weight: 750; white-space: nowrap; }
.toast-close {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer;
}
.toast-close .icon { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (min-width: 900px) {
  .view { padding-top: 24px; }
}
