/* ============================================================
   WN §5.1 token remap (DIR-2026-06-11 Stage 2). The prototype's
   brand/colors_and_type.css is not ported; this self-contained
   :root block assigns every prototype token this artefact consumes.
   Repo tokens (src/styles/design-tokens.css, loaded globally via
   BaseLayout) are referenced where an equivalent exists; brand-literal
   values are carried where the repo has none. Decision 6.6: the mono
   faces map to the system mono stack (no new font dependency).
   ============================================================ */
:root {
  --font-sans: var(--pf-font-sans);
  --font-display: var(--font-sans);
  --font-mono-dev: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-mono-marketing: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bg-page: var(--pf-paper);
  --bg-ink-soft: rgba(0, 58, 77, 0.04);
  --pf-text: #1a1a1a;
  --fg-2: #334155;            /* brand --pf-slate-600 */
  --fg-3: #6B838B;            /* brand --pf-slate-400 */
  --pf-slate-50: #F1F5F7;
  --pf-slate-100: #E3ECEF;
  --pf-slate-200: #C9D7DC;
  --pf-slate-300: #9FB3BA;
  --pf-slate-500: #47606A;
  --border-1: var(--pf-slate-100);
  --border-2: var(--pf-slate-200);
  --pf-extra-light: #ECF5F8;
  --pf-light-blue: #D2EEF0;
  --pf-cyan-ink: #018990;
  --pf-green: #03BF5D;
  --pf-lime: #BED629;
  --pf-red: #c0392b;
  --pf-steel: #4899B7;
  --warning: #E8A317;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --sh-focus: 0 0 0 3px rgba(2, 180, 191, 0.35);
  --sh-2: 0 4px 12px rgba(0, 58, 77, 0.10);
  --dur-2: 200ms;
  --dur-3: 320ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --pf-gradient-dark: linear-gradient(135deg, var(--pf-navy-deep) 0%, var(--pf-navy) 100%);
  --pf-overlay-navy: linear-gradient(135deg, rgba(0, 42, 56, 0.92) 0%, rgba(0, 58, 77, 0.80) 100%);
  --pf-scrim-bottom: linear-gradient(0deg, rgba(0, 42, 56, 0.85) 0%, rgba(0, 42, 56, 0.20) 55%, rgba(0, 42, 56, 0) 100%);
}

/* ============================================================
   AFOR · live surface · styles
   Product-UI surface family: paper page, white flat cards,
   navy chrome, cyan accent. Data indicators only for RAG.
   ============================================================ */

html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg-page); }

/* Port adaptation (plan R-4): subtract the artefact back-bar from the fixed viewport. */
.af-app { height: calc(100vh - var(--pf-backbar-h, 0px)); height: calc(100svh - var(--pf-backbar-h, 0px)); display: grid; grid-template-columns: 248px 1fr; }

/* ---------------- sidebar ---------------- */
.af-side {
  background: var(--pf-navy); color: #fff; display: flex; flex-direction: column;
  padding: 18px 0 16px; min-height: 0; overflow-y: auto;
}
.af-side-logo { padding: 4px 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.af-side-logo img { height: 40px; width: auto; display: block; }
.af-product { padding: 18px 20px 6px; }
.af-product .pn { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: #fff; }
.af-product .pos {
  margin-top: 5px; font-size: 11.5px; line-height: 1.5; color: rgba(255,255,255,0.62);
}
.af-product .pos b { color: var(--pf-cyan); font-weight: 600; }

.af-nav { margin-top: 14px; display: flex; flex-direction: column; }
.af-nav-head {
  padding: 14px 20px 8px; font-family: var(--font-mono-dev); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.4);
}
.af-nav button {
  appearance: none; background: none; border: 0; cursor: pointer; text-align: left;
  display: block; width: 100%; padding: 11px 20px;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 500; color: rgba(255,255,255,0.78);
  border-left: 2px solid transparent;
  transition: background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.af-nav button:hover { background: rgba(255,255,255,0.05); color: #fff; }
.af-nav button:focus-visible { outline: none; box-shadow: var(--sh-focus); border-radius: var(--r-sm); }
.af-nav button.active { background: rgba(255,255,255,0.08); border-left-color: var(--pf-cyan); color: #fff; font-weight: 600; }
.af-nav button small { display: block; font-size: 10.5px; font-weight: 400; color: rgba(255,255,255,0.45); margin-top: 3px; }
.af-nav button.active small { color: rgba(255,255,255,0.6); }

.af-side-foot { margin-top: auto; padding: 16px 20px 4px; border-top: 1px solid rgba(255,255,255,0.12); }
.af-side-foot p { font-size: 10.5px; line-height: 1.55; color: rgba(255,255,255,0.5); }
.af-side-foot a { color: var(--pf-cyan); text-decoration: none; font-weight: 600; }
.af-side-foot .pf-tagline { margin-top: 12px; color: #fff; font-size: 12px; }
.af-side-foot .pf-tagline .you-can { color: var(--pf-cyan); }

/* ---------------- main column ---------------- */
.af-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.af-top {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #fff; border-bottom: 1px solid var(--border-1);
  padding: 10px clamp(16px, 2.5vw, 28px);
}
.af-context { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.af-context .site { font-size: 13.5px; font-weight: 600; color: var(--pf-navy); white-space: nowrap; }
.af-context .shift {
  font-family: var(--font-mono-dev); font-size: 10.5px; letter-spacing: 0.04em;
  color: var(--fg-3); white-space: nowrap;
}
.af-top-right { display: flex; align-items: center; gap: 12px; flex: none; }
.af-top-right a { font-size: 12px; font-weight: 600; color: var(--pf-cyan-ink); text-decoration: none; white-space: nowrap; }
.af-top-right a:hover { text-decoration: underline; }

.af-sample {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 24px; padding: 0 11px; border-radius: var(--r-pill);
  background: rgba(190, 214, 41, 0.16); border: 1px solid rgba(190, 214, 41, 0.55);
  font-size: 10.5px; font-weight: 600; color: #5a661a; white-space: nowrap;
}
.af-sample::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--pf-lime); }

.af-scroll { overflow-y: auto; min-height: 0; flex: 1; }
.af-body { padding: clamp(16px, 2.5vw, 28px); max-width: 1180px; }

/* screens */
.af-screen { display: none; }
.af-screen.active { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .af-screen.active { animation: afIn var(--dur-3) var(--ease-out) both; }
}
@keyframes afIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* screen header strip */
.af-strip {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.af-strip h1 { font-size: 21px; letter-spacing: -0.015em; color: var(--pf-navy); }
.af-strip .meta {
  font-family: var(--font-mono-dev); font-size: 10px; letter-spacing: 0.04em;
  color: var(--fg-3); text-align: right; line-height: 1.6;
}
.af-sec {
  margin: 26px 0 12px; display: flex; align-items: baseline; gap: 10px;
}
.af-sec h2 { font-size: 13px; letter-spacing: 0.02em; color: var(--pf-navy); }
.af-sec .k {
  font-family: var(--font-mono-dev); font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--pf-cyan-ink);
}
.af-sec .rule { flex: 1; height: 1px; background: var(--border-1); }

/* ---------------- flash KPI cards ---------------- */
.af-flash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.af-kpi { background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md); padding: 16px 18px; }
.af-kpi .k { font-size: 11.5px; font-weight: 600; color: var(--fg-2); }
.af-kpi .v { margin-top: 8px; display: flex; align-items: baseline; gap: 5px; }
.af-kpi .v .num { font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: -0.02em; color: var(--pf-navy); font-variant-numeric: tabular-nums; }
.af-kpi .v .unit { font-size: 12px; color: var(--fg-3); font-weight: 500; }
.af-kpi .plan { margin-top: 5px; font-family: var(--font-mono-dev); font-size: 9.5px; letter-spacing: 0.03em; color: var(--fg-3); }
.af-kpi .delta { margin-top: 9px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.af-kpi .delta.neg { color: var(--pf-red); }
.af-kpi .delta.pos { color: var(--pf-green); }

/* ---------------- takt grid ---------------- */
.af-takt { background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md); padding: 16px 18px 18px; overflow-x: auto; }
.af-takt table { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 640px; }
.af-takt th {
  font-family: var(--font-mono-dev); font-size: 9px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--fg-3); font-weight: 500; text-align: center; padding: 2px 4px;
}
.af-takt th.line-h { text-align: left; }
.af-takt td.line {
  font-size: 12px; font-weight: 600; color: var(--pf-navy); white-space: nowrap; padding-right: 10px;
}
.af-takt td.cell { padding: 0; }
.af-takt .cellbox {
  height: 38px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono-dev); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums;
  border: 1px solid transparent; cursor: default;
  transition: border-color var(--dur-2) var(--ease-out);
}
.af-takt .cellbox.hl { border-color: var(--pf-navy); }
.af-takt-note { margin-top: 10px; font-size: 11px; color: var(--fg-3); }

/* alerts */
.af-alerts { display: flex; flex-direction: column; gap: 8px; }
.af-alert {
  background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md);
  padding: 13px 16px; display: grid; grid-template-columns: auto 1fr; gap: 12px; cursor: pointer;
}
.af-alert:hover { border-color: var(--border-2); }
.af-alert .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; }
.af-alert.critical .dot { background: var(--pf-red); }
.af-alert.warning .dot { background: var(--warning); }
.af-alert.positive .dot { background: var(--pf-green); }
.af-alert .t { font-size: 13.5px; font-weight: 600; color: var(--pf-navy); line-height: 1.4; }
.af-alert .lvl {
  font-family: var(--font-mono-dev); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-3); margin-left: 8px;
}
.af-alert .cause { display: none; margin-top: 7px; font-size: 12.5px; line-height: 1.55; color: var(--fg-2); max-width: 78ch; }
.af-alert.open .cause { display: block; }

/* ---------------- actions before shift ---------------- */
.af-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.af-action { background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md); padding: 16px 18px 16px; display: flex; flex-direction: column; }
.af-action .fo {
  font-family: var(--font-mono-dev); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--pf-cyan-ink); display: flex; justify-content: space-between; gap: 8px;
}
.af-action .fo .n { color: var(--fg-3); }
.af-action .tx { margin-top: 10px; font-size: 13.5px; line-height: 1.55; font-weight: 600; color: var(--pf-navy); }
.af-why-btn {
  appearance: none; background: none; border: 0; cursor: pointer; padding: 0; margin-top: 10px;
  font-family: var(--font-sans); font-size: 11.5px; font-weight: 600; color: var(--pf-cyan-ink); text-align: left;
}
.af-why-btn:hover { text-decoration: underline; }
.af-why { display: none; margin-top: 10px; border-top: 1px solid var(--border-1); padding-top: 10px; }
.af-action.open .af-why { display: block; }
.af-why .row { margin-bottom: 8px; }
.af-why .row .wk {
  font-family: var(--font-mono-dev); font-size: 8.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-3); display: block; margin-bottom: 2px;
}
.af-why .row .wv { font-size: 12px; line-height: 1.5; color: var(--fg-2); }
.af-act-btns { margin-top: auto; padding-top: 14px; display: flex; gap: 8px; }
.af-act-btns .pf-btn { flex: 1; }
.af-action.accepted .af-act-btns { display: none; }
.af-accepted {
  display: none; margin-top: auto; padding-top: 14px;
  font-size: 12px; font-weight: 600; color: var(--pf-green);
}
.af-action.accepted .af-accepted { display: flex; align-items: center; gap: 7px; }

/* ---------------- priorities timeline ---------------- */
.af-prio { background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md); padding: 6px 18px; }
.af-prio-row {
  display: grid; grid-template-columns: 64px 220px 1fr; gap: 16px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--border-1);
}
.af-prio-row:last-child { border-bottom: 0; }
.af-prio-row .t { font-family: var(--font-mono-dev); font-size: 12px; font-weight: 500; color: var(--pf-cyan-ink); font-variant-numeric: tabular-nums; }
.af-prio-row .w { font-size: 13px; font-weight: 600; color: var(--pf-navy); }
.af-prio-row .c { font-size: 12.5px; line-height: 1.5; color: var(--fg-2); }

/* ---------------- q-stops ---------------- */
.af-q { display: grid; grid-template-columns: 1fr 1.6fr; gap: 12px; align-items: start; }
.af-q-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.af-q-stat { background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md); padding: 14px 16px; }
.af-q-stat .v { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.02em; color: var(--pf-navy); }
.af-q-stat .k { margin-top: 4px; font-size: 10.5px; line-height: 1.4; color: var(--fg-3); }
.af-q-list { background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md); padding: 6px 18px; }
.af-q-row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border-1);
}
.af-q-row:last-child { border-bottom: 0; }
.af-q-row .t { font-family: var(--font-mono-dev); font-size: 11.5px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.af-q-row .w { font-size: 12.5px; font-weight: 600; color: var(--pf-navy); }
.af-q-row .w small { display: block; font-weight: 400; font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.af-q-row .pf-chip-success { white-space: nowrap; }
.af-q-note { margin-top: 8px; font-size: 11px; color: var(--fg-3); }

/* ---------------- MOS Critic ---------------- */
.af-health {
  display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center;
  background: var(--pf-navy); color: #fff; border-radius: var(--r-md); padding: 20px 24px;
}
.af-health .hv { font-family: var(--font-display); font-weight: 600; font-size: 44px; letter-spacing: -0.03em; color: var(--pf-cyan); line-height: 1; }
.af-health .hv small { font-size: 16px; color: rgba(255,255,255,0.6); }
.af-health .hd { font-size: 12px; color: var(--pf-green); font-weight: 600; margin-top: 6px; }
.af-health p { font-size: 12.5px; line-height: 1.55; color: rgba(255,255,255,0.75); max-width: 56ch; }
.af-health .as {
  font-family: var(--font-mono-dev); font-size: 10px; letter-spacing: 0.04em;
  color: rgba(255,255,255,0.65); text-align: right; line-height: 1.7;
}
.af-health .as b { color: #fff; font-weight: 600; }

.af-crit-group { margin-top: 22px; }
.af-crit-row {
  background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md);
  margin-bottom: 8px; overflow: hidden;
}
.af-crit-head {
  appearance: none; background: none; border: 0; cursor: pointer; width: 100%; text-align: left;
  display: grid; grid-template-columns: 14px minmax(190px, 280px) 1fr auto; gap: 14px; align-items: center;
  padding: 13px 16px; font-family: var(--font-sans);
  transition: background var(--dur-2) var(--ease-out);
}
.af-crit-head:hover { background: var(--bg-ink-soft); }
.af-crit-head:focus-visible { outline: none; box-shadow: var(--sh-focus); border-radius: var(--r-sm); }
.af-crit-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.af-crit-row.ok .dot { background: var(--pf-green); }
.af-crit-row.warn .dot { background: var(--warning); }
.af-crit-row.crit .dot { background: var(--pf-red); }
.af-crit-head .nm { font-size: 12.5px; font-weight: 600; color: var(--pf-navy); line-height: 1.35; }
.af-crit-head .nm .en { font-family: var(--font-mono-dev); font-size: 9.5px; font-weight: 500; color: var(--fg-3); margin-right: 6px; }
.af-crit-head .sg { font-size: 12px; line-height: 1.45; color: var(--fg-2); }
.af-crit-head .bl {
  font-family: var(--font-mono-dev); font-size: 9px; letter-spacing: 0.05em;
  color: var(--fg-3); white-space: nowrap; text-align: right;
}
.af-crit-body { display: none; border-top: 1px solid var(--border-1); padding: 14px 16px 16px 44px; }
.af-crit-row.open .af-crit-body { display: block; }
.af-crit-body .gap { font-size: 12.5px; color: var(--fg-2); }
.af-crit-body .gap b { color: var(--pf-navy); }
.af-crit-action {
  margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1px solid rgba(2,180,191,0.3); background: rgba(2,180,191,0.06);
  border-radius: var(--r-sm); padding: 10px 14px;
}
.af-crit-action .at { font-size: 12.5px; font-weight: 600; color: var(--pf-navy); line-height: 1.45; }
.af-crit-action .at .ak {
  display: block; font-family: var(--font-mono-dev); font-size: 8.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--pf-cyan-ink); margin-bottom: 3px; font-weight: 500;
}

/* ---------------- family module screens ---------------- */
.af-module { max-width: 720px; }
.af-module-card { background: #fff; border: 1px solid var(--pf-light-blue); border-radius: var(--r-md); padding: 26px 28px; }
.af-module-card .role {
  font-family: var(--font-mono-dev); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--pf-cyan-ink);
}
.af-module-card h2 { margin-top: 8px; font-size: 22px; }
.af-module-card p { margin-top: 12px; font-size: 14px; line-height: 1.65; max-width: 60ch; }
.af-module-card .feeds {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-1);
  font-size: 12.5px; color: var(--fg-2);
}
.af-module-card .feeds b { color: var(--pf-navy); }
.af-family-note { margin-top: 14px; font-size: 12px; line-height: 1.6; color: var(--fg-3); max-width: 64ch; }

/* footer note inside screens */
.af-footnote {
  margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border-1);
  font-size: 11.5px; line-height: 1.6; color: var(--fg-3); max-width: 86ch;
}
.af-footnote b { color: var(--fg-2); }

/* ---------------- density tweak ---------------- */
body[data-density="compact"] .af-body { padding: 14px 18px; }
body[data-density="compact"] .af-kpi { padding: 12px 14px; }
body[data-density="compact"] .af-kpi .v .num { font-size: 23px; }
body[data-density="compact"] .af-prio-row { padding: 8px 0; }
body[data-density="compact"] .af-crit-head { padding: 9px 14px; }
body[data-density="compact"] .af-sec { margin: 18px 0 10px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1060px) {
  .af-flash { grid-template-columns: repeat(2, 1fr); }
  .af-actions { grid-template-columns: 1fr; }
  .af-q { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .af-app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100svh; }
  body { overflow: auto; }
  .af-side { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px; padding: 10px 12px; }
  .af-side-logo { border: 0; padding: 0 10px 0 4px; }
  .af-side-logo img { height: 32px; }
  .af-product { display: none; }
  .af-nav { margin: 0; flex-direction: row; flex-wrap: wrap; }
  .af-nav-head { display: none; }
  .af-nav button { width: auto; padding: 8px 12px; border-left: 0; border-radius: var(--r-sm); }
  .af-nav button small { display: none; }
  .af-side-foot { display: none; }
  .af-health { grid-template-columns: 1fr; gap: 12px; }
  .af-health .as { text-align: left; }
  .af-crit-head { grid-template-columns: 14px 1fr; }
  .af-crit-head .sg, .af-crit-head .bl { grid-column: 2; }
  .af-prio-row { grid-template-columns: 56px 1fr; }
  .af-prio-row .c { grid-column: 2; }
}
