/* GIScopeTracker — shared styles (landing + app + print) */

:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaef;
  --ink: #0e1621;
  --ink-2: #4a5566;
  --ink-3: #7c8697;
  --line: #e2e6eb;
  --line-2: #cbd2db;
  --accent: #1c5cab;
  --accent-hover: #184f95;
  --accent-ink: #ffffff;
  --accent-soft: #e5eefa;
  --accent-text: #1c5cab;
  --good: #0ca30c;  --good-ink: #006300;  --good-soft: #e3f4e3;
  --warn: #fab219;  --warn-ink: #7a4f00;  --warn-soft: #fff3d6;
  --bad: #d03b3b;   --bad-ink: #a12424;   --bad-soft: #fbe8e8;
  --focus: 0 0 0 3px rgba(42, 120, 214, .35);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(14, 22, 33, .05), 0 1px 3px rgba(14, 22, 33, .07);
  --shadow-lg: 0 12px 32px rgba(14, 22, 33, .16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Data colours: categorical (procedure identity) and ordinal (independence) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --seq-1: #86b6ef; --seq-2: #5598e7; --seq-3: #2a78d6; --seq-4: #184f95;
  --chart-grid: #e6e8ec; --chart-axis: #c3c2b7; --chart-muted: #7c8697;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1114; --surface: #181b20; --surface-2: #20242a; --surface-3: #2a2f36;
    --ink: #f2f4f7; --ink-2: #c1c7d0; --ink-3: #8b94a3;
    --line: #2a2f36; --line-2: #3a414b;
    --accent: #3987e5; --accent-hover: #5598e7; --accent-ink: #ffffff; --accent-soft: #1b2a3f; --accent-text: #86b6ef;
    --good-ink: #4fd14f; --good-soft: #15301a; --warn-ink: #fcc75a; --warn-soft: #3a2f12; --bad-ink: #f08a8a; --bad-soft: #3d1c1c;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #86b6ef;
    --chart-grid: #2a2f36; --chart-axis: #3a414b; --chart-muted: #8b94a3;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1114; --surface: #181b20; --surface-2: #20242a; --surface-3: #2a2f36;
  --ink: #f2f4f7; --ink-2: #c1c7d0; --ink-3: #8b94a3;
  --line: #2a2f36; --line-2: #3a414b;
  --accent: #3987e5; --accent-hover: #5598e7; --accent-ink: #ffffff; --accent-soft: #1b2a3f; --accent-text: #86b6ef;
  --good-ink: #4fd14f; --good-soft: #15301a; --warn-ink: #fcc75a; --warn-soft: #3a2f12; --bad-ink: #f08a8a; --bad-soft: #3d1c1c;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #86b6ef;
  --chart-grid: #2a2f36; --chart-axis: #3a414b; --chart-muted: #8b94a3;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .8em; }
small, .small { font-size: .85rem; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 600 .92rem/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--bad-ink); border-color: var(--line-2); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger-solid:hover { background: #b52f2f; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: .85rem; }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: .9rem; }
.field .hint { font-size: .82rem; color: var(--ink-3); }
.field .req { color: var(--bad-ink); margin-left: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 8px; min-height: 40px; padding: 0 11px; width: 100%;
}
select { padding-right: 30px; 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='%237c8697' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[type=number] { font-variant-numeric: tabular-nums; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-fields .field { margin-bottom: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92rem; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-error { color: var(--bad-ink); background: var(--bad-soft); border-radius: 8px; padding: 10px 12px; font-size: .9rem; margin-bottom: 14px; }
.form-ok { color: var(--good-ink); background: var(--good-soft); border-radius: 8px; padding: 10px 12px; font-size: .9rem; margin-bottom: 14px; }

/* Segmented pills (single choice) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  font: 500 .9rem/1.2 var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 14px; min-height: 38px; cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
}
.seg button:hover { border-color: var(--accent); }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg.invalid button { border-color: var(--bad); }
.seg-sm button { padding: 5px 11px; min-height: 32px; font-size: .85rem; }

/* Chips (multi / tri-state) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 .86rem/1.2 var(--font); color: var(--ink-2); background: var(--surface-2);
  border: 1px solid transparent; border-radius: 999px; padding: 7px 12px; min-height: 34px; cursor: pointer;
}
.chip:hover { border-color: var(--line-2); }
.chip[aria-pressed="true"], .chip.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.chip.strength { background: var(--good-soft); color: var(--good-ink); border-color: var(--good); }
.chip.improve { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn); }
.chip .mark { font-weight: 800; width: 1em; text-align: center; }

/* ---------- Cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
:not(.grid) > .card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-sub { color: var(--ink-3); font-size: .85rem; margin-top: 2px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }
.section { margin-bottom: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

/* Stat tiles */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--ink-2); font-size: .85rem; }
.stat .value { font-size: 1.9rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.stat .sub { color: var(--ink-3); font-size: .82rem; }
.stat-link { color: inherit; display: block; }
.stat-link:hover { text-decoration: none; border-color: var(--accent); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.bad { background: var(--bad-soft); color: var(--bad-ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 650; white-space: nowrap; }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 650; border-bottom: 0; }

/* Alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-size: .92rem; margin-bottom: 16px; }
.alert.warn { background: var(--warn-soft); }
.alert.bad { background: var(--bad-soft); }
.alert.good { background: var(--good-soft); }
.alert .icon { margin-top: 2px; }
.alert p:last-child { margin-bottom: 0; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty h3 { color: var(--ink); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.05rem; color: var(--ink); padding: 4px 8px 18px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px;
  color: var(--ink-2); font-weight: 550; font-size: .93rem;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav .nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 16px 10px 6px; font-weight: 650; }
.sidebar .spacer { flex: 1; }
.userbox { border-top: 1px solid var(--line); padding: 12px 8px 0; font-size: .85rem; color: var(--ink-2); }
.userbox .who { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 26px 32px 60px; max-width: 1240px; width: 100%; }
.demo-banner { background: var(--warn-soft); color: var(--warn-ink); font-size: .85rem; padding: 8px 14px; text-align: center; font-weight: 550; }
.demo-banner a { color: inherit; text-decoration: underline; }

.topbar, .bottomnav { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  }
  .topbar .brand { padding: 0; font-size: 1rem; }
  .main { padding: 18px 16px 96px; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a, .bottomnav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px;
    font: 600 .7rem/1 var(--font); color: var(--ink-3); background: none; border: 0; cursor: pointer;
  }
  .bottomnav a.active { color: var(--accent-text); }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav .add span.plus { background: var(--accent); color: var(--accent-ink); border-radius: 12px; width: 44px; height: 30px; display: flex; align-items: center; justify-content: center; }
  .bottomnav svg.icon { width: 22px; height: 22px; }
  h1 { font-size: 1.35rem; }
}

/* Mobile "More" sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 16px 16px 0 0; padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.sheet .nav a { padding: 13px 12px; font-size: 1rem; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 2px auto 10px; }

/* ---------- Toasts & dialogs ---------- */
.toasts { position: fixed; z-index: 60; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
@media (max-width: 860px) { .toasts { left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); max-width: none; } }
.toast { background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: .9rem; display: flex; gap: 9px; align-items: flex-start; animation: toast-in .18s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: #16651b; color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(0,0,0,.4); }
.modal-body { padding: 20px 20px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { justify-content: center; padding-bottom: 8px; font-size: 1.2rem; }
.auth-card .tagline { text-align: center; color: var(--ink-2); margin-bottom: 20px; font-size: .92rem; }
.auth-foot { text-align: center; font-size: .88rem; color: var(--ink-2); margin-top: 14px; }
.auth-foot a { font-weight: 600; }
.privacy-note { font-size: .8rem; color: var(--ink-3); text-align: center; margin-top: 16px; }

/* ---------- Entry form ---------- */
.entry-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; }
@media (max-width: 720px) { .entry-grid { grid-template-columns: minmax(0, 1fr); } }
.entry-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.entry-section h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; }
.def-text { font-size: .82rem; color: var(--ink-2); min-height: 1.2em; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 2px; margin-top: 8px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; z-index: 5; }
@media (max-width: 860px) {
  .sticky-actions { bottom: calc(58px + env(safe-area-inset-bottom)); flex-wrap: nowrap; gap: 6px; margin-left: -4px; margin-right: -4px; padding: 10px 4px 8px; }
  .sticky-actions .btn-lg { min-height: 44px; padding: 0 12px; font-size: .92rem; }
  .sticky-actions .btn-ghost { display: none; }
  .sticky-actions .btn-danger .btn-text { display: none; }
}
.legend-tri { font-size: .8rem; color: var(--ink-3); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Log list ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field > label { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.cell-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ind-dot { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 720px) {
  table.table.responsive thead { display: none; }
  table.table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 8px 10px; background: var(--surface); }
  .table.responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); color: var(--ink-3); font-size: .8rem; font-weight: 600; text-align: left; }
  .table.responsive td.r { text-align: right; }
  .table.responsive td.cell-select::before, .table.responsive td.cell-actions::before { content: ""; }
  .table.responsive td .cell-tags { justify-content: flex-end; max-width: 72%; }
  .table.responsive td.cell-actions { display: none; }
}

/* ---------- Charts ---------- */
.chart-box { position: relative; width: 100%; height: 300px; }
.chart-box.tall { height: 360px; }
.chart-box.short { height: 220px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--ink-2); margin: 4px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; width: 16px; }
.legend i.dash { height: 0; border-top: 2px dashed var(--ink-3); width: 16px; border-radius: 0; background: none !important; }
.view-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.view-toggle button { border: 0; background: var(--surface); color: var(--ink-2); font: 600 .8rem/1 var(--font); padding: 7px 10px; cursor: pointer; }
.view-toggle button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }

/* CI "forest" bar in QI table */
.ci-cell { min-width: 160px; }
.ci-track { position: relative; height: 18px; }
.ci-track .axis { position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--surface-3); border-radius: 2px; }
.ci-track .range { position: absolute; top: 6px; height: 6px; border-radius: 3px; background: var(--seq-2); opacity: .55; }
.ci-track .pt { position: absolute; top: 3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--seq-4); box-shadow: 0 0 0 2px var(--surface); }
.ci-track .target { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--ink-2); }

/* Mini bars (report / tables) */
.bar-stack { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--surface-2); gap: 2px; min-width: 80px; }
.bar-stack span { display: block; height: 100%; }

/* Learning curve status list */
.lc-list { display: grid; gap: 8px; }
.lc-row { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; flex-wrap: wrap; }
.lc-row > div { min-width: 0; }
.lc-row .name { font-weight: 600; }

/* Import */
.dropzone { border: 2px dashed var(--line-2); border-radius: 12px; padding: 30px 16px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone.drag, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.err-list { max-height: 320px; overflow: auto; font-size: .86rem; }
.progress { height: 8px; background: var(--surface-3); border-radius: 8px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* DOPS */
.dops-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dops-item .lbl { flex: 1 1 240px; font-size: .92rem; }
.dops-domain { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 650; margin: 18px 0 2px; }
.scale-key { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: .84rem; color: var(--ink-2); }
.scale-key b { color: var(--ink); }

/* ---------- Report (scorecard) ---------- */
.report { background: #fff; color: #111; max-width: 8.5in; margin: 0 auto; padding: .45in .5in; border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 10.5pt; line-height: 1.35; color-scheme: light; }
.report h1 { font-size: 16pt; margin: 0; color: #111; }
.report h2 { font-size: 10.5pt; text-transform: uppercase; letter-spacing: .06em; margin: 12px 0 5px; color: #1c5cab; border-bottom: 1.5px solid #1c5cab; padding-bottom: 2px; }
.report .r-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 6px; }
.report .r-meta { text-align: right; font-size: 9pt; color: #444; }
.report table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.report th, .report td { padding: 3px 5px; border-bottom: 1px solid #ddd; text-align: left; }
.report th { font-size: 7.8pt; text-transform: uppercase; letter-spacing: .03em; color: #555; }
.report td.r, .report th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report .r-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.report .r-foot { margin-top: 12px; padding-top: 6px; border-top: 1px solid #999; font-size: 8pt; color: #555; display: flex; justify-content: space-between; }
.report .ok { color: #006300; font-weight: 600; }
.report .no { color: #a12424; font-weight: 600; }
.report .na { color: #777; }
.report .bar-stack { height: 9px; background: #eee; }
.report .note { font-size: 8pt; color: #555; }

@media (max-width: 860px) {
  .report-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
  .report { min-width: 640px; }
}

/* ---------- Landing page ---------- */
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; max-width: 1160px; margin: 0 auto; }
.site-header nav { display: flex; gap: 8px; align-items: center; }
.hero { max-width: 1160px; margin: 0 auto; padding: 48px 24px 32px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); letter-spacing: -.03em; line-height: 1.08; margin-bottom: 16px; }
.hero .lead { font-size: 1.12rem; color: var(--ink-2); max-width: 36em; margin-bottom: 24px; }
.hero-visual { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 18px; }
.hero-visual svg { width: 100%; height: auto; display: block; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 24px; } }
.features { max-width: 1160px; margin: 0 auto; padding: 24px 24px 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .features { grid-template-columns: 1fr; } }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.feature .ficon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--ink-2); font-size: .93rem; margin: 0; }
.band { max-width: 1160px; margin: 24px auto; padding: 28px 24px; }
.privacy-band { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 860px) { .privacy-band { grid-template-columns: 1fr; } }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ticks li { display: flex; gap: 10px; align-items: flex-start; }
.ticks li svg { color: var(--good-ink); margin-top: 3px; }
.ticks li.no svg { color: var(--bad-ink); }
.site-footer { max-width: 1160px; margin: 0 auto; padding: 28px 24px 40px; color: var(--ink-3); font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--line); }
.prose { max-width: 760px; margin: 0 auto; padding: 24px; }
.prose h2 { margin-top: 1.6em; }
.prose li { margin-bottom: .4em; }


/* ---------- v0.3: reflection, guides, admin ---------- */
.step-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.card > .step-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; flex: none; }
.theme-bars { display: grid; gap: 7px; }
.theme-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(40px, 1fr) auto; gap: 8px; align-items: center; font-size: .86rem; }
.theme-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.theme-fill { display: block; height: 100%; background: var(--seq-3); border-radius: 4px; }
.conf-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.conf-cell { background: var(--surface-2); border-radius: 8px; padding: 8px 4px; text-align: center; }
.conf-val { font-weight: 650; font-size: 1.05rem; }
textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 11px; width: 100%; resize: vertical; line-height: 1.45; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.mono, textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.admin-tabs { flex-wrap: wrap; }
.admin-tabs button { padding: 9px 14px; font-size: .88rem; }
.admin-text { border-top: 1px solid var(--line); padding-top: 12px; }
.guide-card { color: inherit; display: block; transition: border-color .12s; }
.guide-card:hover { border-color: var(--accent); text-decoration: none; }
.md { line-height: 1.6; }
.md h2 { font-size: 1.15rem; margin: 1.4em 0 .5em; }
.md h2:first-child, .md .md-callout:first-child + h2 { margin-top: .4em; }
.md h3 { font-size: 1rem; margin: 1.2em 0 .4em; }
.md ul, .md ol { padding-left: 1.3em; margin: 0 0 .9em; }
.md li { margin-bottom: .3em; }
.md table.md-table { margin: 4px 0 14px; }
.md .table td, .md .table th { vertical-align: top; }
.md-callout { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 14px; margin: 0 0 14px; font-size: .93rem; }
sup.cite { font-size: .72em; color: var(--accent-text); font-weight: 600; margin-left: 1px; }
.guide-refs { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 12px; font-size: .85rem; color: var(--ink-2); }
.guide-refs h2 { font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.guide-preview { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
@media print { .guide .page-head .btn-row, .guide .alert { display: none !important; } .guide .card { border: 0; box-shadow: none; padding: 0; } }

/* ---------- Print ---------- */
@media print {
  @page { size: letter portrait; margin: 0.4in; }
  body { background: #fff; }
  .sidebar, .topbar, .bottomnav, .no-print, .toasts, .demo-banner { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .report { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 8.5pt; line-height: 1.25; }
  .report h1 { font-size: 14pt; }
  .report h2 { font-size: 9pt; margin: 8px 0 3px; }
  .report table { font-size: 8pt; }
  .report th, .report td { padding: 1.5px 4px; }
  .report th { font-size: 6.8pt; }
  .report .note { font-size: 7pt; }
  .report .r-foot { margin-top: 8px; }
  .report h2 { break-after: avoid; }
  .report-scroll { margin: 0; padding: 0; overflow: visible; }
  .report { min-width: 0; }
  .report table, .report .r-block { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
