/* Modernization Light — Fiori-adjacent design system (SAPF POC)
   Tokens per docs/02-personas-and-workflow.md. Amber is reserved for human gates. */

:root {
  --canvas: #f5f6f7;
  --surface: #ffffff;
  --hairline: #e4e7eb;
  --hairline-2: #d0d5dc;
  --ink: #1a2733;
  --body: #334654;
  --muted: #5b6b79;
  --faint: #8494a3;
  --blue: #0a6ed1;
  --blue-deep: #085caf;
  --blue-tint: #eaf3fc;
  --blue-tint-2: #d5e8f9;
  --shell: #22303c;
  --shell-2: #2c3d4c;
  --teal: #0f766e;
  --teal-tint: #e6f3f1;
  --amber: #b45309;
  --amber-tint: #fdf3e7;
  --amber-line: #ecc9a3;
  --red: #bb0000;
  --red-tint: #fbeaea;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 3px rgba(26,39,51,.08), 0 4px 14px rgba(26,39,51,.06);
  --shadow-lift: 0 2px 6px rgba(26,39,51,.10), 0 10px 28px rgba(26,39,51,.10);
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--canvas);
  color: var(--body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- shell bar ---------- */
.shell {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 26px;
  background: var(--shell);
  color: #e8edf2;
  padding: 0 26px;
  height: 52px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 2px 10px rgba(15,23,30,.25);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 650; letter-spacing: .01em; font-size: 15.5px; }
.brand-mark { display: inline-flex; width: 26px; height: 26px; }
.brand-mark svg { width: 100%; height: 100%; }
.shell-nav { display: flex; gap: 4px; flex: 1; }
.shell-nav a {
  color: #c3cdd6; text-decoration: none; font-size: 13.5px; font-weight: 550;
  padding: 6px 12px; border-radius: 7px; line-height: 1.2;
}
.shell-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.shell-nav a.active { color: #fff; background: rgba(10,110,209,.55); }
.shell-tag { font-size: 11.5px; color: #93a3b1; letter-spacing: .02em; white-space: nowrap; }

/* ---------- layout ---------- */
.view-root { min-height: calc(100vh - 52px - 120px); outline: none; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 26px; }
.wrap-narrow { max-width: 880px; margin: 0 auto; padding: 0 26px; }

.section { padding: 46px 0; }
.section + .section { border-top: 1px solid var(--hairline); }
.section-head { margin-bottom: 22px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--blue); margin-bottom: 6px; }
h1 { color: var(--ink); font-size: 32px; line-height: 1.22; letter-spacing: -.015em; font-weight: 720; }
h2 { color: var(--ink); font-size: 22px; line-height: 1.3; letter-spacing: -.01em; font-weight: 680; }
h3 { color: var(--ink); font-size: 16.5px; font-weight: 650; }
.lede { font-size: 17.5px; line-height: 1.7; color: var(--body); max-width: 760px; }
.sub { color: var(--muted); font-size: 14.5px; max-width: 720px; }

/* ---------- hero ---------- */
.hero { padding: 58px 0 44px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: 44px; align-items: center; }
.hero h1 { font-size: 36px; margin: 10px 0 14px; }
.hero .lede strong { color: var(--ink); }
.hero-ctas { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 8px; padding: 11px 18px; font-size: 14.5px; font-weight: 620;
  text-decoration: none; cursor: pointer; border: 1px solid transparent; line-height: 1.2;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); }
.btn-ghost { background: var(--surface); color: var(--blue); border-color: var(--hairline-2); }
.btn-ghost:hover { border-color: var(--blue); }
.btn svg { width: 15px; height: 15px; }

/* the before/after mini visual in hero */
.hero-visual { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-lift); overflow: hidden; }
.hv-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--hairline); font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.hv-body { display: grid; grid-template-columns: 1fr 1fr; }
.hv-pane { padding: 14px 16px; font-family: var(--mono); font-size: 11px; line-height: 1.7; overflow-x: auto; white-space: pre; }
.hv-pane.legacy { background: #1d2831; color: #9fb2c0; }
.hv-pane.modern { background: #fbfdff; color: #29404f; border-left: 1px solid var(--hairline); }
.hv-pane .kw { color: #6db3f2; } .hv-pane.modern .kw { color: var(--blue); font-weight: 600; }
.hv-pane .cm { color: #5b7183; } .hv-pane.modern .cm { color: #7c93a5; }
.hv-arrow { display: flex; align-items: center; justify-content: center; padding: 8px; background: var(--blue-tint); color: var(--blue); font-size: 11.5px; font-weight: 650; gap: 8px; border-top: 1px solid var(--hairline); }
.hv-arrow svg { width: 14px; height: 14px; }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; }
.kpi .k-glyph { display: inline-flex; width: 18px; height: 18px; color: var(--blue); margin-bottom: 8px; }
.kpi .k-glyph svg { width: 100%; height: 100%; }
.kpi .k-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.kpi .k-num { font-size: 26px; font-weight: 720; color: var(--ink); line-height: 1.15; }
.kpi .k-unit { font-size: 12.5px; color: var(--muted); }
.kpi.amber .k-glyph { color: var(--amber); }
.kpi.teal .k-glyph { color: var(--teal); }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.card h3 { margin-bottom: 8px; display: flex; align-items: center; gap: 9px; }
.card h3 .g { width: 17px; height: 17px; color: var(--blue); flex: none; }
.card h3 .g svg { width: 100%; height: 100%; }
.card p { font-size: 14.5px; color: var(--body); }
.card .fine { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* pipeline diagram (overview) */
.pipe { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 20px; }
.pipe-stage { background: var(--surface); border: 1px solid var(--hairline); border-radius: 9px; padding: 13px 13px 11px; position: relative; }
.pipe-stage .num { font-family: var(--mono); font-size: 10.5px; color: var(--faint); font-weight: 600; }
.pipe-stage .nm { font-size: 13px; font-weight: 650; color: var(--ink); line-height: 1.3; margin: 3px 0 5px; }
.pipe-stage .ds { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.pipe-stage.gated { border-bottom: 3px solid var(--amber); }
.gate-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 7px;
  background: var(--amber-tint); color: var(--amber); border: 1px solid var(--amber-line);
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 2.5px 7px; border-radius: 20px;
}
.gate-chip svg { width: 10px; height: 10px; }

/* ---------- workbench ---------- */
.wb-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.wb-rail { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 6px; }
.wb-step {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 9px;
  padding: 10px 12px; cursor: pointer; font-family: inherit; width: 100%;
}
.wb-step .dot {
  flex: none; width: 22px; height: 22px; border-radius: 50%; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-tint); color: var(--blue); font-size: 11px; font-weight: 700; font-family: var(--mono);
}
.wb-step .t { font-size: 12.5px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.wb-step .s { font-size: 11px; color: var(--muted); line-height: 1.35; }
.wb-step.active { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-tint-2); }
.wb-step.done .dot { background: var(--teal-tint); color: var(--teal); }
.wb-step.gate .dot { background: var(--amber-tint); color: var(--amber); }
.wb-step:disabled { opacity: .55; cursor: not-allowed; }

.wb-stage-panel { min-height: 480px; }
.stage-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.stage-head .stage-num { font-family: var(--mono); font-size: 12px; color: var(--faint); font-weight: 600; }
.stage-io { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 16px; }
.io-chip { font-size: 11.5px; padding: 3px 9px; border-radius: 14px; background: var(--blue-tint); color: var(--blue-deep); font-weight: 600; border: 1px solid var(--blue-tint-2); }
.io-chip.out { background: var(--teal-tint); color: var(--teal); border-color: #cde7e3; }

/* agent transcript */
.transcript { background: var(--shell); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0; }
.tr-line { display: flex; gap: 10px; margin-bottom: 10px; }
.tr-line:last-child { margin-bottom: 0; }
.tr-role {
  flex: none; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 4px; height: fit-content; margin-top: 2px;
}
.tr-role.agent { background: rgba(10,110,209,.28); color: #7cbdf5; }
.tr-role.tool { background: rgba(255,255,255,.10); color: #aebbc7; }
.tr-role.human { background: rgba(180,83,9,.30); color: #f0b479; }
.tr-body { font-size: 13px; color: #cdd8e1; line-height: 1.6; }
.tr-body code { font-family: var(--mono); font-size: 12px; color: #8ec7f7; background: rgba(10,110,209,.14); padding: 1px 5px; border-radius: 4px; }
.cite {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 650;
  background: rgba(10,110,209,.16); color: #8ec7f7; border: 1px solid rgba(10,110,209,.35);
  border-radius: 12px; padding: 1px 8px; margin-left: 6px; vertical-align: 1px;
}

/* code panes */
.code-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.code-pane { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--hairline); }
.cp-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 13px; font-size: 11.5px; font-weight: 650; letter-spacing: .02em; }
.code-pane.legacy .cp-head { background: #17222b; color: #9fb2c0; }
.code-pane.modern .cp-head { background: var(--blue-tint); color: var(--blue-deep); }
.cp-body { font-family: var(--mono); font-size: 11.5px; line-height: 1.66; padding: 13px 15px; overflow-x: auto; white-space: pre; }
.code-pane.legacy .cp-body { background: #1d2831; color: #a9bcca; }
.code-pane.modern .cp-body { background: #fcfdff; color: #29404f; }
.code-pane .kw { color: #6db3f2; font-weight: 600; } .code-pane.modern .kw { color: var(--blue); }
.code-pane .cm { color: #5b7183; font-style: italic; } .code-pane.modern .cm { color: #7c93a5; }
.code-pane .st { color: #d9a06b; } .code-pane.modern .st { color: #9a6a2f; }
.code-pane .hl { background: rgba(187,0,0,.25); border-radius: 3px; padding: 0 2px; }
.code-pane.modern .hl { background: rgba(15,118,110,.14); }
.cp-note { font-size: 12px; color: var(--muted); padding: 8px 13px; border-top: 1px solid var(--hairline); background: var(--surface); white-space: normal; font-family: var(--sans); line-height: 1.5; }

/* gate cards */
.gate-card { border: 1.5px solid var(--amber-line); border-radius: var(--radius); background: var(--amber-tint); padding: 18px 20px; margin: 18px 0; }
.gate-card .gc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.gate-card .gc-head .g { width: 20px; height: 20px; color: var(--amber); }
.gate-card .gc-head .g svg { width: 100%; height: 100%; }
.gate-card h3 { color: var(--amber); font-size: 15px; }
.gate-card .who { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--amber); opacity: .85; }
.gate-check { list-style: none; margin: 10px 0; }
.gate-check li { display: flex; gap: 9px; font-size: 13.5px; color: #6b4a1f; padding: 4px 0; align-items: flex-start; }
.gate-check li svg { width: 15px; height: 15px; flex: none; margin-top: 3px; color: var(--amber); }
.gate-actions { display: flex; gap: 10px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.btn-approve { background: var(--amber); color: #fff; border: none; }
.btn-approve:hover { background: #96450a; }
.gate-approved {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 650; color: var(--teal);
  background: var(--teal-tint); border: 1px solid #cde7e3; padding: 7px 13px; border-radius: 8px;
}
.gate-approved svg { width: 15px; height: 15px; }
.gate-rationale { font-size: 13px; color: #6b4a1f; background: rgba(255,255,255,.6); border-radius: 8px; padding: 10px 13px; margin-top: 10px; line-height: 1.6; }
.gate-rationale strong { color: var(--amber); }

/* rejection beat */
.reject-note { border-left: 3px solid var(--red); background: var(--red-tint); border-radius: 0 8px 8px 0; padding: 12px 15px; font-size: 13.5px; color: #7a2020; margin: 12px 0; line-height: 1.6; }
.reject-note strong { color: var(--red); }

/* stage nav footer */
.stage-nav { display: flex; justify-content: space-between; margin-top: 22px; gap: 10px; }

/* ---------- matrix ---------- */
.matrix-tools { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.mt-btn {
  font-family: inherit; font-size: 12.5px; font-weight: 620; padding: 6px 13px; border-radius: 18px;
  border: 1px solid var(--hairline-2); background: var(--surface); color: var(--muted); cursor: pointer;
}
.mt-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.matrix-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); }
table.matrix { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
.matrix th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); padding: 11px 14px; border-bottom: 1.5px solid var(--hairline-2); background: #fafbfc; white-space: nowrap;
}
.matrix td { padding: 11px 14px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.matrix tr:last-child td { border-bottom: none; }
.matrix .rid { font-family: var(--mono); font-weight: 650; color: var(--ink); white-space: nowrap; }
.matrix .loc, .matrix .art, .matrix .tst { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.matrix .art { color: var(--blue-deep); }
.status {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 14px; white-space: nowrap;
}
.status svg { width: 11px; height: 11px; }
.status.verified { background: var(--teal-tint); color: var(--teal); }
.status.amended { background: var(--amber-tint); color: var(--amber); }
.status.flagged { background: var(--red-tint); color: var(--red); }
.matrix tr.dim { display: none; }

/* ---------- context pack ---------- */
.pack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.pack-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.pack-card .pc-head { display: flex; align-items: center; gap: 9px; padding: 13px 17px; border-bottom: 1px solid var(--hairline); }
.pack-card .pc-head .g { width: 17px; height: 17px; color: var(--blue); }
.pack-card .pc-head .g svg { width: 100%; height: 100%; }
.pack-card .pc-head h3 { font-size: 14.5px; }
.pack-card .pc-body { padding: 14px 17px; font-size: 13.5px; }
.pack-card .pc-body ul { list-style: none; }
.pack-card .pc-body li { padding: 4px 0 4px 16px; position: relative; color: var(--body); }
.pack-card .pc-body li::before { content: ""; position: absolute; left: 2px; top: 12px; width: 5px; height: 5px; background: var(--blue); opacity: .5; }
.pack-card .pc-meta { font-family: var(--mono); font-size: 10.5px; color: var(--faint); padding: 9px 17px; border-top: 1px solid var(--hairline); background: #fafbfc; }

.mcp-diagram { margin-top: 22px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 20px; }
.mcp-diagram svg { width: 100%; height: auto; display: block; }

/* ---------- findings ---------- */
.ledger { border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.ledger-row { display: grid; grid-template-columns: 1.3fr 90px 90px 1fr; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--hairline); font-size: 13px; align-items: center; }
.ledger-row:last-child { border-bottom: none; }
.ledger-row.head { background: #fafbfc; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.ledger-row .st-name { font-weight: 620; color: var(--ink); }
.ledger-row .mins { font-family: var(--mono); font-size: 12.5px; }
.ledger-row .mins.agent { color: var(--blue-deep); }
.ledger-row .mins.human { color: var(--amber); }
.ledger-row .note { color: var(--muted); font-size: 12px; }
.ledger-row.total { background: var(--blue-tint); font-weight: 650; }
.bar-duo { height: 8px; border-radius: 4px; overflow: hidden; display: flex; margin-top: 4px; background: var(--hairline); }
.bar-duo .a { background: var(--blue); } .bar-duo .h { background: var(--amber); }

.bneck { border-left: 3px solid var(--blue); background: var(--surface); border-radius: 0 8px 8px 0; padding: 13px 16px; margin-bottom: 12px; border-top: 1px solid var(--hairline); border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.bneck h3 { font-size: 14px; margin-bottom: 4px; }
.bneck p { font-size: 13px; color: var(--body); }
.bneck .fix { color: var(--teal); font-weight: 600; }

.week-plan { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 16px; }
.week { background: var(--surface); border: 1px solid var(--hairline); border-radius: 9px; padding: 12px; }
.week .w-num { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--blue); }
.week .w-body { font-size: 12px; color: var(--body); line-height: 1.45; margin-top: 4px; }
.week.gated { border-bottom: 3px solid var(--amber); }

/* honest panel */
.honest { border: 1.5px dashed var(--hairline-2); border-radius: var(--radius); padding: 20px 22px; background: #fbfcfd; }
.honest h3 { display: flex; gap: 9px; align-items: center; }
.honest ul { margin: 10px 0 0 2px; list-style: none; }
.honest li { padding: 5px 0 5px 18px; position: relative; font-size: 14px; }
.honest li::before { content: ""; position: absolute; left: 2px; top: 14px; width: 6px; height: 6px; background: var(--blue); opacity: .45; }

/* ---------- misc ---------- */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pill { font-size: 12px; font-weight: 620; color: var(--muted); background: var(--surface); border: 1px solid var(--hairline-2); padding: 4px 11px; border-radius: 16px; }
.foot { background: var(--shell); color: #93a3b1; margin-top: 60px; }
.foot-inner { max-width: 1140px; margin: 0 auto; padding: 26px; font-size: 12.5px; line-height: 1.6; }
.foot-inner strong { color: #c3cdd6; }
.foot-links { margin-top: 6px; font-size: 11.5px; }
a { color: var(--blue); }

.fade-in { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } html { scroll-behavior: auto; } }
.no-anim .fade-in { animation: none !important; }
.no-anim { scroll-behavior: auto; }

/* ---------- mobile (≤720px) — media queries only, desktop untouched ---------- */
@media (max-width: 720px) {
  html, body { overflow-x: hidden; }
  .shell { padding: 0 14px; gap: 10px; height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .shell-tag { display: none; }
  .shell-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .shell-nav a { white-space: nowrap; font-size: 12.5px; padding: 5px 10px; }
  .wrap, .wrap-narrow { padding: 0 16px; }
  .hero { padding: 34px 0 30px; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero h1 { font-size: 27px; }
  h1 { font-size: 26px; } h2 { font-size: 20px; }
  .lede { font-size: 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .pack-grid, .code-duo { grid-template-columns: 1fr; }
  .pipe { grid-template-columns: repeat(2, 1fr); }
  .week-plan { grid-template-columns: repeat(2, 1fr); }
  .wb-layout { grid-template-columns: 1fr; }
  .wb-rail { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .wb-step { min-width: 168px; }
  .ledger-row { grid-template-columns: 1fr 70px 70px; }
  .ledger-row .note { display: none; }
  .section { padding: 32px 0; }
  .stage-nav .btn { padding: 10px 14px; font-size: 13.5px; }
  .hv-body { grid-template-columns: 1fr; }
  .hv-pane.modern { border-left: none; border-top: 1px solid var(--hairline); }
}
