/* ===========================================================================
   Ricky Rich · Italian Modernist Finance Editorial
   Design tokens + base styles + components.
   No reliance on Tailwind for colors/typography (kept only for spacing utilities).
   =========================================================================== */

:root {
  /* ── Typography ───────────────────────────────────────────────────── */
  --font-display: 'Instrument Serif', 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  /* ── Color · Light (Avorio Italiano) ─────────────────────────────── */
  --ink: #1A1815;
  --ink-deep: #0D0C0A;
  --paper: #F8F4EE;
  --paper-elevated: #FCFAF4;
  --paper-deep: #EDE6DA;
  --rule: #D8CFBE;
  --rule-soft: #E5DDCC;
  --muted: #75695A;
  --muted-soft: #A89C8A;

  --accent: #B23A1B;          /* terracotta italiana */
  --accent-soft: #E8D5CB;
  --accent-deep: #7C2611;
  --gain: #2D5F3F;            /* verde finance */
  --gain-soft: #C7DCC9;
  --loss: #B23A1B;
  --warn: #C68A2E;

  /* ── Scale ────────────────────────────────────────────────────────── */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* ── Motion ──────────────────────────────────────────────────────── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 180ms;
  --dur-med: 380ms;
  --dur-slow: 720ms;

  /* ── Safe-area iOS ───────────────────────────────────────────────── */
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
  --sa-right: env(safe-area-inset-right, 0px);
}

:root.dark {
  --ink: #F0EBE0;
  --ink-deep: #FFFFFF;
  --paper: #0D0C0A;
  --paper-elevated: #18150F;
  --paper-deep: #050403;
  --rule: #2E2820;
  --rule-soft: #1F1B14;
  --muted: #8D8576;
  --muted-soft: #5A5448;

  --accent: #E8633F;
  --accent-soft: #4A2418;
  --accent-deep: #F88962;
  --gain: #5DA871;
  --gain-soft: #1F3526;
  --loss: #E8633F;
  --warn: #E0A858;
}

/* ── Reset & base ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--paper);
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  letter-spacing: -0.005em;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; color: inherit; }

/* ── Typography classes ─────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.02em; }
.font-mono { font-family: var(--font-mono); font-feature-settings: "tnum", "zero"; }
.italic-display { font-style: italic; }

.kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker-accent { color: var(--accent); }

.display-xl {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 9rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  font-weight: 400;
}
.display-lg {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.display-md {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.metric {
  font-family: var(--font-mono);
  font-feature-settings: "tnum", "zero";
  letter-spacing: -0.02em;
  line-height: 1;
}
.metric-xl { font-size: clamp(2rem, 5vw, 3rem); }
.metric-lg { font-size: 1.75rem; }
.metric-md { font-size: 1.25rem; }

.gain { color: var(--gain); }
.loss { color: var(--loss); }
.muted { color: var(--muted); }

/* ── Layout ─────────────────────────────────────────────────────────── */
.container-edit {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: max(1.25rem, var(--sa-left));
  padding-right: max(1.25rem, var(--sa-right));
}
@media (min-width: 768px) {
  .container-edit { padding-left: max(2rem, var(--sa-left)); padding-right: max(2rem, var(--sa-right)); }
}

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}
.rule-double {
  height: 6px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

/* ── Header / Masthead ─────────────────────────────────────────────── */
.masthead {
  padding-top: calc(0.875rem + var(--sa-top));
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  background-color: color-mix(in oklab, var(--paper) 88%, transparent);
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.85rem;
  letter-spacing: -0.025em;
  line-height: 1;
}
.brand-mark { font-style: italic; color: var(--accent); }
.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 0.25rem;
}

.icon-btn {
  width: 44px; height: 44px;
  border-radius: var(--r-full);
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--paper-deep); border-color: var(--ink); outline: none; }

/* ── Ticker tape ───────────────────────────────────────────────────── */
.ticker-tape {
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: relative;
}
.ticker-tape::before,
.ticker-tape::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  z-index: 2;
  pointer-events: none;
}
.ticker-tape::before { left: 0; background: linear-gradient(90deg, var(--paper), transparent); }
.ticker-tape::after { right: 0; background: linear-gradient(-90deg, var(--paper), transparent); }
.ticker-track {
  display: inline-flex;
  gap: 3rem;
  padding: 0.6rem 0;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--muted);
}
.ticker-symbol {
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ticker-price { color: var(--ink); }
.ticker-change.gain { color: var(--gain); }
.ticker-change.loss { color: var(--loss); }
@keyframes ticker-scroll {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* ── Hero / Masthead newspaper ─────────────────────────────────────── */
.editorial-masthead {
  padding: clamp(2.5rem, 8vw, 5rem) 0 clamp(2rem, 6vw, 4rem);
  text-align: center;
  position: relative;
}
.editorial-masthead .meta-line {
  display: flex; justify-content: center; align-items: center; gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.editorial-masthead .meta-line .dot { width: 4px; height: 4px; border-radius: var(--r-full); background: var(--muted); }
.editorial-masthead h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 14vw, 9rem);
  line-height: 0.86;
  letter-spacing: -0.045em;
  color: var(--ink);
}
.editorial-masthead h1 .ital { font-style: italic; color: var(--accent); display: inline-block; }
.editorial-masthead .sub {
  max-width: 38rem;
  margin: 2rem auto 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  line-height: 1.4;
  color: var(--muted);
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.card-paper {
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.card-tall {
  min-height: 220px;
  display: flex; flex-direction: column; justify-content: space-between;
}

.mode-card {
  display: block;
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: left;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur-med) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.mode-card::after {
  content: '→';
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  font-size: 1.25rem;
  color: var(--muted);
  transition: transform var(--dur-med) var(--ease-spring), color var(--dur-fast) ease;
}
.mode-card:hover,
.mode-card:focus-visible {
  outline: none;
  border-color: var(--ink);
  transform: translateY(-2px);
}
.mode-card:hover::after,
.mode-card:focus-visible::after {
  transform: translate(6px, -2px);
  color: var(--accent);
}
.mode-card .num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.mode-card .label {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.1;
  margin: 0.5rem 0 0.5rem;
  letter-spacing: -0.02em;
}
.mode-card .desc {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}
.mode-card.recommended {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.mode-card.recommended .label,
.mode-card.recommended .num { color: var(--paper); }
.mode-card.recommended .desc { color: var(--paper-deep); }
.mode-card.recommended::after { color: var(--paper-deep); }
.mode-card.recommended .badge-rec {
  position: absolute;
  bottom: 1.25rem; left: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  min-height: 48px;
  border-radius: var(--r-full);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: all var(--dur-fast) var(--ease-out);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--accent);
  outline: none;
}
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  background: var(--paper-elevated);
  border-color: var(--ink);
  outline: none;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  min-height: 40px;
  padding: 0.5rem 1rem;
}
.btn-ghost:hover { color: var(--accent); }
.btn-block { display: flex; width: 100%; }

/* ── Form controls ─────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.input, .select {
  width: 100%;
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 0.75rem 1rem;
  min-height: 48px;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
  appearance: none;
  -webkit-appearance: none;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--ink);
}
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2375695A' stroke-width='1.5' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* Range slider — iOS/Android safe */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--rule);
  border-radius: var(--r-full);
  outline: none;
  padding: 0;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  background: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  cursor: grab;
  transition: transform var(--dur-fast) var(--ease-spring);
}
.range::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
.range::-moz-range-thumb {
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  background: var(--ink);
  border: 2px solid var(--paper);
  cursor: grab;
}

/* Radio cards */
.radio-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-elevated);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  min-height: 64px;
}
.radio-card:hover { border-color: var(--ink); }
.radio-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .radio-dot {
  width: 22px; height: 22px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--rule);
  flex-shrink: 0;
  display: grid; place-items: center;
  transition: border-color var(--dur-fast) ease;
}
.radio-card .radio-dot::after {
  content: ''; width: 10px; height: 10px;
  border-radius: var(--r-full);
  background: var(--ink);
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-spring);
}
.radio-card input[type="radio"]:checked ~ .radio-dot { border-color: var(--ink); }
.radio-card input[type="radio"]:checked ~ .radio-dot::after { transform: scale(1); }
.radio-card:has(input[type="radio"]:checked) {
  border-color: var(--ink);
  background: var(--paper-deep);
}

/* ── Tables ────────────────────────────────────────────────────────── */
.editorial-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.editorial-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.75rem 1rem 0.75rem 0;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
  font-weight: 500;
}
.editorial-table tbody tr {
  border-bottom: 1px solid var(--rule-soft);
  transition: background var(--dur-fast) ease;
}
.editorial-table tbody tr:hover { background: var(--paper-deep); }
.editorial-table td {
  padding: 1rem 1rem 1rem 0;
  vertical-align: middle;
}
.editorial-table .num-cell {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  text-align: right;
}
.editorial-table .ticker-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
}

/* ── Badge ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--r-full);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  font-weight: 500;
  background: var(--paper-deep);
  color: var(--muted);
  border: 1px solid var(--rule);
}
.badge .dot {
  width: 6px; height: 6px;
  border-radius: var(--r-full);
  background: currentColor;
}
.badge-green { color: var(--gain); background: var(--gain-soft); border-color: transparent; }
.badge-orange { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge-yellow { color: var(--warn); background: color-mix(in oklab, var(--warn) 18%, var(--paper)); border-color: transparent; }
.badge-gray { color: var(--muted); }

/* ── Tooltips ──────────────────────────────────────────────────────── */
.tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--muted);
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.625rem 0.875rem;
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.002em;
  white-space: pre-wrap;
  width: max-content;
  max-width: 280px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) ease;
  z-index: 20;
}
.tooltip:hover::after, .tooltip:focus-within::after { opacity: 1; }

/* ── Disclaimer ────────────────────────────────────────────────────── */
.disclaimer {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--paper-elevated);
  font-size: 0.875rem;
  color: var(--ink);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.disclaimer strong { color: var(--accent); }

/* ── Animations ────────────────────────────────────────────────────── */
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes draw-line {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}
.rise {
  opacity: 0;
  animation: rise var(--dur-slow) var(--ease-out) forwards;
}
.rise-1 { animation-delay: 80ms; }
.rise-2 { animation-delay: 160ms; }
.rise-3 { animation-delay: 240ms; }
.rise-4 { animation-delay: 320ms; }
.rise-5 { animation-delay: 400ms; }
.rise-6 { animation-delay: 500ms; }

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; opacity: 1; }
  html { scroll-behavior: auto; }
}

/* ── Section breaks ────────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--ink);
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}
.section-head .meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Skeleton ──────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--rule-soft) 25%, var(--paper-deep) 50%, var(--rule-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Loading state ─────────────────────────────────────────────────── */
.loader-pulse {
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  background: var(--accent);
  margin: 0 auto 1.5rem;
  animation: pulse-grow 1.4s var(--ease-out) infinite;
}
@keyframes pulse-grow {
  0%, 100% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ── Footer ────────────────────────────────────────────────────────── */
.editorial-footer {
  margin-top: 4rem;
  padding: 2rem 0 calc(2rem + var(--sa-bottom));
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
}
.editorial-footer .colofon {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (min-width: 768px) {
  .editorial-footer .colofon { grid-template-columns: 2fr 1fr 1fr; }
}
.editorial-footer .colofon strong { color: var(--ink); display: block; margin-bottom: 0.5rem; font-weight: 500; }

/* ── Print ─────────────────────────────────────────────────────────── */
@media print {
  .masthead, .ticker-tape, .editorial-footer, .btn, .icon-btn, .no-print { display: none !important; }
  body { background: white; color: black; }
  .card { border: 1px solid #999; box-shadow: none; }
}

/* ── Utilities (only what we need) ─────────────────────────────────── */
.stack { display: flex; flex-direction: column; }
.row { display: flex; }
.grid { display: grid; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.italic { font-style: italic; }
.font-mono { font-family: var(--font-mono); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }

/* Responsive grids */
.grid-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) { .grid-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-cards { grid-template-columns: repeat(4, 1fr); } }

.grid-results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 900px) {
  .grid-results { grid-template-columns: 1.4fr 1fr; }
}

.grid-metrics-3 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (min-width: 640px) { .grid-metrics-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid-metrics-3 { grid-template-columns: repeat(6, 1fr); } }

/* Metric tile */
.tile-metric {
  padding: 1rem;
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.tile-metric .label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.tile-metric .value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* SVG donut */
.donut-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
}
@media (min-width: 700px) {
  .donut-wrap { grid-template-columns: 240px 1fr; }
}
.donut-svg { width: 100%; max-width: 240px; height: auto; aspect-ratio: 1; margin: 0 auto; }
.donut-svg circle.bg { stroke: var(--rule); }
.donut-svg .seg-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  fill: var(--muted);
}
.donut-center-num {
  font-family: var(--font-display);
  font-size: 1.85rem;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: middle;
}
.donut-center-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  fill: var(--muted);
  text-anchor: middle;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.92rem;
}
.legend-swatch {
  width: 10px; height: 10px;
  border-radius: 2px;
  align-self: center;
}
.legend-label { color: var(--ink); }
.legend-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.legend-val strong { color: var(--ink); font-weight: 500; }
