/* Foresters Competitor Intelligence Dashboard
   Brand: Plum #5E2750, Teal #1A8A8A, Gold #C4A052, Cream #F5F2ED
   Type: DM Serif Display (display), DM Sans (body). No em dashes. */

:root {
  --plum: #5E2750;
  --plum-dark: #44193B;
  --teal: #1A8A8A;
  --teal-dark: #146B6B;
  --gold: #C4A052;
  --cream: #F5F2ED;
  --cream-2: #EDE7DE;
  --ink: #2A2230;
  --ink-soft: #5A5260;
  --muted: #8A8290;
  --line: #E2DCD3;
  --white: #FFFFFF;
  --danger: #B23A3A;
  --warn: #C97A2B;
  --success: #2E7D5B;
  --shadow: 0 1px 3px rgba(94, 39, 80, 0.08), 0 4px 16px rgba(94, 39, 80, 0.06);
  --shadow-lg: 0 8px 32px rgba(94, 39, 80, 0.18);
  --radius: 10px;
  --radius-sm: 6px;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "DM Serif Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  overflow-x: hidden;
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body.locked { overflow: hidden; }

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: "SF Mono", "Menlo", monospace; font-size: 0.85em; background: var(--cream-2); padding: 1px 5px; border-radius: 4px; color: var(--plum); }

.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ===== Password gate ===== */
.gate {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(135deg, var(--plum) 0%, var(--plum-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-card {
  background: var(--white); border-radius: 16px; padding: 40px 36px;
  max-width: 400px; width: 100%; text-align: center; box-shadow: var(--shadow-lg);
}
.gate-logo { margin-bottom: 20px; }
.gate-title { font-family: var(--font-display); font-size: 24px; color: var(--plum); margin-bottom: 6px; }
.gate-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 24px; }
.gate-form { display: flex; flex-direction: column; gap: 12px; }
.gate-input {
  padding: 12px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 15px; transition: border-color 0.15s;
}
.gate-input:focus { outline: none; border-color: var(--teal); }
.gate-error { color: var(--danger); font-size: 13px; }
.gate-foot { margin-top: 24px; color: var(--muted); font-size: 12px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--plum); color: var(--white); }
.btn-primary:hover { background: var(--plum-dark); }

/* ===== Shell ===== */
.dashboard { min-height: 100vh; }

.topbar {
  background: var(--plum); color: var(--white); padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-size: 18px; }
.brand-sub { font-size: 12px; opacity: 0.8; }
.topbar-meta { display: flex; align-items: center; gap: 12px; }
.meta-pill { background: rgba(255,255,255,0.15); padding: 5px 12px; border-radius: 20px; font-size: 12px; }
.report-select {
  background: rgba(255,255,255,0.15); color: var(--white); border: 1px solid rgba(255,255,255,0.35);
  border-radius: 20px; padding: 8px 14px; min-height: 44px; font-family: var(--font-body);
  font-size: 13px; cursor: pointer;
}
.report-select option { color: var(--ink, #2A2530); }

a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible,
summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px;
}
.nav-toggle { display: none; background: none; border: none; color: var(--white); font-size: 22px; cursor: pointer; min-width: 44px; min-height: 44px; }

.shell { display: flex; max-width: 1500px; margin: 0 auto; }

.sidenav {
  width: 248px; flex-shrink: 0; background: var(--white); border-right: 1px solid var(--line);
  padding: 16px 12px; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); min-height: 44px;
  color: var(--ink-soft); font-size: 14px; margin-bottom: 2px;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}
.nav-item:hover { background: var(--cream); text-decoration: none; color: var(--plum); transform: translateX(2px); }
.nav-item.is-active { background: var(--plum); color: var(--white); }
.nav-num {
  font-family: var(--font-body); font-weight: 700; font-size: 12px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center; border-radius: 6px;
  background: var(--cream-2); color: var(--plum); flex-shrink: 0;
}
.nav-item.is-active .nav-num { background: rgba(255,255,255,0.2); color: var(--white); }
.nav-title { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }

.main { flex: 1; padding: 28px 36px 40px; min-width: 0; animation: pageIn 0.35s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 32px; padding-bottom: 16px; border-bottom: 2px solid var(--line); }
.page-title { font-family: var(--font-display); font-size: 32px; color: var(--plum); line-height: 1.15; letter-spacing: -0.01em; }
.page-source { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ===== Guard rail ===== */
.guard-rail {
  background: var(--cream-2); border-left: 4px solid var(--gold); padding: 14px 18px;
  border-radius: var(--radius-sm); margin-bottom: 24px; font-size: 13px; color: var(--ink-soft);
}
.guard-rail strong { color: var(--plum); }

/* ===== Sections ===== */
.module-section { margin-bottom: 40px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.section-head h2 { font-family: var(--font-display); font-size: 21px; color: var(--plum); line-height: 1.25; }
.section-sub { color: var(--muted); font-size: 13px; margin-top: 2px; max-width: 720px; }
.section-actions { flex-shrink: 0; }
.section-body { }

/* ===== Metric grid ===== */
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
@media (min-width: 901px) and (max-width: 1280px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
.main > .panel { margin-bottom: 32px; }
.main > .tab-panel.is-active { margin-bottom: 32px; }
.main > .md-export-details + .panel { margin-top: 32px; }
.metric-card {
  background: var(--white); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border-top: 3px solid var(--line);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.metric-card--accent { border-top-color: var(--accent, var(--plum)); }
.metric-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.metric-value { font-family: var(--font-display); font-size: 30px; color: var(--plum); line-height: 1.1; }
.metric-value--text {
  font-size: 18px; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.metric-card--accent .metric-value { color: var(--accent, var(--plum)); }
.metric-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.metric-trend { font-size: 12px; margin-top: 6px; font-weight: 600; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-flat { color: var(--muted); }
.metric-foot { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 12px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
}
.badge--neutral { background: var(--cream-2); color: var(--ink-soft); }
.badge--high, .badge--danger { background: #FBE3E3; color: var(--danger); }
.badge--medium, .badge--warn { background: #FBEEDC; color: var(--warn); }
.badge--low, .badge--success { background: #DCF0E5; color: var(--success); }
.badge--brand { background: var(--plum); color: var(--white); }
.badge--teal { background: #D4ECEC; color: var(--teal-dark); }
.badge--gold { background: #F5EACF; color: #8A6D2E; }

.tier-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.tier-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--plum)); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--white); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table caption { text-align: left; padding: 12px 16px; font-size: 13px; color: var(--muted); }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table thead th { background: var(--cream-2); font-weight: 600; color: var(--plum); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; position: sticky; top: 0; }
.data-table tbody tr { transition: background 0.15s ease, box-shadow 0.15s ease; }
.data-table tbody tr:hover { background: var(--cream); box-shadow: inset 3px 0 0 var(--teal); }
.data-table th[data-sort-key] { cursor: pointer; user-select: none; }
.data-table th[data-sort-key]:hover { color: var(--teal); }
.data-table th[data-sort-key]::after { content: " \2195"; opacity: 0.4; font-size: 10px; }
.data-table th.sorted-asc, .data-table th.sorted-desc { color: var(--teal-dark); background: #E5F0F0; }
.data-table th.sorted-asc::after { content: " \2191"; opacity: 1; color: var(--teal-dark); }
.data-table th.sorted-desc::after { content: " \2193"; opacity: 1; color: var(--teal-dark); }
.empty-row { text-align: center; color: var(--muted); padding: 24px; }
.num { text-align: right; }
td .num { text-align: right; }
.vi-score { font-weight: 700; color: var(--plum); }
.opp-score { font-weight: 700; color: var(--gold); }

/* ===== Domain cells ===== */
.domain-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.domain-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ext-link { display: inline-block; min-height: 24px; color: var(--teal); font-weight: 500; }
.rank-cell { font-weight: 700; color: var(--ink-soft); }
.domain-list { display: flex; flex-wrap: wrap; gap: 4px; }
.domain-chip { background: var(--cream-2); padding: 2px 7px; border-radius: 4px; font-size: 11px; color: var(--ink-soft); }
.ref-chip { display: inline-block; background: #E8E0F0; color: var(--plum); padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ===== Bar rows ===== */
.bar-rows { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 90px; align-items: center; gap: 12px; }
.bar-label { font-size: 13px; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.bar-track { height: 18px; background: var(--cream-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; }
.anim .bar-fill { animation: barGrow 0.7s cubic-bezier(0.25, 0.8, 0.3, 1) both; }
@keyframes barGrow { from { width: 0; } }
.anim .bar-row:nth-child(1) .bar-fill { animation-delay: 0.05s; }
.anim .bar-row:nth-child(2) .bar-fill { animation-delay: 0.12s; }
.anim .bar-row:nth-child(3) .bar-fill { animation-delay: 0.19s; }
.anim .bar-row:nth-child(4) .bar-fill { animation-delay: 0.26s; }
.anim .bar-row:nth-child(5) .bar-fill { animation-delay: 0.33s; }
.anim .bar-row:nth-child(6) .bar-fill { animation-delay: 0.4s; }
.anim .bar-row:nth-child(7) .bar-fill { animation-delay: 0.47s; }
.anim .bar-row:nth-child(8) .bar-fill { animation-delay: 0.54s; }
.anim .bar-row:nth-child(n+9) .bar-fill { animation-delay: 0.6s; }
.bar-value { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Sparklines ===== */
.spark-wrap { margin-top: 16px; display: flex; align-items: center; gap: 10px; }
.sparkline { width: 100%; max-width: 480px; height: 64px; }
.spark-cap { font-size: 12px; color: var(--muted); }
.sparkline-empty { color: var(--muted); }

/* ===== Alerts ===== */
.alert-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.alert { background: var(--white); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-left: 4px solid var(--muted); display: flex; gap: 12px; }
.alert--high, .alert--danger { border-left-color: var(--danger); }
.alert--medium, .alert--warn { border-left-color: var(--warn); }
.alert--low, .alert--success { border-left-color: var(--success); }
.alert-type { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; min-width: 90px; }
.alert-title { font-weight: 600; color: var(--ink); font-size: 14px; }
.alert-detail { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.alert-date { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ===== Panels ===== */
.panel { background: var(--white); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-left: 4px solid var(--teal); }
.panel--info { border-left-color: var(--teal); }
.panel--warn { border-left-color: var(--warn); }
.panel--danger { border-left-color: var(--danger); }
.panel--success { border-left-color: var(--success); }
.panel--brand { border-left-color: var(--plum); }
.panel-title { font-weight: 700; color: var(--plum); margin-bottom: 8px; font-size: 14px; }
.panel-body { font-size: 14px; color: var(--ink-soft); }
.panel-body p + p { margin-top: 8px; }
.panel-body ul { margin-top: 8px; padding-left: 18px; }
.panel-body li { margin-bottom: 4px; }

/* ===== Def list ===== */
.def-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.def-list dt { font-size: 13px; color: var(--muted); font-weight: 600; }
.def-list dd { font-size: 14px; color: var(--ink); }

/* ===== Tabs ===== */
.tab-bar { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab { background: none; border: none; padding: 10px 16px; min-height: 44px; cursor: pointer; font-family: var(--font-body); font-size: 14px; color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 500; }
.tab:hover { color: var(--plum); }
.tab.is-active { color: var(--plum); border-bottom-color: var(--plum); font-weight: 600; }
.tab-count { background: var(--cream-2); padding: 1px 6px; border-radius: 8px; font-size: 11px; }
.tab.is-active .tab-count { background: var(--plum); color: var(--white); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== Pending ===== */
.pending { display: flex; align-items: center; gap: 12px; background: var(--cream-2); border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center; justify-content: center; height: 100%; min-height: 140px; }
.pending-icon { font-size: 28px; color: var(--muted); }
.pending-label { font-weight: 600; color: var(--ink-soft); }
.pending-detail { font-size: 13px; color: var(--muted); }

.source-line { font-size: 12px; color: var(--muted); margin-top: 10px; font-style: italic; }

/* ===== Race chart (M5) ===== */
.race-chart { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding: 16px; background: var(--white); border-radius: var(--radius); border: 1px solid var(--line); overflow-x: auto; }
.race-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 48px; flex: 1; height: 100%; }
.race-bars { display: flex; align-items: flex-end; gap: 3px; height: 180px; width: 100%; justify-content: center; }
.race-bar { width: 12px; min-height: 2px; border-radius: 3px 3px 0 0; }
.anim .race-bar { animation: raceGrow 0.7s cubic-bezier(0.25, 0.8, 0.3, 1) both; }
@keyframes raceGrow { from { height: 0; } }
.anim .race-col:nth-child(1) .race-bar { animation-delay: 0.05s; }
.anim .race-col:nth-child(2) .race-bar { animation-delay: 0.13s; }
.anim .race-col:nth-child(3) .race-bar { animation-delay: 0.21s; }
.anim .race-col:nth-child(4) .race-bar { animation-delay: 0.29s; }
.anim .race-col:nth-child(5) .race-bar { animation-delay: 0.37s; }
.anim .race-col:nth-child(6) .race-bar { animation-delay: 0.45s; }
.anim .race-col:nth-child(n+7) .race-bar { animation-delay: 0.53s; }
.race-label { font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }
.battle-table th, .battle-table td { white-space: nowrap; }

/* ===== Annotations (M5) ===== */
.ann-timeline { display: flex; flex-direction: column; gap: 0; }
.ann-item { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 14px 0; border-left: 2px solid var(--line); padding-left: 20px; position: relative; }
.ann-item::before { content: ""; position: absolute; left: -6px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid var(--white); }
.ann-date { font-size: 12px; color: var(--muted); font-weight: 600; padding-top: 1px; }
.ann-title { font-weight: 600; color: var(--ink); font-size: 14px; }
.ann-detail { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }

/* ===== Gallery (M7) ===== */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.gallery-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.gallery-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.gallery-head .ext-link { flex: 1; font-weight: 600; }
.rank-pill { background: var(--cream-2); color: var(--plum); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.gallery-title { padding: 10px 14px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.gallery-shot { height: 180px; background: var(--cream-2); display: flex; align-items: stretch; justify-content: center; }
.gallery-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.shot-unavailable { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; padding: 16px; text-align: center; border: 1px dashed var(--line, #D8D2C8); }
.shot-unavailable-title { font-weight: 600; color: var(--ink-soft, #6B6459); font-size: 13px; }
.aio-patterns { padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-top: 1px solid var(--line); }
.pattern-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.pattern-label { color: var(--ink-soft); }
.gallery-note { padding: 8px 14px 14px; font-size: 12px; color: var(--muted); }
.on-page { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.on-page-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; font-size: 12px; align-items: baseline; }
.op-label { color: var(--muted); font-weight: 600; }
.op-value { color: var(--ink); word-break: break-word; }
.pending-inline { padding: 10px 14px; font-size: 12px; }
.compare-table th, .compare-table td { text-align: center; white-space: nowrap; }
.compare-table td:first-child { text-align: left; font-weight: 600; color: var(--ink-soft); }

/* ===== Social (M8) ===== */
.thread-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.thread-card { background: var(--white); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--teal); }
.thread-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sub-badge { background: var(--plum); color: var(--white); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.thread-title { font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.35; }
.thread-meta { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.thread-brands { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }
.thread-action { margin-top: 8px; font-size: 12px; }
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.idea-card { background: linear-gradient(135deg, var(--plum) 0%, var(--plum-dark) 100%); color: var(--white); border-radius: var(--radius); padding: 18px; }
.idea-num { font-size: 11px; letter-spacing: 0.08em; opacity: 0.7; font-weight: 700; }
.idea-title { font-family: var(--font-display); font-size: 18px; margin: 6px 0 8px; }
.idea-body { font-size: 13px; opacity: 0.9; line-height: 1.45; }
.idea-tag { margin-top: 10px; display: inline-block; background: rgba(196,160,82,0.3); color: var(--gold); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ===== Recommendations (M9) ===== */
.rec-grid, .blocker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.rec-card, .blocker-card { background: var(--white); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-left: 4px solid var(--gold); }
.blocker-card { border-left-color: var(--muted); }
.blocker--high { border-left-color: var(--danger); }
.blocker--medium { border-left-color: var(--warn); }
.rec-head, .blocker-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rec-id, .blocker-id { font-weight: 700; color: var(--plum); font-size: 13px; }
.rec-title, .blocker-title { font-weight: 600; color: var(--ink); font-size: 15px; line-height: 1.35; }
.rec-rationale, .blocker-impact { font-size: 13px; color: var(--ink-soft); margin-top: 6px; line-height: 1.5; }
.rec-refs, .blocker-refs { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.md-export { background: var(--ink); border-radius: var(--radius); padding: 18px; overflow-x: auto; }
.md-export pre { color: #D4ECEC; font-family: "SF Mono", "Menlo", monospace; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.formula-list { list-style: none; margin-top: 10px; }
.formula-list li { font-size: 13px; color: var(--ink-soft); padding: 3px 0; }

/* ===== Skeleton loading states ===== */
.skeleton-group { display: flex; flex-direction: column; gap: 10px; }
.skeleton { position: relative; overflow: hidden; background: var(--cream-2); border-radius: var(--radius-sm); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.65), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton--line { height: 14px; }
.skeleton--line.short { width: 60%; }
.skeleton--stat { height: 74px; }
.skeleton--block { height: 180px; border-radius: 0; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 32px; }
.skeleton-note { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* ===== Footer ===== */
.page-footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.page-footer p + p { margin-top: 6px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .shell { flex-direction: column; }
  .sidenav { position: fixed; left: -260px; top: 64px; height: calc(100vh - 64px); z-index: 40; transition: left 0.2s; box-shadow: var(--shadow-lg); }
  .sidenav.open { left: 0; }
  .main { padding: 20px 16px 32px; }
  .page-title { font-size: 24px; }
  .bar-row { grid-template-columns: 110px 1fr 70px; }
  .metric-value { font-size: 24px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .ann-item { grid-template-columns: 1fr; gap: 4px; }
  .aio-patterns { grid-template-columns: 1fr; }
  .rec-grid, .blocker-grid { grid-template-columns: 1fr; }
  .topbar-brand .brand-text { display: none; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .skeleton::after { animation: none; }
}
