/* =================================================================
   PCG-MAS · Apple-grade static frontend
   Design tokens, light/dark, system fonts, scoped components.
   ================================================================= */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display',
               'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --accent:        #5b6fc4;
  --accent-strong: #4554a8;
  --accent-soft:   rgba(91, 111, 196, 0.10);

  --pass:    #10b981;
  --fail:    #ef4444;
  --pending: #f59e0b;
  --verify:  #3b82f6;

  --bg:        #fafbfc;
  --surface:   #ffffff;
  --surface-2: #f3f5f9;
  --border:    rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --fg:        #0f172a;
  --fg-soft:   #475569;
  --fg-muted:  #94a3b8;

  --card-bg:     #1c2230;
  --card-fg:     #f5f7fb;
  --card-muted:  #c7cdd9;
  --card-border: #2d3548;

  --ease:    cubic-bezier(0.22, 1, 0.36, 1);
  --fast:    180ms;
  --normal:  280ms;
  --slow:    520ms;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --shadow:    0 4px 16px -4px rgba(15, 23, 42, 0.10), 0 0 0 1px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 48px -16px rgba(15, 23, 42, 0.20), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0b0e14;
    --surface:       #11151c;
    --surface-2:     #161b25;
    --border:        rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --fg:            #f1f5f9;
    --fg-soft:       #c7d2e0;
    --fg-muted:      #74809a;
    --accent-soft:   rgba(110, 132, 220, 0.14);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.20), 0 0 0 1px rgba(255,255,255,0.05);
    --shadow:    0 4px 16px -4px rgba(0,0,0,0.30), 0 0 0 1px rgba(255,255,255,0.06);
    --shadow-lg: 0 18px 48px -16px rgba(0,0,0,0.50), 0 0 0 1px rgba(255,255,255,0.06);
  }
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fafbfc; --surface: #ffffff; --surface-2: #f3f5f9;
  --border: rgba(15,23,42,0.08); --border-strong: rgba(15,23,42,0.16);
  --fg: #0f172a; --fg-soft: #475569; --fg-muted: #94a3b8;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e14; --surface: #11151c; --surface-2: #161b25;
  --border: rgba(255,255,255,0.07); --border-strong: rgba(255,255,255,0.14);
  --fg: #f1f5f9; --fg-soft: #c7d2e0; --fg-muted: #74809a;
}

/* =================================================================
   Reset + base
   ================================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "ss02", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 0.94rem;
  line-height: 1.55;
}

code, kbd, pre, samp { font-family: var(--font-mono); }

h1, h2, h3, h4 {
  letter-spacing: -0.018em;
  color: var(--fg);
  margin: 0;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem 1.5rem;
}

a { color: var(--accent); text-decoration: none; transition: color var(--fast); }
a:hover { color: var(--accent-strong); }

/* =================================================================
   Sticky header
   ================================================================= */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.9rem 1.5rem;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.0rem;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.brand-mark {
  display: inline-flex;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #5b6fc4 0%, #8a6fe6 100%);
  align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
}
.brand-name { font-weight: 700; }
.brand-sub {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--fg-soft);
  letter-spacing: 0;
}

.header-nav {
  display: flex;
  gap: 0.15rem;
  margin-left: auto;
  align-items: center;
}
.header-nav a {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--fg-soft);
  padding: 0.45rem 0.75rem;
  border-radius: 7px;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.header-nav a:hover, .header-nav a.is-active {
  color: var(--fg);
  background: var(--surface-2);
}

.icon-btn {
  width: 34px; height: 34px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-soft);
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); border-color: var(--border-strong); }

/* =================================================================
   Hero
   ================================================================= */
.hero {
  position: relative;
  padding: 1.6rem 1.5rem 1.4rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.hero-mesh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(50% 70% at 92% 8%, var(--accent-soft) 0%, transparent 60%),
    radial-gradient(50% 70% at -5% 110%, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 60%),
    radial-gradient(40% 50% at 50% 0%, color-mix(in srgb, #8a6fe6 6%, transparent) 0%, transparent 70%);
}

.hero-title {
  position: relative;
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  max-width: 40ch;
  background: linear-gradient(118deg, var(--fg) 0%, var(--fg) 35%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 0 0.6rem 0;
}

.hero-lede {
  position: relative;
  color: var(--fg-soft);
  font-size: 1rem;
  max-width: 68ch;
  margin: 0 0 0.85rem 0;
}

.hero-meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

/* =================================================================
   Settings strip (shared backend / API key / topk / replay-check)
   ================================================================= */
.settings {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(220px, 2fr) minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 1.0rem;
  align-items: start;     /* align tops so all field-labels start at the same y */
}

/* Make API-key hint absolutely positioned so it doesn't push the input down */
.settings-grid .field {
  position: relative;
  padding-bottom: 1.1rem;  /* reserve room for the hint underneath */
}
.settings-grid .field-hint {
  position: absolute;
  left: 0;
  bottom: 0;
  font-size: 0.68rem;
  line-height: 1.3;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 920px) {
  .settings-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; }
.field-inline { flex-direction: row; align-items: center; gap: 0.55rem; }
.field-inline input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.field-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.hint {
  margin: 0.7rem 0 0 0;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], textarea, select {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  color: var(--fg);
  width: 100%;
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast);
  box-shadow: var(--shadow-sm);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm);
}
textarea { resize: vertical; min-height: 60px; }

/* Custom select with caret */
.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.2rem;
  cursor: pointer;
}
.select-caret {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--fg-muted);
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  background: var(--border-strong);
  border-radius: 999px;
  width: 100%;
  outline: none;
  accent-color: var(--accent);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(91,111,196,0.4);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.slider-row output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  min-width: 1.5ch;
  text-align: center;
}

/* =================================================================
   Tabs nav (flat, underline-active, Apple-style)
   ================================================================= */
.tabs {
  display: flex;
  gap: 0.1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tabs button {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--fg-soft);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--fast), border-color var(--fast);
}
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] {
  color: var(--fg);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* =================================================================
   Tab panels
   ================================================================= */
.tab-panel { animation: fadeIn 0.35s var(--ease); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =================================================================
   Two-column layout
   ================================================================= */
.two-col {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(560px, 2.4fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 920px) {
  .two-col { grid-template-columns: 1fr; }
}

/* =================================================================
   Card
   ================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.card:last-child { margin-bottom: 0; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.card-title {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.card-title.spaced { margin-top: 0.8rem; }

.muted { color: var(--fg-soft); margin: 0; }
.muted.small { font-size: 0.84rem; }

p { margin: 0; }

/* =================================================================
   Buttons
   ================================================================= */
.primary-btn, .ghost-btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.005em;
  border-radius: var(--radius);
  padding: 0.7rem 1.25rem;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: transform var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease),
              background var(--fast) var(--ease),
              filter var(--fast) var(--ease);
}

.primary-btn {
  background: linear-gradient(180deg, #5b6fc4 0%, #4554a8 100%);
  color: #ffffff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset,
              0 4px 16px -6px rgba(91,111,196,0.50);
}
.primary-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.primary-btn:active { transform: translateY(0); filter: brightness(0.96); }
.primary-btn.full-width { width: 100%; }
.primary-btn .btn-icon { opacity: 0.85; }

.ghost-btn {
  background: var(--surface);
  border-color: var(--border);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}
.ghost-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

/* =================================================================
   Segmented control (text / url / file)
   ================================================================= */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  background: transparent;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 7px;
  color: var(--fg-soft);
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.seg-btn:hover { color: var(--fg); }
.seg-btn.is-active {
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* =================================================================
   File upload box — dashed container with native button + hints
   ================================================================= */
.file-dropbox {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1.1rem 1.15rem;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: background var(--fast), border-color var(--fast);
  max-width: 100%;
}
.file-dropbox.is-dragover {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-style: solid;
}

.file-input-native {
  font: inherit;
  font-size: 0.82rem;
  color: var(--fg-muted);
  cursor: pointer;
  max-width: 100%;
}

/* Apple-grade styling for the native Choose-File button — silver, macOS-like */
.file-input-native::file-selector-button,
.file-input-native::-webkit-file-upload-button {
  margin-right: 0.7rem;
  padding: 0.42rem 0.95rem 0.42rem 1.95rem;   /* extra left padding for icon */
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1d1d1f;
  background-color: #f5f5f7;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><polyline points='17 8 12 3 7 8'/><line x1='12' y1='3' x2='12' y2='15'/></svg>"),
    linear-gradient(180deg, #ffffff 0%, #ececef 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: 0.6rem center, 0 0;
  background-size: 13px 13px, 100% 100%;
  border: 1px solid #c6c6c8;
  border-radius: 6px;
  cursor: pointer;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.7) inset,
    0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: filter var(--fast), box-shadow var(--fast);
}
.file-input-native::file-selector-button:hover,
.file-input-native::-webkit-file-upload-button:hover {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><polyline points='17 8 12 3 7 8'/><line x1='12' y1='3' x2='12' y2='15'/></svg>"),
    linear-gradient(180deg, #ffffff 0%, #e2e2e5 100%);
}
.file-input-native::file-selector-button:active,
.file-input-native::-webkit-file-upload-button:active {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><polyline points='17 8 12 3 7 8'/><line x1='12' y1='3' x2='12' y2='15'/></svg>"),
    linear-gradient(180deg, #e5e5e8 0%, #d3d3d6 100%);
  box-shadow:
    0 1px 1px 0 rgba(0, 0, 0, 0.08) inset;
}

/* Dark-mode variant: keep silver feel but match the surrounding surface */
[data-theme="dark"] .file-input-native::file-selector-button,
[data-theme="dark"] .file-input-native::-webkit-file-upload-button {
  color: #f5f5f7;
  background-color: #3a3a3c;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dcdce0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><polyline points='17 8 12 3 7 8'/><line x1='12' y1='3' x2='12' y2='15'/></svg>"),
    linear-gradient(180deg, #4a4a4c 0%, #353537 100%);
  border-color: #5a5a5c;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.06) inset,
    0 1px 2px 0 rgba(0, 0, 0, 0.4);
}

.file-dropbox-hint {
  margin: 0;
  font-size: 0.74rem;
  color: var(--fg-muted);
  line-height: 1.4;
}
.file-dropbox-exts {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  line-height: 1.3;
}

/* Legacy .dropzone-native wrapper kept for completeness, no styling needed */

/* Legacy dashed-pill dropzone, kept for backwards compatibility */
.file-field .dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--surface);
  transition: background var(--fast), border-color var(--fast);
  cursor: pointer;
  width: fit-content;
  max-width: 100%;
}
.dropzone:hover { background: var(--accent-soft); border-color: var(--accent); }
.dropzone.is-dragover { background: var(--accent-soft); border-color: var(--accent); border-style: solid; }
.dropzone-content {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}
.dropzone-icon { color: var(--fg-muted); flex-shrink: 0; }
.dropzone-label {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--fg);
  white-space: nowrap;
}
.dropzone-info {
  margin: 0.55rem 0 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--fg-muted);
}
.dropzone-exts {
  display: inline-block;
  margin-top: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}
/* Single-line hint: the supported extensions, immediately under the pill */
.dropzone-hint-line {
  margin: 0.45rem 0 0 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  line-height: 1.3;
}
/* Italic note: lives further below the dropzone with a clear gap, smaller */
.field-note {
  margin: 1.1rem 0 0 0;
  font-size: 0.7rem;
  color: var(--fg-muted);
  font-style: italic;
  line-height: 1.4;
}
/* hide the OLD .dropzone-hint that we no longer use inside the pill */
.dropzone .dropzone-hint { display: none; }

/* =================================================================
   Status row (4 channel chips)
   ================================================================= */
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.2rem 0 0.4rem 0;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-soft);
  transition: color var(--fast), border-color var(--fast);
}
.status-chip .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--fg-muted);
  transition: background var(--fast), box-shadow var(--fast);
}
.status-chip[data-state="pending"] { color: var(--pending); border-color: color-mix(in srgb, var(--pending) 35%, transparent); }
.status-chip[data-state="pending"] .dot { background: var(--pending); animation: dotPulse 0.85s ease-in-out infinite; }
.status-chip[data-state="pass"]    { color: var(--pass); border-color: color-mix(in srgb, var(--pass) 35%, transparent); }
.status-chip[data-state="pass"] .dot { background: var(--pass); }
.status-chip[data-state="fail"]    { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 35%, transparent); }
.status-chip[data-state="fail"] .dot { background: var(--fail); }

@keyframes dotPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1.0;  transform: scale(1.2); }
}

/* =================================================================
   Animated SVG flow diagram
   ================================================================= */
.flow-wrap {
  width: 100%;
  padding: 1.0rem 0.4rem 0.5rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.flow-svg { width: 100%; height: auto; max-height: 240px; display: block; }

.node circle { fill: var(--surface); stroke: var(--fg-muted); stroke-width: 2; transition: fill var(--normal) var(--ease), stroke var(--normal) var(--ease), stroke-width var(--normal) var(--ease); }
.node-io circle { stroke: var(--accent); stroke-width: 2.5; }
.node-io text.node-label { fill: var(--accent); }

.node text.node-label    { font-family: var(--font-mono); font-weight: 600; font-size: 18px; fill: var(--fg); text-anchor: middle; }
.node text.node-sublabel { font-family: var(--font-sans); font-size: 11px; fill: var(--fg-soft); text-anchor: middle; }

.node[data-state="pending"] circle { stroke: var(--pending); stroke-width: 3; animation: nodePulse 1.1s ease-in-out infinite; }
.node[data-state="pass"]    circle { stroke: var(--pass); stroke-width: 3; fill: color-mix(in srgb, var(--pass) 14%, transparent); }
.node[data-state="fail"]    circle { stroke: var(--fail); stroke-width: 3; fill: color-mix(in srgb, var(--fail) 14%, transparent); }

@keyframes nodePulse {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50%      { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--pending) 60%, transparent)); }
}

.edge .edge-line { fill: none; stroke: var(--border-strong); stroke-width: 2; transition: stroke var(--normal); }
.edge[data-state="pending"] .edge-line { stroke: var(--pending); stroke-width: 2.5; }
.edge[data-state="pass"]    .edge-line { stroke: var(--pass); stroke-width: 2.5; }
.edge[data-state="fail"]    .edge-line { stroke: var(--fail); stroke-width: 2.5; stroke-dasharray: 4 4; }
.arrowhead-fill { fill: var(--fg-muted); }

.flow-legend {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--fg-soft);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--fg-muted);
}
.legend-dot.idle    { background: transparent; }
.legend-dot.pending { background: var(--pending); border-color: var(--pending); }
.legend-dot.pass    { background: var(--pass);    border-color: var(--pass); }
.legend-dot.fail    { background: var(--fail);    border-color: var(--fail); }

/* =================================================================
   Banner (accept / reject)
   ================================================================= */
.banner {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.banner[data-decision="accept"] {
  border-color: color-mix(in srgb, var(--pass) 50%, var(--border-strong));
  background: color-mix(in srgb, var(--pass) 6%, var(--surface));
}
.banner[data-decision="reject"] {
  border-color: color-mix(in srgb, var(--fail) 50%, var(--border-strong));
  background: color-mix(in srgb, var(--fail) 6%, var(--surface));
}

.banner-head { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.banner-rationale { color: var(--fg-soft); font-size: 0.9rem; flex: 1; }
.banner-answer {
  padding: 0.85rem 1.0rem;
  background: var(--surface-2);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.banner-meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--fg-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.badge.pass     { color: var(--pass);    background: color-mix(in srgb, var(--pass) 12%, transparent);    border-color: color-mix(in srgb, var(--pass) 35%, transparent); }
.badge.fail     { color: var(--fail);    background: color-mix(in srgb, var(--fail) 12%, transparent);    border-color: color-mix(in srgb, var(--fail) 35%, transparent); }
.badge.pending  { color: var(--pending); background: color-mix(in srgb, var(--pending) 12%, transparent); border-color: color-mix(in srgb, var(--pending) 35%, transparent); }

/* =================================================================
   Code block + key/value lists
   ================================================================= */
.code-block {
  margin: 0;
  padding: 1.0rem 1.15rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.kv-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.kv-list li { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 0.8rem; align-items: baseline; padding: 0.35rem 0; border-bottom: 1px dashed var(--border); }
.kv-list li:last-child { border-bottom: none; }
.kv-list li code { font-size: 0.82rem; background: var(--surface-2); padding: 0.15rem 0.45rem; border-radius: 4px; }
.kv-list li span { color: var(--fg-soft); font-size: 0.86rem; }

/* =================================================================
   Tables
   ================================================================= */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table th {
  text-align: left;
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0.8rem 1.0rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 0.75rem 1.0rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.55;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

/* =================================================================
   Stress-test table
   ================================================================= */
.stress-table-wrap { overflow-x: auto; }
.stress-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.5rem;
}
.stress-table th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0.75rem 0.95rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.stress-table td {
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.stress-table tbody tr:last-child td { border-bottom: none; }
.stress-table td code {
  font-size: 0.78rem;
  background: var(--surface-2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.pill { display: inline-block; padding: 0.22rem 0.7rem; border-radius: 999px; font-family: var(--font-mono); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.02em; border: 1px solid transparent; white-space: nowrap; }
.pill.pass { background: color-mix(in srgb, var(--pass) 14%, transparent); color: var(--pass); border-color: color-mix(in srgb, var(--pass) 40%, transparent); }
.pill.fail { background: color-mix(in srgb, var(--fail) 14%, transparent); color: var(--fail); border-color: color-mix(in srgb, var(--fail) 40%, transparent); }
.pill.err  { background: color-mix(in srgb, var(--pending) 14%, transparent); color: var(--pending); border-color: color-mix(in srgb, var(--pending) 40%, transparent); }

/* =================================================================
   Architecture step grid
   ================================================================= */
.arch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.7rem;
  margin: 0.5rem 0;
}
@media (max-width: 920px) {
  .arch-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .arch-grid { grid-template-columns: 1fr; }
}

.arch-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.0rem 1.1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform var(--normal) var(--ease), box-shadow var(--normal) var(--ease);
}
.arch-step:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.arch-step .num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.arch-step .name { font-weight: 700; font-size: 0.96rem; margin: 0.35rem 0; }
.arch-step .desc { font-size: 0.82rem; color: var(--fg-soft); line-height: 1.55; }

/* =================================================================
   Bullet list polish
   ================================================================= */
.reasons {
  margin: 0.5rem 0 0 1.2rem;
  padding-left: 0.5rem;
  display: grid;
  gap: 0.35rem;
}
.reasons li { color: var(--fg-soft); font-size: 0.92rem; line-height: 1.55; }
.reasons li::marker { color: var(--accent); }

/* =================================================================
   Footer
   ================================================================= */
.footer {
  max-width: 1280px;
  margin: 3rem auto 0 auto;
  padding: 1.5rem 1.5rem 2rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-nav a { font-size: 0.84rem; color: var(--fg-soft); }
.footer-nav a:hover { color: var(--fg); }
.footer-disclaimer { font-size: 0.78rem; color: var(--fg-muted); margin: 0; }

.footer-line {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
}
.footer-copy {
  color: var(--fg);
  font-weight: 600;
}
.footer-disclaimer {
  color: var(--fg-muted);
  font-style: italic;
}
.footer-source {
  color: var(--fg-muted);
}
.footer-source a {
  color: var(--accent);
  word-break: break-all;
}

/* =================================================================
   Misc
   ================================================================= */
.full-width { width: 100%; }
.small { font-size: 0.84rem; }

/* =================================================================
   PATCH B — higher contrast, hero typography, motion design
   ================================================================= */

/* Sharper contrast on body + soft text */
:root {
  --fg:        #0a1020;
  --fg-soft:   #344056;
  --fg-muted:  #6b7689;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg:        #f8fafc;
    --fg-soft:   #d2dae5;
    --fg-muted:  #8893a6;
  }
}
[data-theme="light"] { --fg: #0a1020; --fg-soft: #344056; --fg-muted: #6b7689; }
[data-theme="dark"]  { --fg: #f8fafc; --fg-soft: #d2dae5; --fg-muted: #8893a6; }

/* Brand mark — drop-in container for the SVG */
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px -4px rgba(91,111,196,0.55),
              0 1px 0 rgba(255,255,255,0.10) inset;
  position: relative;
  background: transparent;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 50%);
  pointer-events: none;
}

/* Hero — title smaller, tagline becomes the dominant visual line */
.hero { padding: 1.8rem 1.6rem 1.7rem 1.6rem; }
.hero-title {
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: -0.022em;
  max-width: 42ch;
  margin-bottom: 0.6rem;
}
.hero-tagline {
  position: relative;
  font-size: 2.05rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.028em;
  max-width: 28ch;
  margin: 0 0 0.85rem 0;
  background: linear-gradient(120deg, var(--fg) 0%, var(--fg) 35%, var(--accent) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-lede { color: var(--fg-soft); }

/* Animated gradient mesh — soft pulse, very restrained */
.hero-mesh {
  background:
    radial-gradient(40% 60% at 92% 8%,  rgba(91,111,196,0.18) 0%, transparent 60%),
    radial-gradient(50% 65% at -5% 110%, rgba(138,111,230,0.14) 0%, transparent 60%),
    radial-gradient(35% 45% at 40% 0%,   rgba(217,122,255,0.10) 0%, transparent 70%);
  animation: heroMesh 14s ease-in-out infinite alternate;
}
@keyframes heroMesh {
  0%   { transform: translate3d(0,0,0)    scale(1.00); opacity: 1.0; }
  100% { transform: translate3d(0,-3%,0)  scale(1.06); opacity: 0.85; }
}

/* Brand-mark subtle hover lift */
.brand:hover .brand-mark {
  transform: translateY(-1px);
  transition: transform var(--fast) var(--ease);
  box-shadow: 0 6px 16px -4px rgba(91,111,196,0.70);
}

/* Run button — gradient sweep on hover */
.primary-btn {
  background-image: linear-gradient(125deg,
                    #5b6fc4 0%, #4554a8 45%, #5b6fc4 55%, #4554a8 100%);
  background-size: 220% 100%;
  background-position: 0% 50%;
  transition: background-position 0.6s var(--ease),
              transform var(--fast) var(--ease),
              filter var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}
.primary-btn:hover { background-position: 100% 50%; }

/* Cards lift slightly on hover for tactile feel */
.card {
  transition: transform var(--normal) var(--ease),
              box-shadow var(--normal) var(--ease);
}
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* Tabs — animated underline that grows on hover */
.tabs button { position: relative; }
.tabs button::after {
  content: "";
  position: absolute; left: 50%; right: 50%; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: left var(--normal) var(--ease),
              right var(--normal) var(--ease);
}
.tabs button:hover::after,
.tabs button[aria-selected="true"]::after { left: 0; right: 0; }
.tabs button[aria-selected="true"] { border-bottom-color: transparent !important; }

/* Status chip — full Apple-style transition */
.status-chip { transition: color var(--normal) var(--ease), border-color var(--normal) var(--ease), background var(--normal) var(--ease); }
.status-chip[data-state="pending"] { background: color-mix(in srgb, var(--pending) 8%, var(--surface)); }
.status-chip[data-state="pass"]    { background: color-mix(in srgb, var(--pass) 8%, var(--surface)); }
.status-chip[data-state="fail"]    { background: color-mix(in srgb, var(--fail) 8%, var(--surface)); }

/* SVG node — drop-shadow on pending for premium glow */
.node[data-state="pending"] circle { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--pending) 50%, transparent)); }
.node[data-state="pass"]    circle { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--pass) 35%, transparent)); }
.node[data-state="fail"]    circle { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--fail) 40%, transparent)); }

/* Edge — pulse animation on pending */
.edge[data-state="pending"] .edge-line {
  stroke-dasharray: 6 4;
  animation: edgePulse 1.2s linear infinite;
}
@keyframes edgePulse {
  to { stroke-dashoffset: -20; }
}

/* Increase body text contrast across cards */
.card p, .muted { color: var(--fg-soft); }
.card .muted.small { color: var(--fg-muted); }
.card-title { color: var(--accent); opacity: 0.9; font-weight: 700; }

/* Heavier card titles for hierarchy */
.card .card-title { font-size: 0.78rem; }

/* Footer — refined two-tier layout for the copyright block */
.footer { gap: 0.9rem; }
.footer-legal { display: flex; flex-direction: column; gap: 0.4rem; }
.footer-copyright {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--fg-soft);
}
.footer-disclaimer {
  margin: 0;
  font-size: 0.78rem;
  color: var(--fg-muted);
  max-width: 88ch;
  line-height: 1.55;
}
.footer-disclaimer a { color: var(--accent); }

/* Scroll-reveal animation hooks */
.tab-panel > * {
  opacity: 0;
  transform: translateY(8px);
  animation: revealIn 0.5s var(--ease) forwards;
}
.tab-panel > *:nth-child(1) { animation-delay: 0.02s; }
.tab-panel > *:nth-child(2) { animation-delay: 0.10s; }
.tab-panel > *:nth-child(3) { animation-delay: 0.18s; }
.tab-panel > *:nth-child(4) { animation-delay: 0.26s; }
@keyframes revealIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Hero meta chips — subtle hover */
.chip { transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Subtle global focus ring */
input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* High-contrast mode: stronger borders */
@media (prefers-contrast: more) {
  :root { --border: rgba(15,23,42,0.22); --border-strong: rgba(15,23,42,0.36); }
}

/* =================================================================
   PATCH C — true Apple-grade hero + motion
   ================================================================= */

/* Hero typography — stark hierarchy, large title, smaller everything else */
.hero {
  padding: 2.5rem 2.0rem 2.2rem 2.0rem;
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem) !important;
  line-height: 1.04 !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
  max-width: 22ch !important;
  margin: 0 0 1.0rem 0 !important;
  background: linear-gradient(110deg,
              var(--fg) 0%,
              var(--fg) 25%,
              #5b6fc4 60%,
              #8a6fe6 85%,
              #d97aff 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleShimmer 8s ease-in-out infinite;
}
@keyframes titleShimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.hero-tagline {
  font-size: 1.05rem !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  letter-spacing: -0.005em !important;
  max-width: 60ch !important;
  margin: 0 0 0.55rem 0 !important;
  color: var(--fg-soft) !important;
  background: none !important;
  -webkit-text-fill-color: var(--fg-soft) !important;
}

.hero-lede {
  font-size: 0.92rem !important;
  color: var(--fg-muted) !important;
  max-width: 64ch !important;
  margin: 0 0 1.0rem 0 !important;
}

/* Hero mesh: layered, slowly drifts diagonally — parallax-like */
.hero-mesh {
  background:
    radial-gradient(36% 50% at 88% 12%,  rgba(91,111,196,0.28)  0%, transparent 62%),
    radial-gradient(40% 55% at -2% 102%, rgba(138,111,230,0.20) 0%, transparent 62%),
    radial-gradient(28% 38% at 42% -4%,  rgba(217,122,255,0.16) 0%, transparent 70%),
    radial-gradient(20% 28% at 70% 90%,  rgba(91,111,196,0.14)  0%, transparent 70%);
  animation: meshDrift 22s ease-in-out infinite alternate;
}
@keyframes meshDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1.00); opacity: 1.0; }
  50%  { transform: translate3d(-2%, 1%, 0) scale(1.04); opacity: 0.92; }
  100% { transform: translate3d(1%, -2%, 0) scale(1.07); opacity: 0.85; }
}

/* Floating accent orb — adds depth, very subtle */
.hero::before {
  content: "";
  position: absolute;
  top: -40%; right: -10%;
  width: 60%; height: 180%;
  background: radial-gradient(circle, rgba(91,111,196,0.10) 0%, transparent 55%);
  pointer-events: none;
  animation: orbFloat 18s ease-in-out infinite alternate;
}
@keyframes orbFloat {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-8%, 6%, 0); }
}

/* Brand mark — slow spinning highlight */
.brand-mark { position: relative; }
.brand-mark::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 11px;
  background: conic-gradient(from 0deg,
              transparent 0deg,
              rgba(217, 122, 255, 0.0) 60deg,
              rgba(217, 122, 255, 0.55) 120deg,
              rgba(91, 111, 196, 0.55) 180deg,
              rgba(138, 111, 230, 0.0) 240deg,
              transparent 360deg);
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  padding: 2px;
  opacity: 0;
  transition: opacity var(--normal) var(--ease);
  animation: markSpin 6s linear infinite;
}
.brand:hover .brand-mark::before { opacity: 1; }
@keyframes markSpin {
  to { transform: rotate(360deg); }
}

/* Magnetic-feel cards — translateZ on hover for depth */
.card {
  transform-style: preserve-3d;
  will-change: transform;
}
.card:hover {
  transform: translateY(-2px) scale(1.005);
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.14),
              0 0 0 1px rgba(15, 23, 42, 0.06);
}

/* Smooth tab panel transitions — replace the bare reveal with crossfade-slide */
.tab-panel {
  animation: panelEnter 0.45s var(--ease);
}
@keyframes panelEnter {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Primary button — shimmer band that travels across on hover */
.primary-btn {
  position: relative;
  overflow: hidden;
}
.primary-btn::before {
  content: "";
  position: absolute;
  top: 0; left: -75%;
  width: 50%; height: 100%;
  background: linear-gradient(120deg,
              transparent 0%,
              rgba(255,255,255,0.18) 50%,
              transparent 100%);
  transition: left 0.6s var(--ease);
}
.primary-btn:hover::before { left: 130%; }

/* SVG nodes — gentle hover scale */
.flow-svg .node { transition: transform var(--normal) var(--ease); transform-origin: center; transform-box: fill-box; }
.flow-svg .node:hover { transform: scale(1.06); }

/* Segmented control — animated selected pill */
.segmented { position: relative; }
.seg-btn { position: relative; z-index: 1; transition: color var(--normal) var(--ease); }

/* Settings strip — soft border-glow on focus-within */
.settings { transition: box-shadow var(--normal) var(--ease); }
.settings:focus-within {
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}

/* Banner — entrance animation */
.banner[hidden] { display: none; }
.banner {
  animation: bannerIn 0.55s var(--ease);
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Status chip — subtle scale-in on first state change */
.status-chip {
  transition: color var(--normal) var(--ease),
              border-color var(--normal) var(--ease),
              background var(--normal) var(--ease),
              transform var(--fast) var(--ease);
}
.status-chip[data-state="pending"],
.status-chip[data-state="pass"],
.status-chip[data-state="fail"] {
  transform: scale(1.0);
}
.status-chip[data-state="pending"]:hover,
.status-chip[data-state="pass"]:hover,
.status-chip[data-state="fail"]:hover {
  transform: translateY(-1px);
}

/* Footer — subtle top-border gradient */
.footer {
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg,
                transparent 0%,
                var(--border-strong) 30%,
                var(--border-strong) 70%,
                transparent 100%) 1;
}

/* Honor reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero-title, .hero-mesh, .hero::before, .brand-mark::before,
  .tab-panel, .banner, .primary-btn::before {
    animation: none !important;
    transition: none !important;
  }
}

/* =================================================================
   PATCH D — stress progress bar + side-by-side comparison polish
              + remove tab cascade lag
   ================================================================= */

/* Kill the staggered child-animation cascade — was causing tab-switch lag */
.tab-panel > * { animation: none !important; opacity: 1 !important; transform: none !important; }

/* Tab panel itself: gentle fade only, no transform */
.tab-panel { animation: tabFadeIn 0.22s var(--ease); }
@keyframes tabFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Stress progress bar */
.stress-progress {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.stress-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.6rem;
}
.stress-progress-head #stress-pct {
  font-size: 1.05rem;
  color: var(--pass);
}
.stress-progress-track {
  position: relative;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.stress-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg,
              color-mix(in srgb, var(--pass) 60%, transparent) 0%,
              var(--pass) 60%,
              color-mix(in srgb, var(--pass) 85%, white 15%) 100%);
  border-radius: 999px;
  width: 0%;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px 0 color-mix(in srgb, var(--pass) 45%, transparent);
}

/* Side-by-side comparison polish */
.comparison-decision { margin-bottom: 0.65rem; }
.comparison-answer {
  padding: 0.9rem 1.0rem;
  background: var(--surface-2);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  line-height: 1.6;
  margin-bottom: 0.7rem;
  white-space: pre-wrap;
}
.comparison-decision.accept + .comparison-answer { border-left-color: var(--pass); }
.comparison-decision.reject + .comparison-answer { border-left-color: var(--fail); }
.comparison-rationale {
  color: var(--fg-soft);
  font-size: 0.88rem;
  margin-bottom: 0.7rem;
  line-height: 1.55;
}
.comparison-rationale strong { color: var(--fg); }
.comparison-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
}
.token-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.token-badge.token-overhead {
  background: color-mix(in srgb, var(--pending) 14%, transparent);
  color: var(--pending);
  border-color: color-mix(in srgb, var(--pending) 35%, transparent);
}
.token-badge small { font-weight: 500; opacity: 0.85; }

/* Safari-friendly hidden file input: 0×0 but not display:none or offscreen */
.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.file-picker-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 0.7rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: background var(--fast), border-color var(--fast);
}
.file-picker-label:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}


.file-input-visible {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--fg);
  padding: 0.5rem 0;
  cursor: pointer;
  width: 100%;
}
.file-input-visible::-webkit-file-upload-button {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 0.55rem 1.1rem;
  margin-right: 0.85rem;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
.file-input-visible::-webkit-file-upload-button:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}


/* =================================================================
   PATCH E — robust native file picker controls
   ================================================================= */

.dropzone-hint {
  grid-column: 1 / -1;
}

/* =================================================================
   PHASE 6 — new components for the 8-tab layout
   Apple-grade tokens preserved; everything uses existing var(--*)
   ================================================================= */

/* ----- channel-mapping footnote under the flow svg ----------------- */
.flow-footnote {
  margin: 0.8rem 0 0 0;
  padding: 0.7rem 0.95rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--fg-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
}
.flow-footnote strong {
  color: var(--fg);
  font-weight: 600;
}

/* ----- summary strip --------------------------------------------- */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  margin: 1rem 0 1.1rem 0;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  text-align: center;
}
.summary-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.summary-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
  font-family: var(--font-mono);
}
.summary-value.pass { color: var(--pass); }
.summary-value.fail { color: var(--fail); }
@media (max-width: 720px) {
  .summary-strip { grid-template-columns: repeat(3, 1fr); }
  .summary-item:nth-child(4),
  .summary-item:nth-child(5) {
    grid-column: span 1;
  }
}

/* ----- claim cards (Live Run per-claim list) --------------------- */
.claims-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.5rem;
}
.claim-card {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast) var(--ease);
}
.claim-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}
.claim-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}
.claim-verdict {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
}
.claim-verdict.pass {
  background: color-mix(in srgb, var(--pass) 15%, transparent);
  color: var(--pass);
}
.claim-verdict.fail {
  background: color-mix(in srgb, var(--fail) 14%, transparent);
  color: var(--fail);
}
.claim-verdict.pending {
  background: color-mix(in srgb, var(--pending) 16%, transparent);
  color: var(--pending);
}
.claim-text {
  margin: 0 0 0.7rem 0;
  font-size: 0.97rem;
  line-height: 1.5;
  color: var(--fg);
}

/* 5 channel pills */
.chan-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}
.chan-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg-muted);
  transition: all var(--fast) var(--ease);
}
.chan-pill[data-state="pass"] {
  background: color-mix(in srgb, var(--pass) 12%, transparent);
  border-color: color-mix(in srgb, var(--pass) 40%, transparent);
  color: var(--pass);
}
.chan-pill[data-state="fail"] {
  background: color-mix(in srgb, var(--fail) 12%, transparent);
  border-color: color-mix(in srgb, var(--fail) 40%, transparent);
  color: var(--fail);
}
.chan-pill[data-state="pending"] {
  background: color-mix(in srgb, var(--pending) 12%, transparent);
  border-color: color-mix(in srgb, var(--pending) 40%, transparent);
  color: var(--pending);
}
.chan-pill[data-state="skip"] {
  opacity: 0.5;
}

.claim-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-bottom: 0.45rem;
}
.claim-meta code,
.claim-hash code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

.claim-details {
  margin-top: 0.3rem;
  font-size: 0.85rem;
}
.claim-details summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--fg-muted);
  outline: none;
  padding: 0.25rem 0;
  user-select: none;
}
.claim-details summary:hover { color: var(--fg); }
.claim-details-list {
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.claim-details-list li {
  padding: 0.35rem 0.6rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.claim-details-list li code {
  color: var(--fg);
  font-weight: 600;
  margin-right: 0.45rem;
}

/* ----- Certificate Inspector: dense per-claim grid -------------- */
.cert-grid-wrap {
  margin-top: 1rem;
}
.cert-grid {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin-top: 0.5rem;
}
.cert-grid thead {
  background: var(--surface-2);
}
.cert-grid th, .cert-grid td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.cert-grid th:first-child,
.cert-grid td:first-child,
.cert-grid th:last-child,
.cert-grid td:last-child {
  text-align: left;
}
.cert-grid th {
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cert-grid td.state-pass    { color: var(--pass); font-weight: 700; }
.cert-grid td.state-fail    { color: var(--fail); font-weight: 700; }
.cert-grid td.state-pending,
.cert-grid td.state-skip,
.cert-grid td.state-idle    { color: var(--fg-muted); }

.cert-json-wrap {
  margin-top: 1.2rem;
}
.cert-json-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.cert-json-head .card-subtitle { margin: 0; }

/* ----- Responsibility tab ---------------------------------------- */
.responsibility-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.7rem;
}
.resp-card {
  padding: 0.95rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.resp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.resp-claim-id {
  font-weight: 600;
  font-size: 0.95rem;
}
.resp-claim-id code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.resp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.4rem;
}
.resp-table thead {
  background: var(--surface-2);
}
.resp-table th, .resp-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.resp-table th {
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.resp-table code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.resp-bar-cell {
  width: 28%;
  min-width: 120px;
}
.resp-bar {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.resp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg,
              color-mix(in srgb, var(--accent) 65%, transparent),
              var(--accent));
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}

.component-type-evidence,
.component-type-tool,
.component-type-schema,
.component-type-memory,
.component-type-policy,
.component-type-delegation {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 4px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.component-type-evidence   { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-strong); }
.component-type-tool       { background: color-mix(in srgb, var(--pending) 18%, transparent); color: var(--pending); }
.component-type-schema     { background: color-mix(in srgb, var(--fg-muted) 18%, transparent); color: var(--fg); }
.component-type-memory     { background: color-mix(in srgb, #b58bff 18%, transparent); color: #8a6fe6; }
.component-type-policy     { background: color-mix(in srgb, var(--fail) 16%, transparent); color: var(--fail); }
.component-type-delegation { background: color-mix(in srgb, var(--pass) 16%, transparent); color: var(--pass); }

/* ----- Risk Controller tab --------------------------------------- */
.risk-decision {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.risk-action-display {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.risk-action-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.risk-action-pill {
  display: inline-block;
  padding: 0.35rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 999px;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
}

.risk-num-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.risk-num {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.risk-num-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.risk-num-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
}

.risk-summary {
  margin: 0;
  padding: 0.7rem 0.85rem;
  font-size: 0.92rem;
  line-height: 1.5;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.3rem;
}
.cost-table thead { background: var(--surface-2); }
.cost-table th, .cost-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.cost-table th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cost-table code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.cost-table .chosen-action {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.cost-table .chosen-action td:first-child { font-weight: 700; }

.risk-reasons {
  margin: 0.3rem 0 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
}
.risk-reasons code {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ----- Risk-action tags (4 actions, shared across tabs) ---------- */
.risk-tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.risk-tag.tag-answer {
  background: color-mix(in srgb, var(--pass) 14%, transparent);
  color: var(--pass);
  border-color: color-mix(in srgb, var(--pass) 35%, transparent);
}
.risk-tag.tag-verify {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.risk-tag.tag-escalate {
  background: color-mix(in srgb, var(--pending) 16%, transparent);
  color: var(--pending);
  border-color: color-mix(in srgb, var(--pending) 35%, transparent);
}
.risk-tag.tag-refuse {
  background: color-mix(in srgb, var(--fail) 14%, transparent);
  color: var(--fail);
  border-color: color-mix(in srgb, var(--fail) 35%, transparent);
}

/* ----- Audit-envelope bars --------------------------------------- */
.envelope-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.5rem;
}
.envelope-row {
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.env-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
.env-ch {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
}
.env-ch code {
  font-family: var(--font-mono);
  font-weight: 700;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 0.35rem;
}
.env-rate {
  font-family: var(--font-mono);
  font-size: 1.0rem;
  color: var(--pass);
}
.env-rate strong { font-weight: 700; }
.env-bar {
  position: relative;
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.env-bar-ci {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
.env-bar-mean {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  background: var(--accent-strong);
  transform: translateX(-1.5px);
  border-radius: 2px;
}
.env-meta {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

/* ----- Architecture tab: tables & flowchart ---------------------- */
.arch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 0.7rem;
}
.arch-table thead { background: var(--surface-2); }
.arch-table th, .arch-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.arch-table th {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.arch-table td code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ----- Architecture: event choreography flow --------------------- */
.choreography-flow {
  display: grid;
  /* 17 columns: 9 steps (cols 1,3,5,7,9,11,13,15,17) interleaved with
     8 right-arrows (cols 2,4,6,8,10,12,14,16). 'certificate' sits at col 17. */
  grid-template-columns:
    auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto;
  align-items: center;
  justify-content: start;
  column-gap: 0.4rem;
  row-gap: 0.35rem;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-top: 0.7rem;
  overflow-x: auto;
}
.choreo-step {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  white-space: nowrap;
  text-align: center;
}
.choreo-arrow {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-weight: 700;
}
/* Vertical arrow sits in column 17 (under 'certificate'), row 2, centered */
.choreo-arrow-down {
  grid-column: 17;
  grid-row: 2;
  justify-self: center;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
}
/* 'done' sits at column 17, row 3 — directly below 'certificate' */
.choreo-done {
  grid-column: 17;
  grid-row: 3;
  justify-self: center;
}

/* ----- Stale-state banner ---------------------------------------- */
.stale-banner.pcg-stale-success {
  color: var(--pass);
  background: color-mix(in srgb, var(--pass) 8%, transparent);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--pass);
}

/* ----- Updated flow svg: 6 nodes instead of 5 ------------------- */
/* (the existing .flow-svg styling already handles arbitrary nodes,
   just bump the viewbox width so 6 nodes don't crowd) */
.flow-svg { max-width: 100%; height: auto; }


/* ----- Results-tab compare progress (one bar per side) ---------- */
.compare-progress {
  padding: 1rem 0.4rem;
}
.compare-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}
.compare-progress-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg);
}
.compare-progress-pct {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
}
.compare-progress-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.compare-progress-fill {
  height: 100%;
  background: linear-gradient(90deg,
              color-mix(in srgb, var(--accent) 60%, transparent),
              var(--accent));
  border-radius: 999px;
  transition: width 0.45s var(--ease);
}

/* =================================================================
   Results tab — PCG comparison card (4 generic components)
   ================================================================= */
.pcg-card-header {
  margin-bottom: 0.65rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.pcg-card-header-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.pcg-cert-id {
  font-size: 0.74rem;
  color: var(--fg-muted);
}
.pcg-cert-id code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--fg);
}

.pcg-chan-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin-bottom: 0.7rem;
}
.chan-pill.pcg-mini {
  padding: 0.16rem 0.45rem;
  font-size: 0.7rem;
}

.pcg-answer {
  margin-bottom: 0.7rem;
}

.pcg-attribution-list {
  list-style: none;
  margin: 0 0 0.7rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.pcg-attr-item {
  padding: 0.55rem 0.7rem;
  background: var(--surface-2);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.pcg-attr-item:has(.pcg-attr-mark.pass) {
  border-left-color: var(--pass);
}
.pcg-attr-item:has(.pcg-attr-mark.fail) {
  border-left-color: var(--fail);
}
.pcg-attr-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
}
.pcg-attr-mark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
}
.pcg-attr-mark.pass { color: var(--pass); }
.pcg-attr-mark.fail { color: var(--fail); }
.pcg-attr-id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}
.pcg-attr-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--fg);
  margin-bottom: 0.35rem;
}
.pcg-attr-supports {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.pcg-support-chip {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  font-size: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-muted);
}
.pcg-support-chip code {
  font-family: var(--font-mono);
  color: var(--fg);
  background: none;
  padding: 0;
}
.pcg-attribution-empty {
  margin: 0 0 0.7rem 0;
  padding: 0.6rem 0.8rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--fg-muted);
}

.pcg-why {
  margin-bottom: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}
.pcg-why-headline {
  margin: 0 0 0.35rem 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--fg);
}
.pcg-why-body {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--fg-muted);
}
.pcg-why-body code {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--fg);
}

.pcg-meta { margin-top: 0.4rem; }

/* Polished public footer identity strip */
.footer {
  margin-top: 56px;
  padding: 26px 20px 30px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  text-align: center;
}

.footer-line {
  margin: 0;
}

.footer-copy {
  color: rgba(226, 232, 240, 0.95);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.footer-disclaimer {
  max-width: 820px;
  margin: 8px auto 0;
  color: rgba(148, 163, 184, 0.92);
  font-size: 0.92rem;
  line-height: 1.55;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.48);
  color: rgba(219, 234, 254, 0.96);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.footer-link:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.62);
  background: rgba(30, 64, 175, 0.28);
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  color: currentColor;
  flex: 0 0 auto;
}

.footer-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.footer-icon-text {
  border-radius: 5px;
  background: rgba(96, 165, 250, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

@media (max-width: 720px) {
  .footer-links {
    align-items: stretch;
    flex-direction: column;
  }

  .footer-link {
    justify-content: center;
  }
}
