/* ============================================================================
   DPDP Comply — customer demo
   Self-contained stylesheet. No build step, no external fonts, no CDN.
   Palette mirrors src/app/globals.css (indigo primary / cyan accent).
   ========================================================================== */

:root {
  --bg: hsl(210 40% 98%);
  --fg: hsl(222.2 84% 4.9%);
  --card: hsl(0 0% 100%);
  --muted: hsl(210 40% 96.1%);
  --muted-fg: hsl(215.4 16.3% 46.9%);
  --primary: hsl(243.4 75.4% 58.6%);
  --primary-soft: hsl(243.4 75.4% 58.6% / 0.1);
  --primary-fg: #fff;
  --accent: hsl(187.2 85.7% 53.3%);
  --accent-soft: hsl(187.2 85.7% 53.3% / 0.14);
  --border: hsl(214.3 31.8% 91.4%);
  --danger: hsl(0 72.2% 50.6%);
  --danger-soft: hsl(0 72.2% 50.6% / 0.1);
  --warn: hsl(38 92% 50%);
  --warn-soft: hsl(38 92% 50% / 0.13);
  --ok: hsl(160 84% 39%);
  --ok-soft: hsl(160 84% 39% / 0.12);
  --sidebar: hsl(243.5 47.1% 13.1%);
  --sidebar-fg: hsl(210 40% 98%);
  --sidebar-border: hsl(243.8 30.3% 23.7%);
  --sidebar-hover: hsl(243.8 30.3% 23.7%);
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow: 0 4px 16px rgb(15 23 42 / 0.08);
  --shadow-lg: 0 18px 50px rgb(15 23 42 / 0.14);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Widget accent. Must live at :root, not on .dpdp-banner — the age gate,
     preferences panel and guardian flow render as siblings of the banner, and
     a .dpdp-btn-primary that cannot resolve this is white-on-white. */
  --dpdp-primary: #4f46e5;
}

:root[data-theme="dark"] {
  --dpdp-primary: #6366f1;
  --bg: hsl(222.2 84% 4.9%);
  --fg: hsl(210 40% 98%);
  --card: hsl(222.2 47.4% 6.2%);
  --muted: hsl(217.2 32.6% 17.5%);
  --muted-fg: hsl(215 20.2% 65.1%);
  --primary: hsl(238.7 83.5% 66.7%);
  --primary-soft: hsl(238.7 83.5% 66.7% / 0.16);
  --border: hsl(217.2 32.6% 17.5%);
  --sidebar: hsl(243.5 47.1% 9%);
  --shadow: 0 4px 16px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 18px 50px rgb(0 0 0 / 0.5);
}

* { box-sizing: border-box; }

/* Overlays below set an explicit `display`, which outranks the [hidden]
   attribute's UA default — without this they stay invisible but keep
   swallowing clicks. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--primary); }

/* ---------------------------------------------------------------- layout */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 290px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-head {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; stroke: #fff; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; opacity: 0.6; letter-spacing: 0.04em; text-transform: uppercase; }

.progress-wrap { margin-top: 16px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11px; opacity: 0.6; margin-bottom: 6px; }
.progress-track { height: 4px; border-radius: 999px; background: var(--sidebar-border); overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); width: 0; transition: width 0.35s ease; }

.nav { flex: 1; padding: 12px 10px 24px; }
.nav-act {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  opacity: 0.45; padding: 14px 10px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px;
  background: none; border: 0; cursor: pointer;
  color: inherit; font: inherit; font-size: 13.5px;
  transition: background 0.15s;
}
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 550; }
.nav-num {
  width: 21px; height: 21px; border-radius: 6px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 650; font-family: var(--mono);
  background: var(--sidebar-border); color: var(--sidebar-fg);
}
.nav-item.active .nav-num { background: rgb(255 255 255 / 0.22); }
.nav-item.seen .nav-num { background: var(--ok); color: #05261b; }
.nav-item.active.seen .nav-num { background: rgb(255 255 255 / 0.22); color: #fff; }
.nav-label { flex: 1; min-width: 0; }
.nav-sec { font-size: 10px; font-family: var(--mono); opacity: 0.5; flex-shrink: 0; }
.nav-item.active .nav-sec { opacity: 0.85; }

.sidebar-foot {
  padding: 12px 16px 18px; border-top: 1px solid var(--sidebar-border);
  font-size: 11px; opacity: 0.55; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.sidebar-foot button {
  background: none; border: 1px solid var(--sidebar-border); color: inherit;
  border-radius: 6px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: 11px;
}
.sidebar-foot button:hover { background: var(--sidebar-hover); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 32px;
  display: flex; align-items: center; gap: 14px;
}
.topbar-crumb { font-size: 12.5px; color: var(--muted-fg); flex: 1; min-width: 0; }
.topbar-crumb b { color: var(--fg); font-weight: 600; }
.menu-toggle { display: none; }

.stage-area { padding: 34px 32px 90px; max-width: 1120px; width: 100%; margin: 0 auto; }

/* ---------------------------------------------------------------- chapter */

.chapter { display: none; animation: rise 0.3s ease; }
.chapter.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.ch-head { margin-bottom: 26px; }
.ch-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-soft);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 14px;
}
.ch-title { font-size: 30px; margin-bottom: 10px; }
.ch-lede { font-size: 16.5px; color: var(--muted-fg); max-width: 74ch; }

/* the two-column body: stage on the left, law rail on the right */
.ch-body { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 24px; align-items: start; }
@media (max-width: 1080px) { .ch-body { grid-template-columns: minmax(0, 1fr); } }

.rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 78px; }
@media (max-width: 1080px) { .rail { position: static; } }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600;
}
.card-head .icon { width: 15px; height: 15px; stroke: var(--muted-fg); flex-shrink: 0; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 12px 16px; }

.rail-card { border-left: 3px solid var(--primary); }
.rail-card .card-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-fg); }
.rail-card.law { border-left-color: var(--primary); }
.rail-card.recorded { border-left-color: var(--ok); }
.rail-card.caution { border-left-color: var(--warn); }
.rail-quote { font-size: 13.5px; line-height: 1.6; }
.rail-quote em { color: var(--muted-fg); font-style: normal; }
.rail-src { margin-top: 9px; font-size: 11px; color: var(--muted-fg); font-family: var(--mono); }

.sec-pill {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
  padding: 2px 7px; border-radius: 5px;
}

/* ---------------------------------------------------------------- generic bits */

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat { background: var(--muted); border-radius: 10px; padding: 13px 14px; }
.stat-val { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-lab { font-size: 11.5px; color: var(--muted-fg); margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--muted); color: var(--muted-fg); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: hsl(32 85% 40%); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.badge.accent { background: var(--accent-soft); color: hsl(187 80% 32%); }
:root[data-theme="dark"] .badge.warn { color: var(--warn); }
:root[data-theme="dark"] .badge.accent { color: var(--accent); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer;
  background: var(--primary); color: var(--primary-fg);
  transition: filter 0.15s, opacity 0.15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn.ghost:hover:not(:disabled) { background: var(--muted); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; }

.hint { font-size: 12.5px; color: var(--muted-fg); }
.hint.center { text-align: center; }
.mono { font-family: var(--mono); font-size: 12px; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13px; align-items: baseline; }
.kv dt { color: var(--muted-fg); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
/* Block + absolute icon rather than flex: list items carry arbitrary inline
   markup (<b>, <a>, <span class="mono">), and each of those would otherwise
   become its own flex column. */
.list li { display: block; position: relative; padding-left: 25px; font-size: 13.5px; }
.list li svg { position: absolute; left: 0; top: 4px; width: 15px; height: 15px; stroke: var(--ok); }
.list.plain li svg { stroke: var(--primary); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted-fg); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border);
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
.tbl-scroll { overflow-x: auto; }
/* Many-column tables of short values: size to content and scroll, instead of
   squeezing the last columns into unreadable slivers. Prose-heavy tables are
   left to wrap normally. */
.tbl-scroll.wide > table.tbl { width: max-content; min-width: 100%; }
.tbl-scroll.wide > table.tbl td, .tbl-scroll.wide > table.tbl th { white-space: nowrap; }
.tbl-scroll.wide > table.tbl td .chips { flex-wrap: nowrap; }

/* ---------------------------------------------------------------- browser mock */

.browser {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow);
}
.browser-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; background: var(--muted); border-bottom: 1px solid var(--border);
}
.browser-dots { display: flex; gap: 5px; }
.browser-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--border); display: block; }
.browser-url {
  flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-family: var(--mono); font-size: 11.5px; color: var(--muted-fg);
  display: flex; align-items: center; gap: 6px;
}
.browser-url svg { width: 11px; height: 11px; stroke: var(--ok); }
.browser-viewport { position: relative; min-height: 320px; background: var(--bg); overflow: hidden; }

/* fake retail site behind the banner */
.site { padding: 0; filter: none; transition: filter 0.3s; }
.site.blurred { filter: blur(3px) saturate(0.6); pointer-events: none; }
.site-nav {
  display: flex; align-items: center; gap: 18px; padding: 14px 22px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.site-logo { font-weight: 700; letter-spacing: -0.02em; font-size: 15px; color: var(--fg); }
.site-logo span { color: var(--primary); }
.site-nav a { color: var(--muted-fg); text-decoration: none; font-size: 12.5px; }
.site-hero { padding: 30px 22px; }
.site-hero h4 { font-size: 21px; margin-bottom: 6px; }
.site-hero p { color: var(--muted-fg); font-size: 13.5px; }
.site-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 22px 26px; }
.site-tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.site-tile .ph { height: 62px; background: linear-gradient(135deg, var(--muted), var(--border)); }
.site-tile .cap { padding: 8px 10px; font-size: 11.5px; color: var(--muted-fg); }

/* ---------------------------------------------------------------- consent banner replica
   Mirrors widget/src/styles.ts so what the customer sees here is what ships. */

.dpdp-overlay {
  position: absolute; inset: 0; background: rgb(0 0 0 / 0.35);
  display: grid; place-items: center; padding: 18px; z-index: 5;
}
.dpdp-banner {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: calc(100% - 28px); max-width: 620px; z-index: 10;
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  animation: rise 0.3s ease;
}
.dpdp-inner {
  background: #fff; color: #111827; border: 1px solid #e5e7eb;
  border-radius: 10px; padding: 18px 20px;
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.18);
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
}
:root[data-theme="dark"] .dpdp-inner { background: #1f2937; color: #f9fafb; border-color: #374151; }
.dpdp-header-row { width: 100%; display: flex; justify-content: flex-end; }
.dpdp-lang-toggle { display: flex; align-items: center; gap: 3px; font-size: 11px; opacity: 0.65; }
.dpdp-lang-btn {
  background: none; border: 0; cursor: pointer; font: inherit; font-size: 11px;
  padding: 2px 5px; border-radius: 4px; color: inherit;
}
.dpdp-lang-btn.dpdp-lang-active { font-weight: 700; background: rgb(0 0 0 / 0.07); }
:root[data-theme="dark"] .dpdp-lang-btn.dpdp-lang-active { background: rgb(255 255 255 / 0.12); }
.dpdp-content { flex: 1; min-width: 220px; }
.dpdp-title { margin: 0 0 5px; font-size: 15px; font-weight: 600; }
.dpdp-desc { margin: 0; font-size: 13px; opacity: 0.82; }
.dpdp-link { color: var(--dpdp-primary); text-decoration: underline; cursor: pointer; }
.dpdp-link-sep { opacity: 0.4; margin: 0 3px; }
.dpdp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dpdp-btn {
  padding: 8px 15px; border-radius: 6px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 0; font-family: inherit; white-space: nowrap;
}
.dpdp-btn:hover { opacity: 0.87; }
.dpdp-btn-primary { background: var(--dpdp-primary); color: #fff; }
.dpdp-btn-outline { background: transparent; border: 1px solid currentColor; opacity: 0.72; color: inherit; }

/* preferences panel */
.dpdp-prefs { position: absolute; inset: 0; z-index: 20; background: rgb(0 0 0 / 0.5); display: grid; place-items: center; padding: 14px; }
.dpdp-prefs-inner {
  background: #fff; color: #111827; border-radius: 10px;
  width: min(520px, 100%); max-height: 100%; overflow-y: auto;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25); display: flex; flex-direction: column;
}
:root[data-theme="dark"] .dpdp-prefs-inner { background: #1f2937; color: #f9fafb; }
.dpdp-prefs-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e5e7eb; }
:root[data-theme="dark"] .dpdp-prefs-header { border-color: #374151; }
.dpdp-prefs-header h3 { font-size: 15px; }
.dpdp-close { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; opacity: 0.5; color: inherit; }
.dpdp-purposes { padding: 14px 20px; display: flex; flex-direction: column; gap: 12px; }
.dpdp-purpose { padding: 13px; border: 1px solid #e5e7eb; border-radius: 8px; }
:root[data-theme="dark"] .dpdp-purpose { border-color: #374151; }
.dpdp-purpose.locked { opacity: 0.72; }
.dpdp-purpose-label { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 13.5px; cursor: pointer; }
.dpdp-checkbox { width: 16px; height: 16px; accent-color: var(--dpdp-primary); cursor: pointer; }
.dpdp-required { font-size: 10.5px; background: #f3f4f6; color: #6b7280; padding: 2px 7px; border-radius: 4px; margin-left: auto; }
:root[data-theme="dark"] .dpdp-required { background: #374151; color: #d1d5db; }
.dpdp-purpose-desc { margin: 5px 0 0; font-size: 12px; opacity: 0.72; }
.dpdp-third-parties { margin: 5px 0 0; font-size: 11px; opacity: 0.55; font-family: var(--mono); }
.dpdp-blocked-note {
  margin: 7px 0 0; font-size: 11px; padding: 5px 8px; border-radius: 5px;
  background: hsl(0 72% 50% / 0.09); color: hsl(0 65% 42%);
}
.dpdp-prefs-footer { padding: 14px 20px; border-top: 1px solid #e5e7eb; }
:root[data-theme="dark"] .dpdp-prefs-footer { border-color: #374151; }
.dpdp-prefs-footer .dpdp-btn { width: 100%; }

/* age gate */
.gate-inner {
  background: #fff; color: #111827; border-radius: 12px; padding: 24px;
  width: min(400px, 100%); box-shadow: 0 20px 60px rgb(0 0 0 / 0.3); text-align: center;
}
:root[data-theme="dark"] .gate-inner { background: #1f2937; color: #f9fafb; }
.gate-inner h3 { font-size: 17px; margin-bottom: 7px; }
.gate-inner p { font-size: 13px; opacity: 0.75; margin-bottom: 18px; }
.gate-actions { display: flex; gap: 9px; flex-direction: column; }

/* ---------------------------------------------------------------- dashboard mock */

.dash { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--card); }
.dash-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--sidebar); color: var(--sidebar-fg); font-size: 12.5px;
}
.dash-bar .brand-mark { width: 22px; height: 22px; border-radius: 6px; }
.dash-bar .brand-mark svg { width: 12px; height: 12px; }
.dash-bar .path { opacity: 0.62; font-family: var(--mono); font-size: 11px; }
.dash-bar .spacer { flex: 1; }
.dash-bar .who { display: flex; align-items: center; gap: 7px; opacity: 0.85; }
.dash-bar .avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary);
  display: grid; place-items: center; font-size: 10px; font-weight: 650;
}
.dash-body { padding: 16px; }

/* ---------------------------------------------------------------- code / json */

.code {
  background: hsl(222 47% 8%); color: hsl(210 40% 92%);
  border-radius: 9px; padding: 13px 15px; overflow-x: auto;
  font-family: var(--mono); font-size: 11.8px; line-height: 1.65; margin: 0;
  border: 1px solid hsl(217 33% 20%);
}
.code .k { color: hsl(187 86% 63%); }
.code .s { color: hsl(95 45% 68%); }
.code .n { color: hsl(43 96% 66%); }
.code .c { color: hsl(215 16% 50%); font-style: italic; }
.code .hl { background: hsl(43 96% 56% / 0.16); border-radius: 3px; }
.code .bad { color: hsl(0 80% 68%); background: hsl(0 72% 50% / 0.16); border-radius: 3px; }

.console {
  background: hsl(222 47% 8%); border: 1px solid hsl(217 33% 20%); border-radius: 9px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
  max-height: 210px; overflow-y: auto;
}
.console-head {
  padding: 7px 12px; border-bottom: 1px solid hsl(217 33% 20%);
  color: hsl(215 16% 58%); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  display: flex; align-items: center; gap: 7px; position: sticky; top: 0; background: hsl(222 47% 8%);
}
.console-lines { padding: 9px 12px; color: hsl(210 40% 88%); }
.console-lines div { animation: rise 0.25s ease; }
.console-lines .t { color: hsl(215 16% 48%); }
.console-lines .g { color: hsl(160 70% 60%); }
.console-lines .r { color: hsl(0 80% 68%); }
.console-lines .y { color: hsl(43 96% 66%); }
.console-lines .b { color: hsl(187 86% 63%); }

/* ---------------------------------------------------------------- chain viz */

.chain { display: flex; flex-direction: column; gap: 0; }
.chain-row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--card);
  position: relative; transition: border-color 0.2s, background 0.2s;
}
.chain-row + .chain-row { margin-top: 16px; }
.chain-row + .chain-row::before {
  content: ""; position: absolute; left: 26px; top: -16px; height: 16px; width: 2px; background: var(--border);
}
.chain-seq {
  width: 30px; height: 30px; border-radius: 8px; background: var(--muted);
  display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 650;
}
.chain-main { min-width: 0; }
.chain-act { font-size: 13px; font-weight: 550; }
.chain-hash { font-family: var(--mono); font-size: 10.5px; color: var(--muted-fg); margin-top: 2px; }
.chain-row.tampered { border-color: var(--danger); background: var(--danger-soft); }
.chain-row.tampered .chain-seq { background: var(--danger); color: #fff; }
.chain-row.broken { border-color: var(--warn); background: var(--warn-soft); }
.chain-row.editing { border-color: var(--primary); }
.chain-edit {
  width: 100%; margin-top: 6px; font-family: var(--mono); font-size: 11.5px;
  padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg);
}

.verdict {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 9px;
  font-size: 13.5px; font-weight: 550;
}
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: var(--danger-soft); color: var(--danger); }
.verdict svg { width: 18px; height: 18px; stroke: currentColor; flex-shrink: 0; }

/* ---------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-bottom: 16px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -21px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
  border: 2px solid var(--card); box-shadow: 0 0 0 2px var(--primary);
}
.timeline li.done::before { background: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.timeline li.pending::before { background: var(--card); box-shadow: 0 0 0 2px var(--border); }
.timeline li.alert::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.tl-when { font-size: 11px; color: var(--muted-fg); font-family: var(--mono); }
.tl-what { font-size: 13.5px; font-weight: 550; margin-top: 1px; }
.tl-note { font-size: 12.5px; color: var(--muted-fg); margin-top: 2px; }

/* ---------------------------------------------------------------- steps / wizard */

.steps { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.step {
  flex: 1; min-width: 96px; padding: 8px 10px; border-radius: 8px;
  background: var(--muted); font-size: 11.5px; color: var(--muted-fg);
  border-top: 2px solid var(--border);
}
.step.active { background: var(--primary-soft); color: var(--primary); border-top-color: var(--primary); font-weight: 600; }
.step.done { background: var(--ok-soft); color: var(--ok); border-top-color: var(--ok); }
.step-n { font-family: var(--mono); font-size: 10px; opacity: 0.8; display: block; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 550; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font: inherit; font-size: 13.5px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.field .help { font-size: 11.5px; color: var(--muted-fg); margin-top: 4px; }

.otp-row { display: flex; gap: 8px; }
.otp-row input {
  width: 44px; height: 52px; text-align: center; font-family: var(--mono); font-size: 20px; font-weight: 650;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--fg);
}

.radio-cards { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.radio-card {
  border: 1px solid var(--border); border-radius: 9px; padding: 12px 13px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s; background: var(--card);
}
.radio-card:hover { border-color: var(--primary); }
.radio-card.sel { border-color: var(--primary); background: var(--primary-soft); }
.radio-card .rc-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.radio-card .rc-desc { font-size: 12px; color: var(--muted-fg); margin-top: 4px; }

/* ---------------------------------------------------------------- toggles */

.switch-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
}
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row .sr-main { flex: 1; min-width: 0; }
.switch-row .sr-title { font-size: 13.5px; font-weight: 550; }
.switch-row .sr-desc { font-size: 12px; color: var(--muted-fg); }
.switch {
  width: 38px; height: 22px; border-radius: 999px; background: var(--border);
  border: 0; cursor: pointer; position: relative; flex-shrink: 0; transition: background 0.18s; padding: 0;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform 0.18s; box-shadow: var(--shadow-sm);
}
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

/* ---------------------------------------------------------------- scan animation */

.scan-list { display: flex; flex-direction: column; gap: 7px; }
.scan-item {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  animation: rise 0.25s ease;
}
.scan-item .ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--muted); font-size: 11px; font-family: var(--mono); font-weight: 650; }
.scan-item .nm { font-weight: 550; }
.scan-item .dm { font-size: 11px; color: var(--muted-fg); font-family: var(--mono); }
.scanning-bar { height: 3px; border-radius: 999px; background: var(--muted); overflow: hidden; margin-bottom: 12px; }
.scanning-bar i { display: block; height: 100%; width: 30%; background: var(--primary); animation: sweep 1.1s infinite ease-in-out; }
@keyframes sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }

/* ---------------------------------------------------------------- misc */

.callout {
  display: flex; gap: 11px; padding: 12px 14px; border-radius: 9px;
  background: var(--accent-soft); font-size: 13px; align-items: flex-start;
}
.callout svg { width: 16px; height: 16px; stroke: hsl(187 80% 34%); flex-shrink: 0; margin-top: 2px; }
:root[data-theme="dark"] .callout svg { stroke: var(--accent); }
.callout.warn { background: var(--warn-soft); }
.callout.warn svg { stroke: hsl(32 85% 40%); }
:root[data-theme="dark"] .callout.warn svg { stroke: var(--warn); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11.5px; padding: 3px 9px; border-radius: 6px;
  background: var(--muted); color: var(--muted-fg); font-family: var(--mono);
}

.footer-nav {
  position: fixed; bottom: 0; left: 290px; right: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  padding: 11px 32px; display: flex; align-items: center; gap: 12px;
}
.footer-nav .spacer { flex: 1; }
.footer-nav .fn-hint { font-size: 11.5px; color: var(--muted-fg); }
.footer-nav kbd {
  font-family: var(--mono); font-size: 10.5px; background: var(--muted);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px;
}

/* ---------------------------------------------------------------- cover */

.cover { text-align: center; padding: 30px 0 10px; }
.cover h1 { font-size: 40px; letter-spacing: -0.03em; margin-bottom: 14px; }
.cover .ch-lede { margin: 0 auto 26px; font-size: 17px; }
.cover-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 13px; text-align: left; margin-top: 26px; }
.cover-tile { padding: 15px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); }
.cover-tile .ct-sec { font-family: var(--mono); font-size: 11px; color: var(--primary); font-weight: 650; }
.cover-tile .ct-t { font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.cover-tile .ct-d { font-size: 12px; color: var(--muted-fg); margin-top: 3px; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .footer-nav { left: 0; }
  .stage-area { padding: 24px 18px 90px; }
  .topbar { padding: 10px 18px; }
  .ch-title { font-size: 25px; }
  .cover h1 { font-size: 30px; }
  .site-tiles { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .sidebar, .topbar, .footer-nav { display: none; }
  .chapter { display: block !important; page-break-after: always; }
}
