/* Waymark: calm teal with a safety amber accent. Deliberately separate from any other brand. */
:root {
  --bg1: #e8f5f2; --bg2: #e4edf8; --surface: #ffffff; --surface-2: #f2f8f7; --ink: #0b2b2e; --muted: #4a6466; --line: #d3e2e0;
  --brand: #0e7c7b; --brand-ink: #ffffff; --brand-soft: #d6efed; --accent: #f5a300; --accent-ink: #241700;
  --ok: #157a3d; --ok-bg: #dcf3e4; --warn: #a85a00; --warn-bg: #fdecc8; --bad: #b42323; --bad-bg: #fbdcdc; --info: #1d5fa8; --info-bg: #dbeafe;
  --sev-critical: #b42323; --sev-high: #c2570c; --sev-medium: #1d5fa8; --sev-low: #5b7476;
  --focus: #0e7c7b; --radius: 16px; --nav-h: 72px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg1: #061213; --bg2: #0a1721; --surface: #10201f; --surface-2: #162928; --ink: #e7f2f1; --muted: #9fb7b6; --line: #25423f;
    --brand: #3cc3bd; --brand-ink: #032322; --brand-soft: #123a39; --accent: #ffb62e; --accent-ink: #241700;
    --ok: #62d68c; --ok-bg: #0f3320; --warn: #ffb74d; --warn-bg: #3a2a08; --bad: #ff8f86; --bad-bg: #3d1414; --info: #82baf7; --info-bg: #10294a;
    --sev-critical: #ff8f86; --sev-high: #ffa14d; --sev-medium: #82baf7; --sev-low: #9fb7b6;
    --focus: #3cc3bd;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); min-height: 100vh;
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg1);
  background-image: radial-gradient(900px 500px at 8% -10%, var(--brand-soft), transparent 60%), radial-gradient(800px 500px at 100% 0%, var(--bg2), transparent 55%);
  background-attachment: fixed;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 0.85rem; } .tiny { font-size: 0.75rem; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
#app { min-height: 100vh; }
.side { display: none; }
.main { padding: 0 16px calc(var(--nav-h) + 40px); max-width: 960px; margin: 0 auto; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 0 10px; }
.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--ink); }
.top .org { color: var(--muted); font-size: 0.85rem; }
.top .grow { flex: 1; min-width: 0; }
.logo { width: 34px; height: 34px; flex: none; }
.tabs {
  position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); height: var(--nav-h); z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; padding: 6px; border-radius: 26px;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: 18px;
  text-decoration: none; color: var(--muted); font-size: 0.72rem; font-weight: 600; background: none; border: 0;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current='page'] { color: var(--brand); background: var(--brand-soft); }
.tab.walk { color: var(--accent-ink); background: var(--accent); margin: 0 4px; box-shadow: 0 6px 16px rgba(245, 163, 0, 0.4); }
.tab.walk[aria-current='page'] { color: var(--accent-ink); background: var(--accent); }
@media (min-width: 960px) {
  .tabs { display: none; }
  #app { display: grid; grid-template-columns: 260px 1fr; }
  .side {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 16px; height: calc(100vh - 32px); margin: 16px 0 16px 16px; padding: 16px 12px;
  }
  .side .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; padding: 6px 10px 14px; text-decoration: none; color: var(--ink); }
  .side a.nav {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; text-decoration: none; color: var(--ink); font-weight: 600; min-height: 44px;
  }
  .side a.nav svg { width: 22px; height: 22px; color: var(--muted); }
  .side a.nav[aria-current='page'] { background: var(--brand-soft); color: var(--brand); }
  .side a.nav[aria-current='page'] svg { color: var(--brand); }
  .side a.nav.walk { background: var(--accent); color: var(--accent-ink); margin: 6px 0; }
  .side a.nav.walk svg { color: var(--accent-ink); }
  .side .foot { margin-top: auto; padding: 10px; font-size: 0.85rem; color: var(--muted); }
  .main { padding: 0 32px 60px; width: 100%; }
  .top .brand { display: none; }
}
.page { display: flex; flex-direction: column; gap: 16px; padding-top: 6px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr; } .grid2.stack-sm { grid-template-columns: 1fr; } }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(8, 40, 44, 0.04); }
.card.pad { padding: 16px; }
.card h3 { margin-bottom: 8px; }
a.card, button.card { text-align: left; text-decoration: none; color: inherit; display: block; width: 100%; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 650; text-decoration: none; color: var(--ink);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.sm { min-height: 38px; padding: 0 12px; border-radius: 12px; font-size: 0.9rem; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 1.05rem; border-radius: 18px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 650; font-size: 0.9rem; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); outline-offset: 0;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); outline: 2px solid var(--focus); outline-offset: 1px; }
.input.invalid { border-color: var(--bad); }
.help { color: var(--muted); font-size: 0.85rem; }
.err { color: var(--bad); font-size: 0.88rem; font-weight: 600; }
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 3px; }
.seg::before {
  content: ''; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n, 2)); border-radius: 11px; background: var(--surface);
  box-shadow: 0 1px 4px rgba(8, 40, 44, 0.18); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform var(--t-med) var(--ease);
}
.seg button { position: relative; z-index: 1; min-height: 40px; border: 0; background: none; font-weight: 650; border-radius: 11px; color: var(--muted); padding: 0 8px; }
.seg button[aria-pressed='true'] { color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; }
.chip[aria-pressed='true'] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip.sev-critical[aria-pressed='true'] { background: var(--sev-critical); color: #fff; border-color: var(--sev-critical); }
.chip.sev-high[aria-pressed='true'] { background: var(--sev-high); color: #fff; border-color: var(--sev-high); }
.chip.sev-medium[aria-pressed='true'] { background: var(--sev-medium); color: #fff; border-color: var(--sev-medium); }
.chip.sev-low[aria-pressed='true'] { background: var(--sev-low); color: #fff; border-color: var(--sev-low); }
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  position: relative; display: flex; gap: 12px; align-items: center; padding: 14px 14px 14px 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: inherit; width: 100%; text-align: left; overflow: hidden;
}
.item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line); }
.item.sev-critical::before, .item.bad::before { background: var(--sev-critical); }
.item.sev-high::before, .item.warn::before { background: var(--sev-high); }
.item.sev-medium::before, .item.info::before { background: var(--sev-medium); }
.item.sev-low::before { background: var(--sev-low); }
.item.ok::before { background: var(--ok); }
.item .title { font-weight: 650; overflow-wrap: anywhere; }
.item .sub { color: var(--muted); font-size: 0.85rem; }
.item .end { margin-left: auto; text-align: right; flex: none; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: var(--brand); margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 4px 0; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px; }
.kpi .n { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.kpi .l { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.kpi.bad .n { color: var(--bad); } .kpi.warn .n { color: var(--warn); } .kpi.ok .n { color: var(--ok); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width 420ms var(--ease); }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--sev-high); } .bar.bad > i { background: var(--bad); }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .v { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; }
.ring .v small { display: block; font-size: 0.65rem; font-weight: 600; color: var(--muted); text-align: center; margin-top: -4px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.photos img, .photos .thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: block; }
.thumb { position: relative; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.6); color: #fff; }
.ai-box { background: linear-gradient(135deg, var(--brand-soft), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.ai-tag { display: inline-flex; gap: 6px; align-items: center; font-size: 0.75rem; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: 0.06em; }
.ai-tag svg { width: 14px; height: 14px; }
.timeline { display: flex; flex-direction: column; gap: 10px; border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; }
.timeline .ev { position: relative; font-size: 0.9rem; }
.timeline .ev::before { content: ''; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.banner { padding: 12px 14px; border-radius: 14px; background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 0.92rem; }
.banner.info { background: var(--info-bg); color: var(--info); }
.fab-wrap { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 28px); z-index: 15; }
@media (min-width: 960px) { .fab-wrap { bottom: 28px; right: 32px; } }
.fab { display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 22px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: 0 10px 24px rgba(245, 163, 0, 0.45); }
.fab svg { width: 24px; height: 24px; }
.actions-big { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .actions-big { grid-template-columns: 1fr; } }
.tile { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: inherit; text-align: left; width: 100%; }
.tile .ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.tile .ic svg { width: 26px; height: 26px; }
.tile.hot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tile.hot .ic { background: rgba(255, 255, 255, 0.5); color: var(--accent-ink); }
.tile .t { font-weight: 750; } .tile .s { font-size: 0.85rem; opacity: 0.8; }

/* ---------- sheets, toasts ---------- */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(4, 20, 22, 0.45); display: flex; align-items: flex-end; justify-content: center; animation: fade var(--t-med) var(--ease); }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; border-radius: 28px 28px 0 0; animation: slideup var(--t-sheet) var(--ease); margin: 0; }
.sheet.wide { max-width: 760px; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 8px; }
.sheet-head h2 { flex: 1; }
.sheet-body { padding: 8px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 10px 18px calc(14px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 28px; animation: pop var(--t-sheet) var(--ease); } }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 28px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 960px) { .toasts { bottom: 28px; } }
.toast { pointer-events: auto; max-width: 92vw; padding: 12px 18px; border-radius: 999px; font-weight: 650; display: flex; gap: 10px; align-items: center; animation: toastin var(--t-sheet) var(--ease); }
.toast.bad { color: var(--bad); } .toast.ok svg { color: var(--ok); width: 20px; height: 20px; }
.icon { width: 22px; height: 22px; flex: none; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .panel { width: 100%; max-width: 440px; padding: 28px 24px; display: flex; flex-direction: column; gap: 16px; }
.auth .panel .logo { width: 56px; height: 56px; }
.code-input { text-align: center; font-size: 1.6rem; letter-spacing: 0.4em; font-variant-numeric: tabular-nums; }

/* ---------- audit runner ---------- */
.sec-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; width: 100%; border: 0; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); text-align: left; }
.sec-head .t { font-weight: 750; flex: 1; }
.q { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.q .qt { font-weight: 600; overflow-wrap: anywhere; }
.ans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ans button { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.ans button[aria-pressed='true'][data-r='pass'] { background: var(--ok); border-color: var(--ok); color: #fff; }
.ans button[aria-pressed='true'][data-r='partial'] { background: var(--sev-high); border-color: var(--sev-high); color: #fff; }
.ans button[aria-pressed='true'][data-r='fail'] { background: var(--bad); border-color: var(--bad); color: #fff; }
.ans button[aria-pressed='true'][data-r='na'] { background: var(--muted); border-color: var(--muted); color: #fff; }
.q.fail { border-color: var(--bad); } .q.partial { border-color: var(--sev-high); }
.sticky-bar { position: sticky; bottom: calc(var(--nav-h) + 24px); z-index: 10; padding: 10px; display: flex; gap: 10px; align-items: center; border-radius: 22px; }
@media (min-width: 960px) { .sticky-bar { bottom: 16px; } }
.report-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.sigbox { border: 1px dashed var(--line); border-radius: 14px; padding: 14px; min-height: 64px; }

/* ---------- tour ---------- */
.tour-mask { position: fixed; inset: 0; z-index: 70; }
.tour-hole { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(4, 20, 22, 0.62); transition: top var(--t-sheet) var(--ease), left var(--t-sheet) var(--ease), width var(--t-sheet) var(--ease), height var(--t-sheet) var(--ease); pointer-events: none; }
.tour-card { position: fixed; z-index: 71; width: min(340px, calc(100vw - 32px)); padding: 18px; animation: pop var(--t-sheet) var(--ease); display: flex; flex-direction: column; gap: 10px; }
.dots { display: flex; gap: 6px; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); } .dots i.on { background: var(--brand); width: 22px; border-radius: 6px; }

/* ---------- onboarding ---------- */
.wiz { max-width: 640px; margin: 0 auto; padding: 24px 16px 60px; display: flex; flex-direction: column; gap: 18px; }
.opt { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); width: 100%; text-align: left; }
.opt[aria-pressed='true'] { border-color: var(--brand); background: var(--brand-soft); }
.opt .ic { width: 44px; height: 44px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.opt .ic svg { width: 24px; height: 24px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); flex: none; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 12px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }

/* ---------- print ---------- */
.only-print { display: none; }
@media print {
  body { background: #fff !important; color: #000; }
  .tabs, .side, .top, .fab-wrap, .no-print, .toasts, .sticky-bar { display: none !important; }
  .only-print { display: block; }
  .main { padding: 0; max-width: none; }
  .card, .item { box-shadow: none; break-inside: avoid; }
  .glass { backdrop-filter: none; background: #fff; }
  #app { display: block; }
  .qr-sheet { break-after: page; }
}
.qr-sheet { text-align: center; padding: 24px; }
.qr-sheet svg { width: 260px; height: 260px; }

/* ---------- additions ---------- */
.photo-full { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; background: var(--surface-2); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.qr-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-align: center; background: #fff; color: #111; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qr-card img { image-rendering: pixelated; }
.qr-site { font-size: .8rem; color: #555; }
.qr-area { font-weight: 700; font-size: 1.05rem; }
.qr-cta { font-size: .8rem; color: #555; }
.chip.static { cursor: default; }
.dim { opacity: .6; }
.danger-zone { border: 1px solid var(--bad); border-radius: 14px; padding: 14px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex: none; }
.chat-in { position: sticky; bottom: calc(var(--tabbar-h, 72px) + 8px); display: flex; gap: 8px; padding: 8px; border-radius: 18px; }
.chat-in .input { flex: 1; }
@media print {
  body.printing-qr #app, body.printing-qr .toasts { display: none !important; }
  body.printing-qr .backdrop { position: static; background: none; display: block; }
  body.printing-qr .sheet { position: static; box-shadow: none; border: 0; max-height: none; width: auto; transform: none; background: #fff; }
  body.printing-qr .sheet-head, body.printing-qr .sheet-foot { display: none; }
  body.printing-qr .qr-grid { grid-template-columns: repeat(2, 1fr); }
  body.printing-qr .qr-card { break-inside: avoid; border: 1px solid #999; }
}
.app-boot { display: grid; place-items: center; min-height: 100vh; }
.boot-spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.doc-page { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; } .doc-page ul { padding-left: 20px; } .doc-page li { margin: 6px 0; }
#view:focus, #view:focus-visible { outline: none; }

/* ======== Field-tool restyle: paper, contour lines, tighter corners, strong type ======== */
:root {
  --bg1: #f1eee6; --surface: #fffefb; --surface-2: #e9e5da; --ink: #11262b; --muted: #55676a; --line: #cfc9b9;
  --radius: 10px; --brand-soft: #d8ebe6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { --bg1: #0a1618; --surface: #112326; --surface-2: #19302f; --line: #2a4846; }
}
body {
  background-color: var(--bg1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320' viewBox='0 0 320 320'%3E%3Cg fill='none' stroke='%230e7c7b' stroke-opacity='.09' stroke-width='1.2'%3E%3Cpath d='M-20 60c60-40 110 30 180-10s120-40 180 0'/%3E%3Cpath d='M-20 100c60-40 110 30 180-10s120-40 180 0'/%3E%3Cpath d='M-20 150c70-50 120 40 190-5s110-30 170 10'/%3E%3Cpath d='M-20 210c60-30 130 40 190 0s110-20 170 15'/%3E%3Cpath d='M-20 270c70-40 110 30 180-5s120-30 180 5'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
}
h1 { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
h3 { font-weight: 750; }
.card, .item, .tile, .opt { border-radius: var(--radius); border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 rgba(17, 38, 43, 0.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .card, :root:not([data-theme='light']) .item, :root:not([data-theme='light']) .tile { border-color: var(--line); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5); } }
.card.empty, .card .card, .card .item, .list .item { box-shadow: none; }
.list .item { border-width: 1.5px; border-left-width: 6px; border-left-color: var(--line); }
.item.bad { border-left-color: var(--bad); } .item.warn { border-left-color: var(--accent); } .item.ok { border-left-color: var(--ok); } .item.info { border-left-color: var(--info); }
.item.sev-critical { border-left-color: var(--sev-critical); } .item.sev-high { border-left-color: var(--sev-high); } .item.sev-medium { border-left-color: var(--sev-medium); } .item.sev-low { border-left-color: var(--sev-low); }
.btn { border-radius: 9px; font-weight: 750; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: var(--brand); border-color: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); } }
.chip, .badge { border-radius: 6px; }
.chip { font-weight: 700; }
.input, .select, .textarea { border-radius: 8px; border-width: 1.5px; background: var(--surface); }
.seg, .seg::before, .seg button { border-radius: 8px; }
.tile.hot { background: var(--accent); border-color: var(--ink); }
.tile .ic { border-radius: 8px; }
.kpi .n { font-weight: 850; letter-spacing: -0.03em; }
.ref, .sub code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ======== Liquid glass that actually has something to refract ======== */
.top {
  position: sticky; top: 8px; z-index: 15; margin: 8px -4px 4px; padding: 8px 10px; border-radius: 16px;
  background: var(--solid-surface); border: 1px solid var(--glass-border); box-shadow: var(--glass-hl), var(--glass-shadow);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .top { background: var(--glass-bg); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)); backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)); }
}
@media (prefers-reduced-transparency: reduce) { .top { background: var(--solid-surface); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (min-width: 960px) { .top { margin-left: 0; margin-right: 0; } }
.tabs { border-radius: 22px; }
.tab { border-radius: 16px; }
.tab[aria-current='page'] { background: rgba(14, 124, 123, 0.16); }
.sheet { border-radius: 20px 20px 0 0; }

/* ======== Micro interactions, a little more noticeable ======== */
@keyframes bounce { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes ringdraw { from { stroke-dasharray: 0 301.6; } }
@keyframes stripein { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.tab[aria-current='page'] svg { animation: bounce 320ms var(--ease); }
.ring circle:nth-child(2) { animation: ringdraw 900ms var(--ease) both; }
.list > .item { animation: stripein 280ms var(--ease) both; }
.list > .item:nth-child(2) { animation-delay: 40ms; } .list > .item:nth-child(3) { animation-delay: 80ms; } .list > .item:nth-child(4) { animation-delay: 120ms; } .list > .item:nth-child(5) { animation-delay: 160ms; } .list > .item:nth-child(n+6) { animation-delay: 200ms; }
input[type='checkbox'] { accent-color: var(--brand); }
input[type='checkbox']:checked { animation: bounce 220ms var(--ease); }
.chip[aria-pressed='true'] { animation: bounce 200ms var(--ease); }
.tile:active, .item:active, .btn:active { transform: translate(2px, 2px) scale(0.985); box-shadow: 1px 1px 0 rgba(17, 38, 43, 0.9); }
@media (hover: hover) { .tile:hover, .card.press:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(17, 38, 43, 0.9); } }
@media (prefers-reduced-motion: reduce) { .tab[aria-current='page'] svg, .ans button, .sticky-bar .btn, .ring circle, .list > .item, input[type='checkbox']:checked, .chip[aria-pressed='true'] { animation: none; } }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.card.kpi, a.kpi { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }

.ans button { transition: transform var(--t-fast) var(--ease), background var(--t-med) var(--ease), color var(--t-med) var(--ease); }
.ans button[aria-pressed='true'] { animation: bounce 260ms var(--ease); }
.card.q.fail { animation: shake 320ms var(--ease); }
@keyframes glowonce { 0% { box-shadow: 0 0 0 0 rgba(245, 163, 0, 0.7); } 100% { box-shadow: 0 0 0 14px rgba(245, 163, 0, 0); } }
.sticky-bar .btn.primary:not([disabled]) { animation: glowonce 700ms var(--ease) 1; }
.btn svg, .item > svg:last-child { transition: transform var(--t-med) var(--ease); }
@media (hover: hover) { .btn:hover svg { transform: translateX(2px); } .item:hover > svg:last-child { transform: translateX(4px); } }
.badge { animation: bounce 260ms var(--ease) both; }
.toast { animation: toastin 280ms var(--ease) both; }
.kpi .n { display: inline-block; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .ans button, .card.q.fail, .sticky-bar .btn, .badge { animation: none; } }
#app > :not(.side):not(.main):not(.tabs) { grid-column: 1 / -1; }

/* ======== Sign-in: liquid background, glass panel, floating labels ======== */
.auth { position: relative; overflow: hidden; isolation: isolate; --mx: 0; --my: 0; }
.blobs { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(160deg, #0b3c3f 0%, #0e5f60 45%, #12383f 100%); }
.blobs i { position: absolute; border-radius: 50%; filter: blur(48px); opacity: 0.85; will-change: transform; transition: transform 700ms var(--ease); }
.blobs .b1 { width: 52vmax; height: 52vmax; left: -14vmax; top: -16vmax; background: radial-gradient(circle at 35% 35%, #35d0c4, #0e7c7b 60%, transparent 72%); animation: drift1 22s ease-in-out infinite alternate; transform: translate(calc(var(--mx) * 30px), calc(var(--my) * 30px)); }
.blobs .b2 { width: 44vmax; height: 44vmax; right: -12vmax; bottom: -14vmax; background: radial-gradient(circle at 60% 40%, #ffc23d, #f5a300 55%, transparent 72%); opacity: 0.7; animation: drift2 26s ease-in-out infinite alternate; transform: translate(calc(var(--mx) * -40px), calc(var(--my) * -40px)); }
.blobs .b3 { width: 34vmax; height: 34vmax; right: 12vmax; top: -6vmax; background: radial-gradient(circle at 50% 50%, #5aa9ff, #2a6fd0 55%, transparent 72%); opacity: 0.55; animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { margin: 8vmax 0 0 10vmax; scale: 1.15; } }
@keyframes drift2 { to { margin: 0 12vmax 10vmax 0; scale: 1.2; } }
@keyframes drift3 { to { margin: 14vmax 0 0 -10vmax; scale: 0.85; } }
.auth .panel {
  position: relative; border-radius: 28px; padding: 32px 26px; max-width: 440px; width: 100%;
  background: rgba(255, 255, 255, 0.78); border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 30px 80px rgba(3, 30, 33, 0.45);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .auth .panel { background: rgba(255, 255, 255, 0.58); -webkit-backdrop-filter: blur(26px) saturate(170%); backdrop-filter: blur(26px) saturate(170%); }
}
@media (prefers-reduced-transparency: reduce) { .auth .panel { background: #fffefb; -webkit-backdrop-filter: none; backdrop-filter: none; } }
.auth .panel > * { animation: rise 520ms var(--ease) both; }
.auth .panel > *:nth-child(2) { animation-delay: 60ms; } .auth .panel > *:nth-child(3) { animation-delay: 120ms; } .auth .panel > *:nth-child(4) { animation-delay: 180ms; } .auth .panel > *:nth-child(5) { animation-delay: 240ms; }
.auth .logo { filter: drop-shadow(0 8px 14px rgba(14, 124, 123, 0.4)); animation: logoin 700ms var(--ease) both; }
@keyframes logoin { from { opacity: 0; transform: scale(0.6) rotate(-12deg); } to { opacity: 1; transform: none; } }
.auth h1 { font-size: 2rem; }
.auth .seg { background: rgba(255, 255, 255, 0.5); border-color: rgba(14, 60, 63, 0.18); }
.auth .seg::before { background: #fff; box-shadow: 0 2px 8px rgba(8, 40, 44, 0.22); }
.float { position: relative; }
.float .input { padding: 22px 14px 8px; min-height: 56px; border-radius: 14px; background: rgba(255, 255, 255, 0.85); border: 1.5px solid rgba(14, 60, 63, 0.22); transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), background var(--t-med) var(--ease); }
.float label { position: absolute; left: 15px; top: 17px; color: var(--muted); font-weight: 600; pointer-events: none; transform-origin: left top; transition: transform var(--t-med) var(--ease), color var(--t-med) var(--ease); }
.float .input:focus + label, .float .input:not(:placeholder-shown) + label { transform: translateY(-11px) scale(0.76); color: var(--brand); }
.float .input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(14, 124, 123, 0.18); outline: none; }
.auth .code-input { letter-spacing: 0.4em; font-weight: 800; font-size: 1.3rem; text-align: left; }
.auth .btn.big { position: relative; overflow: hidden; min-height: 54px; border-radius: 16px; background: linear-gradient(135deg, #0e7c7b, #0b5d62); color: #fff; border: 0; box-shadow: 0 10px 24px rgba(14, 124, 123, 0.4); }
.auth .btn.big::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%); transform: translateX(-120%); }
@media (hover: hover) { .auth .btn.big:hover::after { transform: translateX(120%); transition: transform 700ms var(--ease); } .auth .btn.big:hover { background: linear-gradient(135deg, #12908f, #0e6d72); } }
.ripple { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); animation: ripple 650ms var(--ease) forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(40); opacity: 0; } }
.auth .help { text-align: center; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .auth .panel { background: rgba(10, 28, 30, 0.6); border-color: rgba(255, 255, 255, 0.14); color: var(--ink); } :root:not([data-theme='light']) .float .input { background: rgba(255, 255, 255, 0.06); } :root:not([data-theme='light']) .float .input:focus { background: rgba(255, 255, 255, 0.1); } :root:not([data-theme='light']) .auth .seg::before { background: var(--surface-2); } }
@media (prefers-reduced-motion: reduce) { .blobs i, .auth .panel > *, .auth .logo { animation: none; transition: none; } }
.auth .panel .muted, .auth .help { color: #2f4548; } @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth .panel .muted, :root:not([data-theme="light"]) .auth .help { color: var(--muted); } }
