/* ============================================================================
   Bedrock Flowdown — design system
   Layout and component vocabulary follow the Roundhouse (RailCompliant) SOG
   shell: sidebar + topbar + content, cards, signal-aspect status pills, dense
   tables. Colour is the Bedrock CMMC v2 palette: neutral shadcn surfaces,
   brand teal primary (logo #1f9da0 → oklch(0.44 0.07 196) for text/fills), a
   soft orange accent for hover/active-nav (logo #ee8028), Geist-style sans.
   System fonts only (strict CSP; no remote fonts, no CDN assets).
   ============================================================================ */

:root {
  color-scheme: light;
  /* ---- Neutrals (v2: --background/--card/--muted/--border) ---- */
  --paper:      oklch(0.985 0 0);
  --surface:    oklch(1 0 0);
  --surface-2:  oklch(0.97 0 0);
  --ink:        oklch(0.145 0 0);
  --ink-soft:   oklch(0.36 0 0);
  --ink-faint:  oklch(0.556 0 0);
  --line:       oklch(0.922 0 0);
  --line-soft:  oklch(0.95 0 0);

  /* ---- Brand teal (v2 --primary / --ring / charts) ---- */
  --teal:       oklch(0.44 0.07 196);
  --teal-700:   oklch(0.38 0.07 196);
  --teal-50:    oklch(0.95 0.025 196);
  --teal-ring:  oklch(0.7 0.06 196);
  --brand-teal: #1f9da0;
  --brand-orange: #ee8028;

  /* ---- Accent (v2 --accent: soft orange tint for hover + active nav) ---- */
  --accent:     oklch(0.955 0.03 65);
  --accent-ink: oklch(0.25 0.03 50);

  /* ---- Sidebar (v2 --sidebar: light, not a dark slab) ---- */
  --sidebar:     oklch(0.985 0 0);
  --sidebar-ink: oklch(0.145 0 0);
  --sidebar-soft: oklch(0.45 0 0);
  --sidebar-line: oklch(0.922 0 0);

  /* ---- Signal aspects — status language (kept from the shell) ---- */
  --ok:    #1c7a46; --ok-bg:  #e3f0e7;
  --due:   #a66300; --due-bg: #fbeed4;
  --over:  #b02a22; --over-bg:#f8e2e0;
  --info:  var(--teal); --info-bg: var(--teal-50);

  --radius:     10px;
  --radius-sm:  7px;
  --radius-pill:999px;
  --shadow-sm:  0 1px 2px rgba(16,24,32,.05), 0 1px 3px rgba(16,24,32,.06);
  --shadow:     0 1px 3px rgba(16,24,32,.06), 0 8px 20px -10px rgba(16,24,32,.2);
  --shadow-lg:  0 24px 60px -20px rgba(15,25,30,.4);
  --ring:       0 0 0 3px color-mix(in oklch, var(--teal-ring) 45%, transparent);

  --sans: "Geist", "Geist Variable", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --tracking-caps: .08em;
}

[data-theme=dark] {
  color-scheme: dark;
  --paper:      oklch(0.145 0 0);
  --surface:    oklch(0.205 0 0);
  --surface-2:  oklch(0.245 0 0);
  --ink:        oklch(0.985 0 0);
  --ink-soft:   oklch(0.8 0 0);
  --ink-faint:  oklch(0.708 0 0);
  --line:       oklch(1 0 0 / 10%);
  --line-soft:  oklch(1 0 0 / 7%);

  --teal:       oklch(0.77 0.09 192);
  --teal-700:   oklch(0.84 0.09 192);
  --teal-50:    oklch(0.27 0.035 196);
  --teal-ring:  oklch(0.55 0.07 196);

  --accent:     oklch(0.3 0.035 55);
  --accent-ink: oklch(0.985 0.008 70);

  --sidebar:     oklch(0.205 0 0);
  --sidebar-ink: oklch(0.985 0 0);
  --sidebar-soft: oklch(0.72 0 0);
  --sidebar-line: oklch(1 0 0 / 10%);

  --ok:   #62c48d; --ok-bg:  #14261c;
  --due:  #dfa353; --due-bg: #2b2210;
  --over: #e88379; --over-bg:#2e1917;

  --shadow-sm:  0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.35);
  --shadow:     0 1px 3px rgba(0,0,0,.4), 0 8px 20px -10px rgba(0,0,0,.6);
  --shadow-lg:  0 24px 60px -20px rgba(0,0,0,.7);
}
/* Solid teal stays a fill in dark mode (light --teal would wash out white text). */
[data-theme=dark] .btn.primary { background: oklch(0.5 0.08 196); border-color: oklch(0.5 0.08 196); color: #fff; }
[data-theme=dark] .btn.primary:hover { background: oklch(0.56 0.08 196); border-color: oklch(0.56 0.08 196); }
[data-theme=dark] .topbar { background: color-mix(in oklch, var(--paper) 85%, transparent); }
[data-theme=dark] .note { background: #251d0e; border-color: #4d3d1c; color: #d9b877; }
[data-theme=dark] .note.ok { background: var(--ok-bg); border-color: #2a4a37; color: var(--ok); }
[data-theme=dark] .note.over { background: var(--over-bg); border-color: #5a322f; color: var(--over); }
[data-theme=dark] .note.info { background: var(--teal-50); border-color: oklch(0.4 0.05 196); color: var(--teal); }
[data-theme=dark] .auth-brand, [data-theme=dark] .mk-hero, [data-theme=dark] .mk-band { background: oklch(0.12 0.01 200); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: 8px; border: none; background: transparent;
  color: var(--ink-soft); font-size: 1.02rem; cursor: pointer; line-height: 1;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.theme-toggle::before { content: "☾"; }
[data-theme=dark] .theme-toggle::before { content: "☀"; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--paper);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.18; font-weight: 700; letter-spacing: -.011em; color: var(--ink); }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1.02rem; letter-spacing: -.005em; }
p { margin: 0 0 1em; }
small { font-size: .8rem; }
code, .mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 3px; }

/* utilities */
.muted { color: var(--ink-faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.m-0 { margin: 0; }
.mt-s { margin-top: .5rem; } .mt-m { margin-top: 1rem; }
.mb-s { margin-bottom: .5rem; } .mb-m { margin-bottom: 1rem; }
.gap-s { gap: .8rem; }
.w-full { width: 100%; justify-content: center; }
.flex { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.max-720 { max-width: 720px; }
.max-560 { max-width: 560px; }
.sub-cell { display: block; font-size: .74rem; color: var(--ink-faint); margin-top: .1rem; }
.link-box { font-family: var(--mono); font-size: .8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .7rem; word-break: break-all; }

/* ============================================================================
   APP SHELL
   ============================================================================ */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar); color: var(--sidebar-ink);
  padding: 0 0 1.25rem; position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; border-right: 1px solid var(--sidebar-line);
}
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.05rem 1.25rem 1rem; border-bottom: 1px solid var(--sidebar-line); }
.brand .mark { width: 36px; height: 36px; flex: none; display: grid; place-items: center; }
.brand .mark img { width: 36px; height: 36px; object-fit: contain; display: block; }
.brand b { color: var(--sidebar-ink); font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.brand .brand-accent { color: var(--brand-teal); }
.brand small { display: block; color: var(--sidebar-soft); font-size: .64rem; letter-spacing: var(--tracking-caps); text-transform: uppercase; margin-top: 2px; }

.org-switch {
  margin: .9rem 1rem; padding: .6rem .75rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--sidebar-line);
  font-size: .84rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.org-switch b { color: var(--sidebar-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-tag { font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: .1rem .45rem; border-radius: var(--radius-pill); background: var(--line); color: var(--ink-soft); flex: none; }
.plan-tag.pro { background: var(--teal); color: #fff; }

.nav { padding: .35rem .6rem; overflow-y: auto; }
.nav .group { color: var(--sidebar-soft); font-size: .64rem; text-transform: uppercase; letter-spacing: var(--tracking-caps); font-weight: 700; margin: 1.05rem .7rem .4rem; }
.nav a {
  display: flex; align-items: center; gap: .65rem; color: var(--sidebar-ink);
  padding: .5rem .7rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 2px; position: relative;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.nav a.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-orange); }
.nav a .ic { width: 18px; text-align: center; opacity: .75; font-size: .95rem; }
.nav a.active .ic { opacity: 1; color: var(--brand-orange); }
.sidebar .spacer { flex: 1; }
.who { padding: .7rem 1.1rem 0; border-top: 1px solid var(--sidebar-line); margin: .7rem .6rem 0; font-size: .8rem; color: var(--sidebar-soft); text-transform: capitalize; }
.who b { color: var(--sidebar-ink); display: block; margin-bottom: .05rem; text-transform: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-attribution { padding: .55rem 1.1rem .8rem; margin: 0 .6rem; font-size: .68rem; color: var(--sidebar-soft); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: .8rem; padding: .7rem 1.6rem;
  background: color-mix(in oklch, var(--surface) 85%, transparent); backdrop-filter: saturate(1.4) blur(6px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.crumbs { color: var(--ink-faint); font-size: .85rem; }
.crumbs a { color: var(--ink-soft); }
.topbar-spacer { margin-left: auto; }
.content { padding: 1.6rem 1.9rem 3rem; max-width: 1680px; width: 100%; animation: fd-rise .28s ease both; }
@keyframes fd-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.35rem; }
.page-head .titles { flex: 1; min-width: 0; }
.page-head h1 { margin-bottom: .2rem; }
.page-head .sub { color: var(--ink-soft); font-size: .9rem; max-width: 68ch; }
.page-head .actions { display: flex; gap: .55rem; flex: none; flex-wrap: wrap; }

.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .68rem; font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-faint); }
.eyebrow::before { content: ""; width: 14px; height: 2px; background: var(--brand-orange); border-radius: 2px; }

/* ============================================================================
   BUTTONS & INPUTS
   ============================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 600; line-height: 1.1;
  padding: .52rem .95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, box-shadow .12s, transform .04s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-700); border-color: var(--teal-700); }
.btn.orange { background: var(--brand-orange); border-color: var(--brand-orange); color: #fff; }
.btn.orange:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: .34rem .62rem; font-size: .8rem; }
.btn.danger { color: var(--over); border-color: #e6c6c3; }
.btn.danger:hover { background: var(--over-bg); border-color: var(--over); }
form.inline { display: inline; margin: 0; }

label.field { display: block; margin-bottom: 1rem; }
label.field > span { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .32rem; }
label.field .hint { font-weight: 400; color: var(--ink-faint); }
label.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; margin-bottom: 1rem; }
label.check input { width: 17px; height: 17px; accent-color: var(--teal); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; font: inherit; font-size: .9rem; color: var(--ink);
  padding: .5rem .62rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in oklch, var(--line) 60%, var(--ink-faint)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: var(--ring); }
textarea { min-height: 72px; resize: vertical; }
hr.soft { border: none; border-top: 1px solid var(--line-soft); margin: 1.15rem 0; }

/* ============================================================================
   CARDS & GRID
   ============================================================================ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card .card-head { display: flex; align-items: center; gap: .6rem; padding: .85rem 1.15rem; border-bottom: 1px solid var(--line-soft); }
.card .card-head h3 { margin: 0; }
.card .card-head .actions { margin-left: auto; display: flex; gap: .4rem; }
.card .card-body { padding: 1.15rem; }
.card .card-foot { padding: .7rem 1.15rem; border-top: 1px solid var(--line-soft); background: var(--surface-2); font-size: .85rem; color: var(--ink-soft); }
a.card { color: inherit; }
a.card:hover { text-decoration: none; box-shadow: var(--shadow); }
.card + .card { margin-top: 1.15rem; }

.grid { display: grid; gap: 1.15rem; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.sidebar-right { grid-template-columns: 1fr 380px; align-items: start; }
@media (max-width: 980px) { .grid.cols-3, .grid.cols-4, .grid.cols-2, .grid.sidebar-right { grid-template-columns: 1fr; } }
@media (min-width: 1600px) { .app { grid-template-columns: 268px 1fr; } .content { padding: 1.9rem 2.6rem 3.5rem; } .grid { gap: 1.4rem; } }

/* stat tiles */
.stat { padding: 1.05rem 1.15rem; display: block; text-decoration: none; color: inherit; }
.stat .label { color: var(--ink-faint); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.stat .value { font-size: 2rem; font-weight: 700; line-height: 1.05; margin: .3rem 0 .15rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .value.over { color: var(--over); } .stat .value.due { color: var(--due); } .stat .value.ok { color: var(--ok); }
.stat .foot { font-size: .8rem; color: var(--ink-faint); }

/* ============================================================================
   BADGES — signal-aspect pills
   ============================================================================ */
.badge { display: inline-flex; align-items: center; gap: .38rem; font-size: .72rem; font-weight: 650; padding: .16rem .55rem; border-radius: var(--radius-pill); border: 1px solid transparent; white-space: nowrap; line-height: 1.35; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); flex: none; }
.badge.ok   { color: var(--ok);   background: var(--ok-bg);   border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.badge.due  { color: var(--due);  background: var(--due-bg);  border-color: color-mix(in srgb, var(--due) 26%, transparent); }
.badge.over { color: var(--over); background: var(--over-bg); border-color: color-mix(in srgb, var(--over) 24%, transparent); }
.badge.info { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.badge.muted{ color: var(--ink-soft); background: var(--surface-2); border-color: var(--line); }
.badge.lvl  { color: var(--accent-ink); background: var(--accent); border-color: color-mix(in srgb, var(--brand-orange) 30%, transparent); font-family: var(--mono); font-weight: 700; letter-spacing: .01em; }
.badge.sm { font-size: .68rem; padding: .1rem .42rem; }

/* ============================================================================
   TABLES
   ============================================================================ */
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.tbl th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--ink-faint); font-weight: 700; padding: .6rem .85rem; border-bottom: 1px solid var(--line); background: var(--surface-2); }
table.tbl td { padding: .62rem .85rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.actions { text-align: right; white-space: nowrap; }
.scroll { overflow-x: auto; }
.reasons { margin: .15rem 0 0; padding-left: 1rem; font-size: .8rem; color: var(--ink-soft); }
.reasons li { margin: .05rem 0; }

dl.spec { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.3rem; margin: 0; }
dl.spec dt { color: var(--ink-faint); font-size: .82rem; }
dl.spec dd { margin: 0; font-weight: 550; }

/* posture hero on the sub page */
.posture { display: flex; gap: 1.4rem; align-items: flex-start; flex-wrap: wrap; }
.posture .big { display: flex; flex-direction: column; gap: .2rem; min-width: 160px; }
.posture .big .badge { font-size: .85rem; padding: .3rem .8rem; align-self: flex-start; }
.posture .lvls { display: flex; gap: 1.4rem; }
.posture .lvls div { display: flex; flex-direction: column; }
.posture .lvls span { color: var(--ink-faint); font-size: .68rem; text-transform: uppercase; letter-spacing: var(--tracking-caps); font-weight: 700; }
.posture .lvls b { font-size: 1.05rem; }

/* ============================================================================
   MISC
   ============================================================================ */
.note { background: var(--accent); border: 1px solid color-mix(in srgb, var(--brand-orange) 35%, transparent); border-radius: var(--radius-sm); padding: .75rem .95rem; font-size: .85rem; color: var(--accent-ink); }
.note.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 26%, transparent); color: var(--ok); }
.note.over { background: var(--over-bg); border-color: color-mix(in srgb, var(--over) 26%, transparent); color: var(--over); }
.note.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 26%, transparent); color: var(--info); }
.note form { margin: 0; }
.empty { text-align: center; padding: 2.4rem 1.5rem; color: var(--ink-faint); }
.empty h3 { color: var(--ink-soft); }
.empty.sm { padding: 1.4rem 1rem; font-size: .86rem; }
.empty.ok-empty { padding: 2rem 1.5rem; color: var(--ok); font-weight: 600; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; align-items: center; gap: .65rem; padding: .62rem 1.15rem; border-bottom: 1px solid var(--line-soft); font-size: .85rem; }
.activity li:last-child { border-bottom: none; }
.act-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--info); }
.act-main { flex: 1; min-width: 0; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-main b { color: var(--ink); }
.act-when { font-size: .74rem; color: var(--ink-faint); white-space: nowrap; }
.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: .7rem; padding: .68rem 1.15rem; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ok); }
.list-row .dot.over { background: var(--over); } .list-row .dot.due { background: var(--due); } .list-row .dot.muted { background: var(--ink-faint); }
.list-row .main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.list-row .main b { font-size: .92rem; }
.list-row .next { font-size: .76rem; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gauge { --size: 120px; width: var(--size); height: var(--size); border-radius: 50%; background: conic-gradient(var(--ok) calc(var(--pct) * 1%), var(--line-soft) 0); display: grid; place-items: center; position: relative; }
.gauge::after { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); }
.gauge-val { position: relative; z-index: 1; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gauge-val span { font-size: .9rem; font-weight: 600; color: var(--ink-faint); margin-left: 1px; }
.gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; }
.att-block { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; margin-bottom: .9rem; }
.att-block h4 { margin: 0 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--ink-faint); }
.filters { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters a { font-size: .8rem; padding: .3rem .7rem; border-radius: var(--radius-pill); border: 1px solid var(--line); color: var(--ink-soft); background: var(--surface); }
.filters a.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.filters a:hover { text-decoration: none; border-color: var(--teal); }

/* ============================================================================
   AUTH (split) + PUBLIC RESPONSE
   ============================================================================ */
.auth-split { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; color: #eaf0f2;
  background: radial-gradient(900px 520px at 80% -10%, color-mix(in srgb, var(--brand-teal) 35%, transparent), transparent 60%), oklch(0.17 0.012 200);
  border-right: 3px solid var(--brand-orange); display: flex; align-items: center; justify-content: center; padding: 3rem;
}
.auth-brand::before { content: ""; position: absolute; inset: 0; opacity: .5; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 34px 34px; mask-image: radial-gradient(720px 520px at 38% 22%, #000, transparent 75%); }
.auth-brand-inner { position: relative; max-width: 440px; }
.auth-logo { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.6rem; }
.auth-logo img { width: 52px; height: 52px; }
.auth-logo b { font-size: 1.5rem; letter-spacing: -.02em; color: #fff; }
.auth-logo b span { color: var(--brand-teal); }
.auth-tag { font-size: 1.06rem; color: #c3cfd4; line-height: 1.5; margin: 0 0 1.7rem; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.auth-points li { display: flex; align-items: flex-start; gap: .65rem; font-size: .92rem; color: #d3dde1; line-height: 1.4; }
.auth-points .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .32rem; flex: none; }
.auth-points .dot.ok { background: #4ecd8a; } .auth-points .dot.due { background: #e8b93d; } .auth-points .dot.info { background: var(--brand-teal); }
.auth-brand-foot { margin: 2rem 0 0; font-family: var(--mono); font-size: .8rem; letter-spacing: .07em; color: #8a9ba2; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; background: var(--surface); }
.auth-form { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 1.7rem; letter-spacing: -.02em; margin: 0 0 .2rem; }
.auth-form > .muted { margin: 0 0 1.5rem; font-size: .92rem; }
.auth-form .foot { font-size: .88rem; text-align: center; margin-top: 1.2rem; color: var(--ink-faint); }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { padding: 2.4rem 1.5rem 2rem; border-right: none; border-bottom: 3px solid var(--brand-orange); }
  .auth-brand-inner { max-width: 540px; text-align: center; margin: 0 auto; }
  .auth-logo { justify-content: center; margin-bottom: 1rem; }
  .auth-points, .auth-brand-foot { display: none; }
  .auth-panel { padding: 2rem 1.4rem 2.6rem; }
}

.pub { max-width: 820px; margin: 0 auto; padding: 2.2rem 1.4rem 4rem; }
.pub-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.4rem; }
.pub-head img { width: 40px; height: 40px; }
.pub-head b { font-size: 1.1rem; }
.pub-head b span { color: var(--brand-teal); }
.pub-head small { display: block; color: var(--ink-faint); font-size: .74rem; text-transform: uppercase; letter-spacing: var(--tracking-caps); }

/* ============================================================================
   MARKETING LANDING (.mk-)
   ============================================================================ */
.mk { background: var(--surface); color: var(--ink); }
.mk-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.mk-nav { position: sticky; top: 0; z-index: 20; background: color-mix(in oklch, var(--surface) 90%, transparent); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--line-soft); }
.mk-nav .mk-wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.mk-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; font-size: 1.05rem; }
.mk-brand img { width: 32px; height: 32px; }
.mk-brand span { color: var(--brand-teal); }
.mk-nav .links { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.mk-nav .links a:not(.mk-btn) { color: var(--ink-soft); font-size: .92rem; font-weight: 600; }
.mk-nav .links a:not(.mk-btn):hover { color: var(--teal); text-decoration: none; }
.mk-btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: .62rem 1.05rem; font-weight: 700; font-size: .92rem; border: 1px solid transparent; transition: transform .08s, background .12s; }
.mk-btn:hover { text-decoration: none; }
.mk-btn:active { transform: translateY(1px); }
.mk-btn.primary { background: var(--teal); color: #fff; }
.mk-btn.primary:hover { background: var(--teal-700); }
.mk-btn.orange { background: var(--brand-orange); color: #fff; }
.mk-btn.ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.mk-btn.ghost:hover { border-color: var(--teal); color: var(--teal); }
.mk-btn.lg { padding: .8rem 1.4rem; font-size: 1rem; }
.mk-hero { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 80% -10%, color-mix(in srgb, var(--brand-teal) 30%, transparent), transparent 60%), oklch(0.17 0.012 200); color: #eaf0f2; border-bottom: 3px solid var(--brand-orange); }
.mk-hero::before { content: ""; position: absolute; inset: 0; opacity: .5; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 34px 34px; mask-image: radial-gradient(1000px 500px at 70% 0%, #000, transparent 75%); }
.mk-hero .mk-wrap { position: relative; padding: 70px 24px 80px; }
.mk-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: #f2b57a; margin-bottom: 20px; }
.mk-eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--brand-orange); display: inline-block; }
.mk-hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 18px; max-width: 16ch; color: #fff; }
.mk-hero h1 .u { color: var(--brand-teal); }
.mk-hero .lede { font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: #b9c8ce; max-width: 56ch; margin: 0 0 30px; }
.mk-cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.mk-hero .fineprint { margin-top: 16px; font-size: .84rem; color: #8a9ba2; }
.mk-hero .fineprint b { color: #f2b57a; }
.mk-section { padding: 76px 0; }
.mk-section.alt { background: var(--surface-2); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.mk-head { max-width: 62ch; margin: 0 0 40px; }
.mk-head .mk-eyebrow { color: var(--brand-orange); }
.mk-head h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 14px; }
.mk-head p { font-size: 1.06rem; color: var(--ink-soft); margin: 0; }
.mk-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.mk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.mk-card .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal); font-size: 1.2rem; margin-bottom: 14px; }
.mk-card h4 { margin: 0 0 8px; font-size: 1.08rem; }
.mk-card p { margin: 0; color: var(--ink-soft); font-size: .94rem; }
.mk-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.mk-step { padding: 22px 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mk-step::before { counter-increment: step; content: "0" counter(step); font-family: var(--mono); color: var(--brand-orange); font-weight: 800; font-size: .8rem; letter-spacing: .1em; display: block; margin-bottom: 8px; }
.mk-step h4 { margin: 0 0 6px; }
.mk-step p { margin: 0; color: var(--ink-soft); font-size: .94rem; }
.mk-price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; max-width: 880px; }
.mk-price-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.mk-price-card.feature { border-color: var(--brand-orange); position: relative; }
.mk-price-card.feature::before { content: "Coming soon"; position: absolute; top: -12px; left: 28px; background: var(--brand-orange); color: #fff; font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; }
.mk-amount { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 4px; }
.mk-amount .n { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; }
.mk-amount .p { color: var(--ink-faint); font-size: .95rem; }
.mk-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 9px; }
.mk-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.mk-list li::before { content: "✓"; color: var(--ok); font-weight: 800; }
.mk-band { background: oklch(0.17 0.012 200); color: #eaf0f2; text-align: center; padding: 64px 0; border-top: 3px solid var(--brand-orange); }
.mk-band h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 12px; color: #fff; letter-spacing: -.02em; }
.mk-band p { color: #b9c8ce; margin: 0 0 24px; font-size: 1.02rem; }
.mk-foot { background: var(--surface-2); color: var(--ink-faint); padding: 32px 0; font-size: .86rem; border-top: 1px solid var(--line-soft); }
.mk-foot .mk-wrap { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; }
.mk-foot a { color: var(--ink-soft); }
.mk-foot .sp { margin-left: auto; }
.mk-legal { padding: 46px 0 64px; }
.mk-legal .mk-wrap { max-width: 760px; }
.mk-legal h1 { font-size: 2rem; margin-bottom: .3rem; }
.mk-legal h2 { font-size: 1.1rem; margin: 2rem 0 .5rem; padding-top: 1.4rem; border-top: 1px solid var(--line-soft); }
.mk-legal p, .mk-legal li { color: var(--ink-soft); line-height: 1.7; }
@media (max-width: 820px) {
  .mk-nav .links a:not(.mk-btn) { display: none; }
  .mk-cards, .mk-steps, .mk-price-grid { grid-template-columns: 1fr; }
  .mk-section { padding: 56px 0; }
}

/* ============================================================================
   RESPONSIVE + MOTION
   ============================================================================ */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--sidebar-line); }
  .sidebar .nav { display: flex; flex-wrap: wrap; gap: .2rem; }
  .sidebar .nav .group { width: 100%; margin: .6rem .7rem .2rem; }
  .sidebar .spacer { display: none; }
  .topbar { padding-inline: 1rem; flex-wrap: wrap; }
  .content { padding: 1.1rem 1rem 2.5rem; }
  .page-head { flex-direction: column; gap: .6rem; }
  table.tbl { font-size: .84rem; }
  table.tbl th, table.tbl td { padding: .5rem .55rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .content { animation: none; }
}

/* ============================================================================
   FLOW-DOWN MAP — server-rendered SVG explorer (map.html + partials/map.html)
   Colour comes only from the status tokens above; nodes are plain surfaces.
   ============================================================================ */
.fd-card { display: flex; flex-direction: column; }
.fd-toolbar { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .7rem 1rem; border-bottom: 1px solid var(--line-soft); }
.fd-filters { display: flex; gap: .35rem; flex-wrap: wrap; }
.fd-tools { display: flex; gap: .35rem; margin-left: auto; }
.fd-chip {
  display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
  padding: .32rem .7rem; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  transition: background .12s, border-color .12s, color .12s;
}
.fd-chip b { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.fd-chip:hover { border-color: var(--teal); }
.fd-chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.fd-chip.on b { color: #fff; }
.fd-chip .fd-swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.fd-chip.ok .fd-swatch { background: var(--ok); } .fd-chip.due .fd-swatch { background: var(--due); } .fd-chip.over .fd-swatch { background: var(--over); }
.fd-chip.on .fd-swatch { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.fd-viewport {
  position: relative; height: min(68vh, 760px); min-height: 360px; overflow: hidden; touch-action: none; cursor: grab;
  background: var(--surface-2);
  background-image: radial-gradient(color-mix(in oklch, var(--ink-faint) 28%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}
.fd-viewport:active { cursor: grabbing; }
.fd-viewport:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.fd-viewport svg { width: 100%; height: 100%; display: block; }
.fd-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.fd-hint { color: var(--ink); font-weight: 600; }

.fdmap text { font-family: var(--sans); pointer-events: none; }
.fdmap .fd-label { font-size: 14px; font-weight: 700; fill: var(--ink); }
.fdmap .fd-label.mono { font-family: var(--mono); }
.fdmap .fd-sub { font-size: 11px; fill: var(--ink-faint); }
.fdmap .fd-status { font-size: 11px; font-weight: 700; }
.fdmap .fd-node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; transition: stroke .12s, filter .12s; }
.fdmap .fd-node { cursor: pointer; }
.fdmap a.fd-node:hover rect, .fdmap a.fd-node:focus-visible rect { stroke: var(--teal); stroke-width: 1.6; filter: drop-shadow(0 4px 10px rgba(16,24,32,.12)); }
.fdmap a.fd-node:focus-visible { outline: none; }
.fdmap .fd-node.prime rect { fill: var(--teal); stroke: var(--teal); }
.fdmap .fd-node.prime .fd-label { fill: #fff; font-size: 16px; }
.fdmap .fd-node.prime .fd-sub { fill: color-mix(in oklch, #fff 78%, var(--teal)); }
.fdmap .fd-node.contract rect { fill: var(--surface); stroke: var(--line); }
.fdmap .fd-node.contract:hover rect, .fdmap .fd-node.contract:focus-visible rect { stroke: var(--brand-orange); }
.fdmap .fd-node.contract:focus-visible { outline: none; }
.fdmap .fd-node.orphan rect { fill: var(--surface-2); stroke: var(--line); stroke-dasharray: 5 4; }
.fdmap .fd-node.is-folded rect { fill: var(--accent); stroke: var(--brand-orange); }
.fdmap .fd-node.is-folded .fd-sub::after { content: " · folded"; }
.fdmap .fd-open text { font-size: 11px; font-weight: 600; fill: var(--teal); pointer-events: all; text-decoration: underline; }
.fdmap .fd-node.sub .fd-bar { stroke: none; }
.fdmap .fd-node.sub.ok .fd-bar, .fdmap .fd-node.sub.ok .fd-dot { fill: var(--ok); } .fdmap .fd-node.sub.ok .fd-status { fill: var(--ok); }
.fdmap .fd-node.sub.due .fd-bar, .fdmap .fd-node.sub.due .fd-dot { fill: var(--due); } .fdmap .fd-node.sub.due .fd-status { fill: var(--due); }
.fdmap .fd-node.sub.over .fd-bar, .fdmap .fd-node.sub.over .fd-dot { fill: var(--over); } .fdmap .fd-node.sub.over .fd-status { fill: var(--over); }
.fdmap .fd-node.sub.muted .fd-bar, .fdmap .fd-node.sub.muted .fd-dot { fill: var(--ink-faint); } .fdmap .fd-node.sub.muted .fd-status { fill: var(--ink-faint); }
.fdmap .fd-edge { stroke: var(--line); stroke-width: 1.4; transition: opacity .15s; }
.fdmap .fd-edge.line { stroke: color-mix(in oklch, var(--teal) 55%, var(--line)); }
.fdmap .fd-edge.ok { stroke: var(--ok); stroke-opacity: .45; }
.fdmap .fd-edge.due { stroke: var(--due); stroke-opacity: .5; }
.fdmap .fd-edge.over { stroke: var(--over); stroke-opacity: .6; stroke-width: 1.8; }
.fdmap .fd-edge.muted, .fdmap .fd-edge.dashed { stroke: var(--line); stroke-dasharray: 5 4; }
.fdmap .is-hidden { display: none; }
[data-theme=dark] .fdmap .fd-node.prime .fd-label { fill: oklch(0.145 0 0); }
[data-theme=dark] .fdmap .fd-node.prime .fd-sub { fill: oklch(0.3 0.03 196); }

@media print {
  .sidebar, .topbar, .fd-toolbar, .fd-foot, .note { display: none !important; }
  .app { display: block; }
  .content { padding: 0; animation: none; max-width: none; }
  .fd-card { border: none; box-shadow: none; }
  .fd-viewport { height: auto; min-height: 0; overflow: visible; background: none; }
  .fd-viewport svg { width: 100%; height: auto; }
  .page-head .sub { display: none; }
}
@media (max-width: 760px) {
  .fd-tools { margin-left: 0; }
  .fd-viewport { height: 62vh; }
}
