/* REBATE Dashboard Layout */

body { display: flex; min-height: 100vh; background: var(--bg-base); color: var(--text-primary); font-family: var(--font-sans); font-size: 14px; line-height: 1.5; }

/* ══════════════════════════════════════════════
   SIDEBAR — collapsed by default, expands on hover
   ══════════════════════════════════════════════ */
.sidebar {
  width: 60px; flex-shrink: 0; background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: var(--z-sticky);
  transition: width 0.25s var(--ease-default);
  overflow: hidden;
}
.sidebar.expanded { width: 240px; }

.sidebar-brand { padding: 0; height: 72px; display: flex; align-items: center; justify-content: center; }
.sidebar.expanded .sidebar-brand { justify-content: flex-start; padding-left: 16px; }
.brand-logo { height: 32px; width: auto; display: none; }
.brand-logo--mark.brand-logo--dark { display: block; }
:root[data-theme="light"] .brand-logo--mark.brand-logo--dark { display: none; }
:root[data-theme="light"] .brand-logo--mark.brand-logo--light { display: block; }
.sidebar.expanded .brand-logo--mark { display: none !important; }
.sidebar.expanded .brand-logo--full.brand-logo--dark { display: block; }
:root[data-theme="light"] .sidebar.expanded .brand-logo--full.brand-logo--dark { display: none; }
:root[data-theme="light"] .sidebar.expanded .brand-logo--full.brand-logo--light { display: block; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }

.nav-group { padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.nav-group:last-child { border-bottom: none; }

/* Collapsed: icon centered in 60px */
.sidebar-link {
  display: flex; align-items: center;
  padding: 0; height: 44px; margin: 0;
  color: var(--text-secondary); text-decoration: none;
  font-size: 15px; font-weight: var(--weight-regular);
  position: relative; white-space: nowrap;
  justify-content: center; gap: 0;
}
/* Expanded: left-aligned with gap */
.sidebar.expanded .sidebar-link {
  justify-content: flex-start;
  padding-left: 16px; gap: 12px;
}
.sidebar-link .icon { flex-shrink: 0; width: 20px; height: 20px; }
.sidebar-link:hover { color: var(--text-primary); background: var(--bg-hover); transition: color 0.15s, background 0.15s; }
.sidebar-link.active {
  color: var(--accent-secondary);
  font-weight: var(--weight-semi);
  background: rgba(240,180,41,0.10);
}
.sidebar-link.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent-secondary);
}
.sidebar-link.active .icon { color: var(--accent-secondary); }

/* Labels hidden when collapsed, visible on hover with delay */
.link-label { display: none; }
.sidebar.expanded .link-label { display: inline; }

/* Theme toggle — pinned at bottom */
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--border-subtle); }

.sidebar-toggle { display: none; }

/* Theme toggle switch */
.toggle-icon--light { display: none; }
.toggle-icon--dark { display: block; }
:root[data-theme="light"] .toggle-icon--light { display: block; }
:root[data-theme="light"] .toggle-icon--dark { display: none; }
.theme-switch { position: relative; display: inline-block; width: 36px; height: 20px; vertical-align: middle; cursor: pointer; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.theme-slider {
  position: absolute; inset: 0; background: var(--bg-elevated); border-radius: 10px;
  transition: background 0.2s ease;
}
.theme-slider::before {
  content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px;
  background: var(--text-muted); border-radius: 50%; transition: transform 0.2s ease, background 0.2s ease;
}
:root[data-theme="light"] .theme-slider { background: var(--accent-secondary); }
:root[data-theme="light"] .theme-slider::before { transform: translateX(16px); background: #fff; }

/* ══════════════════════════════════════════════
   MAIN
   ══════════════════════════════════════════════ */
.main { flex: 1; margin-left: 60px; padding: 46px; transition: margin-left 0.25s var(--ease-default); }
.main.sidebar-collapsed { margin-left: 60px; }

.view { display: none; overflow: hidden; }
.view.active { display: block; overflow: visible; }
.view-header { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-6); }
.view-title { font-family: var(--font-sans); font-size: 24px; font-weight: var(--weight-bold); letter-spacing: -0.2px; }

/* ══════════════════════════════════════════════
   HOME — Analysis Cards
   ══════════════════════════════════════════════ */
.analyses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-4); }
.analysis-card {
  background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  cursor: pointer; transition: all var(--duration-base) var(--ease-default); overflow: hidden; position: relative;
}
.analysis-card:hover { border-color: var(--accent-secondary); box-shadow: 0 0 20px rgba(240, 180, 41, 0.15); }
.card-poster { width: 100%; height: 180px; overflow: hidden; }
.card-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.analysis-card:hover .card-poster img { transform: scale(1.06); }
.card-body { padding: var(--space-4) var(--space-5) var(--space-5); }
.analysis-card-title { font-weight: var(--weight-semi); font-size: var(--text-lg); margin-bottom: var(--space-2); }
.analysis-card-meta { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.analysis-card-meta span { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.analysis-card-meta .genre-tag { color: var(--accent-secondary); font-weight: var(--weight-semi); }

/* Card bottom — mirrored blocks */
.analysis-card-bottom {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding-top: var(--space-3); border-top: 1px solid var(--border-default);
}
.card-match-block, .card-score-block { display: flex; flex-direction: column; }
.card-score-block { align-items: flex-end; }
.card-block-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: 2px; }
.card-block-value { font-size: 14px; font-weight: var(--weight-semi); display: flex; align-items: center; gap: var(--space-1); }
.format-tag { color: var(--text-secondary); font-weight: var(--weight-semi); display: flex; align-items: center; gap: 4px; }

/* Kebab delete */
.card-kebab {
  position: absolute; top: var(--space-2); right: var(--space-2); z-index: 2;
  background: rgba(0,0,0,0.6); border: none; border-radius: var(--radius-sm);
  color: #fff; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s ease;
}
.analysis-card:hover .card-kebab { opacity: 1; }
.card-kebab:hover { background: rgba(227, 40, 76, 0.8); }

/* ══════════════════════════════════════════════
   UPLOAD — Modal overlay
   ══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay-bg);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-modal); opacity: 0; pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-default);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--space-6);
  width: 520px; max-width: 90vw; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); position: relative;
}
.modal-close {
  position: absolute; top: var(--space-3); right: var(--space-3);
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer; transition: all var(--duration-fast);
  padding: 0;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.modal-header { display: flex; align-items: center; margin-bottom: var(--space-5); }
.modal-title { font-size: var(--text-xl); font-weight: var(--weight-bold); }

.upload-zone {
  border: 2px dashed var(--border-default); border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  transition: border-color var(--duration-base) var(--ease-default); color: var(--text-muted);
}
.upload-zone.dragover { border-color: var(--accent-primary); background: rgba(230, 52, 98, 0.05); }
.upload-label { font-weight: var(--weight-semi); color: var(--text-primary); }
.file-selected { display: flex; flex-direction: column; gap: var(--space-4); }
.file-info { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); background: var(--bg-elevated); border-radius: var(--radius-md); }
.file-info-text { flex: 1; min-width: 0; }
.file-name { font-weight: var(--weight-semi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-section { display: flex; flex-direction: column; gap: var(--space-2); }
.budget-header { display: flex; align-items: center; justify-content: space-between; }
.budget-auto-label { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; color: var(--text-muted); cursor: pointer; }
.budget-auto-label input { accent-color: var(--accent-secondary); }
.budget-input-row { display: flex; align-items: stretch; gap: var(--space-2); height: 40px; }
.budget-input-row.disabled { opacity: 0.35; pointer-events: none; }
.budget-currency {
  width: 76px; padding: 0 var(--space-3); font-size: 13px; font-weight: var(--weight-medium);
  background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius-md);
  color: var(--input-text); appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6e7f' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  cursor: pointer;
}
.budget-currency:focus { border-color: var(--input-border-focus); outline: none; }
.budget-value {
  flex: 1; font-size: 18px; font-weight: var(--weight-semi);
  padding: 0 var(--space-3); min-width: 0;
  background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius-md);
  color: var(--input-text);
}
.budget-value:focus { border-color: var(--input-border-focus); outline: none; }
/* Hide number spinners */
.budget-value::-webkit-inner-spin-button,
.budget-value::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.budget-value { -moz-appearance: textfield; }
.budget-unit-toggle { display: flex; border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; }
.budget-unit {
  padding: 0 var(--space-3); border: none; background: var(--bg-surface);
  color: var(--text-muted); font-size: 13px; font-weight: var(--weight-bold); cursor: pointer;
  transition: all var(--duration-fast); height: 100%;
}
.budget-unit.active { background: var(--bg-elevated); color: var(--text-primary); }
.budget-preview { margin-top: 2px; }
.input-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); }

/* Progress */
.progress-stages { display: flex; gap: var(--space-4); margin-bottom: var(--space-3); }
.stage {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--text-muted); opacity: 0.4;
}
.stage.active { opacity: 1; color: var(--accent-primary); }
.stage.done { opacity: 1; color: var(--semantic-success); }
.progress-bar-track { height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); border-radius: 2px; transition: width 0.5s ease; }
.progress-text { margin-top: var(--space-2); }
.fun-fact {
  margin-top: var(--space-4); padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated); border-radius: var(--radius-md);
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  border-left: 3px solid var(--accent-secondary);
  min-height: 48px; transition: opacity 0.3s ease;
}
.fun-fact-label { font-size: 10px; font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--accent-secondary); margin-bottom: 4px; }
.progress-divider { border: none; border-top: 1px solid var(--border-default); margin: var(--space-4) 0; }
.progress-actions { display: flex; gap: 14px; }
.progress-actions .btn { flex: 1; }

/* Minimized progress card on home */
.progress-card {
  background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  padding: var(--space-4); margin-bottom: var(--space-4);
}
.progress-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }
.progress-card-title { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semi); font-size: 14px; }
.progress-card-actions { display: flex; gap: var(--space-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1.5s linear infinite; }

/* ══════════════════════════════════════════════
   RESULTS — Back bar
   ══════════════════════════════════════════════ */
.results-back { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); padding-top: 30px; position: relative; z-index: 2; }
.results-back-left { display: flex; align-items: center; gap: var(--space-2); }

/* ══════════════════════════════════════════════
   RESULTS — Hero banner (B&W, edge-to-edge)
   ══════════════════════════════════════════════ */
.results-hero {
  position: relative; height: 220px; overflow: hidden;
  margin: -46px -46px -70px -46px;
}
.results-hero-img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 30%;
  filter: grayscale(100%) brightness(0.7);
}
.results-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-base) 0%, rgba(8,9,12,0.5) 50%, rgba(8,9,12,0.3) 100%);
}
:root[data-theme="light"] .results-hero-overlay {
  background: linear-gradient(to top, var(--bg-base) 0%, rgba(255,255,255,0.5) 50%, rgba(255,255,255,0.3) 100%);
}

/* ══════════════════════════════════════════════
   RESULTS — Profile header
   ══════════════════════════════════════════════ */
.profile-header { display: flex; gap: var(--space-5); margin-bottom: var(--space-5); align-items: flex-start; position: relative; z-index: 1; padding: 0 var(--space-2); }
.profile-poster { flex-shrink: 0; width: 160px; }
.profile-poster img { width: 100%; border-radius: var(--radius-lg); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
.profile-info { flex: 1; min-width: 0; }
.profile-title { font-family: var(--font-sans); font-size: 28px; font-weight: var(--weight-bold); margin-bottom: var(--space-2); }
.profile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); font-size: 14px; color: var(--text-muted); }
.profile-meta .genre-tag { color: var(--accent-secondary); font-weight: var(--weight-semi); }
.profile-meta .meta-sep { color: var(--border-strong); }
.profile-meta .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.profile-logline { font-size: 14px; color: var(--text-secondary); line-height: 1.6; max-width: 700px; }

/* ══════════════════════════════════════════════
   WIDGETS — Parrot-style stat cards
   ══════════════════════════════════════════════ */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-default);
}
.stat-card-title { font-size: 16px; font-weight: var(--weight-bold); color: var(--text-primary); line-height: 1.2; }
.stat-card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card-header-icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.stat-card-body { padding: 16px 20px; display: flex; align-items: flex-end; gap: var(--space-3); }
.stat-card-value { font-size: 32px; font-weight: var(--weight-bold); line-height: 1; letter-spacing: -0.02em; }
.stat-card-detail { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ══════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════ */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border-default); margin-bottom: var(--space-5); }
.tab {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4); border: none; background: none;
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all var(--duration-base) var(--ease-default);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent-primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ══════════════════════════════════════════════
   SUMMARY TAB — structured report
   ══════════════════════════════════════════════ */
/* Final recommendation banner */
.report-recommendation {
  background: linear-gradient(135deg, rgba(5,197,107,0.10), rgba(5,197,107,0.03));
  border: 1px solid rgba(5,197,107,0.25); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5); margin-bottom: var(--space-5);
}
.report-rec-label {
  font-size: 11px; font-weight: var(--weight-bold); text-transform: uppercase;
  letter-spacing: var(--tracking-wide); color: var(--color-success);
  display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2);
}
.report-rec-label .icon { width: 16px; height: 16px; }
.report-rec-text { font-size: 15px; line-height: 1.6; color: var(--text-primary); }
.report-rec-text strong { color: var(--color-success); }

/* Two-column layout */
.report-layout { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-5); }
@media (max-width: 1024px) { .report-layout { grid-template-columns: 1fr; } }

.report-main { min-width: 0; }
.report-section { margin-bottom: var(--space-5); }
.report-heading { font-size: 18px; font-weight: var(--weight-bold); color: var(--text-primary); margin-bottom: var(--space-3); display: flex; align-items: center; gap: var(--space-2); }
.report-heading-icon { width: 18px; height: 18px; color: var(--accent-secondary); }
.report-body { font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.report-body p { margin-bottom: var(--space-3); }
.report-body strong { color: var(--text-primary); }
.report-body em { color: var(--accent-secondary); font-style: italic; }
.report-body hr { display: none; }

/* Action Plan */
.report-action-plan {
  background: linear-gradient(135deg, rgba(5,197,107,0.06), rgba(5,197,107,0.02));
  border: 1px solid rgba(5,197,107,0.15); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}
.report-action-plan .report-heading { color: var(--color-success); }
.report-action-plan ol { counter-reset: action; padding-left: 0; list-style: none; }
.report-action-plan ol li { counter-increment: action; position: relative; padding-left: 36px; margin-bottom: var(--space-3); }
.report-action-plan ol li::before {
  content: counter(action); position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--color-success); color: var(--bg-primary);
  font-size: 12px; font-weight: var(--weight-bold);
  display: flex; align-items: center; justify-content: center;
}

/* Accordion for country recommendations */
.report-accordion {
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  margin-bottom: var(--space-2); overflow: hidden;
}
.report-accordion[open] { border-color: var(--border-strong); }
.report-accordion-header {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); cursor: pointer;
  list-style: none; user-select: none;
  transition: background var(--duration-fast);
}
.report-accordion-header:hover { background: var(--bg-hover); }
.report-accordion-header::-webkit-details-marker { display: none; }
.report-accordion-rank { font-size: 14px; font-weight: var(--weight-bold); color: var(--text-muted); min-width: 24px; }
.report-accordion-flag { font-size: 18px; }
.report-accordion-country { font-size: 15px; font-weight: var(--weight-semi); flex: 1; }
.report-accordion-chevron { width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.report-accordion[open] .report-accordion-chevron { transform: rotate(180deg); }
.report-accordion-body {
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: 14px; line-height: 1.7; color: var(--text-secondary);
}
.report-accordion-body p { margin-bottom: var(--space-2); }
.report-accordion-body strong { color: var(--text-primary); }
.report-accordion-body em { color: var(--accent-secondary); }
.report-accordion-body ul, .report-accordion-body ol { padding-left: var(--space-5); margin-bottom: var(--space-2); }
.report-accordion-body li { margin-bottom: var(--space-1); }
.report-accordion-body hr { display: none; }

/* Sidebar widgets */
.report-sidebar { display: flex; flex-direction: column; gap: var(--space-4); }
.report-widget {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--space-4);
}
.report-widget--risk { border-color: rgba(248,113,113,0.2); }
.report-widget-title {
  font-size: 13px; font-weight: var(--weight-bold); color: var(--text-primary);
  display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3);
}
.report-widget-title .icon { width: 16px; height: 16px; color: var(--accent-secondary); }
.report-widget--risk .report-widget-title .icon { color: var(--color-danger); }
.report-widget-body { font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.report-widget-body p { margin-bottom: var(--space-2); }
.report-widget-body strong { color: var(--text-primary); font-weight: var(--weight-semi); }
.report-widget-body em { color: var(--accent-secondary); }
.report-widget-body ul, .report-widget-body ol { padding-left: var(--space-4); margin-bottom: var(--space-2); }
.report-widget-body li { margin-bottom: var(--space-1); }

.summary-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-8); gap: var(--space-4); }

/* ══════════════════════════════════════════════
   RANKINGS TABLE — Parrot-style data table
   ══════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; width: 100%; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 900px; }
.data-table thead th {
  padding: var(--space-2) var(--space-3);
  font-size: 11px; font-weight: var(--weight-semi); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  text-align: left; border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface); position: sticky; top: 0; z-index: 1;
  cursor: pointer; user-select: none; white-space: nowrap; overflow: hidden;
}
.data-table thead th:hover { color: var(--text-primary); }
.data-table thead th.sorted-asc::after { content: ' ▲'; font-size: 9px; }
.data-table thead th.sorted-desc::after { content: ' ▼'; font-size: 9px; }

/* Column widths */
#rankings-table th:nth-child(1) { width: 36px; }   /* # */
#rankings-table th:nth-child(2) { min-width: 180px; }  /* Country */
#rankings-table th:nth-child(3) { width: 70px; }    /* Overall */
#rankings-table th:nth-child(4),
#rankings-table th:nth-child(5),
#rankings-table th:nth-child(6),
#rankings-table th:nth-child(7),
#rankings-table th:nth-child(8) { width: 65px; }    /* Pillar scores */
#rankings-table th:nth-child(9) { width: 130px; }   /* Incentive */
#rankings-table th:nth-child(10) { width: 70px; }   /* Net Cost */

.data-table tbody td {
  padding: var(--space-2) var(--space-3);
  font-size: 13px; border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle; overflow: hidden; text-overflow: ellipsis;
}
.data-table tbody tr { cursor: pointer; transition: background var(--duration-fast) var(--ease-default); }
.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table tbody tr.row-expanded td { background: var(--bg-elevated); border-bottom-color: transparent; }

/* Rank column */
.rank-num { font-size: 13px; font-weight: var(--weight-bold); color: var(--text-muted); text-align: center; }

/* Country cell */
.country-cell { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Score cells — just colored number, no bars */
.score-cell { font-weight: var(--weight-semi); text-align: center; }
.score-pill {
  display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: var(--weight-bold); min-width: 36px; text-align: center;
}
.score-pill[data-tier="exceptional"] { background: rgba(52,211,153,0.15); color: #34d399; }
.score-pill[data-tier="high"]        { background: rgba(74,222,128,0.12); color: #4ade80; }
.score-pill[data-tier="good"]        { background: rgba(250,204,21,0.12); color: #facc15; }
.score-pill[data-tier="mid"]         { background: rgba(251,146,60,0.12); color: #fb923c; }
.score-pill[data-tier="low"]         { background: rgba(248,113,113,0.12); color: #f87171; }
.score-pill[data-tier="poor"]        { background: rgba(248,113,113,0.08); color: #ef4444; }

/* Overall score — slightly larger */
.score-pill-lg {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: var(--weight-bold); min-width: 44px; text-align: center;
}
.score-pill-lg[data-tier="exceptional"] { background: rgba(52,211,153,0.18); color: #34d399; }
.score-pill-lg[data-tier="high"]        { background: rgba(74,222,128,0.15); color: #4ade80; }
.score-pill-lg[data-tier="good"]        { background: rgba(250,204,21,0.15); color: #facc15; }
.score-pill-lg[data-tier="mid"]         { background: rgba(251,146,60,0.15); color: #fb923c; }
.score-pill-lg[data-tier="low"]         { background: rgba(248,113,113,0.15); color: #f87171; }
.score-pill-lg[data-tier="poor"]        { background: rgba(248,113,113,0.10); color: #ef4444; }

/* Incentive & cost columns */
.incentive-cell { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-cell { font-weight: var(--weight-semi); white-space: nowrap; }
.cost-negative { color: var(--color-success); }
.cost-positive { color: var(--color-danger); }

/* Category icons in table header */
.th-icon { width: 12px; height: 12px; vertical-align: -2px; margin-right: 2px; opacity: 0.6; }

/* ══════════════════════════════════════════════
   INLINE COUNTRY DETAIL (expands below row)
   ══════════════════════════════════════════════ */
.detail-row-inline td {
  padding: 0 !important; border-bottom: 1px solid var(--border-default);
}
.detail-inline-content {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  animation: slideDown 0.2s ease;
}
@keyframes slideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 600px; } }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.detail-section { margin-bottom: var(--space-3); }
.detail-section-title {
  font-size: 12px; font-weight: var(--weight-semi); color: var(--accent-primary);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-2); display: flex; align-items: center; gap: var(--space-2);
}
.detail-section-title .icon { width: 14px; height: 14px; }
.detail-row { display: flex; justify-content: space-between; padding: var(--space-1) 0; font-size: 13px; border-bottom: 1px solid var(--border-subtle); }
.detail-row-label { color: var(--text-muted); }
.detail-row-value { font-weight: var(--weight-medium); }

/* Location strategies — plain text, not clickable */
.strategy-item { font-size: 13px; color: var(--text-secondary); padding: var(--space-1) 0; display: flex; align-items: center; gap: var(--space-2); }
.strategy-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.strategy-dot--practical { background: var(--color-success); }
.strategy-dot--virtual_production { background: var(--data-5); }
.strategy-dot--vfx_extension { background: var(--accent-secondary); }
.strategy-dot--set_build { background: var(--data-3); }
.strategy-dot--none { background: var(--text-muted); }

.detail-close {
  display: flex; align-items: center; justify-content: center;
  margin-top: var(--space-3); padding: var(--space-2);
  border: none; background: none; color: var(--text-muted); cursor: pointer;
  font-size: 12px; gap: var(--space-1);
}
.detail-close:hover { color: var(--text-primary); }

/* ══════════════════════════════════════════════
   SPLITS TAB
   ══════════════════════════════════════════════ */
.splits-list { display: flex; flex-direction: column; gap: var(--space-4); }
.split-card {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--space-5); transition: border-color var(--duration-base);
}
.split-card:first-child { border-color: var(--accent-secondary); }
.split-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.split-card-rank { font-size: 13px; font-weight: var(--weight-bold); color: var(--text-muted); }
.split-card-rank:first-child { color: var(--accent-secondary); }
.split-card-countries { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.split-card-type {
  font-size: 11px; font-weight: var(--weight-bold); text-transform: uppercase;
  letter-spacing: var(--tracking-wide); padding: 2px 8px; border-radius: var(--radius-sm);
}
.split-type-single { background: var(--color-info-muted); color: var(--color-info); }
.split-type-dual { background: var(--color-success-muted); color: var(--color-success); }
.split-type-triple { background: var(--accent-secondary-muted); color: var(--accent-secondary); }

.split-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-bottom: var(--space-4); }
.split-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.split-stat-value { font-size: 18px; font-weight: var(--weight-bold); margin-top: 2px; }

.split-countries-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-3); }
.split-country-card {
  background: var(--bg-elevated); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
}
.split-country-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.split-country-name { font-weight: var(--weight-semi); }
.split-country-share { font-size: 12px; color: var(--text-muted); }
.split-country-locations { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* ══════════════════════════════════════════════
   LOADING / EMPTY
   ══════════════════════════════════════════════ */
.loading-state, .empty-state { text-align: center; padding: var(--space-8); color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }

/* Blob loader */
.loader {
  height: 40px; aspect-ratio: 2;
  border: 8px solid var(--bg-surface);
  box-sizing: border-box;
  background:
    radial-gradient(farthest-side, var(--accent-secondary) 98%, #0000) left/16px 16px,
    radial-gradient(farthest-side, var(--accent-secondary) 98%, #0000) left/16px 16px,
    radial-gradient(farthest-side, var(--accent-secondary) 98%, #0000) center/16px 16px,
    radial-gradient(farthest-side, var(--accent-secondary) 98%, #0000) right/16px 16px,
    var(--bg-surface);
  background-repeat: no-repeat;
  filter: blur(4px) contrast(10);
  animation: loader-blob 1s infinite;
}
@keyframes loader-blob { 100% { background-position: right, left, center, right; } }

/* Skeleton shimmer */
@keyframes skeleton-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border-subtle) 50%, var(--bg-hover) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: var(--radius-md);
}
.skeleton-card {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); overflow: hidden;
}
.skeleton-card .skeleton-img { height: 180px; }
.skeleton-card .skeleton-body { padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: 10px; }
.skeleton-card .skeleton-line { height: 14px; }
.skeleton-card .skeleton-line--title { height: 20px; width: 70%; }
.skeleton-card .skeleton-line--short { width: 40%; }
.skeleton-stat {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; gap: 10px;
}
.skeleton-stat .skeleton-line { height: 12px; width: 60%; }
.skeleton-stat .skeleton-line--val { height: 24px; width: 45%; }
.skeleton-table-row { display: flex; gap: var(--space-3); padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.skeleton-table-row .skeleton-line { height: 14px; flex: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1.5s linear infinite; }

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .main { padding: var(--space-4); }
  .results-hero { margin: calc(-1 * var(--space-4)); margin-bottom: -70px; }
  .detail-grid { grid-template-columns: 1fr; }
  .split-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .link-label { opacity: 0; width: 0; overflow: hidden; }
  .sidebar .sidebar-link { justify-content: center; padding: 0; gap: 0; }
  .sidebar .brand-logo--full { display: none; }
  .sidebar .brand-logo--mark.brand-logo--dark { display: block; }
  :root[data-theme="light"] .sidebar .brand-logo--mark.brand-logo--dark { display: none; }
  :root[data-theme="light"] .sidebar .brand-logo--mark.brand-logo--light { display: block; }
  .sidebar-toggle { display: none; }
  .main { margin-left: 60px; }
  .main.sidebar-collapsed { margin-left: 60px; }
  .profile-header { flex-direction: column; }
  .profile-poster { width: 120px; }
  .analyses-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .tabs { overflow-x: auto; }
}
@media (max-width: 480px) {
  .main { padding: var(--space-3); margin-left: 0; }
  .results-hero { margin: calc(-1 * var(--space-3)); margin-bottom: -70px; }
  .sidebar { display: none; }
  .stat-cards { grid-template-columns: 1fr; }
  .profile-title { font-size: 22px; }
}

/* ══════════════════════════════════════════════
   COUNTRY EXPLORER
   ══════════════════════════════════════════════ */
.explorer-search { position: relative; max-width: 320px; }
.explorer-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.explorer-search .input { padding-left: 36px; }
.explorer-stats { display: flex; gap: var(--space-4); font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-4); }
.explorer-stats span { color: var(--text-primary); font-weight: var(--weight-semi); }

.explorer-tier-label {
  font-size: 11px; font-weight: var(--weight-bold); text-transform: uppercase;
  letter-spacing: var(--tracking-wide); color: var(--text-muted);
  margin: var(--space-4) 0 var(--space-2); padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
}
.explorer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }

.explorer-card {
  background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4); cursor: pointer; transition: border-color var(--duration-fast), transform var(--duration-fast);
}
.explorer-card:hover { border-color: var(--accent-secondary); transform: translateY(-2px); }
.explorer-card-top { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.explorer-card-flag { font-size: 22px; }
.explorer-card-name { font-size: 14px; font-weight: var(--weight-semi); flex: 1; }
.explorer-card-rebate { font-size: 14px; font-weight: var(--weight-bold); color: var(--color-success); }
.explorer-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.explorer-card-stats > div { display: flex; flex-direction: column; }
.explorer-stat-val { font-size: 13px; font-weight: var(--weight-semi); }
.explorer-stat-label { font-size: 11px; color: var(--text-muted); }

/* Detail */
.explorer-detail-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.explorer-detail-flag { font-size: 36px; }
.explorer-detail-name { font-size: 22px; font-weight: var(--weight-bold); }

.explorer-cat-tabs { display: flex; gap: var(--space-1); margin-bottom: var(--space-4); flex-wrap: wrap; }
.explorer-cat-tab {
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid transparent; cursor: pointer;
  font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: var(--space-1);
  transition: all var(--duration-fast);
}
.explorer-cat-tab .icon { width: 14px; height: 14px; }
.explorer-cat-tab:hover { color: var(--text-primary); }
.explorer-cat-tab.active { color: var(--accent-secondary); border-color: var(--accent-secondary); background: rgba(240,180,41,0.06); }
.explorer-badge { background: var(--bg-hover); padding: 1px 6px; border-radius: 10px; font-size: 11px; margin-left: 2px; }
.explorer-cat-tab.active .explorer-badge { background: var(--accent-secondary); color: var(--bg-base); }

.ex-cat { display: none; }
.ex-cat.active { display: block; }

.ex-section-title { font-size: 14px; font-weight: var(--weight-semi); color: var(--text-muted); margin: var(--space-4) 0 var(--space-2); }

.ex-stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.ex-stat-card { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--space-3); }
.ex-stat-val { font-size: 20px; font-weight: var(--weight-bold); }
.ex-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.ex-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-3); }
.ex-info { background: var(--bg-card); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); }
.ex-info-label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.ex-info-value { font-size: 14px; word-break: break-word; }
.ex-info-value a { color: var(--accent-secondary); text-decoration: none; }
.ex-info-value a:hover { text-decoration: underline; }

.empty-state { text-align: center; padding: var(--space-8); color: var(--text-muted); }

/* Currency modal */
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-panel {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); width: 420px; max-width: 90vw;
  box-shadow: var(--shadow-lg);
}
.modal-panel .modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; margin-bottom: 0; border-bottom: 1px solid var(--border-subtle);
}
.modal-panel .modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.modal-panel .modal-close {
  position: static; width: 28px; height: 28px;
}
.currency-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px; padding: 16px 20px;
}
.currency-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  color: var(--text-primary); cursor: pointer; font-size: 13px; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.currency-btn:hover { border-color: var(--accent-secondary); background: var(--bg-hover); }
.currency-btn.active { border-color: var(--accent-secondary); background: var(--accent-secondary-alpha, rgba(255,193,7,.1)); }
.currency-btn .cur-sym { font-weight: 700; min-width: 22px; color: var(--accent-secondary); }
.currency-btn .cur-code { font-weight: 500; }

/* Methodology modal */
.methodology-content { display: flex; flex-direction: column; gap: var(--space-4); }
.method-pillar { border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.method-pillar-header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--bg-elevated); }
.method-pillar-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--bg-primary); flex-shrink: 0; }
.method-pillar-icon .icon { width: 20px; height: 20px; }
.method-pillar-name { font-size: 15px; font-weight: var(--weight-bold); color: var(--text-primary); }
.method-pillar-sub { font-size: 12px; color: var(--text-muted); }
.method-pillar-body { padding: var(--space-3) var(--space-4); font-size: 13px; line-height: 1.7; color: var(--text-secondary); }
.method-pillar-body p { margin-bottom: var(--space-2); }
.method-pillar-body strong { color: var(--text-primary); }
.method-note { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: 12px; margin-top: var(--space-2); }
.method-section { padding: var(--space-3) 0; }
.method-section-title { font-size: 15px; font-weight: var(--weight-bold); color: var(--text-primary); margin-bottom: var(--space-2); }
.method-section p { font-size: 13px; line-height: 1.7; color: var(--text-secondary); margin-bottom: var(--space-2); }
.method-section strong { color: var(--text-primary); }
.method-list { padding-left: var(--space-4); margin: var(--space-2) 0; font-size: 13px; line-height: 1.8; color: var(--text-secondary); }
.method-list strong { color: var(--text-primary); }

/* Cultural badge tooltip */
.cultural-badge { position: relative; cursor: help; }

/* Cultural penalty notice */
.cultural-notice {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--color-warning-muted);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  font-size: 13px; color: var(--text-secondary); margin-bottom: var(--space-4);
}
.cultural-notice .icon { color: var(--color-warning); flex-shrink: 0; }
.cultural-notice strong { color: var(--text-primary); }
.cultural-badge:hover::after {
  content: attr(title);
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); padding: 6px 10px; font-size: 11px; white-space: nowrap;
  z-index: 100; pointer-events: none; box-shadow: var(--shadow-md); margin-bottom: 4px;
}
