/* ============================================================
   The Interaction Atlas — case studies (standalone explainer pages).

   Surface accent comes from --cs-accent (set inline per section via
   applyTheme); everything else maps onto the shared :root tokens in
   styles.css. Tier severity is shown with a symbol + colour band, never
   colour alone. Namespaced `cs-` throughout so nothing collides with the
   in-app screens.
   ============================================================ */

/* ── Full-bleed mode: hide the app shell on /case-stud* routes ───────── */
body.cs-mode {
  padding-top: 0;
  padding-bottom: 0;
}
body.cs-mode #taskbar,
body.cs-mode #sidebar,
body.cs-mode #sidebar-backdrop,
body.cs-mode #nav-bar {
  display: none !important;
}
body.cs-mode #app {
  max-width: none;
  margin: 0;
  padding: 0;
}

.cs-page {
  --cs-accent: var(--c-brand-2);
  --cs-accent-soft: var(--c-brand-soft);
  --cs-accent-strong: var(--c-brand);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: var(--font-sans);
  min-height: 100vh;
}
.cs-page section {
  scroll-margin-top: 64px;
}

/* ── Nav ─────────────────────────────────────────────────────────────── */
.cs-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 5vw, 48px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border);
}
.cs-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-decoration: none;
}
.cs-wordmark:hover { text-decoration: none; }
.cs-wordmark-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--c-brand);
}
.cs-wordmark-edition { color: var(--cs-accent); }
.cs-wordmark-by {
  font-size: 11px;
  color: var(--c-text-soft);
}
.cs-nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.cs-nav-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.cs-nav-link:hover { color: var(--cs-accent); text-decoration: none; }
.cs-demo-btn {
  background: var(--cs-accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.cs-demo-btn:hover { background: var(--cs-accent-strong); text-decoration: none; }

/* ── Hero ────────────────────────────────────────────────────────────── */
.cs-hero,
.cs-index-hero {
  background:
    radial-gradient(1200px 420px at 14% -10%, var(--cs-accent-soft), transparent 60%),
    var(--c-surface);
  padding: clamp(40px, 7vw, 80px) clamp(16px, 5vw, 48px) clamp(32px, 5vw, 56px);
  border-bottom: 1px solid var(--c-border);
}
.cs-hero-inner {
  max-width: 920px;
  margin: 0 auto;
}
.cs-eyebrow {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cs-accent);
  background: var(--cs-accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
}
.cs-hero-title {
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.08;
  font-weight: 800;
  color: var(--c-brand);
  margin: 18px 0 0;
  letter-spacing: -0.02em;
}
.cs-hero-title em {
  font-style: normal;
  color: var(--cs-accent);
}
.cs-lede {
  font-size: clamp(16px, 2.2vw, 20px);
  line-height: 1.55;
  color: var(--c-text-muted);
  margin: 16px 0 0;
  max-width: 760px;
}
.cs-person-chip {
  display: inline-block;
  margin-top: 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text-muted);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  padding: 7px 14px;
  border-radius: 999px;
}
.cs-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
}
.cs-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 220px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--c-text-muted);
  font-weight: 500;
}
.cs-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--cs-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* ── Sections ────────────────────────────────────────────────────────── */
.cs-section {
  padding: clamp(40px, 6vw, 72px) clamp(16px, 5vw, 48px);
  max-width: 980px;
  margin: 0 auto;
}
.cs-section-grey {
  background: var(--c-bg);
  border-block: 1px solid var(--c-border);
}
.cs-section-inner {
  padding: clamp(40px, 6vw, 72px) clamp(16px, 5vw, 48px);
  max-width: 980px;
  margin: 0 auto;
}
.cs-h2 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  color: var(--c-brand);
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}
.cs-prose {
  font-size: 16px;
  line-height: 1.65;
  color: var(--c-text-muted);
  margin: 0 0 14px;
}

/* ── Contrast (without vs with) ──────────────────────────────────────── */
.cs-contrast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 720px) {
  .cs-contrast-grid { grid-template-columns: 1fr; }
}
.cs-contrast-card {
  border-radius: 14px;
  padding: 22px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
}
.cs-contrast-left {
  border-color: var(--c-tier-4-bg);
  background: linear-gradient(180deg, var(--c-tier-5-bg) 0%, var(--c-surface) 60%);
}
.cs-contrast-right {
  border-color: var(--cs-accent);
  background: linear-gradient(180deg, var(--cs-accent-soft) 0%, var(--c-surface) 60%);
}
.cs-contrast-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--c-text);
}
.cs-contrast-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cs-contrast-list li {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--c-text-muted);
}

/* ── Flags (tiered cards) ────────────────────────────────────────────── */
.cs-flag-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cs-flag-card {
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-border-strong);
  border-radius: 12px;
  padding: 18px 20px;
  background: var(--c-surface);
}
.cs-flag-card[data-tier="6"] { border-left-color: var(--c-tier-6); }
.cs-flag-card[data-tier="5"] { border-left-color: var(--c-tier-5); }
.cs-flag-card[data-tier="4"] { border-left-color: var(--c-tier-4); }
.cs-flag-card[data-tier="3"] { border-left-color: var(--c-tier-3); }
.cs-flag-card[data-tier="2"] { border-left-color: var(--c-tier-2); }
.cs-flag-card[data-tier="1"] { border-left-color: var(--c-tier-1); }
.cs-flag-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cs-flag-icon { font-size: 16px; }
.cs-flag-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--c-text);
  margin: 0;
  flex: 1;
}
.cs-flag-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-text-muted);
  margin: 12px 0 0;
}
.cs-flag-footer {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-muted);
  background: var(--c-surface-2);
  border-radius: 8px;
  padding: 8px 12px;
}
.cs-evidence {
  margin-top: 12px;
  border-top: 1px dashed var(--c-border);
  padding-top: 10px;
}
.cs-evidence-head {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--cs-accent);
}
.cs-evidence-caret {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  font-weight: 700;
}
.cs-evidence-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-text-muted);
  margin: 10px 0 0;
}

/* ── Walkthrough — interactive step-by-step stepper ──────────────────── */
.cs-stepper {
  margin-top: 8px;
}
.cs-stepper-progress {
  margin-bottom: 22px;
}
.cs-stepper-meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--c-text-soft);
  margin-bottom: 8px;
}
.cs-stepper-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--c-surface-2);
  overflow: hidden;
}
.cs-stepper-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--cs-accent);
  transition: width 0.35s ease;
}

.cs-stepper-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cs-stepper-step {
  position: relative;
  padding-bottom: 6px;
}
/* vertical connector between step nodes */
.cs-stepper-step::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 42px;
  bottom: -2px;
  width: 2px;
  background: var(--c-border);
  z-index: 0;
}
.cs-stepper-step:last-of-type::before {
  display: none;
}
.cs-stepper-step.is-done::before {
  background: var(--c-tier-1);
}

.cs-stepper-head {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
}
.cs-stepper-num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 0 0 4px var(--c-surface);
  transition: background 0.2s ease, color 0.2s ease;
}
.cs-stepper-step.is-upcoming .cs-stepper-num {
  background: var(--c-surface-2);
  color: var(--c-text-soft);
  box-shadow: 0 0 0 4px var(--c-surface), inset 0 0 0 1px var(--c-border);
}
.cs-stepper-step.is-active .cs-stepper-num {
  background: var(--cs-accent);
  color: #fff;
}
.cs-stepper-step.is-done .cs-stepper-num {
  background: var(--c-tier-1);
  color: #fff;
}
.cs-stepper-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.35;
}
.cs-stepper-step.is-upcoming .cs-stepper-title {
  font-weight: 600;
  color: var(--c-text-soft);
}
.cs-stepper-head:hover .cs-stepper-title {
  color: var(--cs-accent);
}

.cs-stepper-panel {
  margin: 4px 0 6px 56px;
  animation: cs-step-in 0.22s ease;
}
@keyframes cs-step-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.cs-stepper-detail {
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-text-muted);
  margin: 0;
}
.cs-stepper-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.cs-stepper-next {
  background: var(--cs-accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.cs-stepper-next:hover {
  background: var(--cs-accent-strong);
}
.cs-stepper-back {
  background: none;
  border: 0;
  color: var(--c-text-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 8px;
  cursor: pointer;
}
.cs-stepper-back:hover {
  color: var(--cs-accent);
}

/* completion banner */
.cs-stepper-done {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 12px;
  padding: 18px 20px;
  border: 1px solid var(--cs-accent);
  background: var(--cs-accent-soft);
  border-radius: 14px;
}
.cs-stepper-done-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--c-tier-1);
  color: #fff;
  font-weight: 800;
}
.cs-stepper-done-body { flex: 1; }
.cs-stepper-done-body strong {
  color: var(--c-text);
  font-size: 15.5px;
}
.cs-stepper-done-body .cs-stepper-detail {
  margin-top: 4px;
}
.cs-stepper-restart {
  flex-shrink: 0;
  align-self: center;
  background: none;
  border: 1px solid var(--cs-accent);
  color: var(--cs-accent);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.cs-stepper-restart:hover {
  background: var(--cs-accent);
  color: #fff;
}

/* deep-link pill (reused inside the active step panel) */
.cs-walk-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cs-accent);
  background: var(--cs-accent-soft);
  border: 1px solid transparent;
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}
.cs-walk-link:hover {
  text-decoration: none;
  border-color: var(--cs-accent);
}

@media (max-width: 540px) {
  .cs-stepper-panel { margin-left: 0; }
}

/* ── Tier pill ───────────────────────────────────────────────────────── */
.cs-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.cs-pill-sym { font-size: 11px; }
.cs-pill[data-tier="1"] { background: var(--c-tier-1-bg); color: var(--c-tier-1); border-color: var(--c-tier-1); }
.cs-pill[data-tier="2"] { background: var(--c-tier-2-bg); color: var(--c-tier-2); border-color: var(--c-tier-2); }
.cs-pill[data-tier="3"] { background: var(--c-tier-3-bg); color: var(--c-tier-3); border-color: var(--c-tier-3); }
.cs-pill[data-tier="4"] { background: var(--c-tier-4-bg); color: var(--c-tier-4); border-color: var(--c-tier-4); }
.cs-pill[data-tier="5"] { background: var(--c-tier-5-bg); color: var(--c-tier-5); border-color: var(--c-tier-5); }
.cs-pill[data-tier="6"] { background: var(--c-tier-6-bg); color: var(--c-tier-6); border-color: var(--c-tier-6); }

/* ============================================================
   Click-through demo — mock "phone" + step controls
   ============================================================ */
.cs-demo {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
  margin-top: 22px;
}
@media (max-width: 800px) {
  .cs-demo { grid-template-columns: 1fr; gap: 24px; }
}
.cs-demo-screen-col { display: flex; justify-content: center; }
.cs-demo-stage { width: 100%; display: flex; justify-content: center; }

/* the device */
.cs-phone {
  width: 340px;
  max-width: 100%;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cs-phone-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--c-brand);
  color: #fff;
  padding: 14px 16px;
}
.cs-phone-logo {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  font-size: 14px;
}
.cs-phone-name { font-weight: 600; font-size: 14px; }
.cs-phone-titlebar {
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}
.cs-phone-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px;
  min-height: 280px;
  background: var(--c-bg);
  animation: cs-screen-in 0.24s ease;
}
@keyframes cs-screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* side: dots + caption + controls */
.cs-demo-side { padding-top: 4px; }
.cs-demo-dots { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.cs-demo-dot {
  width: 26px;
  height: 6px;
  border-radius: 999px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  padding: 0;
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}
.cs-demo-dot.is-done { background: var(--c-tier-1); border-color: var(--c-tier-1); }
.cs-demo-dot.is-cur { background: var(--cs-accent); border-color: var(--cs-accent); width: 36px; }
.cs-demo-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--c-text-soft);
  margin-bottom: 8px;
}
.cs-demo-do {
  font-size: clamp(19px, 2.4vw, 23px);
  font-weight: 800;
  color: var(--c-brand);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.cs-demo-detail {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--c-text-muted);
  margin: 0;
}
.cs-demo-controls { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.cs-demo-next {
  background: var(--cs-accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 26px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
}
.cs-demo-next:hover { background: var(--cs-accent-strong); }
.cs-demo-back {
  background: none;
  border: 0;
  color: var(--c-text-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 8px;
  cursor: pointer;
}
.cs-demo-back:hover { color: var(--cs-accent); }

/* ---- mock-screen widgets ---- */
.cs-scr-note { font-size: 13px; line-height: 1.5; color: var(--c-text-muted); margin: 0; }
.cs-scr-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--c-text-soft);
}
.cs-scr-prompt-ic { font-size: 14px; }
.cs-scr-field {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.cs-scr-field-k { color: var(--c-text-soft); }
.cs-scr-field-v { font-weight: 700; color: var(--c-text); }
.cs-scr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-scr-chip {
  background: var(--cs-accent-soft);
  color: var(--cs-accent-strong);
  border: 1px solid var(--cs-accent);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
}
.cs-scr-result {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-border-strong);
  border-radius: 10px;
  padding: 12px 14px;
}
.cs-scr-result[data-tier="6"] { border-left-color: var(--c-tier-6); }
.cs-scr-result[data-tier="5"] { border-left-color: var(--c-tier-5); }
.cs-scr-result[data-tier="4"] { border-left-color: var(--c-tier-4); }
.cs-scr-result[data-tier="3"] { border-left-color: var(--c-tier-3); }
.cs-scr-result[data-tier="2"] { border-left-color: var(--c-tier-2); }
.cs-scr-result[data-tier="1"] { border-left-color: var(--c-tier-1); }
.cs-scr-result-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cs-scr-result-ic { font-size: 13px; }
.cs-scr-result-title { flex: 1; font-size: 14px; font-weight: 700; color: var(--c-text); }
.cs-scr-result-body { font-size: 13px; line-height: 1.55; color: var(--c-text-muted); margin: 8px 0 0; }
.cs-scr-result-foot {
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-text-soft);
  background: var(--c-surface-2);
  border-radius: 6px;
  padding: 6px 8px;
}
.cs-scr-ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cs-scr-ladder-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.cs-scr-dot { flex-shrink: 0; width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; background: var(--c-tier-3); }
.cs-scr-dot[data-tier="1"] { background: var(--c-tier-1); }
.cs-scr-dot[data-tier="2"] { background: var(--c-tier-2); }
.cs-scr-dot[data-tier="3"] { background: var(--c-tier-3); }
.cs-scr-dot[data-tier="4"] { background: var(--c-tier-4); }
.cs-scr-dot[data-tier="5"] { background: var(--c-tier-5); }
.cs-scr-ladder-label { display: block; font-size: 13.5px; font-weight: 700; color: var(--c-text); }
.cs-scr-ladder-sub { display: block; font-size: 12px; color: var(--c-text-soft); margin-top: 2px; }
.cs-scr-kv {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 12px 14px;
}
.cs-scr-kv dt { font-size: 12.5px; color: var(--c-text-soft); }
.cs-scr-kv dd { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--c-text); text-align: right; }
.cs-scr-bubble {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.cs-scr-bubble-you {
  align-self: flex-end;
  margin-left: auto;
  background: var(--cs-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cs-scr-bubble-atlas {
  align-self: flex-start;
  margin-right: auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  border-bottom-left-radius: 4px;
}
.cs-scr-banner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.5;
}
.cs-scr-banner strong { font-size: 13px; }
.cs-scr-banner-success { background: var(--c-tier-1-bg); border: 1px solid var(--c-tier-1); color: #13532f; }
.cs-scr-banner-danger { background: var(--c-tier-5-bg); border: 1px solid var(--c-tier-5); color: #7f1d1d; }
.cs-scr-banner-info { background: var(--cs-accent-soft); border: 1px solid var(--cs-accent); color: var(--cs-accent-strong); }
.cs-scr-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.cs-scr-check li { display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--c-text-muted); }
.cs-scr-check-ic {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  background: var(--c-surface-2);
  color: var(--c-text-soft);
}
.cs-scr-check li.is-done { color: var(--c-text); }
.cs-scr-check li.is-done .cs-scr-check-ic { background: var(--c-tier-1); color: #fff; }
.cs-scr-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.cs-scr-list li { font-size: 13px; line-height: 1.5; color: var(--c-text-muted); }

/* ── Meters ──────────────────────────────────────────────────────────── */
.cs-meter-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
}
.cs-meter-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.cs-meter-label {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--c-text);
}
.cs-meter-caption {
  font-size: 12.5px;
  color: var(--c-text-soft);
  font-family: var(--font-mono);
}
.cs-meter-track {
  height: 12px;
  border-radius: 999px;
  background: var(--c-surface-2);
  overflow: hidden;
}
.cs-meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.cs-meter-fill[data-tone="green"] { background: var(--c-tier-1); }
.cs-meter-fill[data-tone="amber"] { background: var(--c-tier-3); }
.cs-meter-fill[data-tone="red"] { background: var(--c-tier-5); }

/* ── Stats ───────────────────────────────────────────────────────────── */
.cs-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.cs-stat-card {
  text-align: center;
  padding: 24px 16px;
  border: 1px solid var(--c-border);
  border-radius: 14px;
  background: var(--c-surface);
}
.cs-stat-value {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  color: var(--cs-accent);
  line-height: 1.1;
}
.cs-stat-label {
  font-size: 13.5px;
  color: var(--c-text-soft);
  margin-top: 10px;
  line-height: 1.4;
}

/* ── Callout ─────────────────────────────────────────────────────────── */
.cs-callout {
  border-radius: 14px;
  padding: 22px 24px;
  border: 1px solid var(--c-border);
}
.cs-callout-teal {
  background: var(--cs-accent-soft);
  border-color: var(--cs-accent);
}
.cs-callout-danger {
  background: var(--c-tier-5-bg);
  border-color: var(--c-tier-5);
}
.cs-callout-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--c-text);
}
.cs-callout-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-text-muted);
  margin: 0;
}

/* ── CTA + footer ────────────────────────────────────────────────────── */
.cs-cta-wrap {
  padding: clamp(40px, 6vw, 72px) clamp(16px, 5vw, 48px);
}
.cs-cta {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  background: linear-gradient(135deg, var(--c-brand) 0%, var(--cs-accent-strong) 100%);
  border-radius: 20px;
  padding: clamp(32px, 5vw, 56px);
  color: #fff;
}
.cs-cta-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  margin: 0;
}
.cs-cta-body {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);
  margin: 14px auto 0;
  max-width: 560px;
}
.cs-cta-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
}
.cs-cta-btn {
  background: #fff;
  color: var(--c-brand);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
}
.cs-cta-btn:hover { text-decoration: none; opacity: 0.92; }
.cs-cta-link {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.cs-cta-link:hover { text-decoration: underline; }
.cs-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding: 28px clamp(16px, 5vw, 48px);
  border-top: 1px solid var(--c-border);
  font-size: 12.5px;
  color: var(--c-text-soft);
}
.cs-footer-note { max-width: 560px; }

/* ============================================================
   Index / directory
   ============================================================ */
.cs-dir-section {
  border-top: 1px solid var(--c-border);
}
.cs-dir-section:nth-of-type(even) {
  background: var(--c-bg);
}
.cs-dir-section-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(36px, 5vw, 60px) clamp(16px, 5vw, 48px);
}
.cs-dir-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--cs-accent);
}
.cs-dir-title {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 800;
  color: var(--c-brand);
  margin: 0;
}
.cs-dir-blurb {
  font-size: 14.5px;
  color: var(--c-text-muted);
  margin: 6px 0 0;
  max-width: 640px;
}
.cs-dir-visit {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cs-accent);
  text-decoration: none;
  white-space: nowrap;
}
.cs-dir-visit:hover { text-decoration: underline; }
.cs-dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

/* ── Index cards ─────────────────────────────────────────────────────── */
.cs-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 22px;
  background: var(--c-surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.cs-card:hover {
  border-color: var(--cs-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}
.cs-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cs-card-tag {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cs-accent);
}
.cs-card-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--c-brand);
  margin: 0;
  line-height: 1.2;
}
.cs-card-tagline {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--c-text-muted);
  margin: 0;
  flex: 1;
}
.cs-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--c-border);
  padding-top: 12px;
  font-size: 13px;
  color: var(--c-text-soft);
}
.cs-card-arrow {
  font-weight: 700;
  color: var(--cs-accent);
}

/* ============================================================
   Flagship sandbox — faithful interactive app recreation
   ============================================================ */
/* hero source timeline */
.cs-tl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.cs-tl-node {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: 9px 14px;
}
.cs-tl-tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--cs-accent); }
.cs-tl-item { font-size: 14.5px; font-weight: 700; color: var(--c-text); }
.cs-tl-arrow { color: var(--c-text-soft); font-weight: 700; }

.cs-sandbox-section { max-width: 1000px; }
.cs-sandbox-try { margin-top: 14px; }

/* the app window */
.cs-app {
  border: 1px solid var(--c-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--c-bg);
  margin-top: 18px;
}
.cs-app-bar { display: flex; align-items: center; gap: 9px; background: var(--c-brand); color: #fff; padding: 13px 16px; }
.cs-app-logo { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.14); font-size: 14px; }
.cs-app-name { font-weight: 600; font-size: 14.5px; }
.cs-app-crumb { font-weight: 400; opacity: .7; }
.cs-app-demo-tag { margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 2px 9px; }
.cs-app-body { padding: clamp(14px, 2.5vw, 22px); display: flex; flex-direction: column; gap: 14px; }

/* context bar */
.cs-sb-ctx { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: 12px 14px; }
.cs-sb-ctx-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cs-sb-ctx-label { font-weight: 700; font-size: 13.5px; color: var(--c-text); }
.cs-sb-ctx-summary { font-size: 13px; color: var(--c-text-2, var(--c-text-muted)); }
.cs-sb-ctx-summary.muted { color: var(--c-text-soft); }
.cs-sb-ctx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.cs-sb-ctx-chip {
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: var(--c-surface-2); color: var(--c-text-muted);
  border: 1px solid var(--c-border); border-radius: 999px; padding: 6px 12px;
}
.cs-sb-ctx-chip:hover { border-color: var(--cs-accent); color: var(--cs-accent); }
.cs-sb-ctx-chip.is-on { background: var(--cs-accent); border-color: var(--cs-accent); color: #fff; }

/* panels */
.cs-sb-panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: 14px; }
.cs-sb-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cs-sb-panel-title { font-weight: 800; font-size: 15px; color: var(--c-brand); }
.cs-sb-panel-count, .cs-sb-panel-hint { font-size: 12px; color: var(--c-text-soft); }

/* drug cards */
.cs-sb-drugs { display: flex; flex-direction: column; gap: 8px; }
.cs-sb-drug { display: flex; align-items: center; gap: 11px; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 10px; padding: 10px 12px; }
.cs-sb-drug-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--c-brand-2); }
.cs-sb-drug[data-color="violet"] .cs-sb-drug-dot { background: #6d28d9; }
.cs-sb-drug[data-color="teal"] .cs-sb-drug-dot { background: #0f766e; }
.cs-sb-drug[data-color="orange"] .cs-sb-drug-dot { background: #c2410c; }
.cs-sb-drug-text { flex: 1; min-width: 0; }
.cs-sb-drug-name { font-weight: 700; font-size: 14px; color: var(--c-text); }
.cs-sb-drug-sub { font-size: 12px; color: var(--c-text-soft); }
.cs-sb-drug-x { color: var(--c-text-soft); font-size: 18px; line-height: 1; }
.cs-sb-add { display: flex; align-items: center; gap: 8px; margin-top: 9px; border: 1px dashed var(--c-border-strong); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--c-text-soft); }

/* overview */
.cs-sb-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--c-border); border: 1px solid var(--c-border); border-radius: 12px; overflow: hidden; }
.cs-sb-ov-cell { background: var(--c-surface); padding: 14px; text-align: center; }
.cs-sb-ov-num { font-size: 20px; font-weight: 800; color: var(--c-brand); }
.cs-sb-ov-lbl { font-size: 11.5px; color: var(--c-text-soft); margin-top: 3px; }
.cs-sb-overview[data-tier="4"] .cs-sb-ov-risk .cs-sb-ov-num { color: var(--c-tier-4); }
.cs-sb-overview[data-tier="5"] .cs-sb-ov-risk .cs-sb-ov-num { color: var(--c-tier-5); }
.cs-sb-overview[data-tier="3"] .cs-sb-ov-risk .cs-sb-ov-num { color: var(--c-tier-3); }

/* matrix */
.cs-sb-mx-wrap { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: 14px; }
.cs-sb-mx-cap { font-size: 12px; font-weight: 700; color: var(--c-text-soft); margin-bottom: 10px; }
.cs-mx { display: grid; gap: 4px; align-items: center; }
.cs-mx-corner { }
.cs-mx-col, .cs-mx-row { font-size: 11px; font-weight: 600; color: var(--c-text-muted); }
.cs-mx-col { text-align: center; }
.cs-mx-row { text-align: right; padding-right: 6px; }
.cs-mx-cell { height: 30px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: var(--c-surface-2); }
.cs-mx-cell.is-self { background: repeating-linear-gradient(45deg, var(--c-surface-2), var(--c-surface-2) 4px, var(--c-bg) 4px, var(--c-bg) 8px); }
.cs-mx-cell[data-tier="3"] { background: var(--c-tier-3); }
.cs-mx-cell[data-tier="4"] { background: var(--c-tier-4); }
.cs-mx-cell[data-tier="5"] { background: var(--c-tier-5); }
.cs-mx-cell[data-tier="6"] { background: var(--c-tier-6); }

/* pair rows */
.cs-sb-pairs { display: flex; flex-direction: column; gap: 9px; }
.cs-sb-pair { border: 1px solid var(--c-border); border-radius: 11px; overflow: hidden; background: var(--c-surface); }
.cs-sb-pair-head { display: block; width: 100%; text-align: left; background: none; border: 0; border-left: 4px solid var(--c-border-strong); padding: 13px 15px; cursor: pointer; }
.cs-sb-pair-head[data-tier="3"] { border-left-color: var(--c-tier-3); }
.cs-sb-pair-head[data-tier="4"] { border-left-color: var(--c-tier-4); }
.cs-sb-pair-head[data-tier="5"] { border-left-color: var(--c-tier-5); }
.cs-sb-pair-head[data-tier="6"] { border-left-color: var(--c-tier-6); }
.cs-sb-pair-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.cs-sb-pair-names { display: flex; align-items: center; gap: 7px; flex: 1; }
.cs-sb-pair-name { font-weight: 700; font-size: 14.5px; color: var(--c-text); }
.cs-sb-pair-plus { color: var(--c-text-soft); }
.cs-sb-pair-pin { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c-tier-5); background: var(--c-tier-5-bg); border-radius: 999px; padding: 3px 8px; }
.cs-sb-pair-tier { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 4px 10px; }
.cs-sb-pair-tier[data-tier="3"] { background: var(--c-tier-3-bg); color: var(--c-tier-3); }
.cs-sb-pair-tier[data-tier="4"] { background: var(--c-tier-4-bg); color: var(--c-tier-4); }
.cs-sb-pair-tier[data-tier="5"] { background: var(--c-tier-5-bg); color: var(--c-tier-5); }
.cs-sb-pair-tier[data-tier="6"] { background: var(--c-tier-6-bg); color: var(--c-tier-6); }
.cs-sb-pair-headline { font-size: 13.5px; color: var(--c-text-muted); margin-top: 8px; line-height: 1.45; }
.cs-sb-pair-cta { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--cs-accent); }
.cs-sb-pair-chev { font-weight: 700; }

/* expanded: wording modes + mechanism */
.cs-sb-expand { padding: 4px 15px 16px; border-top: 1px solid var(--c-border); background: var(--c-bg); }
.cs-sb-expand-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 12px; }
.cs-sb-expand-lbl { font-size: 12px; font-weight: 700; color: var(--c-text-soft); }
.cs-modeseg { display: inline-flex; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 999px; padding: 3px; }
.cs-modeseg-btn { border: 0; background: none; font-size: 12.5px; font-weight: 700; color: var(--c-text-muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.cs-modeseg-btn.is-on { background: var(--cs-accent); color: #fff; }
.cs-sb-expand-body { font-size: 14.5px; line-height: 1.6; color: var(--c-text); margin: 0; }
.cs-sb-escalated { margin-top: 12px; font-size: 12.5px; font-weight: 600; color: var(--c-tier-5); background: var(--c-tier-5-bg); border-radius: 8px; padding: 8px 11px; }
.cs-sb-mech { margin-top: 14px; }
.cs-sb-mech summary { font-size: 12.5px; font-weight: 700; color: var(--cs-accent); cursor: pointer; }
.cs-sb-mech p { font-size: 13.5px; line-height: 1.6; color: var(--c-text-muted); margin: 10px 0 0; }

@media (max-width: 560px) {
  .cs-sb-overview { grid-template-columns: 1fr; }
  .cs-modeseg-btn { padding: 6px 11px; }
}
