/* BOSS's own design system. Deliberately avoids Metro UI classes whose
   behavior is a poor fit for plain content (Metro's .app-bar is
   position:fixed, .badge is position:absolute top:0/right:0 meant for
   corner notification dots, .button flex-grows inside a flex parent,
   and .table/.select assume extra JS-generated markup). Metro is kept
   for its icon font (mif-*), which is plain, predictable CSS.

   Design language: flat surfaces separated by hairline borders, not
   drop shadows (a data-dense reference tool reads as more precise this
   way than a "card soup" of floating panels); one restrained accent
   color, not a decorative one per badge/category; a monospace face for
   every genuinely numeric value (prices, Greeks, percentages) so digits
   line up the way they would on a real pricing terminal, while prose
   stays on the system sans. No web font is loaded -- every face here is
   already on the device -- keeping with cmd/boss's zero-runtime-
   dependency design (see README's "no CDN, everything embedded"). */

:root {
  color-scheme: light dark;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius: 8px;
  --radius-sm: 5px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;

  --boss-bg: #f7f7f5;
  --boss-surface: #ffffff;
  --boss-surface-alt: #f1f0ec;
  --boss-fg: #17181c;
  --boss-muted: #62666f;
  --boss-muted-2: #7b7e86;
  --boss-border: #e2e1db;
  --boss-primary: #1f3a5f;
  --boss-primary-dark: #16283f;
  --boss-primary-fg: #ffffff;
  --boss-primary-tint: #edf1f5;
  --boss-positive: #15754d;
  --boss-positive-tint: #e9f4ef;
  --boss-negative: #a13529;
  --boss-negative-tint: #f8ece9;
  --boss-warning-bg: #f9f0e2;
  --boss-warning-fg: #7c531a;
  --shadow-sm: 0 1px 2px rgba(20, 20, 18, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --boss-bg: #101113;
    --boss-surface: #17181b;
    --boss-surface-alt: #1d1f23;
    --boss-fg: #e9e8e4;
    --boss-muted: #9a9da5;
    --boss-muted-2: #84878f;
    --boss-border: #2a2c31;
    --boss-primary: #9db8d9;
    --boss-primary-dark: #c2d5ea;
    --boss-primary-fg: #10202f;
    --boss-primary-tint: #1a2733;
    --boss-positive: #56b98c;
    --boss-positive-tint: #12261e;
    --boss-negative: #d98177;
    --boss-negative-tint: #2b1815;
    --boss-warning-bg: #2c2318;
    --boss-warning-fg: #e3b878;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --boss-bg: #101113;
  --boss-surface: #17181b;
  --boss-surface-alt: #1d1f23;
  --boss-fg: #e9e8e4;
  --boss-muted: #9a9da5;
  --boss-muted-2: #84878f;
  --boss-border: #2a2c31;
  --boss-primary: #9db8d9;
  --boss-primary-dark: #c2d5ea;
  --boss-primary-fg: #10202f;
  --boss-primary-tint: #1a2733;
  --boss-positive: #56b98c;
  --boss-positive-tint: #12261e;
  --boss-negative: #d98177;
  --boss-negative-tint: #2b1815;
  --boss-warning-bg: #2c2318;
  --boss-warning-fg: #e3b878;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  background: var(--boss-bg);
  color: var(--boss-fg);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-sans); line-height: 1.2; letter-spacing: -0.01em; font-weight: 650; }
a { color: var(--boss-primary); }
a:hover { color: var(--boss-primary-dark); }

/* Any genuinely numeric value -- a price, a Greek, a percentage, a
   strike -- reads as more exact in a fixed-width face with tabular
   figures than in the prose sans, the same convention a real pricing
   terminal follows. Applied by role (see each component below), never
   blanket-applied to body text. */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.boss-container { max-width: 1080px; margin: 0 auto; padding-inline: var(--space-4); }
.boss-main { padding-block: var(--space-6) var(--space-8); }

/* ---------- nav ---------- */
.boss-navbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--boss-bg);
  border-bottom: 1px solid var(--boss-border);
}
.boss-navbar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-3); flex-wrap: wrap; }
.boss-brand { font-weight: 700; font-size: 1.05em; letter-spacing: 0.06em; text-decoration: none; color: var(--boss-fg); }
.boss-nav-links { display: flex; gap: var(--space-5); flex-wrap: wrap; row-gap: var(--space-1); }
.boss-nav-links a { text-decoration: none; color: var(--boss-muted); font-size: 0.88em; font-weight: 600; }
.boss-nav-links a:hover { color: var(--boss-fg); }
.lang-switcher { display: flex; gap: 2px; }
.lang-link { padding: 3px 8px; border-radius: var(--radius-sm); font-size: 0.72em; font-weight: 700; text-decoration: none; color: var(--boss-muted); letter-spacing: 0.03em; }
.lang-link:hover { color: var(--boss-fg); background: var(--boss-surface-alt); }
.lang-link.active { color: var(--boss-fg); background: var(--boss-surface-alt); }

/* ---------- cards & sections ---------- */
.card {
  background: var(--boss-surface);
  border: 1px solid var(--boss-border);
  border-radius: var(--radius);
  padding: var(--space-6);
}
.card + .card { margin-top: var(--space-5); }

/* ---------- hero ---------- */
.hero {
  padding: var(--space-8) 0 var(--space-6);
  border-bottom: 1px solid var(--boss-border);
  margin-bottom: var(--space-6);
}
.hero h1 {
  font-size: 0.8em; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--boss-muted); margin: 0;
}
.hero h2 { font-size: clamp(1.9em, 4vw, 2.6em); font-weight: 650; letter-spacing: -0.02em; color: var(--boss-fg); margin: var(--space-2) 0 0; text-wrap: balance; }
.hero p { color: var(--boss-muted); max-width: 58ch; margin: var(--space-3) 0 0; font-size: 1.05em; }
.hero-links { margin-top: var(--space-6); display: flex; gap: var(--space-3); flex-wrap: wrap; }

.boss-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding-block: 11px; padding-inline: 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--boss-border); background: var(--boss-surface);
  color: var(--boss-fg); text-decoration: none; font-size: 0.92em; font-weight: 600;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.boss-btn:hover { border-color: var(--boss-muted-2); background: var(--boss-surface-alt); color: var(--boss-fg); }
.boss-btn-primary { background: var(--boss-primary); color: var(--boss-primary-fg); border-color: var(--boss-primary); }
.boss-btn-primary:hover { background: var(--boss-primary-dark); border-color: var(--boss-primary-dark); color: var(--boss-primary-fg); }

/* ---------- find-by tiles ---------- */
.section-intro { color: var(--boss-muted); margin-top: var(--space-2); }
/* A plain flex-wrap row of cards, not CSS grid: grid's auto-placement
   combined with auto-sized rows and flex children turned out to be an
   unreliable combination in testing (Chromium would size an item's own
   row correctly but position the *next* row using a stale, too-short
   row-height, so row 2 visibly overlapped row 1). Flex-wrap has no
   equivalent row-track-sizing step to get wrong. */
.tiles-grid { display: flex; flex-wrap: wrap; gap: 1px; margin-top: var(--space-5); background: var(--boss-border); border: 1px solid var(--boss-border); border-radius: var(--radius); overflow: hidden; }
.tile {
  flex: 1 1 190px;
  display: flex; flex-direction: column; gap: var(--space-2);
  padding-block: 40px; padding-inline: var(--space-5);
  background: var(--boss-surface); text-decoration: none; color: inherit;
  transition: background 0.12s ease;
}
.tile:hover { background: var(--boss-surface-alt); }
.tile .mif-2x { color: var(--boss-muted); font-size: 1.6em; }
.tile-label { font-size: 1.05em; font-weight: 650; }
.tile-count { color: var(--boss-muted); font-size: 0.85em; }
.back-link { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--boss-muted); text-decoration: none; font-size: 0.88em; font-weight: 600; margin-bottom: var(--space-3); }
.back-link:hover { color: var(--boss-fg); }

/* ---------- strategy page ---------- */
.strategy-header-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap;
}
.strategy-header h1 { font-size: 1.9em; letter-spacing: -0.015em; margin-bottom: var(--space-3); }
.strategy-badges { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-5); }
.share-hero { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.boss-btn-share-hero {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--boss-primary);
  background: var(--boss-primary); color: var(--boss-primary-fg);
  font-size: 0.92em; font-weight: 650; cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.boss-btn-share-hero:hover { background: var(--boss-primary-dark); border-color: var(--boss-primary-dark); }
.boss-btn-share-hero .mif-share { font-size: 1.05em; }
.boss-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px; border-radius: var(--radius-sm);
  font-size: 0.76em; font-weight: 650; letter-spacing: 0.01em;
  background: transparent; color: var(--boss-muted); border: 1px solid var(--boss-border);
  text-decoration: none; cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.boss-badge:hover { border-color: var(--boss-muted-2); color: var(--boss-fg); text-decoration: none; }
/* Only Risk and Reward get semantic color -- they're the two dimensions
   a viewer actually needs to spot at a glance; giving every other
   classification (proficiency, direction, volatility, type) its own
   decorative hue was noise, not signal, in a page whose subject is
   already dense with real numbers competing for attention. */
.boss-badge-risk { background: var(--boss-negative-tint); color: var(--boss-negative); border-color: transparent; }
.boss-badge-reward { background: var(--boss-positive-tint); color: var(--boss-positive); border-color: transparent; }

.strategy-content h2 { font-size: 1.05em; font-weight: 650; margin-top: var(--space-6); margin-bottom: var(--space-2); }
.strategy-content h2:first-child { margin-top: 0; }
.strategy-content p, .strategy-content li { color: var(--boss-fg); }
.strategy-content ul, .strategy-content ol { padding-left: 1.3em; }
.boss-columns-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.lookalikes { list-style: none; padding: 0; display: flex; gap: var(--space-2); flex-wrap: wrap; }
.lookalikes li a {
  display: inline-block; padding: 5px 12px; border: 1px solid var(--boss-border); border-radius: var(--radius-sm);
  text-decoration: none; font-size: 0.86em; font-weight: 600; color: var(--boss-fg);
}
.lookalikes li a:hover { border-color: var(--boss-muted-2); background: var(--boss-surface-alt); }

/* ---------- live structure ---------- */
.live-structure-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.live-structure-header h2 { margin: 0; font-size: 1.05em; font-weight: 650; }
.live-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: var(--space-3);
  font-size: 0.76em; font-weight: 650; color: var(--boss-positive); text-transform: uppercase; letter-spacing: 0.04em;
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--boss-positive); animation: boss-pulse 1.8s ease-in-out infinite; }
@keyframes boss-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
/* A stale badge must not read as "everything is fine, just paused": no
   pulse (pulsing implies an active feed), a warning color instead of
   the positive one, and a title attribute (set in the template) that
   explains why -- the whole point is that this state is visibly
   different from the one it replaces, not a subtler shade of the same
   thing. */
.live-badge-stale { color: var(--boss-warning-fg); cursor: help; }
.live-badge-stale .live-dot { background: var(--boss-warning-fg); animation: none; }

.controls-row { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-4); }
#structure-controls.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s ease; }
.control { flex: 1 1 180px; }
.share-feedback { font-size: 0.85em; color: var(--boss-positive); font-weight: 600; }
.control label { display: block; font-size: 0.76em; font-weight: 650; color: var(--boss-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--space-1); }
.boss-select {
  width: 100%; padding: 9px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--boss-border); background: var(--boss-surface); color: var(--boss-fg);
  font-size: 0.95em; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.boss-select:focus-visible { outline: 2px solid var(--boss-primary); outline-offset: 1px; }

.index-price-banner {
  display: inline-flex; gap: 6px; align-items: baseline;
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--boss-surface-alt); color: var(--boss-muted);
  font-size: 0.85em;
}
.index-price-banner strong { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.05em; color: var(--boss-fg); }

.table-scroll { margin-top: var(--space-5); overflow-x: auto; }
.boss-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 0.92em; }
.boss-table th, .boss-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--boss-border); }
.boss-table thead th { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--boss-muted); font-weight: 650; }
.boss-table tbody tr:hover { background: var(--boss-surface-alt); }
.pos-long { color: var(--boss-positive); font-weight: 650; }
.pos-short { color: var(--boss-negative); font-weight: 650; }

.boss-metrics { display: flex; flex-wrap: wrap; margin-top: var(--space-5); border: 1px solid var(--boss-border); border-radius: var(--radius); overflow: hidden; }
.metric {
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--space-3) var(--space-4);
  flex: 1 1 130px;
  border-right: 1px solid var(--boss-border); border-bottom: 1px solid var(--boss-border);
}
.metric:last-child, .metric-wide { border-right: none; }
.metric-wide { flex: 2 1 260px; }
.metric-label { font-size: 0.7em; color: var(--boss-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 650; }
.metric-value { font-family: var(--font-mono); font-size: 1.2em; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-value.positive { color: var(--boss-positive); }
.metric-value.negative { color: var(--boss-negative); }

.charts-section-title { margin-top: var(--space-6); margin-bottom: var(--space-1); font-size: 1.05em; font-weight: 650; }
.charts-section-hint { color: var(--boss-muted); font-size: 0.86em; margin-top: 0; margin-bottom: var(--space-4); }

.cost-card {
  margin-top: var(--space-5); padding: var(--space-4) var(--space-5);
  border: 1px solid var(--boss-border); border-radius: var(--radius); background: var(--boss-surface-alt);
}
.cost-card h3 { margin: 0 0 var(--space-1); font-size: 0.95em; font-weight: 650; }
.cost-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--boss-border); }
.cost-row span:first-child { color: var(--boss-muted); font-size: 0.92em; }
.cost-row span:last-child { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cost-row.cost-total { border-bottom: none; padding-top: var(--space-2); font-weight: 650; font-size: 1.05em; }
.cost-row.cost-total span:first-child { color: var(--boss-fg); font-size: 1em; }
.boss-charts-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--boss-border); border: 1px solid var(--boss-border); border-radius: var(--radius); overflow: hidden;
}
.boss-charts-grid .chart-block:first-child { grid-column: 1 / -1; }
.chart-block {
  background: var(--boss-surface);
  padding: var(--space-4);
}
.chart-block h3 { margin: 0 0 var(--space-2); font-size: 0.85em; color: var(--boss-muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; }
.boss-chart { display: block; max-width: 100%; width: 100%; height: auto; }

.scenario-table-scroll { margin-top: var(--space-3); }
.scenario-table { min-width: 480px; font-size: 0.88em; }
.scenario-table td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.scenario-table td.positive, .scenario-table td.negative { font-weight: 650; }
.scenario-table tr.scenario-current { background: var(--boss-primary-tint); }
.scenario-table tr.scenario-breakeven td:first-child { font-style: italic; }
.scenario-tag {
  display: inline-block; font-family: var(--font-sans); font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.03em;
  font-weight: 650; color: var(--boss-muted); border: 1px solid var(--boss-border);
  border-radius: var(--radius-sm); padding: 1px 7px; margin-left: 4px; vertical-align: middle;
}

/* ---------- glossary / reference ---------- */
.glossary { margin-top: var(--space-3); }
.glossary dt { font-weight: 650; margin-top: var(--space-4); }
.glossary dd { margin-left: 0; color: var(--boss-muted); }
.strategy-index { columns: 3; list-style: none; padding: 0; margin-top: var(--space-3); }
.strategy-index li { break-inside: avoid; margin-bottom: var(--space-2); }
.strategy-index li a { text-decoration: none; color: var(--boss-fg); }
.strategy-index li a:hover { color: var(--boss-primary); }

.strategy-list { list-style: none; padding: 0; margin-top: var(--space-4); display: flex; flex-direction: column; }
.strategy-list li a {
  display: block; padding: var(--space-3) var(--space-4); border: 1px solid var(--boss-border);
  text-decoration: none; color: var(--boss-fg); font-weight: 600;
}
.strategy-list li:not(:first-child) a { margin-top: -1px; }
.strategy-list li:first-child a { border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); }
.strategy-list li:last-child a { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.strategy-list li a:hover { position: relative; border-color: var(--boss-muted-2); background: var(--boss-surface-alt); }

.boss-alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--boss-surface-alt); margin-bottom: var(--space-4); border: 1px solid var(--boss-border); }
.boss-alert-warning { background: var(--boss-warning-bg); color: var(--boss-warning-fg); border-color: transparent; }

.prose { max-width: 680px; }
.prose h1 { font-size: 1.7em; letter-spacing: -0.015em; }
.prose p, .prose li { color: var(--boss-fg); }

@media (max-width: 820px) {
  .boss-charts-grid { grid-template-columns: repeat(2, 1fr); }
  .boss-charts-grid .chart-block:first-child { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .strategy-index { columns: 1; }
  .boss-columns-2 { grid-template-columns: 1fr; gap: var(--space-4); }
  .card { padding: var(--space-4); }
  .metric { border-right: none; }

  /* Below the legs table's readable width, a scrolling 8-column table
     hides the leg you're looking at (Position/Right) off the left edge
     as soon as you scroll to see Premium/Fill Price/Fee. Restacking
     each row as a small labeled card keeps every leg's identity next
     to its numbers at all times, no horizontal scrolling required. */
  .table-scroll { overflow-x: visible; }
  .boss-table { min-width: 0; }
  .boss-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .boss-table, .boss-table tbody, .boss-table tr, .boss-table td { display: block; width: 100%; }
  .boss-table tr {
    border: 1px solid var(--boss-border); border-radius: var(--radius-sm);
    margin-bottom: var(--space-3); padding: var(--space-2) var(--space-3);
  }
  .boss-table td {
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
    border-bottom: 1px solid var(--boss-border); padding: 8px 0; text-align: right;
  }
  .boss-table td:last-child { border-bottom: none; }
  .boss-table td::before {
    content: attr(data-label); font-family: var(--font-sans); font-size: 0.75em; text-transform: uppercase;
    letter-spacing: 0.03em; color: var(--boss-muted); font-weight: 650; text-align: left;
  }
}
@media (max-width: 560px) {
  .boss-charts-grid { grid-template-columns: 1fr; }
  .hero h2 { font-size: 1.7em; }
}
