/* Step Revo — development tracker styles. Colours from Design-Tokens.json. */
:root {
  --bg: #F3F5FB;
  --surface: #FFFFFF;
  --surface-2: #E9ECF6;
  --text: #0A0B12;
  --muted: #4A5068;
  --line: #D6DAE8;
  --primary: #2E5BFF;
  --pink: #C70F55;
  --progress: #007A50;
  --violet: #7957ED;
  --warn: #9A5B00;
  --danger: #B3261E;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(10, 11, 18, .06), 0 4px 16px rgba(10, 11, 18, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A0B12;
    --surface: #12141F;
    --surface-2: #1A1D2C;
    --text: #F5F7FF;
    --muted: #A9AFC6;
    --line: #262A3D;
    --primary: #3B64FF;
    --pink: #FF7AA5;
    --progress: #00F5A0;
    --violet: #9B82F5;
    --warn: #F2B544;
    --danger: #FF8A80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "DM Sans", system-ui, sans-serif;
}
h1, h2, h3, h4 { font-family: "Sora", system-ui, sans-serif; line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin-top: 0; }
h3 { font-size: 1.05rem; }
h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.1em 0 .4em; }
p { margin: 0 0 .8em; }
a { color: var(--primary); }
code {
  font: .86em/1.4 ui-monospace, "Cascadia Code", Consolas, monospace;
  background: var(--surface-2);
  padding: .1em .35em;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

/* Layout */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px 64px; }
header.top {
  padding: 32px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.brand-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--pink)); }
.sub { color: var(--muted); max-width: 70ch; }

nav.toc {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin: 0 -16px 24px; padding: 10px 16px;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
}
nav.toc a {
  flex: none; text-decoration: none; color: var(--text);
  padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: .85rem;
}
nav.toc a:hover { background: var(--primary); color: #fff; }

section.block { margin-bottom: 40px; scroll-margin-top: 64px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* Summary tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .n { font: 600 1.7rem/1 "Sora", sans-serif; }
.tile .l { color: var(--muted); font-size: .82rem; margin-top: 6px; }

.modbars { display: grid; gap: 8px; }
.modbar { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 64px; gap: 12px; align-items: center; font-size: .9rem; }
.modbar a { color: var(--text); text-decoration: none; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--progress)); border-radius: 99px; }
.modbar .pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Workflow steps */
.flow { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: s; }
.flow li {
  counter-increment: s;
  display: grid; grid-template-columns: 34px 1fr; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.flow li::before {
  content: counter(s);
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 .95rem "Sora", sans-serif; color: #fff; background: var(--primary);
}
.flow li.gate::before { background: var(--pink); }
.flow b { display: block; }
.flow span { color: var(--muted); font-size: .92rem; }

/* Tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* Legend + badges */
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.badge, .legend span {
  display: inline-block; font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid currentColor;
}
.s-not-started { color: var(--muted); }
.s-approval { color: var(--violet); }
.s-in-progress { color: var(--primary); }
.s-review { color: var(--warn); }
.s-changes { color: var(--danger); }
.s-done { color: var(--progress); }
.s-blocked { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* Modules + tasks */
.module { margin-bottom: 28px; scroll-margin-top: 64px; }
.module-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.module-head p { color: var(--muted); margin: 0; font-size: .9rem; }
.module-head .count { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

details.task {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 8px; box-shadow: var(--shadow);
}
details.task[open] { border-color: var(--primary); }
details.task > summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center;
  padding: 12px 14px; min-height: 44px;
}
details.task > summary::-webkit-details-marker { display: none; }
.tid { font: 600 .85rem "Sora", sans-serif; color: var(--primary); }
.tname { font-weight: 600; }
.tname small { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; }

/* status badge text driven by data-status */
details.task .badge::after { content: "Not started"; }
details.task[data-status="approval"] .badge { color: var(--violet); }
details.task[data-status="approval"] .badge::after { content: "Awaiting approval"; }
details.task[data-status="in-progress"] .badge { color: var(--primary); }
details.task[data-status="in-progress"] .badge::after { content: "In progress"; }
details.task[data-status="review"] .badge { color: var(--warn); }
details.task[data-status="review"] .badge::after { content: "In review"; }
details.task[data-status="changes"] .badge { color: var(--danger); }
details.task[data-status="changes"] .badge::after { content: "Changes requested"; }
details.task[data-status="done"] .badge { color: var(--progress); }
details.task[data-status="done"] .badge::after { content: "Approved · done"; }
details.task[data-status="blocked"] .badge { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
details.task[data-status="blocked"] .badge::after { content: "Blocked"; }
details.task:not([data-status]) .badge, details.task[data-status="not-started"] .badge { color: var(--muted); }

.task-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 14px 0 0; font-size: .9rem; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
.note { border-left: 3px solid var(--pink); padding: 6px 12px; background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: .9rem; margin-top: 12px; }

ol.cases { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
ol.cases li {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: start;
  padding: 7px 10px; border-radius: 8px; background: var(--surface-2); font-size: .9rem;
}
ol.cases li > b { font: 600 .78rem/1.9 "Sora", sans-serif; color: var(--muted); }
ol.cases li::after {
  content: "Not run"; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; align-self: center;
}
ol.cases li[data-r="pass"]::after { content: "Pass"; color: var(--progress); border-color: currentColor; }
ol.cases li[data-r="fail"]::after { content: "Fail"; color: var(--danger); border-color: currentColor; }
ol.cases li[data-r="na"]::after { content: "N/A"; }

/* Handoff log */
ol.log { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
ol.log li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); font-size: .9rem; }
ol.log li > b { font: 600 .78rem/1.9 "Sora", sans-serif; color: var(--muted); }
.note a { font-weight: 600; }

/* Reports */
.report { border-left: 4px solid var(--progress); }
.report.template { border-left-color: var(--line); opacity: .85; }
.report dl.meta { margin-top: 6px; }

/* Placeholder sample */
.ph {
  display: inline-grid; place-items: center; width: 120px; height: 80px;
  border: 2px dashed var(--muted); border-radius: 12px; color: var(--muted);
  font: 600 .8rem "Sora", sans-serif; background: repeating-linear-gradient(45deg, transparent 0 8px, var(--surface-2) 8px 16px);
}

footer { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); padding-top: 16px; }

@media (max-width: 560px) {
  h1 { font-size: 1.5rem; }
  .modbar { grid-template-columns: 1fr 48px; }
  .modbar .bar { grid-column: 1 / -1; grid-row: 2; }
  details.task > summary { grid-template-columns: 40px 1fr; }
  details.task > summary .badge { grid-column: 2; justify-self: start; }
  ol.cases li { grid-template-columns: 40px 1fr; }
  ol.cases li::after { grid-column: 2; justify-self: start; }
  dl.meta { grid-template-columns: 1fr; }
  dl.meta dt { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
