/* ==========================================================================
   underinvested.org
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-2: #f5f8f6;
  --bg-3: #eef3f0;
  --ink: #0a1410;
  --ink-2: rgba(10, 20, 16, .68);
  --ink-3: rgba(10, 20, 16, .48);
  --green: #0b8a52;          /* brand + "growth" series */
  --green-deep: #06683c;
  --mint: #6dffb3;           /* highlight fills, never text */
  --mint-2: #1fd68a;
  --mint-soft: #e9fbf2;
  --blue: #2a78d6;           /* "contributions" in the hero */
  --orange: #f08c00;         /* "contributions" in the growth calculator */
  --down: #c93636;
  --warn: #9a6200;
  --warn-bg: #fff4dc;
  --line: rgba(10, 20, 16, .10);
  --line-2: rgba(10, 20, 16, .16);
  --grid: #e8ece9;
  --axis: #c6cdc9;
  --muted: #7a8580;
  --radius: 22px;
  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 64px);
  --head-h: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
canvas, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
::selection { background: var(--mint); color: #02140a; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip {
  position: fixed; top: 10px; left: 10px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 15px;
  transform: translateY(-160%);
  transition: transform .2s;
}
.skip:focus { transform: none; }

/* ---------- Section snapping (large screens only) ---------- */

@media (min-width: 900px) and (min-height: 620px) {
  html { scroll-snap-type: y mandatory; }
  .snap { scroll-snap-align: start; }
  .snap-end { scroll-snap-align: end; }
  .module { height: 100vh; height: 100svh; }
  .module.fit-auto { height: auto; min-height: 100vh; min-height: 100svh; }
  .module .table-wrap { contain: size; min-height: 180px; }
  .calc-summary { contain: size; }
}

/* ---------- Logo ---------- */

.logo {
  display: inline-flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 23px;
  line-height: .84;
  letter-spacing: -.05em;
}
.logo span { display: block; }
.logo-under { color: var(--ink-3); }
.cursor {
  display: inline-block;
  width: .4em;
  height: .64em;
  margin-left: .1em;
  background: var(--mint-2);
  box-shadow: 0 0 12px rgba(31, 214, 138, .55);
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 22px var(--gutter);
  transition: background .4s var(--ease), padding .4s var(--ease), border-color .4s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  padding-block: 12px;
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom-color: var(--line);
}
.site-header .logo { justify-self: start; }

.nav-pill {
  display: flex;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(10, 20, 16, .05);
  border: 1px solid rgba(10, 20, 16, .06);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.nav-pill a {
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 16px;
  letter-spacing: -.01em;
  color: var(--ink-2);
  transition: background .25s, color .25s;
}
.nav-pill a:hover { background: rgba(10, 20, 16, .06); color: var(--ink); }
.nav-pill a.active { background: var(--ink); color: #fff; }

.nav-cta {
  justify-self: end;
  font-size: 16px;
  letter-spacing: -.01em;
  position: relative;
}
.nav-cta::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s var(--ease);
}
.nav-cta:hover::after { transform: scaleX(1); transform-origin: left; }

.menu-btn { display: none; }

/* ---------- Section rail ---------- */

.rail {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rail a {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
}
.rail a::before {
  content: "";
  position: absolute;
  right: 6px; top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: 99px;
  background: rgba(10, 20, 16, .22);
  transition: height .3s var(--ease), margin .3s var(--ease), background .3s;
}
.rail a.active::before { height: 18px; margin-top: -9px; background: var(--green); }
.rail a:hover::before { background: var(--ink); }
.rail b {
  position: absolute;
  right: 22px; top: 50%;
  transform: translate(6px, -50%);
  white-space: nowrap;
  font: 500 11.5px/1 var(--mono);
  letter-spacing: .02em;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px 9px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
}
.rail a:hover b, .rail a:focus-visible b { opacity: 1; transform: translate(0, -50%); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 15px 26px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -.01em;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s;
}
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { transform: translateY(-2px); box-shadow: 0 14px 40px -10px rgba(11, 138, 82, .55); }
.btn-ghost { background: rgba(10, 20, 16, .05); color: var(--ink); }
.btn-ghost:hover { background: rgba(10, 20, 16, .09); }

.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: background .2s, border-color .2s, transform .2s var(--ease);
}
.btn-mini:hover { border-color: rgba(10, 20, 16, .35); }
.btn-mini:active { transform: translateY(1px); }
.btn-mini-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-mini-dark:hover { background: #1b2a24; }
.btn-mini:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--head-h) + clamp(28px, 8vh, 96px)) var(--gutter) 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(70% 55% at 85% 100%, rgba(109, 255, 179, .16), transparent 70%),
    var(--bg);
}
.field {
  position: absolute;
  left: 0; right: 0; top: 0;
  bottom: var(--marquee-h, 68px);
  width: 100%;
  height: calc(100% - var(--marquee-h, 68px));
  z-index: -2;
}
.hero-shade {
  position: absolute; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(48% 46% at 18% 34%, rgba(255, 255, 255, .96) 0%, rgba(255, 255, 255, .7) 55%, rgba(255, 255, 255, 0) 100%),
    linear-gradient(to bottom, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, 0) 16%);
}
.hero-content { max-width: 780px; position: relative; z-index: 1; }
.hero-content > * { width: fit-content; max-width: 100%; }
.hero h1 {
  font-weight: 500;
  font-size: clamp(56px, 9.4vw, 150px);
  line-height: .87;
  letter-spacing: -.058em;
  padding-bottom: .14em;
  margin: 22px 0 -.08em;
  background: linear-gradient(180deg, #0a1410 35%, #0b8a52 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  margin-top: 22px;
  max-width: 36ch;
  font-size: clamp(17px, 1.45vw, 21px);
  line-height: 1.22;
  letter-spacing: -.01em;
  color: var(--ink-2);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }

.hero-readout {
  position: absolute;
  z-index: 2;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s var(--ease);
  white-space: nowrap;
}
.hero-readout.on { opacity: 1; }
.hero-readout.left { align-items: flex-start; text-align: left; }
.ro-when { font: 500 12px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ro-value { font-weight: 500; font-size: clamp(30px, 3.4vw, 52px); letter-spacing: -.045em; line-height: 1.04; font-variant-numeric: tabular-nums; }
.odo { display: inline-flex; align-items: flex-start; }
.odo-sym, .odo-c { display: inline-block; line-height: 1.04em; }
.odo-d {
  display: inline-block;
  height: 1.04em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(transparent, #000 9%, #000 91%, transparent);
}
.odo-strip { display: block; will-change: transform; }
.odo-strip i { display: block; height: 1.04em; line-height: 1.04em; font-style: normal; text-align: center; }
.ro-split { font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.ro-split .sw:nth-of-type(2) { margin-left: 8px; }

.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-in { background: var(--blue); }
.sw-grow { background: var(--green); }

.hero-note {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  bottom: calc(var(--marquee-h, 68px) + 14px);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font: 400 12px/1.4 var(--mono);
  color: var(--ink-2);
  max-width: calc(100% - 2 * var(--gutter));
  pointer-events: none;
}
.hero-note span { display: inline-flex; align-items: center; gap: 7px; }
.hero-assume { color: var(--ink-3); }

/* ---------- Ticker tape (TradingView) + fallback topics strip ---------- */

.tape {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  min-height: 46px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.tape tv-ticker-tape { display: block; }

.marquee {
  overflow: hidden;
  padding: 20px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 52s linear infinite; }
.marquee-group { display: flex; }
.marquee span {
  display: inline-flex;
  align-items: center;
  gap: 30px;
  padding-right: 30px;
  font-size: clamp(18px, 1.7vw, 24px);
  letter-spacing: -.03em;
  color: var(--ink-2);
  white-space: nowrap;
}
.marquee span::after {
  content: "";
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--mint-2);
  box-shadow: 0 0 10px rgba(31, 214, 138, .6);
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections & type ---------- */

.section {
  max-width: 1480px;
  margin: 0 auto;
  padding: calc(var(--head-h) + 22px) var(--gutter) 28px;
}

.label {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.label::before { content: ""; width: 18px; height: 1px; background: currentColor; }

h2 {
  font-weight: 500;
  font-size: clamp(44px, 7vw, 108px);
  line-height: .9;
  letter-spacing: -.055em;
}

/* ---------- Toolkit ---------- */

.toolkit {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(28px, 5vh, 56px);
  padding-bottom: 48px;
}
.toolkit-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: end;
}
.toolkit-head h2 { margin-top: 18px; font-size: clamp(40px, 5.6vw, 88px); }
.toolkit-lede { color: var(--ink-2); font-size: clamp(17px, 1.4vw, 20px); max-width: 40ch; justify-self: end; }

.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 200px;
  padding: 22px 22px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--bg-2));
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(11, 138, 82, .35);
  box-shadow: 0 30px 70px -40px rgba(11, 138, 82, .55);
}
.card-num { font: 500 13px/1 var(--mono); color: var(--green); }
.card-icon { width: 44px; height: 44px; margin: 18px 0 auto; color: var(--ink); }
.card h3 { font-weight: 500; font-size: clamp(20px, 1.6vw, 24px); line-height: 1.04; letter-spacing: -.04em; margin-top: 18px; max-width: 16ch; }
.card-start { background: var(--ink); border-color: var(--ink); color: #fff; }
.card-start .card-num { color: var(--mint-2); }
.card-start h3 { margin-top: auto; }
.card-start p { color: rgba(255, 255, 255, .7); }
.card-start .card-go { border-color: rgba(255, 255, 255, .25); }
.card-start:hover .card-go { background: var(--mint-2); color: var(--ink); }
.card p { margin-top: 10px; font-size: 15px; color: var(--ink-2); max-width: 26ch; }
.card-go {
  position: absolute;
  top: 18px; right: 18px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 16px;
  transition: background .25s, color .25s, transform .35s var(--ease);
}
.card:hover .card-go { background: var(--ink); color: #fff; transform: rotate(-45deg); }

.promise {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.promise li {
  font-size: 14px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.promise li::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--mint-2); }

/* ---------- Module layout ---------- */

.module {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.module-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 46ch);
  gap: 16px 40px;
  align-items: end;
  margin-bottom: clamp(14px, 2.2vh, 24px);
}
.module-head h2 { font-size: clamp(32px, 3.9vw, 60px); line-height: .95; letter-spacing: -.05em; margin-top: 12px; }
.key-idea {
  font-size: 15px;
  line-height: 1.42;
  color: var(--ink-2);
  padding-left: 16px;
  border-left: 2px solid var(--mint-2);
}
.key-idea b { color: var(--ink); font-weight: 600; }

/* ---------- Window panels ---------- */

.window {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow:
    0 40px 100px -60px rgba(11, 138, 82, .45),
    0 1px 2px rgba(10, 20, 16, .04);
}
.window::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(50% 30% at 85% 0%, rgba(109, 255, 179, .14), transparent 70%);
}
.window-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  flex: none;
}
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(10, 20, 16, .12); }
.file { color: var(--ink-2); margin-left: 6px; }
.live, .saved { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; }
.live { color: var(--green); }
.live::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mint-2);
  box-shadow: 0 0 10px var(--mint-2);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }
.saved::before {
  content: "";
  width: 9px; height: 10px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 10'%3E%3Cpath d='M2 4V3a2.5 2.5 0 015 0v1h.5A1.5 1.5 0 019 5.5v3A1.5 1.5 0 017.5 10h-6A1.5 1.5 0 010 8.5v-3A1.5 1.5 0 011.5 4H2zm1 0h3V3a1.5 1.5 0 00-3 0v1z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 10'%3E%3Cpath d='M2 4V3a2.5 2.5 0 015 0v1h.5A1.5 1.5 0 019 5.5v3A1.5 1.5 0 017.5 10h-6A1.5 1.5 0 010 8.5v-3A1.5 1.5 0 011.5 4H2zm1 0h3V3a1.5 1.5 0 00-3 0v1z'/%3E%3C/svg%3E") no-repeat center / contain;
}

.footnote {
  flex: none;
  padding: 10px 18px 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
}
.sel-footnote { font-size: 9.6px; font-style: italic; }

/* ---------- Form controls ---------- */

.stepper {
  display: flex;
  align-items: center;
  height: 50px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.stepper:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(11, 138, 82, .12); }
.stepper.bad, .stepper.bad:focus-within { border-color: var(--down); box-shadow: 0 0 0 4px rgba(201, 54, 54, .1); }
.stepper input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  padding: 0 4px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.stepper .affix { padding-left: 14px; color: var(--ink-3); font-size: 18px; }
.stepper .affix-end { padding: 0 10px 0 0; font-size: 16px; }
.stepper input:first-child { padding-left: 14px; }
.stepper button {
  flex: none;
  width: 42px;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  transition: background .2s;
}
.stepper button:hover { background: rgba(10, 20, 16, .05); }
.stepper button:first-of-type { border-left: 1px solid var(--line); }
.stepper button:last-of-type { border-radius: 0 11px 11px 0; }
.stepper-plain { height: 44px; }
.stepper-sm { height: 36px; border-radius: 10px; width: 150px; }
.stepper-sm input { font-size: 15px; }
.stepper-sm .affix { font-size: 15px; padding-left: 11px; }

.field-error { color: var(--down); font-size: 13px; min-height: 1.3em; margin-top: 6px; }

/* ---------- Calculator ---------- */

.calc-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.35fr) auto;
  grid-template-rows: auto auto auto;
  gap: 0 14px;
  align-items: end;
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
  position: relative;
  z-index: 6;
}
/* Title, help and control rows line up across all inputs (subgrid). */
.ctl { display: grid; grid-row: span 3; grid-template-rows: subgrid; min-width: 0; }
.ctl > * { min-width: 0; }
.ctl > :first-child { grid-row: 1; }
.ctl > .ctl-help { grid-row: 2; }
.ctl > :last-child { grid-row: 3; }
.stepper input { width: 0; } /* let flex size the field, not the input's default width */
.ctl-title { font-weight: 600; font-size: 14px; letter-spacing: -.01em; align-self: end; }
.ctl-help { font-size: 12px; line-height: 1.3; color: var(--ink-2); margin: 1px 0 6px; align-self: start; }
.calc-inputs .stepper { height: 40px; border-radius: 10px; }
.calc-inputs .stepper input, .calc-inputs .stepper .affix { font-size: 16px; }
.calc-inputs .stepper .affix-end { font-size: 14px; }
.calc-inputs .stepper button { width: 36px; font-size: 19px; }
.calc-inputs .stepper button:last-of-type { border-radius: 0 9px 9px 0; }

.select { position: relative; }
.select-btn {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  text-align: left;
  transition: border-color .2s, box-shadow .2s;
}
.select-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn[aria-expanded="true"] { border-color: var(--green); box-shadow: 0 0 0 4px rgba(11, 138, 82, .12); }
.select-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.select-panel, .pop-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  width: max(100%, 360px);
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 30px 80px -30px rgba(10, 20, 16, .35), 0 2px 8px rgba(10, 20, 16, .06);
  padding: 6px;
}
.select-panel { right: 0; left: auto; }
.opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 11px;
  transition: background .15s;
}
.opt:hover { background: var(--bg-2); }
.opt[aria-pressed="true"] { background: var(--mint-soft); box-shadow: inset 3px 0 0 var(--green); }
.opt b { display: block; font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.opt span { display: block; font-size: 13.5px; line-height: 1.35; color: var(--ink-2); margin-top: 3px; }
.custom-rate { padding: 12px 14px 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.custom-rate.active { background: var(--mint-soft); border-radius: 11px; box-shadow: inset 3px 0 0 var(--green); }
.custom-rate label { display: block; font-weight: 600; font-size: 16px; }
.custom-rate > p:not(.field-error) { font-size: 13.5px; color: var(--ink-2); font-style: italic; margin: 2px 0 10px; }

.reset {
  grid-column: -2;
  grid-row: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 4px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-3);
  transition: color .2s;
}
.reset:hover { color: var(--ink); }

.calc-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 24vw, 340px);
  flex: 1 1 auto;
  min-height: 0;
}
.chart-host {
  position: relative;
  min-height: 300px;
  outline-offset: -4px;
}
.chart-host > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-host:focus-visible { border-radius: 0 0 0 var(--radius); }

.calc-summary {
  border-left: 1px solid var(--line);
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.calc-summary h3 { font-weight: 600; font-size: clamp(19px, 1.5vw, 22px); line-height: 1.1; letter-spacing: -.035em; }
.how summary { cursor: pointer; font-size: 15px; list-style: none; }
.how summary::-webkit-details-marker { display: none; }
.how summary u { font-weight: 600; text-underline-offset: 3px; }
.how-body { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.how-body p + p { margin-top: 8px; }

.sum-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.sum-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.sum-list span { display: block; font-size: 14.5px; line-height: 1.3; }
.sum-list small { font-size: inherit; color: var(--ink-2); }
.sum-list b { display: block; font-weight: 600; font-size: 17px; margin-top: 3px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.key { position: relative; display: block; width: 22px; height: 18px; }
.key-line::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; border-radius: 2px; }
.key-green::before { background: var(--green); }
.key-orange::before { background: var(--orange); }
.key-band { height: 14px; margin-top: 2px; border-radius: 50%; width: 14px; margin-left: 4px; background: rgba(11, 138, 82, .25); }
.mk-sq, .mk-tri { position: absolute; left: 6px; top: 4px; width: 10px; height: 10px; }
.mk-sq { background: var(--green); border-radius: 2px; box-shadow: 0 0 0 2px #fff; }
.mk-tri { background: var(--orange); clip-path: polygon(50% 0, 100% 100%, 0 100%); }

.growth-share { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.gs-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14.5px; }
.gs-row b { font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }
.gs-bar { display: flex; gap: 2px; height: 8px; margin: 10px 0 8px; }
.gs-bar i { display: block; height: 100%; border-radius: 4px; transition: flex-grow .5s var(--ease); min-width: 2px; }
.gs-bar i:first-child { background: var(--orange); }
.gs-bar i:last-child { background: var(--green); }
.growth-share p { font-size: 13px; color: var(--ink-2); line-height: 1.35; }

/* ---------- Chart chrome (SVG) ---------- */

.ax text, .tick { font: 400 12px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.ax-title { font: 500 11px var(--mono); fill: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.crosshair { stroke: rgba(10, 20, 16, .35); stroke-width: 1; shape-rendering: crispEdges; }

/* ---------- Toolbar ---------- */

.toolbar {
  position: relative;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 16px;
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex: none;
}
/* Each control sits under its own small title. */
.tb-group { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.tb-label { font: 500 10.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.tb-value { height: 34px; display: inline-flex; align-items: center; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.tb-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tb-hint { align-self: flex-end; line-height: 34px; font-size: 13px; color: var(--ink-3); }
.toolbar .status { height: 34px; padding: 0 12px; font-size: 13px; }
.toolbar .btn-mini { height: 34px; padding: 0 12px; font-size: 13.5px; }
.toolbar .stepper-sm { height: 34px; width: 136px; }

.seg {
  display: inline-flex;
  height: 34px;
  padding: 3px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line-2);
}
.seg button {
  min-width: 38px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  transition: background .2s, color .2s;
}
.seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.seg-wide button { font-weight: 500; }

.pop { position: relative; }
.pop-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px 0 13px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  white-space: nowrap;
}
.pop-btn[aria-expanded="true"] { border-color: var(--green); }
.pop-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.pop-panel { padding: 14px; width: 330px; }
.pop-title { font-weight: 600; font-size: 15px; }
.pop-help { font-size: 13px; color: var(--ink-2); margin: 3px 0 12px; line-height: 1.35; }
.pf-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.pf-list li { display: flex; align-items: center; gap: 8px; }
.pf-list input, .pf-add input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: #fff;
  font-size: 15px;
  outline: none;
}
.pf-list input:focus, .pf-add input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 138, 82, .12); }
.pf-list .sw { width: 10px; height: 10px; }
.pf-uses { font: 11px var(--mono); color: var(--ink-3); width: 5ch; text-align: right; flex: none; }
.icon-btn {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--ink-3);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: rgba(201, 54, 54, .08); color: var(--down); }
.pf-add { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.status:empty { display: none; }
.status.ok { background: var(--mint-soft); color: var(--green-deep); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.bad { background: rgba(201, 54, 54, .09); color: var(--down); }
.status::before { font-weight: 700; }
.status.ok::before { content: "✓"; }
.status.warn::before { content: "!"; }
.status.bad::before { content: "!"; }

/* ---------- Tables ---------- */

.table-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 160px;
  overflow: auto;
}
.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.grid th, .grid td { padding: 0 8px; height: 46px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  height: 40px;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-2);
  border-bottom-color: var(--line-2);
}
.grid tfoot td, .grid tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--bg-2);
  font-weight: 600;
  border-top: 1px solid var(--line-2);
  border-bottom: 0;
}
.grid th:first-child, .grid td:first-child { padding-left: 18px; }
.grid th:last-child, .grid td:last-child { padding-right: 18px; }
.grid .num { text-align: right; }
.c-idx { width: 44px; color: var(--ink-3); font: 12px var(--mono); }
td.c-idx { color: var(--ink-3); }
.c-del { width: 46px; }
.grid tbody tr { transition: background .15s; }
.grid tbody tr:hover { background: var(--bg-2); }
.grid tbody tr.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { from { background: var(--mint-soft); } }

.cell {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(10, 20, 16, .035);
  outline: none;
  font-size: 15px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.cell:hover { border-color: var(--line-2); background-color: #fff; }
.cell:focus { border-color: var(--green); background-color: #fff; box-shadow: 0 0 0 3px rgba(11, 138, 82, .12); }
/* Colour-coded asset type / portfolio fields (same colours as the charts). */
select.cell-tag { background-color: var(--tag-bg); box-shadow: inset 3px 0 0 var(--tag); padding-left: 13px; }
select.cell-tag:hover { background-color: var(--tag-bg); }
select.cell-tag:focus { background-color: #fff; box-shadow: inset 3px 0 0 var(--tag), 0 0 0 3px rgba(11, 138, 82, .12); }
.tag {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  padding: 4px 10px 4px 12px;
  border-radius: 7px;
  background: var(--tag-bg);
  box-shadow: inset 3px 0 0 var(--tag);
  color: var(--ink);
  font-size: 14px;
}
.cell.invalid { border-color: var(--down); }
.cell-ticker { text-transform: uppercase; font-family: var(--mono); font-size: 14px; letter-spacing: .02em; min-width: 110px; }
.cell-ticker::placeholder { text-transform: none; font-family: var(--font); }
select.cell {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  min-width: 170px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%230a1410' stroke-opacity='.6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.num-cell { position: relative; display: block; min-width: 120px; max-width: 170px; margin-left: auto; }
.num-cell .cell { text-align: right; padding-right: 26px; }
.num-cell.pre .cell { padding-left: 22px; padding-right: 10px; }
.num-cell i {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-style: normal;
  font-size: 14px;
  color: var(--ink-3);
  pointer-events: none;
}
.num-cell i.post { right: 10px; }
.num-cell i.pre { left: 10px; }
.calc { color: var(--ink-2); padding-right: 18px; }
.calc-tag { font: 10px var(--mono); color: var(--ink-3); letter-spacing: .04em; margin-left: 6px; text-transform: uppercase; }
td.calc { padding-right: 18px !important; }

.del {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--ink-3);
  opacity: .6;
  transition: opacity .2s, background .2s, color .2s;
}
tr:hover .del, .del:focus-visible { opacity: 1; }
.del:hover { background: rgba(201, 54, 54, .08); color: var(--down); }

.empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 18px;
  text-align: center;
  color: var(--ink-2);
}
.empty p { width: 100%; font-size: 16px; }

/* Rebalancer */
.grid-rebal .grp th {
  position: sticky; top: 0; z-index: 3;
  height: 34px;
  font: 500 11px var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.grid-rebal .grp small { text-transform: none; letter-spacing: 0; font: 11px var(--font); color: var(--ink-3); margin-left: 6px; }
.grid-rebal thead tr:nth-child(2) th { top: 34px; }
.grid-rebal .grp-upd { background: var(--mint-soft) !important; color: var(--green-deep) !important; border-left: 2px solid var(--green); }
.grid-rebal th.upd { background: #f6fdf9; }
.grid-rebal td.upd { background: rgba(233, 251, 242, .45); }
.grid-rebal th.upd:nth-child(7), .grid-rebal td.upd:nth-child(7) { border-left: 2px solid var(--green); }
.grid-rebal tfoot td.upd { background: #e4f7ec; }
.grid-rebal tbody td { color: var(--ink-2); }
.grid-rebal tbody td.ro-ticker { font: 500 14px var(--mono); color: var(--ink); letter-spacing: .02em; }
.grid-rebal tbody td.muted { color: var(--ink-3); }
.grid-rebal tr.is-new td { background: rgba(233, 251, 242, .4); }
.new-tag {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--mint-soft);
  color: var(--green-deep);
  font: 600 10px var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.trade { font-weight: 600; }
.trade.buy { color: var(--green-deep); }
.trade.sell { color: var(--down); }
.trade.none { color: var(--ink-3); font-weight: 400; }
.trade small { font: 500 10.5px var(--mono); letter-spacing: .05em; text-transform: uppercase; margin-right: 6px; opacity: .8; }

/* ---------- Viz cards (pies & comparison) ---------- */

.sync-note { padding: 10px 18px; font-size: 13.5px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--line); }

.trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 1 1 auto;
  min-height: 0;
}
.viz-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 18px 14px;
}
.viz-card + .viz-card { border-left: 1px solid var(--line); }
.viz-card figcaption {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.02em;
  flex: none;
}
.vc-count { margin-left: auto; font: 400 11px var(--mono); color: var(--ink-3); letter-spacing: .02em; font-weight: 400; }
.vc-num {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 7px;
  background: var(--bg-3);
  font: 500 11px var(--mono);
  color: var(--ink-2);
}

.donut-host, .cmp-host { position: relative; flex: 1 1 auto; min-height: 200px; }
.donut-host > svg, .cmp-host > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.donut-center { pointer-events: none; }
.dc-label { font: 500 11px var(--mono); fill: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.dc-value { font: 600 22px var(--font); fill: var(--ink); letter-spacing: -.03em; }
.dc-sub { font: 400 12.5px var(--font); fill: var(--ink-2); }
.slice { cursor: pointer; transition: opacity .2s; }
.dim .slice:not(.hot), .dim .seg-rect:not(.hot), .dim .ribbon:not(.hot) { opacity: .28; }

.legend, .deltas {
  list-style: none;
  flex: none;
  max-height: calc(3 * 30px + 4px);
  overflow-y: auto;
  scroll-snap-type: y proximity;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}
.legend.more, .deltas.more {
  -webkit-mask-image: linear-gradient(#000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 22px), transparent);
}
.legend li, .deltas li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  height: 30px;
  scroll-snap-align: start;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: default;
  transition: background .15s;
}
.legend li:hover, .legend li.hot, .deltas li:hover, .deltas li.hot { background: var(--bg-2); }
.legend .sw, .deltas .sw { width: 12px; height: 12px; }
.lg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-pct { font-weight: 600; font-variant-numeric: tabular-nums; }
.lg-usd { color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 8ch; text-align: right; }
.deltas li { grid-template-columns: 12px minmax(0, 1fr) auto auto; }
.d-chg { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 7ch; text-align: right; }
.d-chg.up { color: var(--green-deep); }
.d-chg.down { color: var(--down); }
.d-chg.flat { color: var(--ink-3); font-weight: 400; }
.d-path { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 13px; }

.cmp-label { font: 500 12px var(--font); fill: var(--ink-2); }
.cmp-head { font: 500 11px var(--mono); fill: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.cmp-total { font: 600 13px var(--font); fill: var(--ink); }
.seg-rect, .ribbon { cursor: pointer; transition: opacity .2s; }

.viz-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
  padding: 20px;
  color: var(--ink-3);
  font-size: 14.5px;
}

/* ---------- Glossary (word cloud + definition card) ---------- */

.seg-cats button { display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; }
.toolbar .tb-group { min-width: 0; max-width: 100%; }
/* On narrow screens the category filter scrolls sideways instead of widening the page. */
.seg-cats { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-cats::-webkit-scrollbar { display: none; }
.cat-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }

.gloss {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}
.cloud {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 50% 50%, rgba(109, 255, 179, .10), transparent 70%);
}
.word {
  position: absolute;
  left: 0; top: 0;
  padding: .06em .32em .1em;
  border-radius: .28em;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.035em;
  white-space: nowrap;
  color: var(--c);
  opacity: 0;
  transition: transform .7s var(--ease), opacity .35s, background-color .2s, box-shadow .2s;
}
.cloud.ready .word { opacity: 1; }
.cloud:not(.ready) .word { transition: none; }
.word span { display: inline-block; animation: drift var(--fd, 7s) ease-in-out var(--fdl, 0s) infinite alternate; }
@keyframes drift { from { transform: translate(-2px, -3px); } to { transform: translate(2px, 3px); } }
.cloud.has-active .word:not(.is-active) { opacity: .82; }
.word:hover { background-color: var(--c-bg); opacity: 1 !important; }
.word.is-active { background-color: var(--c-bg); box-shadow: inset 0 -2px 0 var(--c); opacity: 1 !important; }
.cloud .word.is-muted { opacity: .14 !important; pointer-events: none; }
.word:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }

.def-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 14px;
  border-left: 1px solid var(--line);
}
.def-body { display: flex; flex-direction: column; gap: 10px; }
.def-body.swap { animation: defIn .45s var(--ease); }
@keyframes defIn { from { opacity: 0; transform: translateY(8px); } }
.def-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 11px/1 var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.def-cat i { width: 8px; height: 8px; border-radius: 3px; }
.def-term { font-weight: 500; font-size: clamp(26px, 2.4vw, 40px); line-height: 1; letter-spacing: -.045em; }
.def-text { font-size: clamp(15px, 1.15vw, 16.5px); line-height: 1.5; color: var(--ink); }
.def-ex {
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--bg-2);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-2);
}
.def-ex b { display: block; margin-bottom: 3px; font: 500 10.5px/1.2 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--green); }
.def-related { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.def-rel-label { font: 500 10.5px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-right: 4px; }
.rel-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 13.5px;
  transition: border-color .2s, background .2s;
}
.rel-chip:hover { border-color: var(--green); background: var(--mint-soft); }
.def-link { align-self: flex-start; font-weight: 600; font-size: 15px; color: var(--green-deep); border-bottom: 1px solid rgba(11, 138, 82, .35); padding-bottom: 2px; }
.def-link:hover { border-color: var(--green); }
.def-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 12px; }
.def-auto { font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; white-space: nowrap; }
.def-auto:hover { border-color: rgba(10, 20, 16, .35); color: var(--ink); }
.def-progress { flex: 1; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.def-progress i { display: block; height: 100%; background: var(--green); transform-origin: left; transform: scaleX(0); }
.def-card.auto .def-progress i { animation: tourBar var(--dur, 6s) linear forwards; }
@keyframes tourBar { to { transform: scaleX(1); } }
.def-count { font: 400 11px var(--mono); color: var(--ink-3); }

/* Without JavaScript the glossary is a plain list. */
.gl-list { padding: 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 24px; }
.gl-list dt { font-weight: 600; }
.gl-list dd { font-size: 14.5px; color: var(--ink-2); margin-top: 4px; }
.js .gl-list { display: none; }
html:not(.js) #glossary .gloss, html:not(.js) #glossary .toolbar { display: none; }

/* ---------- Select: ETF checklist ---------- */

.sel { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); flex: 1 1 auto; min-height: 0; }
.sel-nav { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.sel-steps {
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sel-foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: var(--bg-2); }
.sel-foot .btn-mini { justify-content: center; height: 34px; font-size: 13.5px; }
.sel-prog { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; }
.sel-prog .link-btn { font-size: 12.5px; }
.sel-prog .sel-progress { grid-column: 1 / -1; width: 100%; margin: 0; }
.sel-tab {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border-radius: 12px;
  text-align: left;
  transition: background .2s, box-shadow .2s;
}
.sel-tab:hover { background: var(--bg-2); }
.sel-tab[aria-selected="true"] { background: var(--mint-soft); box-shadow: inset 3px 0 0 var(--green); }
.sel-n { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--bg-3); font: 500 12px var(--mono); color: var(--ink-2); transition: background .2s, color .2s; }
.sel-tab[aria-selected="true"] .sel-n { background: var(--green); color: #fff; }
.sel-tt b { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.2; letter-spacing: -.01em; }
.sel-tick { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); transition: background .2s, border-color .2s; }
.sel-tab.done .sel-tick {
  border-color: var(--green);
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.sel-progress { display: block; height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; }
.sel-progress i { display: block; width: 0; height: 100%; background: var(--green); transition: width .4s var(--ease); }

/* Each step: text scrolls in .sel-body, the "checked" bar stays put underneath. */
.js .sel-panels { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.js .sel-panel:not(.active) { display: none; }
.js .sel-panel.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; animation: defIn .4s var(--ease); }
.sel-body { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 28px; padding: 18px 26px 14px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sel-panel + .sel-panel { border-top: 1px solid var(--line); }
.sel-panel .def-cat i { width: 8px; height: 8px; border-radius: 3px; background: var(--green); }
.sel-title { margin: 8px 0 10px; font-weight: 500; font-size: clamp(26px, 2.4vw, 38px); line-height: 1; letter-spacing: -.045em; }
.sel-why { font-size: 15.5px; line-height: 1.5; }
.sel-h { margin: 16px 0 8px; font: 500 10.5px/1.2 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.sel-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.sel-list li { position: relative; padding-left: 18px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.sel-list li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--mint-2); }
.sel-list b { color: var(--ink); font-weight: 600; }
/* The right column (rule, links, tick box) stays in view while long step text scrolls. */
.sel-side { display: flex; flex-direction: column; min-width: 0; position: sticky; top: 0; align-self: start; }
.sel-rule { padding: 14px 16px; border-radius: 14px; background: var(--ink); color: #fff; }
.sel-rule b { display: block; margin-bottom: 6px; font: 500 10.5px/1.2 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--mint-2); }
.sel-rule p { font-size: 15px; line-height: 1.45; }
.sel-example { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.sel-example .sel-h { margin-top: 0; }
.sel-example b { color: var(--ink); }
.sel-mixes { margin-top: 6px; }
.mix { display: grid; grid-template-columns: 66px minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 6px; }
.mix-name { font-size: 13px; color: var(--ink-2); }
.mix-bar { display: flex; gap: 2px; height: 22px; }
.mix-bar i { flex: 0 0 calc(var(--w) - 2px); border-radius: 4px; background: var(--c); color: #fff; font: 600 11px/22px var(--font); font-style: normal; text-align: center; overflow: hidden; }
.mix-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.mix-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.mix-note { margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.sel-links { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.sel-links a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .2s, background .2s;
}
.sel-links a:hover { border-color: var(--green); background: var(--mint-soft); }
.sel-links .src { font: 500 10.5px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--green-deep); white-space: nowrap; }
.sel-links .ttl { font-size: 14px; line-height: 1.35; color: var(--ink); }
.sel-links .ext { color: var(--ink-3); }
/* "I've checked this" box: under the links in the right column. */
.sel-done {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 2px solid var(--green);
  border-radius: 14px;
  background: var(--mint-soft);
  box-shadow: 0 14px 30px -18px rgba(11, 138, 82, .7);
  cursor: pointer;
  transition: background .25s, border-color .25s, transform .2s var(--ease);
}
.sel-done:hover { transform: translateY(-1px); }
.sel-done input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.sel-done input:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.sel-done input:checked {
  border-color: #fff;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.3l3 3 6-6.6' fill='none' stroke='%2306683c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.sel-done-text { min-width: 0; }
.sel-done-text b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.sel-done-text small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.sel-done-badge {
  margin-left: auto;
  padding: 5px 11px;
  border-radius: 999px;
  background: #fff;
  color: var(--green-deep);
  font: 600 11px var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s, transform .25s var(--ease);
}
.sel-done.is-done { background: var(--green); border-color: var(--green); }
.sel-done.is-done .sel-done-text b { color: #fff; }
.sel-done.is-done .sel-done-text small { color: rgba(255, 255, 255, .82); }
.sel-done.is-done .sel-done-badge { opacity: 1; transform: none; }
/* A few pulses on the empty box each time a step opens, so it's hard to miss. */
.js .sel-panel.active .sel-done:not(.is-done) input { animation: tickPulse 1.6s ease-out .5s 3; }
@keyframes tickPulse {
  0% { box-shadow: 0 0 0 0 rgba(31, 214, 138, .65); }
  70% { box-shadow: 0 0 0 12px rgba(31, 214, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 214, 138, 0); }
}
@media (min-width: 900px) and (max-height: 900px) {
  .sel-tab { padding: 7px 10px; }
  .sel-body { padding: 14px 24px 12px; gap: 24px; }
  .sel-title { margin: 6px 0 8px; font-size: clamp(24px, 2.2vw, 32px); }
  .sel-why { font-size: 15px; }
  .sel-h { margin: 12px 0 6px; }
  .sel-list { gap: 5px; }
  .sel-list li { font-size: 14px; line-height: 1.45; }
  .sel-rule { padding: 12px 14px; }
  .sel-rule p { font-size: 14.5px; }
  .sel-links a { padding: 7px 12px; }
  .sel-done { padding: 10px 12px; margin-top: 12px; }
  .sel-done-text small { font-size: 12.5px; }
  .sel-example { margin-top: 12px; padding: 10px 12px; }
}
/* Without JavaScript all seven steps are shown one after another. */
html:not(.js) .sel { grid-template-columns: 1fr; }
html:not(.js) .sel-steps, html:not(.js) .sel-prog { display: none; }

/* ---------- Import dialog ---------- */

.modal {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 26px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 40px 120px -40px rgba(10, 20, 16, .45), 0 2px 10px rgba(10, 20, 16, .08);
  overflow-y: auto;
}
.modal::backdrop { background: rgba(10, 20, 16, .38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal[open] { animation: modalIn .35s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-x { position: absolute; top: 14px; right: 14px; }
.modal-title { margin: 10px 0 6px; font-weight: 500; font-size: clamp(26px, 3vw, 34px); line-height: 1.05; letter-spacing: -.04em; }
.imp-lede { color: var(--ink-2); font-size: 15.5px; max-width: 56ch; }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding: 28px 20px;
  border: 1.5px dashed var(--line-2);
  border-radius: 16px;
  background: var(--bg-2);
  color: var(--ink-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.drop svg { color: var(--green); margin-bottom: 4px; }
.drop b { font-size: 17px; color: var(--ink); font-weight: 600; }
.drop span { font-size: 14px; }
.drop u { text-underline-offset: 3px; color: var(--green-deep); }
.drop:hover, .drop.over { border-color: var(--green); background: var(--mint-soft); }
.drop:focus-within { outline: 2px solid var(--green); outline-offset: 3px; }

.imp-paste { margin-top: 14px; }
.imp-paste summary { cursor: pointer; font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.imp-paste summary:hover { color: var(--ink); }
.imp-paste textarea {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  font: 13px/1.5 var(--mono);
  resize: vertical;
  outline: none;
}
.imp-paste textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 138, 82, .12); }
.imp-help { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.imp-help p + p { margin-top: 6px; }
.imp-help b { color: var(--ink); }
.link-btn { font-weight: 600; color: var(--green-deep); border-bottom: 1px solid rgba(11, 138, 82, .35); padding: 0; }
.link-btn:hover { border-color: var(--green); }

.imp-source { font-size: 14px; color: var(--ink-2); }
.imp-cols { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.imp-cols li { padding: 5px 10px; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--line); }
.imp-cols li.found { background: var(--mint-soft); border-color: rgba(11, 138, 82, .25); color: var(--green-deep); }
.imp-cols li.found::before { content: "✓ "; font-weight: 700; }
.imp-cols li.missing { color: var(--ink-3); }
.imp-cols b { font-weight: 600; }
.imp-preview { border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 300px; }
.imp-table th, .imp-table td { height: 36px; font-size: 14px; }
.imp-table thead th { height: 34px; }
.imp-table td.ro-ticker { font: 500 13.5px var(--mono); letter-spacing: .02em; }
.imp-table .imp-more { color: var(--ink-3); font-size: 13px; font-weight: 400; background: #fff; }
.imp-new { margin-left: 6px; padding: 1px 6px; border-radius: 5px; background: var(--mint-soft); color: var(--green-deep); font: 600 9.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }
.imp-notes { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.imp-notes li { position: relative; padding-left: 20px; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.imp-notes li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.imp-notes li.info::before { content: "i"; color: var(--green); font-family: var(--mono); left: 4px; }
.imp-notes li.warn::before { content: "!"; color: var(--warn); left: 5px; }
.imp-options { display: flex; flex-wrap: wrap; gap: 14px 28px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.imp-how { border: 0; display: flex; flex-direction: column; gap: 6px; }
.imp-how legend { margin-bottom: 6px; font: 500 10.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.imp-how label { display: flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.imp-how input { accent-color: var(--green); width: 16px; height: 16px; }
.imp-pf { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); max-width: 280px; }
.imp-pf select.cell { min-width: 200px; background-color: #fff; border-color: var(--line-2); }
.imp-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.imp-actions .btn-mini { height: 38px; padding: 0 16px; font-size: 14px; }

/* ---------- Broker guide (optional dialog) ---------- */

.modal-wide { width: min(1100px, calc(100vw - 32px)); padding: 26px 30px 22px; }
.brk-head .imp-lede { max-width: 72ch; }
.brk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px); gap: 26px; margin-top: 18px; align-items: start; }
.brk-prog { margin-bottom: 10px; }
.brk-check { border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .2s, background .2s; }
.brk-check + .brk-check { margin-top: 8px; }
.brk-check[open] { border-color: rgba(11, 138, 82, .35); box-shadow: inset 3px 0 0 var(--green); }
.brk-check summary { display: grid; grid-template-columns: 28px minmax(0, 1fr) 18px; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; list-style: none; border-radius: 14px; }
.brk-check summary::-webkit-details-marker { display: none; }
.brk-check summary:hover { background: var(--bg-2); }
.brk-check[open] summary { background: var(--mint-soft); border-radius: 13px 13px 0 0; }
.brk-check[open] .sel-n { background: var(--green); color: #fff; }
.brk-st b { display: block; font-weight: 600; font-size: 15px; line-height: 1.25; letter-spacing: -.01em; }
.brk-st small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--ink-3); }
.brk-tick { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); transition: background .2s, border-color .2s; }
.brk-check.done .brk-tick {
  border-color: var(--green);
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.brk-body { padding: 12px 16px 14px 54px; }
.brk-intro { margin-bottom: 10px; font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.brk-body .sel-list li, .brk-more .sel-list li { font-size: 14px; }
.brk-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.brk-links .sel-h { margin: 0 4px 0 0; }
.brk-link { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink); transition: border-color .2s, background .2s; }
.brk-link:hover { border-color: var(--green); background: var(--mint-soft); }
.brk-link .src { font: 500 10px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--green-deep); }
.brk-done { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; padding: 8px 14px 8px 10px; border: 2px solid var(--green); border-radius: 12px; background: var(--mint-soft); font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.brk-done input { -webkit-appearance: none; appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border: 2px solid var(--green); border-radius: 7px; background: #fff; cursor: pointer; }
.brk-done input:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.brk-done input:checked { border-color: #fff; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.3l3 3 6-6.6' fill='none' stroke='%2306683c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 15px no-repeat; }
.brk-done.is-done { background: var(--green); color: #fff; }

.brk-calc { position: sticky; top: 0; padding: 18px 18px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-2); }
.brk-calc h4 { margin: 6px 0 4px; font-weight: 600; font-size: 19px; line-height: 1.2; letter-spacing: -.02em; }
.brk-calc-lede { font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.brk-plan { margin-top: 14px; max-width: 220px; }
.brk-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12.5px; color: var(--ink-2); }
.brk-in { position: relative; display: block; }
.brk-in .cell { height: 34px; padding-right: 26px; background: #fff; border-color: var(--line); font-variant-numeric: tabular-nums; }
.brk-in i { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 13px; color: var(--ink-3); pointer-events: none; }
.brk-in input::-webkit-outer-spin-button, .brk-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.brk-in input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.brk-brokers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.brk-broker { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.brk-pair { display: flex; flex-direction: column; gap: 10px; }
.brk-pair[hidden] { display: none; }
.brk-type { min-width: 0; height: 34px; background-color: #fff; border-color: var(--line); font-size: 14px; }
.brk-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.brk-table th[scope="row"] { width: 44%; padding: 3px 8px 3px 0; text-align: left; font-weight: 400; font-size: 13px; line-height: 1.25; color: var(--ink-2); }
.brk-table td, .brk-table thead th { padding: 3px 0 3px 8px; }
.brk-table thead th { font-weight: 600; }
.brk-name { height: 34px; padding-inline: 8px; font-weight: 600; font-size: 15px; background: transparent; }

.brk-result { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.brk-bars { display: flex; flex-direction: column; gap: 6px; }
.brk-bar { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.brk-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brk-track { display: flex; height: 14px; border-radius: 4px; background: rgba(10, 20, 16, .06); overflow: hidden; }
.brk-track i { height: 100%; transition: width .35s var(--ease); }
.brk-track i + i { box-shadow: inset 1px 0 0 #fff; }
.brk-out { margin-top: 10px; }
.brk-out th[scope="row"] { font-size: 12.5px; }
.brk-out td { padding: 3px 0 3px 8px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.brk-out .key { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 2px; vertical-align: 0; }
.brk-out thead th { text-align: right; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brk-out tr.total th, .brk-out tr.total td { padding-top: 7px; border-top: 1px solid var(--line-2); font-weight: 600; color: var(--ink); font-size: 14px; }
.brk-out tr.share th, .brk-out tr.share td { color: var(--ink-3); font-size: 12px; }
.brk-verdict { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 14px; line-height: 1.4; }
.brk-verdict b { color: var(--mint-2); }
.brk-assume { margin-top: 10px; font-size: 12px; line-height: 1.45; color: var(--ink-3); }
.brk-assume .link-btn { font-size: 12px; }

.brk-more { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.brk-start { padding-top: 16px; border-top: 1px solid var(--line); }
.brk-more .sel-h { margin-top: 0; }
.brk-steps { counter-reset: brk; list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.brk-steps li { counter-increment: brk; position: relative; padding-left: 32px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.brk-steps li::before { content: counter(brk); position: absolute; left: 0; top: 0; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: var(--mint-soft); color: var(--green-deep); font: 600 11.5px var(--mono); }
.brk-start .btn-mini { height: 38px; padding: 0 16px; }
.brk-note { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.sel-foot button.btn-mini { cursor: pointer; }
html:not(.js) [data-open-broker] { display: none; }

/* ---------- Tooltip ---------- */

.tooltip {
  position: fixed;
  z-index: 90;
  top: 0; left: 0;
  min-width: 200px;
  max-width: 300px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px -18px rgba(10, 20, 16, .35), 0 2px 6px rgba(10, 20, 16, .06);
  pointer-events: none;
  font-size: 14px;
  line-height: 1.35;
}
.tt-title { font-weight: 600; font-size: 15px; letter-spacing: -.01em; margin-bottom: 8px; }
.tt-row { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 2px 8px; align-items: center; }
.tt-row + .tt-row { margin-top: 8px; }
.tt-key { display: block; width: 14px; height: 2px; border-radius: 2px; }
.tt-key.box { height: 10px; width: 10px; border-radius: 3px; }
.tt-name { color: var(--ink-2); }
.tt-val { grid-column: 2; font-weight: 600; font-size: 15.5px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tt-sub { grid-column: 2; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.tt-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }

/* ---------- Footer ---------- */

.site-footer { padding: 64px var(--gutter) 32px; border-top: 1px solid var(--line); max-width: 1480px; margin: 0 auto; }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr));
  gap: 40px;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--line);
}
.logo-sm { font-size: 19px; }
.footer-about { margin-top: 18px; max-width: 36ch; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.footer-contact:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px rgba(11, 138, 82, .5); }
.footer-mail { display: block; width: fit-content; margin-top: 12px; font-size: 14px; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.footer-mail:hover { color: var(--ink); border-color: var(--green); }
.footer-h { margin-bottom: 14px; font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: 15px; color: var(--ink-2); transition: color .2s; }
.footer-col a:hover { color: var(--green-deep); }
.disclaimer { margin-top: 24px; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); max-width: 110ch; }
.disclaimer b { color: var(--ink-2); font-weight: 600; }
.footer-bottom { margin-top: 14px; display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.copy { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Legal pages ---------- */

html.no-snap { scroll-snap-type: none !important; }
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter);
  background: rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.page-back { font-size: 15px; color: var(--ink-2); }
.page-back:hover { color: var(--ink); }
.doc { max-width: 760px; margin: 0 auto; padding: clamp(48px, 8vw, 96px) var(--gutter) 72px; }
.doc h1 { margin: 16px 0 10px; font-weight: 500; font-size: clamp(40px, 6vw, 72px); line-height: .95; letter-spacing: -.05em; }
.doc-updated { font: 400 12.5px var(--mono); color: var(--ink-3); }
.doc-lede { margin: 28px 0 8px; padding: 16px 18px; border-left: 2px solid var(--mint-2); background: var(--bg-2); border-radius: 0 12px 12px 0; font-size: 17px; line-height: 1.5; }
.doc h2 { margin: 36px 0 10px; font-weight: 600; font-size: 21px; letter-spacing: -.02em; }
.doc p, .doc li { font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.doc p + p { margin-top: 10px; }
.doc ul { margin-top: 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.doc b { color: var(--ink); font-weight: 600; }
.doc a { color: var(--green-deep); border-bottom: 1px solid rgba(11, 138, 82, .35); }
.doc a:hover { border-color: var(--green); }

/* ---------- Reveal on scroll ---------- */

.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.cards li.reveal:nth-child(2) { transition-delay: .06s; }
.cards li.reveal:nth-child(3) { transition-delay: .12s; }
.cards li.reveal:nth-child(4) { transition-delay: .18s; }
.cards li.reveal:nth-child(5) { transition-delay: .24s; }

/* ---------- Fit: short desktop screens ---------- */

@media (min-width: 900px) and (max-height: 820px) {
  .ctl-help { display: none; }
  .chart-host { min-height: 240px; }
  .module-head h2 { font-size: clamp(30px, 3.2vw, 46px); }
  .key-idea { font-size: 14px; }
  .calc-summary { gap: 10px; padding: 14px 18px; }
  .card { min-height: 170px; }
  .card-icon { margin-top: 12px; }
}
@media (min-width: 900px) and (max-height: 700px) {
  .key-idea { display: none; }
  .module-head { margin-bottom: 10px; }
  .footnote { padding-block: 7px; font-size: 11px; }
  .sel-footnote { font-size: 8.8px; }
  .hero h1 { font-size: clamp(52px, 8vw, 110px); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
  .calc-inputs { gap: 14px; }
  .card { padding: 18px; }
}

@media (max-width: 1100px) {
  .nav-pill a { padding: 7px 11px; font-size: 15px; }
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .calc-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2px; }
  .ctl-title { padding-top: 10px; }
  .reset { grid-column: 1 / -1; grid-row: auto; justify-self: end; height: auto; margin-top: 8px; }
  .ctl-help { min-height: 0; }
}

@media (min-width: 900px) and (max-width: 1100px) {
  .calc-inputs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 12px; }
  .ctl-title { padding-top: 0; }
  .reset { position: absolute; top: 10px; right: 18px; height: auto; margin-top: 0; font-size: 13px; }
  .calc-inputs .stepper button { width: 32px; }
}

@media (max-width: 899px) {
  :root { --head-h: 64px; }
  .site-header { grid-template-columns: auto 1fr; padding: 14px var(--gutter); }
  .site-header.scrolled { padding-block: 10px; }
  .nav-cta { display: none; }
  .menu-btn {
    display: grid;
    justify-self: end;
    align-content: center;
    gap: 6px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(10, 20, 16, .06);
  }
  .menu-btn span { display: block; width: 18px; height: 2px; margin: 0 auto; border-radius: 2px; background: var(--ink); transition: transform .3s var(--ease); }
  .menu-btn[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .nav-pill {
    position: fixed;
    top: 72px; left: 12px; right: 12px;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .96);
    border-color: var(--line);
    box-shadow: 0 30px 80px -30px rgba(10, 20, 16, .35);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .25s, transform .25s var(--ease);
  }
  .nav-pill.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-pill a { font-size: 18px; padding: 12px 16px; border-radius: 14px; }
  .rail { display: none; }

  .hero { padding-top: calc(var(--head-h) + 40px); }
  .hero-shade {
    background:
      linear-gradient(to bottom, rgba(255, 255, 255, .96) 0%, rgba(255, 255, 255, .85) 45%, rgba(255, 255, 255, 0) 70%);
  }
  .hero-note { gap: 4px 12px; font-size: 11px; }
  .hero-assume { width: 100%; }

  .toolkit-head { grid-template-columns: 1fr; }
  .toolkit-lede { justify-self: start; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { min-height: 0; }
  .card-icon { margin-bottom: 0; }

  .section { padding-top: calc(var(--head-h) + 28px); padding-bottom: 40px; }
  .module-head { grid-template-columns: 1fr; }
  .calc-body { grid-template-columns: 1fr; }
  .chart-host { height: 360px; min-height: 0; }
  .calc-summary { border-left: 0; border-top: 1px solid var(--line); }
  .growth-share { margin-top: 4px; }
  .table-wrap { max-height: 70vh; }
  .trio { grid-template-columns: 1fr; }
  .sel { display: flex; flex-direction: column; }
  .sel-nav { display: contents; }
  .sel-foot { order: 3; border-top: 1px solid var(--line); }
  .sel-steps { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .sel-steps::-webkit-scrollbar { display: none; }
  .sel-tab { width: auto; grid-template-columns: 26px auto 16px; white-space: nowrap; }
  .js .sel-panels { overflow: visible; display: block; }
  .js .sel-panel.active { display: block; }
  .sel-body { grid-template-columns: 1fr; gap: 4px; padding: 18px 16px 8px; overflow: visible; }
  .sel-side { position: static; }
  .sel-done-badge { display: none; }
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 20px; }
  .footer-brand { grid-column: 1 / -1; }
  .gloss { grid-template-columns: 1fr; }
  .cloud { height: 380px; min-height: 0; }
  .def-card { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .viz-card + .viz-card { border-left: 0; border-top: 1px solid var(--line); }
  .donut-host { height: 260px; flex: none; }
  .cmp-host { height: 320px; flex: none; }
  .tb-actions { margin-left: 0; }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .window-bar { white-space: nowrap; }
  .window-bar .dots { display: none; }
  .file { margin-left: 0; overflow: hidden; text-overflow: ellipsis; }
  .saved { font-size: 0; gap: 0; }
  .live { font-size: 11px; }
  .cards { grid-template-columns: 1fr; }
  .calc-inputs { grid-template-columns: 1fr; }
  .card h3 { margin-top: 16px; }
  .select-panel { right: auto; left: 0; width: 100%; }
  .stepper-sm { width: 130px; }
  .toolbar { gap: 10px 14px; }
  .hero-actions .btn { padding: 13px 20px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee-track, .cursor, .live::before, .word span, .def-body.swap, .sel-panel.active .sel-done input { animation: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* Broker guide on narrower screens */
@media (max-width: 1000px) {
  .brk-grid { grid-template-columns: 1fr; }
  .brk-calc { position: static; }
}
@media (max-width: 700px) {
  .modal-wide { padding: 22px 16px 18px; }
  .brk-body { padding: 10px 14px 14px; }
  .brk-calc { padding: 16px 12px 12px; }
  .brk-brokers { grid-template-columns: 1fr; }
}
