/* ============================================================
   SA ANALYTICS — SAVIVE
   Production CSS — Flask/Vanilla JS version
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
  --sa-green:        #007A4D;
  --sa-green-light:  #00a363;
  --sa-green-dark:   #005c3a;
  --sa-gold:         #FFB612;
  --sa-gold-ui:      #c9910d;
  --sa-gold-light:   #fff3cd;
  --sa-red:          #DE3831;
  --sa-blue:         #002395;

  --bg:              #f7f5f0;
  --bg-card:         #ffffff;
  --bg-hover:        #f0ede8;
  --bg-dark:         #1a1a2e;
  --bg-dark-card:    #16213e;

  --text-primary:    #1e1e1e;
  --text-secondary:  #5a5050;
  --text-tertiary:   #8a8070;
  --text-inverse:    #ffffff;

  --border:          #e5e0d8;
  --border-strong:   #c8c0b8;

  --critical:        #DE3831;
  --critical-bg:     #fdf0f0;
  --critical-border: #f5c6c5;
  --high:            #e8850a;
  --high-bg:         #fff8f0;
  --high-border:     #ffd8a8;
  --elevated:        #c9910d;
  --elevated-bg:     #fffbf0;
  --elevated-border: #ffe69c;
  --normal:          #007A4D;
  --normal-bg:       #f0faf5;
  --normal-border:   #a3d9be;
  --moderate:        #2d7dd2;
  --moderate-bg:     #f0f6ff;
  --moderate-border: #b3d1f5;
  --lower:           #007A4D;
  --lower-bg:        #f0faf5;
  --lower-border:    #a3d9be;

  --shadow-sm:       0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:       0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:       0 8px 24px rgba(0,0,0,0.12);

  --radius-sm:       6px;
  --radius-md:       10px;
  --radius-lg:       16px;

  --font-sans:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:       'SF Mono', 'Fira Code', 'Courier New', monospace;

  --transition:      0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--sa-green);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ── SA Flag Stripe ── */
.flag-stripe {
  height: 5px;
  background: linear-gradient(to right,
    #007A4D 0%,
    #007A4D 33.33%,
    #FFB612 33.33%,
    #FFB612 50%,
    #DE3831 50%,
    #DE3831 66.66%,
    #002395 66.66%,
    #002395 83.33%,
    #1e1e1e 83.33%,
    #1e1e1e 100%
  );
}

/* ── Layout ── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

/* ── Header ── */
.app-header {
  background: var(--sa-green);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -1px;
  color: white;
}

.header-logo-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: white;
  line-height: 1.1;
}

.header-logo-text p {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.2;
}

.header-alert {
  flex: 1;
  max-width: 600px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.header-alert.critical { background: rgba(222,56,49,0.25); color: #ffb3b0; border: 1px solid rgba(222,56,49,0.4); }
.header-alert.high      { background: rgba(232,133,10,0.25); color: #ffd8a8; border: 1px solid rgba(232,133,10,0.4); }
.header-alert.elevated  { background: rgba(201,145,13,0.25); color: #ffe69c; border: 1px solid rgba(201,145,13,0.4); }
.header-alert.normal    { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.2); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-countdown {
  text-align: right;
}

.header-countdown-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-countdown-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--sa-gold);
  letter-spacing: -0.5px;
}

/* ── Ticker / Market Strip ── */
.ticker {
  background: #1a1a2e;
  color: rgba(255,255,255,0.85);
  height: 36px;
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
}

.ticker-track:hover {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 28px;
  font-size: 0.8rem;
}

.ticker-label {
  color: rgba(255,255,255,0.5);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ticker-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ticker-change {
  font-size: 0.75rem;
  padding: 1px 5px;
  border-radius: 4px;
}

.ticker-change.up   { color: #4ade80; background: rgba(74,222,128,0.15); }
.ticker-change.down { color: #f87171; background: rgba(248,113,113,0.15); }

.ticker-sep {
  color: rgba(255,255,255,0.2);
  padding: 0 8px;
}

/* ── Navigation Tabs ── */
.tab-nav {
  background: white;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 65px;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.tab-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-nav-inner::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all var(--transition);
  background: none;
  border-radius: 0;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--sa-green);
  background: var(--bg-hover);
}

.tab-btn.active {
  color: var(--sa-green);
  border-bottom-color: var(--sa-green);
}

.tab-btn-icon {
  font-size: 1rem;
}

/* ── Tab Panels ── */
.tab-panel {
  display: none;
  padding: 24px 0;
}

.tab-panel.active {
  display: block;
}

.tab-panel.hidden {
  display: none;
}

/* ── Section Headers ── */
.section-header {
  max-width: 1280px;
  margin: 0 auto 20px;
  padding: 0 20px;
}

.section-title {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-clickable {
  cursor: pointer;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}

.card-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1.1;
}

.card-subvalue {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Metric Cards ── */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 6px;
}

.metric-change.up {
  background: #dcfce7;
  color: #166534;
}

.metric-change.down {
  background: #fee2e2;
  color: #991b1b;
}

.metric-change.neutral {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.metric-detail {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.metric-card.expanded .metric-detail {
  display: block;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-critical  { background: var(--critical-bg);  color: var(--critical);  border: 1px solid var(--critical-border); }
.badge-high      { background: var(--high-bg);      color: var(--high);      border: 1px solid var(--high-border); }
.badge-elevated  { background: var(--elevated-bg);  color: var(--elevated);  border: 1px solid var(--elevated-border); }
.badge-moderate  { background: var(--moderate-bg);  color: var(--moderate);  border: 1px solid var(--moderate-border); }
.badge-normal    { background: var(--normal-bg);    color: var(--normal);    border: 1px solid var(--normal-border); }
.badge-lower     { background: var(--lower-bg);     color: var(--lower);     border: 1px solid var(--lower-border); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--sa-green);
  color: white;
}

.btn-primary:hover {
  background: var(--sa-green-dark);
}

.btn-secondary {
  background: white;
  color: var(--sa-green);
  border: 1px solid var(--sa-green);
}

.btn-secondary:hover {
  background: var(--normal-bg);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ── Progress / Bars ── */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.progress-fill.critical  { background: var(--critical); }
.progress-fill.high      { background: var(--high); }
.progress-fill.elevated  { background: var(--elevated); }
.progress-fill.moderate  { background: var(--moderate); }
.progress-fill.normal    { background: var(--normal); }
.progress-fill.lower     { background: var(--lower); }

/* ── Alert Banner ── */
.alert-banner {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  border: 1px solid;
}

.alert-banner.critical {
  background: var(--critical-bg);
  border-color: var(--critical-border);
  color: #7f1d1d;
}

.alert-banner.high {
  background: var(--high-bg);
  border-color: var(--high-border);
  color: #7c2d12;
}

.alert-banner.elevated {
  background: var(--elevated-bg);
  border-color: var(--elevated-border);
  color: #713f12;
}

.alert-banner.normal {
  background: var(--normal-bg);
  border-color: var(--normal-border);
  color: #14532d;
}

.alert-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.alert-text {
  font-size: 0.85rem;
  margin-top: 3px;
  opacity: 0.85;
}

/* ── Chart containers ── */
.chart-container {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.chart-container canvas {
  max-height: 340px;
}

.chart-dark {
  background: #1a1a2e;
  border-color: rgba(255,255,255,0.1);
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.chart-dark .chart-title {
  color: rgba(255,255,255,0.9);
}

/* ── Countdown ── */
.countdown-section {
  background:
    linear-gradient(to bottom,
      rgba(222,56,49,0.12)  0%,   rgba(222,56,49,0.12)  30%,
      transparent           30%,  transparent           70%,
      rgba(0,35,149,0.12)   70%,  rgba(0,35,149,0.12)  100%
    ),
    linear-gradient(135deg, #002d14 0%, #004d22 55%, #006e32 100%);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* SA flag Y-chevron watermark */
.countdown-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 66'%3E%3Cpolygon points='0,0 0,66 55,33' fill='white'/%3E%3Cpolygon points='0,8 0,58 46,33' fill='%23FFB612'/%3E%3Cpolygon points='0,14 0,52 38,33' fill='black'/%3E%3Cpolygon points='0,20 0,46 30,33' fill='%23007A4D'/%3E%3C/svg%3E");
  background-size: 45% auto;
  background-repeat: no-repeat;
  background-position: left center;
  opacity: 0.07;
  pointer-events: none;
}

/* Subtle gold highlight top-right */
.countdown-section::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255,182,18,0.10) 0%, transparent 70%);
  pointer-events: none;
}

.countdown-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 16px;
}

.countdown-date {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sa-gold);
  margin-bottom: 8px;
}

.countdown-grid {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.countdown-unit {
  text-align: center;
}

.countdown-number {
  font-size: 3rem;
  font-weight: 900;
  color: white;
  line-height: 1;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}

.countdown-unit-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}

.countdown-sep {
  font-size: 2rem;
  color: rgba(255,255,255,0.3);
  line-height: 3rem;
}

.countdown-subtitle {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  margin-top: 8px;
}

/* ── Timeline ── */
.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline-track {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.timeline-item {
  position: relative;
  min-width: 170px;
  flex: 1;
  padding: 0 8px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
}

.timeline-item:first-child::before {
  left: 50%;
}

.timeline-item:last-child::before {
  right: 50%;
}

.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 3px var(--border);
  margin: 0 auto 10px;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.timeline-item.past .timeline-dot     { background: var(--text-tertiary); box-shadow: 0 0 0 3px var(--border-strong); }
.timeline-item.current .timeline-dot  { background: var(--sa-red); box-shadow: 0 0 0 3px rgba(222,56,49,0.3); }
.timeline-item.upcoming .timeline-dot { background: var(--sa-green); box-shadow: 0 0 0 3px rgba(0,122,77,0.3); }
.timeline-item.future .timeline-dot   { background: var(--border); box-shadow: 0 0 0 3px var(--border); }

.timeline-content {
  text-align: center;
  padding: 0 4px;
}

.timeline-date {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Province styles ── */
.province-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.province-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  max-height: 700px;
  overflow-y: auto;
}

.province-list-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
}

.province-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.province-list-item:last-child {
  border-bottom: none;
}

.province-list-item:hover {
  background: var(--bg-hover);
}

.province-list-item.active {
  background: var(--normal-bg);
  border-left: 3px solid var(--sa-green);
  padding-left: 17px;
}

.province-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.province-list-info {
  flex: 1;
  min-width: 0;
}

.province-list-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.province-list-score {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.province-list-badge {
  flex-shrink: 0;
}

.province-detail-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.province-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  text-align: center;
}

.province-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.province-stat {
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.province-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.province-stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.province-basket-bar {
  margin: 6px 0;
}

.province-basket-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.province-basket-bar-label strong {
  color: var(--text-primary);
}

.province-risks {
  margin: 16px 0;
}

.province-risk-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.province-risk-item::before {
  content: '!';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--critical-bg);
  color: var(--critical);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  flex-shrink: 0;
  margin-top: 1px;
}

.survival-tip-box {
  background: var(--normal-bg);
  border: 1px solid var(--normal-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 0.83rem;
  color: #14532d;
  line-height: 1.6;
}

.survival-tip-box strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Province comparative table ── */
.province-table-wrap {
  max-width: 1280px;
  margin: 24px auto 0;
  padding: 0 20px;
  overflow-x: auto;
}

.province-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.province-table th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
}

.province-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.province-table tr:last-child td {
  border-bottom: none;
}

.province-table tr:hover td {
  background: var(--bg-hover);
}

.province-table td:first-child {
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Survival Kit ── */
.survival-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 24px;
}

.survival-subtabs {
  padding: 4px;
  margin: 0 20px 24px;
}

.survival-subtab-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  transition: all var(--transition);
  background: none;
}

.survival-subtab-btn.active {
  background: var(--sa-green);
  color: white;
  box-shadow: var(--shadow-sm);
}

.survival-subtab-btn:hover:not(.active) {
  background: white;
  color: var(--sa-green);
}

.survival-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Stockpile calculator */
.stockpile-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: flex-end;
}

.stockpile-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stockpile-control-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stockpile-control-group select,
.stockpile-control-group input {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: white;
  color: var(--text-primary);
  font-family: inherit;
  min-width: 120px;
}

.stockpile-control-group select:focus,
.stockpile-control-group input:focus {
  outline: 2px solid var(--sa-green);
  outline-offset: 1px;
  border-color: var(--sa-green);
}

.stockpile-total-card {
  background: linear-gradient(135deg, var(--sa-green) 0%, var(--sa-green-light) 100%);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  color: white;
  margin-bottom: 20px;
}

.stockpile-total-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 4px;
}

.stockpile-total-value {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -2px;
}

.stockpile-total-sub {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
  margin-top: 6px;
}

.stockpile-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.stockpile-item-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.stockpile-item-priority {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  flex-shrink: 0;
}

.stockpile-item-priority.p1 { background: #fee2e2; color: var(--critical); }
.stockpile-item-priority.p2 { background: #fff3cd; color: var(--elevated); }
.stockpile-item-priority.p3 { background: #e0f2fe; color: #0369a1; }

.stockpile-item-info {
  flex: 1;
  min-width: 0;
}

.stockpile-item-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.stockpile-item-size {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.stockpile-item-cat {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 0.3px;
}

.stockpile-item-right {
  text-align: right;
  flex-shrink: 0;
}

.stockpile-item-price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--sa-green);
}

.stockpile-item-qty {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

/* ── Budget strategies accordion ── */
.strategy-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.strategy-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: background var(--transition);
}

.strategy-header:hover {
  background: var(--bg-hover);
}

.strategy-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--sa-gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.strategy-title {
  flex: 1;
  font-weight: 700;
  font-size: 0.9rem;
}

.strategy-saving {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sa-green);
  background: var(--normal-bg);
  padding: 3px 10px;
  border-radius: 20px;
}

.strategy-chevron {
  color: var(--text-tertiary);
  transition: transform var(--transition);
  font-size: 1rem;
  font-weight: 700;
}

.strategy-card.open .strategy-chevron {
  transform: rotate(180deg);
}

.strategy-body {
  display: none;
  padding: 0 20px 16px 72px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.strategy-card.open .strategy-body {
  display: block;
}

.strategy-stores {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.strategy-store-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* ── SASSA grants ── */
.grants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.grant-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--sa-green);
}

.grant-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.grant-amount {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--sa-green);
  letter-spacing: -1px;
  line-height: 1;
}

.grant-period {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.grant-eligibility {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Grow your own ── */
.grow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.grow-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--sa-green);
}

.grow-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.grow-crop {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.grow-difficulty {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--normal-bg);
  color: var(--sa-green);
  border: 1px solid var(--normal-border);
}

.grow-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.grow-stat {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.grow-stat strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.82rem;
}

.grow-yield {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── Guides ── */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.guide-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.guide-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--sa-green);
  transform: translateY(-2px);
}

.guide-card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--normal-bg);
  border: 2px solid var(--normal-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 16px;
}

.guide-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.guide-card-desc {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.guide-card-steps {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sa-green);
}

/* Guide detail */
.guide-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.guide-detail-back {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sa-green);
  margin-bottom: 24px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.guide-detail-back:hover {
  text-decoration: underline;
}

.guide-step {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.guide-step:last-child {
  border-bottom: none;
}

.guide-step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sa-green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

.guide-step-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.guide-step-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Basket tracker ── */

/* Icon strip */
.basket-icon-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.basket-icon-strip-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  margin-right: 4px;
}

.basket-icon-strip-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.basket-icon-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.basket-icon-emoji {
  font-size: 1rem;
  line-height: 1;
}

.basket-icon-name {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* 3-way comparison grid */
.basket-compare-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0;
}

@media (max-width: 640px) {
  .basket-compare-grid {
    grid-template-columns: 1fr;
  }
  .bcc-arrow { display: none; }
}

.basket-compare-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  position: relative;
}

.basket-compare-card.now {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.basket-compare-card.projected {
  border-color: var(--critical);
  background: #fff9f9;
}

.bcc-arrow {
  text-align: center;
  font-size: 1.3rem;
  color: var(--text-tertiary);
  padding: 0 8px;
}

.projected-arrow {
  color: var(--critical);
}

.bcc-period {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.bcc-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.bcc-total {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.bcc-total.projected {
  color: var(--critical);
}

.bcc-sub {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.bcc-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

.bcc-badge.neutral { background: var(--bg-hover); color: var(--text-secondary); }
.bcc-badge.up      { background: #fee2e2; color: #991b1b; }
.bcc-badge.critical{ background: #fee2e2; color: #991b1b; }

/* Since 2015 callout */
.basket-since-callout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  background: #fef9ec;
  border: 1px solid #f59e0b;
  border-left: 5px solid #f59e0b;
  border-radius: var(--radius-md);
}

.bsc-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.bsc-headline {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.5;
}

.bsc-detail {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Item cards — redesigned */
.basket-item-emoji {
  font-size: 1.7rem;
  line-height: 1;
}

.basket-item-icon-wrap {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  background: var(--bg-hover);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.basket-item-info {
  flex: 1;
  min-width: 0;
}

.basket-item-price-now {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.basket-item-per {
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.basket-item-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.basket-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.basket-badge.critical { background: #fee2e2; color: #991b1b; }
.basket-badge.high     { background: #fff3cd; color: #92400e; }
.basket-badge.elevated { background: #fef9ec; color: #b45309; }
.basket-badge.muted    { background: var(--bg-hover); color: var(--text-tertiary); }

.badge-sub {
  font-weight: 400;
  opacity: .8;
}

.basket-price-row.highlight {
  background: var(--bg-hover);
  margin: 0 -4px;
  padding: 5px 4px;
  border-radius: 4px;
  border-bottom: none;
}

.basket-price-row.highlight-now {
  background: #eff6ff;
  margin: 0 -4px;
  padding: 5px 4px;
  border-radius: 4px;
  border-bottom: none;
}

.basket-price-row.projected-row {
  background: #fff9f9;
  margin: 0 -4px;
  padding: 5px 4px;
  border-radius: 4px;
  border-bottom: none;
}

.basket-price-val.strong {
  font-weight: 800;
  color: #1d4ed8;
}

.basket-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.basket-household-btns {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.household-btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
  background: none;
}

.household-btn.active {
  background: var(--sa-green);
  color: white;
}

.basket-chart-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.chart-toggle-btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
  background: none;
}

.chart-toggle-btn.active {
  background: white;
  color: var(--sa-green);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* Basket item cards */
.basket-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.basket-item-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.basket-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.basket-item-header:hover {
  background: var(--bg-hover);
}

.basket-item-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.basket-item-change {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--critical);
  display: none; /* replaced by .basket-item-badges */
}

.basket-item-detail {
  display: none;
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}

.basket-item-card.expanded .basket-item-detail {
  display: block;
}

.basket-price-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.basket-price-row:last-child {
  border-bottom: none;
}

.basket-price-year {
  color: var(--text-secondary);
}

.basket-price-val {
  font-weight: 700;
  color: var(--text-primary);
}

.basket-price-val.projected {
  color: var(--critical);
}

/* ── Supply chain steps ── */
.supply-chain {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
}

.supply-step {
  flex: 1;
  min-width: 120px;
  text-align: center;
  position: relative;
}

.supply-step::after {
  content: '→';
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 1.2rem;
  z-index: 1;
}

.supply-step:last-child::after {
  display: none;
}

.supply-step-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 8px;
}

.supply-step-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.supply-step-impact {
  font-size: 0.68rem;
  color: var(--critical);
  font-weight: 700;
}

/* ── Quick actions ── */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.quick-action-item:hover {
  border-color: var(--sa-green);
  background: var(--normal-bg);
}

.quick-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.quick-action-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.quick-action-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.quick-action-arrow {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 1.1rem;
}

/* ── Explainer cards ── */
.explainer-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--sa-gold-ui);
}

.explainer-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.explainer-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.explainer-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Commodity cards ── */
.commodity-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.commodity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid transparent;
}

.commodity-header:hover {
  background: var(--bg-hover);
}

.commodity-card.expanded .commodity-header {
  border-bottom-color: var(--border);
}

.commodity-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.commodity-unit {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.commodity-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.commodity-detail {
  display: none;
  padding: 16px 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.commodity-card.expanded .commodity-detail {
  display: block;
}

.commodity-sparkline-wrap {
  position: relative;
  padding: 0 12px 4px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

.commodity-sparkline {
  display: block;
  width: 100% !important;
  height: 52px !important;
}

.sparkline-label {
  position: absolute;
  top: 4px;
  right: 14px;
  font-size: 0.62rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* ── Price confidence matrix ── */
.confidence-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.confidence-cell {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.confidence-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.confidence-item-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.confidence-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 6px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 3px;
}

.confidence-level {
  font-size: 0.7rem;
  font-weight: 600;
}

/* ── Scrollbar styling ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ── Utility ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 32px; }
.fw-bold { font-weight: 700; }
.fw-black { font-weight: 900; }
.text-green { color: var(--sa-green); }
.text-red { color: var(--critical); }
.text-gold { color: var(--sa-gold-ui); }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }

.spacer { flex: 1; }

/* Live indicator */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 5px;
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.last-updated-text {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

/* Loading spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--sa-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error notice */
.error-notice {
  background: var(--critical-bg);
  border: 1px solid var(--critical-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.82rem;
  color: #7f1d1d;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .province-layout {
    grid-template-columns: 1fr;
  }

  .province-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-alert {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .countdown-grid {
    gap: 12px;
  }

  .countdown-number {
    font-size: 2.2rem;
  }

  .tab-btn {
    padding: 12px 12px;
    font-size: 0.8rem;
  }

  .survival-subtabs {
    margin: 0 10px 20px;
    flex-wrap: wrap;
  }

  .survival-subtab-btn {
    flex: none;
    font-size: 0.75rem;
    padding: 8px 12px;
  }

  .province-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .confidence-matrix {
    grid-template-columns: 1fr;
  }

  .stockpile-controls {
    gap: 10px;
  }
}

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

  .header-logo-text h1 {
    font-size: 1rem;
  }

  .countdown-number {
    font-size: 1.8rem;
  }

  .province-stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Dashboard layout helpers ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.dashboard-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.dashboard-full {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.dashboard-section {
  margin-bottom: 28px;
}

.tab-panel-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Vulnerability snapshot ── */
.vuln-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vuln-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.vuln-rank {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  width: 20px;
  flex-shrink: 0;
  text-align: center;
}

.vuln-name {
  font-weight: 600;
  font-size: 0.85rem;
  flex: 1;
}

.vuln-bar-wrap {
  flex: 2;
}

.vuln-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.vuln-fill {
  height: 100%;
  border-radius: 3px;
}

.vuln-score {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 30px;
  text-align: right;
}

/* ── Fuel metric boxes ── */
.fuel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.fuel-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--sa-green);
}

.fuel-box.warning { border-left-color: var(--high); }
.fuel-box.critical { border-left-color: var(--critical); }

.fuel-box-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.fuel-box-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.fuel-box-sub {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

@media (max-width: 900px) {
  .fuel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid-3 {
    grid-template-columns: 1fr;
  }
}

