/* ==========================================================================
   ACCELPIX BROKERAGE CALCULATOR — DESIGN SYSTEM
   Token system: color, type, layout, motion
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* ---- Brand colors (from Accelpix mark) ---- */
  --navy-900: #161B3D;
  --navy-800: #1C2150;
  --indigo-700: #232C6B;
  --indigo-600: #2A3580;
  --indigo-500: #3B4BA8;
  --indigo-400: #5266C7;
  --amber-600: #E07F0E;
  --amber-500: #F7941E;
  --amber-400: #FFB04D;
  --amber-300: #FFCB85;

  /* ---- Semantic - LIGHT mode ---- */
  --bg: #F6F7FB;
  --bg-elevated: #FFFFFF;
  --bg-sunken: #ECEFF7;
  --surface-1: #FFFFFF;
  --surface-2: #F1F3F9;
  --border-soft: #E2E5F0;
  --border-strong: #CBD0E6;
  --text-primary: #161B3D;
  --text-secondary: #4D5378;
  --text-tertiary: #8086AD;
  --accent: var(--amber-500);
  --accent-strong: var(--amber-600);
  --brand: var(--indigo-600);
  --brand-strong: var(--navy-900);
  --positive: #1A9E6B;
  --negative: #D8473A;
  --shadow-sm: 0 1px 2px rgba(22, 27, 61, 0.06), 0 1px 1px rgba(22,27,61,0.04);
  --shadow-md: 0 6px 20px rgba(22, 27, 61, 0.08), 0 2px 6px rgba(22,27,61,0.05);
  --shadow-lg: 0 20px 50px rgba(22, 27, 61, 0.14), 0 6px 16px rgba(22,27,61,0.08);
  --grain-opacity: 0.025;

  /* ---- Layout ---- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --container: 1180px;
  --header-h: 72px;

  /* ---- Type ---- */
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 150ms;
  --t-med: 280ms;
}

html[data-theme="dark"] {
  --bg: #0E1124;
  --bg-elevated: #161A33;
  --bg-sunken: #090B18;
  --surface-1: #161A33;
  --surface-2: #1D2240;
  --border-soft: #272D52;
  --border-strong: #343C6E;
  --text-primary: #F1F2FA;
  --text-secondary: #ABB0D6;
  --text-tertiary: #6E74A0;
  --accent: var(--amber-500);
  --accent-strong: var(--amber-400);
  --brand: #6E7FD9;
  --brand-strong: #C5CCF4;
  --positive: #34D399;
  --negative: #F87171;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.55);
  --grain-opacity: 0.05;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-med) var(--ease), color var(--t-med) var(--ease);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  width: 100%;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* Subtle grain texture overlay for depth without being a "default" gradient mesh */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------------------------- HEADER ---------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 65;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-logo img { height: 30px; width: auto; }
.logo-light { display: block; }
.logo-dark { display: none; }
html[data-theme="dark"] .logo-light { display: none; }
html[data-theme="dark"] .logo-dark { display: block; }
.footer-brand .logo-light, .footer-brand .logo-dark { height: 26px; margin-bottom: 10px; width: auto; }
.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 1;
  min-width: 0;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  margin-left: auto;
}
.header-cta-secondary, .header-cta-primary {
  white-space: nowrap;
  flex-shrink: 0;
}
/* Progressive collapse as space tightens, so the row never wraps:
   1) shrink the gap between nav links
   2) drop the secondary "Accelpix API" pill, keep the primary CTA
   3) drop the nav links entirely, rely on the hamburger drawer */
@media (max-width: 1180px) {
  .header-nav { gap: 16px; }
}
@media (max-width: 1040px) {
  .header-actions .header-cta-secondary { display: none !important; }
}
.header-nav > a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.header-nav > a:hover { color: var(--accent-strong); }
.header-nav > a.is-active { color: var(--text-primary); font-weight: 600; }

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.theme-toggle svg { width: 19px; height: 19px; stroke: var(--text-primary); }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu-trigger {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.menu-trigger svg { width: 20px; height: 20px; stroke: var(--text-primary); }

/* ---------------------------- BUTTONS ---------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  border-radius: var(--radius-pill);
  padding: 11px 22px;
  border: none;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  color: #1A1300;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
}
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-sm { padding: 8px 16px; font-size: 13.5px; }
.btn-block { width: 100%; }

/* ---------------------------- HERO ---------------------------- */
.hero {
  padding: 64px 0 48px;
  position: relative;
  overflow: hidden;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--amber-500) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber-500) 30%, transparent);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.4rem);
  font-weight: 800;
  max-width: 760px;
}
.hero h1 .accent { color: var(--accent-strong); }
.hero p.lede {
  margin-top: 18px;
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
}
.hero-stats {
  display: flex;
  gap: 36px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.hero-stat .num {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
}
.hero-stat .label {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ---------------------------- BROKER GRID (hub page) ---------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 1.7rem;
  font-weight: 700;
}
.section-head p { color: var(--text-tertiary); font-size: 14.5px; margin: 0; }

.search-bar {
  position: relative;
  max-width: 360px;
  width: 100%;
}
.search-bar input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 14.5px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--t-fast) var(--ease);
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  stroke: var(--text-tertiary);
}

.broker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 56px;
}
.broker-card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  cursor: pointer;
  position: relative;
  min-width: 0;
}
.broker-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.broker-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.broker-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: -0.03em;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.22);
}
.broker-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent 55%);
  pointer-events: none;
}
.broker-card-name { font-weight: 700; font-size: 15px; }
.broker-card-tag { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.broker-card-tags {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-soft);
}
.pill.pill-free { color: var(--positive); border-color: color-mix(in srgb, var(--positive) 40%, transparent); background: color-mix(in srgb, var(--positive) 10%, transparent); }
.broker-card-cta {
  margin-top: auto;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 6px;
}
.broker-card-cta svg { width: 14px; height: 14px; transition: transform var(--t-fast) var(--ease); }
.broker-card:hover .broker-card-cta svg { transform: translateX(3px); }

/* ---------------------------- CALCULATOR LAYOUT ---------------------------- */
.calc-page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.calc-broker-badge {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.03em;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.14), inset 0 1px 0 rgba(255,255,255,0.22);
}
.calc-broker-badge::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent 55%);
  pointer-events: none;
}
.breadcrumb {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}
.breadcrumb a { color: var(--text-tertiary); }
.breadcrumb a:hover { color: var(--accent-strong); }
.breadcrumb .sep { margin: 0 6px; }

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 28px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 22px;
}

/* Segment tabs */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 5px;
  margin-bottom: 24px;
}
.tab {
  text-align: center;
  padding: 9px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  user-select: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab.is-active {
  background: var(--brand-strong);
  color: #fff;
}
html[data-theme="dark"] .tab.is-active { color: var(--navy-900); background: var(--accent); }

/* Form fields */
.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.field-input-wrap { position: relative; }
.field-input-wrap .prefix {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 14px;
  pointer-events: none;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  appearance: none;
}
.field input.has-prefix { padding-left: 30px; }
.field select { font-family: var(--font-body); cursor: pointer; }
.field input:focus, .field select:focus { border-color: var(--accent); background: var(--surface-1); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
  margin-top: 8px;
}
.toggle-row span { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.switch {
  width: 44px; height: 26px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-tertiary);
  top: 3px; left: 3px;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.switch.is-on { background: color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.switch.is-on::after { transform: translateX(18px); background: var(--accent-strong); }

/* Results panel */
.result-hero {
  text-align: center;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 22px;
}
.result-hero .label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.result-hero .value {
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  word-break: break-word;
}
.result-hero .value.positive { color: var(--positive); }
.result-hero .value.negative { color: var(--negative); }
.result-hero .sub { font-size: 13px; color: var(--text-tertiary); margin-top: 6px; }

/* Signature element: segmented breakdown bar */
.breakdown-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: 18px;
}
.breakdown-bar .seg {
  height: 100%;
  transition: width var(--t-med) var(--ease);
  min-width: 2px;
}
.breakdown-legend {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 10px 16px;
  margin-bottom: 8px;
}
.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  gap: 8px;
  min-width: 0;
}
.legend-item .dot-label {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend-item .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-item .amt {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.charges-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
}
.charges-table tr {
  border-top: 1px solid var(--border-soft);
}
.charges-table tr:first-child { border-top: none; }
.charges-table td {
  padding: 10px 0;
  font-size: 14px;
}
.charges-table td:first-child { color: var(--text-secondary); }
.charges-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}
.charges-table tr.total td {
  padding-top: 14px;
  font-weight: 700;
  font-size: 15px;
}
.charges-table tr.total td:last-child { color: var(--accent-strong); }

/* ---------------------------- TERMS / DISCLOSURE ---------------------------- */
.terms-section {
  background: var(--bg-sunken);
  border-top: 1px solid var(--border-soft);
  padding: 56px 0;
  margin-top: 60px;
}
.terms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-top: 28px;
}
.terms-block h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.terms-block h4 .idx {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--amber-500) 14%, transparent);
  width: 22px; height: 22px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.terms-block p, .terms-block li {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}
.terms-block ul { margin: 0; padding-left: 18px; }
.terms-block li { margin-bottom: 6px; }
.terms-disclaimer {
  margin-top: 32px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--amber-500) 8%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--amber-500) 25%, transparent);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.terms-disclaimer strong { color: var(--text-primary); }

/* ---------------------------- FOOTER ---------------------------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 40px 0 28px;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
}
.footer-brand { flex: 0 0 240px; max-width: 240px; }
.footer-brand img { height: 26px; margin-bottom: 10px; }
.footer-brand p { font-size: 13px; color: var(--text-tertiary); max-width: 280px; }
.social-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.social-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.social-icon svg { width: 16px; height: 16px; }
.social-icon:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.footer-links {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px;
  flex: 1;
}
.footer-col h5 {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  white-space: normal;
  line-height: 1.4;
}
.footer-col a {
  display: block;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 9px;
  transition: color var(--t-fast) var(--ease);
  line-height: 1.4;
}
.footer-col a:hover { color: var(--accent-strong); }
.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--text-tertiary);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------------------------- A11Y / FOCUS ---------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------- RESPONSIVE ---------------------------- */
@media (max-width: 1080px) {
  .broker-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 920px) {
  .calc-grid { grid-template-columns: 1fr; }
  .terms-grid { grid-template-columns: 1fr; }
  .broker-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1080px) {
  .footer-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .header-nav { display: none; }
  .menu-trigger { display: flex; }
  .header-actions .header-cta-primary, .header-actions .header-cta-secondary { display: none !important; }
  .hero { padding: 40px 0 32px; }
  .hero-stats { gap: 22px; }
  .field-row { grid-template-columns: 1fr; }
  .footer-grid { flex-direction: column; }
  .footer-brand { flex: 1 1 auto; max-width: none; }
  .footer-links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}
@media (max-width: 480px) {
  .footer-links { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .broker-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .broker-card { padding: 14px; }
  .result-hero .value { font-size: 2.1rem; }
  .breakdown-legend { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab { font-size: 13px; padding: 10px 6px; }
}

/* ---------------------------- MOBILE NAV DRAWER ---------------------------- */
.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 10, 26, 0.72);
  display: none;
  opacity: 0;
  transition: opacity var(--t-med) var(--ease);
}
.mobile-drawer.is-open { display: block; opacity: 1; }
.mobile-drawer-panel {
  position: absolute;
  top: 0; right: 0;
  width: 86%;
  max-width: 340px;
  height: 100%;
  background: var(--bg-elevated);
  padding: 24px;
  transform: translateX(100%);
  transition: transform var(--t-med) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.mobile-drawer.is-open .mobile-drawer-panel { transform: translateX(0); }
.mobile-drawer-panel a {
  padding: 14px 4px;
  font-size: 15.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
}
.mobile-drawer-close {
  align-self: flex-end;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  cursor: pointer;
}
.mobile-drawer-close svg { width: 20px; height: 20px; stroke: var(--text-primary); }

/* ---------------------------- POSITION SIZE CALCULATOR ---------------------------- */

/* Mode switch (Equity / F&O) */
.mode-switch {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
  margin-bottom: 24px;
}
.mode-switch button {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.mode-switch button.is-active {
  background: var(--brand-strong);
  color: #fff;
}
html[data-theme="dark"] .mode-switch button.is-active { background: var(--accent); color: var(--navy-900); }

/* Slider fields: number input + range slider combo */
.slider-field { margin-bottom: 26px; }
.slider-field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.slider-field-head label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.slider-field-head .slider-input-wrap { position: relative; width: 150px; }
.slider-field-head .slider-input-wrap .prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 13px; color: var(--text-tertiary);
  pointer-events: none;
}
.slider-field-head input[type="number"] {
  width: 100%;
  text-align: right;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  outline: none;
}
.slider-field-head input[type="number"].has-prefix { padding-left: 26px; }
.slider-field-head input[type="number"]:focus { border-color: var(--accent); }

input[type="range"].slider {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"].slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--surface-2) var(--fill, 0%));
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent-strong);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  margin-top: -8px;
}
input[type="range"].slider::-moz-range-track {
  height: 4px; border-radius: 2px; background: var(--surface-2);
}
input[type="range"].slider::-moz-range-progress {
  height: 4px; border-radius: 2px; background: var(--accent);
}
input[type="range"].slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent-strong); cursor: pointer;
}
.slider-range-labels {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--text-tertiary);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* Result stat row above the donut */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-box .stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.stat-box .stat-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow-x: auto;
  max-width: 100%;
}
.stat-box .stat-value.risk { color: var(--negative); }
.stat-box .stat-value.reward { color: var(--positive); }

/* Donut chart */
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}
.donut-legend {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.donut-legend .legend-item { font-size: 13px; }

.summary-sentence {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 16px auto 0;
  line-height: 1.6;
}
.summary-sentence strong { color: var(--text-primary); }

.warning-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: color-mix(in srgb, var(--negative) 8%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--negative) 25%, transparent);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 14px;
}
.warning-banner svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; stroke: var(--negative); }
.warning-banner.is-info {
  background: color-mix(in srgb, var(--brand) 8%, var(--surface-1));
  border-color: color-mix(in srgb, var(--brand) 25%, transparent);
}
.warning-banner.is-info svg { stroke: var(--brand); }
#warningsWrap .warning-banner { margin-top: 0; margin-bottom: 20px; }

/* Feature tabs (R-multiple, Kelly, Heat, Streak) */
.feature-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.feature-tabs::-webkit-scrollbar { display: none; }
.feature-tab {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.feature-tab:hover { color: var(--text-secondary); }
.feature-tab.is-active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}
.feature-panel { display: none; }
.feature-panel.is-active { display: block; }

/* Portfolio heat table */
.heat-table-wrap { overflow-x: auto; }
.heat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 560px;
}
.heat-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.heat-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.heat-table td:first-child, .heat-table th:first-child { font-family: var(--font-body); }
.heat-table .remove-row-btn {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--negative);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.heat-meter {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
  margin: 16px 0 8px;
}
.heat-meter-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width var(--t-med) var(--ease);
}

/* Streak simulator bars */
.streak-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  margin: 20px 0 8px;
  padding: 0 4px;
}
.streak-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}
.streak-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--negative), color-mix(in srgb, var(--negative) 70%, var(--surface-1)));
  transition: height var(--t-med) var(--ease);
}
.streak-bar-col .streak-label {
  font-size: 9.5px;
  color: var(--text-tertiary);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* Kelly inputs */
.kelly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.kelly-result-card {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}
.kelly-result-card .label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 6px; }
.kelly-result-card .value { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; }
.kelly-result-card.is-recommended { border: 2px solid var(--accent); }
.kelly-result-card.is-recommended .value { color: var(--accent-strong); }

/* R-multiple badge */
.rr-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--positive) 12%, transparent);
  color: var(--positive);
  border: 1px solid color-mix(in srgb, var(--positive) 30%, transparent);
}
.rr-badge.is-poor {
  background: color-mix(in srgb, var(--negative) 12%, transparent);
  color: var(--negative);
  border-color: color-mix(in srgb, var(--negative) 30%, transparent);
}

/* Saved scenarios */
.scenario-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 6px 6px 6px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0 8px 8px 0;
}
.scenario-pill button {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--border-soft);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}

@media (max-width: 720px) {
  .stat-row { grid-template-columns: 1fr; gap: 10px; }
  .kelly-grid { grid-template-columns: 1fr; }
  .slider-field-head .slider-input-wrap { width: 120px; }
}

/* ---------------------------- TOOLS DROPDOWN NAV ---------------------------- */
.tools-dropdown { position: relative; }
.tools-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  white-space: nowrap;
}
.tools-dropdown-trigger:hover { color: var(--accent-strong); }
.tools-dropdown-trigger.is-active-tool { color: var(--text-primary); font-weight: 600; }
.tools-dropdown-trigger svg { width: 14px; height: 14px; transition: transform var(--t-fast) var(--ease); }
.tools-dropdown.is-open .tools-dropdown-trigger svg { transform: rotate(180deg); }

.tools-dropdown-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 38, 0.32);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-fast) var(--ease), visibility var(--t-fast);
  z-index: 55;
  pointer-events: none;
}
.tools-dropdown-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ============================================================
   MEGA MENU
   Full-width panel anchored under the header, not the trigger.
   ============================================================ */
.mega-menu {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), visibility var(--t-fast);
  z-index: 60;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.tools-dropdown.is-open .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.mega-menu-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 36px 24px 32px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 260px;
  gap: 8px 28px;
}
.mega-col-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 7px;
}
.mega-col-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.mega-col { min-width: 0; }
.mega-link {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  margin: 0 -10px;
  transition: background var(--t-fast) var(--ease);
}
.mega-link:hover { background: var(--surface-2); }
.mega-link.is-current { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.mega-link-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  margin-top: 1px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.mega-link-text { min-width: 0; flex: 1; }
.mega-link-name {
  display: block;
  font-size: 13.5px; font-weight: 600; color: var(--text-primary);
  white-space: normal;
  line-height: 1.3;
}
.mega-link-desc {
  display: block;
  font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; line-height: 1.4;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Featured panel — 4th column */
.mega-featured {
  background: linear-gradient(155deg, #1B2150 0%, #2A3580 65%, #3B3F8F 100%);
  border-radius: var(--radius-md);
  padding: 22px;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(20, 24, 60, 0.35);
}
.mega-featured::before {
  content: '';
  position: absolute;
  top: -40%; right: -30%;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(247,148,30,0.35), transparent 70%);
  pointer-events: none;
}
.mega-featured-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.65);
  margin-bottom: 10px;
}
.mega-featured-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}
.mega-featured-desc {
  font-size: 12.5px;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
  margin-bottom: 18px;
  flex: 1;
}
.mega-featured-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-900);
  background: #fff;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  width: fit-content;
  transition: transform var(--t-fast) var(--ease);
}
.mega-featured-link:hover { transform: translateY(-1px); }
.mega-featured-link svg { width: 13px; height: 13px; }
.mega-featured-bottom-links { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.mega-featured-bottom-links a {
  font-size: 12px; color: rgba(255,255,255,0.8); display: flex; align-items: center; gap: 6px;
}
.mega-featured-bottom-links a:hover { color: #fff; }
.mega-featured-bottom-links svg { width: 12px; height: 12px; flex-shrink: 0; }

@media (max-width: 1080px) {
  .mega-menu-inner { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .mega-featured { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 20px; }
  .mega-featured-desc { margin-bottom: 0; }
  .mega-featured-bottom-links { display: none; }
}
@media (max-width: 720px) {
  .mega-menu { position: fixed; top: 0; height: 100vh; max-height: 100vh; overflow-y: auto; }
  .mega-menu-inner { grid-template-columns: 1fr; padding: 80px 20px 32px; gap: 28px; }
  .mega-featured { grid-column: auto; flex-direction: column; }
  .mega-featured-bottom-links { display: flex; }
}

/* ---------------------------- TOOL HUB GRID (cross-links between tools) ---------------------------- */
.tool-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin: 32px 0 8px;
}
.tool-hub-card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  text-align: center;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tool-hub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.tool-hub-card.is-current { border-color: var(--accent); background: color-mix(in srgb, var(--amber-500) 6%, var(--surface-1)); }
.tool-hub-card .icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
}
.tool-hub-card .name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }

@media (max-width: 1080px) {
  .tool-hub-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .tool-hub-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* ---------------------------- LOT TABLE (Average Price tool) ---------------------------- */
.lot-table-wrap { overflow-x: auto; margin-bottom: 16px; }
.lot-table { width: 100%; border-collapse: collapse; min-width: 460px; }
.lot-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-tertiary); padding: 8px 8px; border-bottom: 1px solid var(--border-soft);
}
.lot-table td { padding: 6px 8px; }
.lot-table input {
  width: 100%; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft); background: var(--surface-2);
  color: var(--text-primary); font-family: var(--font-mono); font-size: 13.5px; outline: none;
}
.lot-table input:focus { border-color: var(--accent); }
.lot-table .remove-lot-btn {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border-soft);
  background: var(--surface-2); color: var(--negative); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lot-table .remove-lot-btn:hover { background: var(--negative); color: #fff; border-color: var(--negative); }

/* ---------------------------- PAYOFF CHART (Option Profit tool) ---------------------------- */
.payoff-chart-wrap { width: 100%; margin: 20px 0; }
.payoff-chart-wrap svg { width: 100%; height: auto; display: block; }
.payoff-legend { display: flex; gap: 20px; justify-content: center; margin-top: 8px; font-size: 12.5px; color: var(--text-secondary); }

/* ---------------------------- MARGIN BREAKDOWN CARDS ---------------------------- */
.margin-range-card {
  background: var(--surface-2); border-radius: var(--radius-md); padding: 18px; text-align: center;
}
.margin-range-card .label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 6px; }
.margin-range-card .range { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 700; color: var(--text-primary); line-height: 1.4; }
.margin-range-card .range .sep { color: var(--text-tertiary); font-size: 0.9rem; margin: 0 3px; }

/* ---------------------------- DIRECTION TOGGLE (Risk:Reward tool) ---------------------------- */
.direction-toggle { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-pill); padding: 4px; gap: 4px; margin-bottom: 22px; }
.direction-toggle button {
  border: none; background: transparent; padding: 8px 20px; border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer;
}
.direction-toggle button.is-active { background: var(--brand-strong); color: #fff; }
html[data-theme="dark"] .direction-toggle button.is-active { background: var(--accent); color: var(--navy-900); }

/* ---------------------------- SEGMENT/POSITION PILLS (Option Profit, Margin tools) ---------------------------- */
.pill-toggle-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.pill-toggle {
  border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--text-secondary);
  padding: 7px 16px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; cursor: pointer;
}
.pill-toggle.is-active { background: var(--brand-strong); color: #fff; border-color: var(--brand-strong); }
html[data-theme="dark"] .pill-toggle.is-active { background: var(--accent); color: var(--navy-900); }

/* ---------------------------- WHAT-IF / TARGET SOLVER CARD ---------------------------- */
.solver-card { background: var(--surface-2); border-radius: var(--radius-md); padding: 18px; margin-top: 16px; }
.solver-card .solver-result { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 700; color: var(--accent-strong); }

/* ============================================================
   LONG-FORM ARTICLE CONTENT (per-tool deep-dive guide)
   ============================================================ */
.article-section { padding: 56px 0 8px; }
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 48px;
  align-items: start;
}
.article-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  order: 2;
}
.article-toc-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary); margin-bottom: 12px;
}
.article-toc-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  list-style: none; margin: 0; padding: 0;
}
.article-toc-list a {
  font-size: 13px; color: var(--text-secondary); display: flex; align-items: baseline; gap: 8px;
  line-height: 1.4;
}
.article-toc-list a:hover { color: var(--accent-strong); }
.article-toc-list .num { font-family: var(--font-mono); font-size: 11px; color: var(--accent-strong); flex-shrink: 0; }
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-toc { position: static; order: -1; margin-bottom: 8px; }
  .article-toc-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px 24px; }
}
@media (max-width: 640px) { .article-toc-list { grid-template-columns: 1fr; } }

.article-prose { max-width: 100%; order: 1; }
.article-prose h2 {
  font-size: 1.5rem; font-weight: 800; margin: 48px 0 16px; color: var(--text-primary); scroll-margin-top: 90px;
}
.article-prose h2:first-child { margin-top: 0; }
.article-prose h3 {
  font-size: 1.15rem; font-weight: 700; margin: 28px 0 12px; color: var(--text-primary);
}
.article-prose p {
  font-size: 15px; line-height: 1.75; color: var(--text-secondary); margin: 0 0 16px;
}
.article-prose ul, .article-prose ol {
  margin: 0 0 16px; padding-left: 22px;
}
.article-prose li {
  font-size: 15px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 8px;
}
.article-prose li::marker { color: var(--accent-strong); }
.article-prose strong { color: var(--text-primary); font-weight: 700; }
.article-prose a { color: var(--accent-strong); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-strong) 35%, transparent); }

.article-callout {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-1));
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  margin: 20px 0;
}
.article-callout p { margin-bottom: 0; font-size: 14px; }
.article-callout p + p { margin-top: 10px; }
.article-callout .callout-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent-strong); margin-bottom: 6px; display: block;
}
.article-callout.is-example { background: color-mix(in srgb, var(--positive) 7%, var(--surface-1)); border-left-color: var(--positive); }
.article-callout.is-example .callout-label { color: color-mix(in srgb, var(--positive) 80%, black 10%); }
html[data-theme="dark"] .article-callout.is-example .callout-label { color: var(--positive); }
.article-callout.is-warning { background: color-mix(in srgb, var(--negative) 7%, var(--surface-1)); border-left-color: var(--negative); }
.article-callout.is-warning .callout-label { color: var(--negative); }

.article-example-table {
  width: 100%; border-collapse: collapse; margin: 16px 0 20px; font-size: 13.5px;
}
.article-example-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-tertiary); padding: 9px 12px; border-bottom: 2px solid var(--border-soft);
  background: var(--surface-2);
}
.article-example-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono); color: var(--text-primary); font-size: 13px;
}
.article-example-table td:first-child { font-family: var(--font-body); color: var(--text-secondary); }
.article-example-table tr:last-child td { border-bottom: none; font-weight: 700; }

.article-compare-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; margin: 20px 0 24px;
}
.article-compare-card {
  background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 18px 20px;
}
.article-compare-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }
.article-compare-card ul { padding-left: 18px; margin-bottom: 0; }
.article-compare-card li { font-size: 13.5px; line-height: 1.6; margin-bottom: 6px; }
@media (max-width: 640px) { .article-compare-grid { grid-template-columns: 1fr; } }

/* ---------------------------- FAQ ACCORDION ---------------------------- */
.faq-section { padding: 48px 0 8px; }
.faq-list { max-width: 760px; }
.faq-item {
  border-bottom: 1px solid var(--border-soft);
}
.faq-item:first-child { border-top: 1px solid var(--border-soft); }
.faq-question {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 4px; font-family: var(--font-display); font-size: 15.5px; font-weight: 700;
  color: var(--text-primary);
}
.faq-question:hover { color: var(--accent-strong); }
.faq-question svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-tertiary); transition: transform var(--t-fast) var(--ease); }
.faq-item.is-open .faq-question svg { transform: rotate(45deg); }
.faq-answer {
  max-height: 0; overflow: hidden; transition: max-height var(--t-fast) var(--ease);
}
.faq-item.is-open .faq-answer { max-height: 600px; }
.faq-answer-inner { padding: 0 4px 20px; font-size: 14.5px; line-height: 1.7; color: var(--text-secondary); }
.faq-answer-inner p { margin: 0 0 10px; }
.faq-answer-inner p:last-child { margin-bottom: 0; }
.faq-answer-inner strong { color: var(--text-primary); }

/* ============================================================
   SHARE BUTTON + DROPDOWN PANEL
   A single "Share" trigger that opens a clean, elevated panel
   listing each platform as a labeled row, plus a copy-link
   action with clear success feedback.
   ============================================================ */
.share-widget {
  position: relative;
  display: inline-block;
  margin-top: 22px;
}
.share-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.share-trigger svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent-strong); }
.share-trigger:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(247, 148, 30, 0.18);
}
.share-trigger .chevron { width: 12px; height: 12px; color: var(--text-tertiary); margin-left: 2px; transition: transform var(--t-fast) var(--ease); }
.share-widget.is-open .share-trigger .chevron { transform: rotate(180deg); }

.share-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 280px;
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top left;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), visibility var(--t-fast);
  z-index: 70;
}
.share-widget.is-open .share-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.share-panel-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 6px 10px 10px;
}
.share-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast) var(--ease);
}
.share-option:hover { background: var(--surface-2); }
.share-option-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.share-option-icon svg { width: 16px; height: 16px; }
.share-option[data-share="whatsapp"] .share-option-icon { background: #25D366; }
.share-option[data-share="twitter"] .share-option-icon { background: #000; }
.share-option[data-share="facebook"] .share-option-icon { background: #1877F2; }
.share-option[data-share="linkedin"] .share-option-icon { background: #0A66C2; }
.share-option[data-share="telegram"] .share-option-icon { background: #26A5E4; }
.share-option[data-share="copy"] .share-option-icon { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border-soft); }
.share-option[data-share="copy"].is-copied .share-option-icon { background: var(--positive); color: #fff; border-color: var(--positive); }
.share-option-text { flex: 1; min-width: 0; }
.share-option-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.share-divider { height: 1px; background: var(--border-soft); margin: 6px 4px; }

.share-backdrop {
  position: fixed;
  inset: 0;
  z-index: 68;
  display: none;
}
.share-widget.is-open ~ .share-backdrop,
.share-backdrop.is-active { display: block; }

@media (max-width: 480px) {
  .share-panel { left: auto; right: 0; transform-origin: top right; width: 248px; padding: 8px; }
  .share-option { padding: 7px 8px; gap: 10px; }
  .share-option-icon { width: 28px; height: 28px; border-radius: 8px; }
  .share-option-icon svg { width: 14px; height: 14px; }
  .share-option-text { font-size: 13px; }
  .share-option-sub { font-size: 10.5px; }
  .share-trigger { padding: 8px 14px; font-size: 13px; }
  .share-trigger svg { width: 14px; height: 14px; }
}


/* ============================================================
   SMART LOAN OPTIMIZER — dedicated sidebar layout
   ============================================================ */
.loan-optimizer-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.loan-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
}
.loan-sidebar-section { margin-bottom: 22px; }
.loan-sidebar-section:last-child { margin-bottom: 0; }
.loan-sidebar-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.loan-field { margin-bottom: 14px; }
.loan-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.loan-field input[type="number"],
.loan-field input[type="date"],
.loan-field select {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color var(--t-fast) var(--ease);
}
.loan-field input:focus, .loan-field select:focus { border-color: var(--accent); }
.loan-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.loan-radio-group { display: flex; flex-direction: column; gap: 6px; }
.loan-radio-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.loan-radio-option:hover { background: var(--surface-2); }
.loan-radio-option.is-selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); }
.loan-radio-option input[type="radio"] { margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.loan-radio-option .opt-text { font-size: 12.5px; line-height: 1.4; }
.loan-radio-option .opt-text strong { display: block; font-size: 13px; color: var(--text-primary); }
.loan-checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.loan-checkbox-row input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.loan-checkbox-row label { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 0; }
.loan-sub-fields { padding-left: 24px; border-left: 2px solid var(--border-soft); margin-top: 8px; }
.loan-sub-fields.is-hidden { display: none; }

.loan-tab-row { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }

/* Results area */
.loan-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.loan-summary-card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.loan-summary-card .label { font-size: 11.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.loan-summary-card .value { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.loan-summary-card .sub { font-size: 11.5px; color: var(--text-tertiary); margin-top: 4px; }
.loan-summary-card .value.is-positive { color: var(--positive); }
.loan-summary-card .value.is-negative { color: var(--negative); }
@media (max-width: 1080px) { .loan-summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }

.loan-compare-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 8px; }
.loan-compare-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-tertiary); padding: 9px 12px; border-bottom: 2px solid var(--border-soft); }
.loan-compare-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); font-family: var(--font-mono); color: var(--text-primary); }
.loan-compare-table td:first-child { font-family: var(--font-body); color: var(--text-secondary); }
.loan-compare-table tr.is-highlight td { background: color-mix(in srgb, var(--positive) 7%, transparent); font-weight: 700; }

.loan-income-gauge { background: var(--surface-2); border-radius: var(--radius-md); padding: 18px 20px; margin-bottom: 16px; }
.loan-income-bar-track { height: 10px; border-radius: 6px; background: var(--border-soft); overflow: hidden; margin: 10px 0 8px; position: relative; }
.loan-income-bar-fill { height: 100%; border-radius: 6px; transition: width var(--t-med) var(--ease); }
.loan-income-bar-fill.band-comfortable { background: var(--positive); }
.loan-income-bar-fill.band-stretched { background: var(--amber-500); }
.loan-income-bar-fill.band-risky { background: var(--negative); }
.loan-income-marker { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--text-tertiary); }
.loan-income-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-tertiary); }

.loan-goalseek-result { background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: var(--radius-md); padding: 18px 20px; margin-top: 14px; }
.loan-goalseek-result .ans { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; color: var(--accent-strong); }

.loan-export-row { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.loan-export-row button { display: inline-flex; align-items: center; gap: 7px; }
.loan-export-row svg { width: 15px; height: 15px; }

.loan-schedule-wrap { max-height: 460px; overflow-y: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
.loan-schedule-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.loan-schedule-table thead th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-tertiary); padding: 8px 10px; border-bottom: 1px solid var(--border-soft); z-index: 2; }
.loan-schedule-table td { padding: 7px 10px; border-bottom: 1px solid var(--border-soft); font-family: var(--font-mono); color: var(--text-secondary); white-space: nowrap; }
.loan-schedule-table tr.has-prepay { background: color-mix(in srgb, var(--positive) 6%, transparent); }
.loan-schedule-table tr.has-prepay td:first-child { font-weight: 700; color: var(--text-primary); }

@media (max-width: 1024px) {
  .loan-optimizer-layout { grid-template-columns: 1fr; }
  .loan-sidebar { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .loan-field-row { grid-template-columns: 1fr; }
  .loan-summary-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PRINT / PDF EXPORT STYLES (Smart Loan Optimizer summary)
   ============================================================ */
.print-summary { display: none; }
@media print {
  .site-header, .mega-menu, .tools-dropdown-backdrop, .mobile-drawer, .share-widget,
  .share-backdrop, .site-footer, .loan-app, .ps-hero .hero-eyebrow,
  .article-section, .faq-section, .standalone-terms,
  main > section.container, h2.print-hide, section.print-hide { display: none !important; }
  .print-summary { display: block !important; padding: 20px; }
  body { background: #fff !important; }
  .print-summary h1 { font-size: 22px; margin-bottom: 4px; font-family: Georgia, serif; }
  .print-summary .print-meta { font-size: 12px; color: #666; margin-bottom: 20px; }
  .print-summary table { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: 12px; }
  .print-summary th, .print-summary td { border: 1px solid #ccc; padding: 6px 10px; text-align: left; }
  .print-summary th { background: #f3f3f3; }
  .print-summary h3 { font-size: 14px; margin: 18px 0 8px; }
}

