:root {
  --cream:         #F5F1EB;
  --navy:          #12141C;
  --gold:          #C9A840;
  --gold-dark:     #B8960B;
  --ink:           #1a1a24;
  --ink-secondary: #5a564e;
  --muted:         #a09880;
  --border:        #E8E4DC;
  --border-strong: rgba(26,26,36,0.2);
  --card-bg:       #ffffff;
  --surface-soft:  #F9F7F3;
  --adr-red:       #b6532b;

  /* Aliases so var() references below resolve correctly */
  --surface:       #ffffff;
  --page:          #F5F1EB;
  --line:          #E8E4DC;
  --line-strong:   rgba(26,26,36,0.2);
  --accent:        var(--gold);
  --accent-strong: var(--gold-dark);
  --adr:           #b6532b;
  --shadow:        0 16px 42px rgba(26, 26, 36, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--cream);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.workspace {
  display: grid;
  gap: 14px;
}


.eyebrow,
.kicker {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.9rem, 3.5vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.trade-form {
  display: grid;
  gap: 14px;
}

/* Two-column page layout */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  align-items: start;
}

.left-col,
.right-col {
  display: grid;
  gap: 14px;
}

/* Securities card — merged Primary + ADR */
.securities-card {
  padding: 16px;
}

.card-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.securities-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.security-sub {
  padding: 0 14px 0 0;
}

.security-sub + .security-sub {
  padding: 0 0 0 14px;
  border-left: 1px solid var(--border);
}

.sub-heading {
  margin: 0 0 12px;
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.entry-card,
.chart-card,
.insight-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.entry-card {
  padding: 16px;
}

.entry-card h2 {
  margin: 0 0 14px;
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--gold-dark);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field-stack,
.setup-grid {
  display: grid;
  gap: 12px;
}

.field-stack {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-2 {
  grid-column: 1 / -1;
}

.field {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field > span:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.input-with-helper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.helper-button {
  min-width: 36px;
  min-height: 39px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.15s ease;
}

.helper-button:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

input,
output {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--card-bg);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0;
}

output {
  display: flex;
  align-items: center;
  background: var(--surface-soft);
  border-style: dashed;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 64, 0.18);
  outline: none;
}

input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
  cursor: not-allowed;
  border-style: dashed;
  opacity: 0.85;
}

input[readonly]:focus {
  border-color: var(--border-strong);
  box-shadow: none;
}

input:not([readonly]) {
  background: var(--card-bg);
  color: var(--ink);
  cursor: text;
  border-style: solid;
  opacity: 1;
}

.lookup-button {
  min-width: 66px;
  min-height: 39px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
}

.lookup-button::before {
  content: "↻";
  margin-right: 6px;
  color: var(--accent-strong);
}

.lookup-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.security-name,
.lookup-status,
.field-note {
  min-height: 14px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
  text-transform: none;
}

.lookup-status[data-tone="good"] {
  color: var(--muted);
}

.lookup-status[data-tone="bad"] {
  color: #a33b2f;
}

.field-note a {
  color: var(--gold-dark);
  text-decoration: none;
  font-weight: 700;
}

.field-note a:hover {
  text-decoration: underline;
}

.comm-link {
  margin-left: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.comm-link:hover {
  color: var(--gold-dark);
}

.field-note[data-tone="warning"] {
  color: #d97706;
  font-weight: 600;
}

.field-note[data-tone="good"] {
  color: var(--accent-strong);
}

.suggestions {
  position: absolute;
  z-index: 10;
  top: 63px;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  box-shadow: 0 14px 32px rgba(26, 26, 36, 0.16);
  background: var(--card-bg);
}

.suggestions:empty {
  display: none;
}

.suggestion-option {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: auto;
  border: 0;
  border-radius: 0;
  padding: 9px 10px;
  color: var(--ink);
  text-align: left;
  background: var(--card-bg);
  cursor: pointer;
}

.suggestion-option:hover {
  background: var(--surface-soft);
}

.suggestion-option span {
  color: var(--muted);
  font-size: 0.78rem;
}

.breakdown-section-title {
  margin: 0 0 12px !important;
}

/* Cost breakdown card */

.breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.breakdown-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-col:first-child {
  padding-right: 14px;
}

.breakdown-col + .breakdown-col {
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.breakdown-heading {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 4px;
  font-family: 'Playfair Display', Georgia, serif;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.78rem;
}

.breakdown-row span:first-child {
  color: var(--muted);
  font-weight: 600;
}

.breakdown-row span:last-child {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

.breakdown-total {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.breakdown-total span:first-child {
  color: var(--ink);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.breakdown-total span:last-child {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
}

.chart-card {
  display: grid;
  gap: 0;
  align-content: start;
  overflow: hidden;
}

.recommendation {
  display: grid;
  gap: 4px;
  padding: 14px;
  color: var(--cream);
  background: var(--navy);
}

.recommendation strong {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--gold);
}

.recommendation span:last-child,
.recommendation .kicker {
  color: rgba(245, 241, 235, 0.72);
}

.chart-bars {
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: 72px minmax(120px, 1fr) minmax(96px, auto);
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
  font-weight: 700;
}

.chart-label {
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 700;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.bar-fill {
  width: 0;
  height: 100%;
  min-width: 5px;
  border-radius: inherit;
}

.adr-fill {
  background: var(--adr-red);
}

.primary-fill {
  background: var(--gold);
}

.chart-row strong {
  color: var(--ink);
  text-align: right;
}

.premium-section {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.premium-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.metric-value {
  font-size: 1.22rem;
  line-height: 1.05;
  color: var(--ink);
}

.metric-detail {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.fx-insight-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 0;
}

.fx-sensitivity-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.fx-sparkline-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.card-title {
  display: block;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.fx-metric-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.metric-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-row label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-row strong {
  font-size: 1.3rem;
  line-height: 1.2;
  color: var(--navy);
}


.fx-insight-text {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.fx-projections-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: auto;
}

.sparkline-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding: 8px 0 12px 0;
  margin-top: 4px;
}

.sparkline-label-top,
.sparkline-label-bottom {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy);
  padding-left: 8px;
  min-height: 16px;
}

.sparkline-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 2px;
  display: block;
}

.sparkline-zone-note {
  font-size: 0.70rem;
  color: var(--muted);
  line-height: 1.4;
  padding: 4px 0 0 2px;
  font-style: italic;
}

#fxSparkline {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.google-icon {
  width: 12px;
  height: 12px;
}

.helper-text {
  font-size: 0.8rem;
  font-weight: 700;
}

.ratio-helper {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* TASK 6 — error/confirm states */
.input-error {
  border-color: #a33b2f !important;
  box-shadow: 0 0 0 3px rgba(163, 59, 47, 0.14) !important;
}

.confirm-pending {
  background: #fff3f3 !important;
  border-color: #a33b2f !important;
  color: #a33b2f !important;
}

/* TASK 3 — auto-match and alternatives notes */
.auto-match-note {
  font-size: 0.72rem;
  color: #B8960B;
  margin-top: 3px;
  display: block;
  line-height: 1.35;
}

.alternatives-note {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
  display: block;
  line-height: 1.35;
  font-style: italic;
}

/* TASK 4 — ADR badge */
.adr-badge-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 6px;
}

.adr-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.adr-badge[data-level="II"],
.adr-badge[data-level="III"] {
  background: #fdf6e0;
  color: var(--gold-dark);
}

.adr-badge[data-level="I"] {
  background: #fff8e6;
  color: #92650a;
}

.adr-badge[data-sponsored="false"] {
  background: #fff3f3;
  color: #a33b2f;
}

.badge-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: 260px;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(26,26,36,0.13);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  /* reset inherited uppercase/caps from .field > span */
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}

.adr-badge-wrapper:hover .badge-tooltip,
.adr-badge:focus .badge-tooltip {
  opacity: 1;
  pointer-events: auto;
}

/* Tooltip internal layout */
.tt-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 2px;
}

.tt-detail {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-secondary);
  line-height: 1.45;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.tt-meta {
  display: flex;
  gap: 6px;
  font-size: 0.71rem;
  color: var(--ink-secondary);
  line-height: 1.4;
  margin-top: 5px;
}

.tt-warn {
  color: #a33b2f;
}

.tt-label {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 1px;
}

.badge-warning {
  font-size: 0.70rem;
  color: #a33b2f;
  display: block;
  margin-top: 3px;
  line-height: 1.35;
}

/* TASK 12 — Withholding tax callout */
.withholding-callout {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.5;
}

.withholding-callout .callout-title {
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  display: block;
}

.withholding-callout small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.70rem;
  font-style: italic;
}

/* Data sources bar — bare, no container */
.data-sources-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 0.5px solid rgba(26, 26, 36, 0.15);
  font-family: Inter, sans-serif;
  font-size: 13px;
}

.data-sources-bar a {
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.data-sources-bar a:hover {
  text-decoration: underline;
}

.source-label {
  color: #B8960B;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.source-separator {
  color: rgba(26, 26, 36, 0.25);
}

.source-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-separator {
  color: var(--border-strong);
}

.yahoo-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: #fff;
  background: #5f01d1;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Disclaimer — Butler-style dot list */
.disclaimer-list {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 0.5px solid rgba(26, 26, 36, 0.15);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.disclaimer-eyebrow {
  margin: 0 0 4px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #B8960B;
}

.disclaimer-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.disclaimer-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #B8960B;
  flex-shrink: 0;
}

.disclaimer-item span:last-child {
  font-family: Inter, sans-serif;
  font-size: 13px;
  color: #3a3830;
}

/* Site footer — matches Butler pattern */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  background: var(--cream);
}

.site-footer-top {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.site-footer-product {
  margin: 0;
  font-size: 14px;
  color: #3a3830;
  font-family: Inter, sans-serif;
}

.site-footer-pipe {
  color: #a09880;
  margin: 0 4px;
}

.site-footer-byline {
  font-style: normal;
  color: #a09880;
}

.site-footer-byline a {
  color: #a09880;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.site-footer-byline a:hover {
  color: #12141C;
}

.site-footer-bottom {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: #6B6B6B;
  font-family: Inter, sans-serif;
}

.site-footer-links {
  display: flex;
  gap: 24px;
}

.site-footer-links a {
  color: #6B6B6B;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer-links a:hover {
  color: #1a1a24;
}

.heart {
  color: var(--gold);
  font-size: 1rem;
}

.insight-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.insight-card strong {
  display: block;
  margin-top: 7px;
  font-size: 1.22rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.insight-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}

/* Financial Fortress nav bar */
.ff-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--cream);
  padding: 0 24px;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.ff-nav.scrolled {
  background: rgba(245, 241, 235, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
  box-shadow: 0 1px 3px rgba(26,26,36,0.06);
}

.ff-nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.ff-nav-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #12141C;
  color: #C9A840;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ff-nav-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: #12141C;
  letter-spacing: -0.01em;
}

.ff-nav-cta {
  background: var(--navy);
  color: var(--cream);
  padding: 9px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.ff-nav-cta:hover {
  background: #2a2d38;
}

/* offset body for fixed nav */
body {
  padding-top: 64px;
}

/* Stock Lens product header */
.sl-header {
  background: var(--cream);
  padding: 40px 24px 28px;
}

.sl-header-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.sl-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sl-eyebrow-line {
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--gold-dark);
  flex-shrink: 0;
}

.sl-eyebrow-text {
  font-size: 14px;
  font-weight: 400;
  color: var(--gold-dark);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sl-h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 12px;
}

.sl-tagline {
  font-size: 17px;
  color: var(--ink-secondary);
  line-height: 1.5;
  max-width: 540px;
  margin: 0;
}

.sl-header-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.sl-btn-ghost {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sl-btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
}

.sl-btn-solid {
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  background: var(--gold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sl-btn-solid:hover {
  background: var(--gold-dark);
  color: var(--cream);
}

@media (max-width: 860px) {
  .two-col-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .securities-panels {
    grid-template-columns: 1fr;
  }

  .security-sub {
    padding: 0;
  }

  .security-sub + .security-sub {
    padding: 12px 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
  }

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

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 10px;
  }

  .site-footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .data-sources-bar {
    justify-content: center;
  }

  .input-action,
  .input-with-helper {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .chart-row strong {
    text-align: left;
  }

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

  .breakdown-col:first-child {
    padding-right: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }

  .breakdown-col + .breakdown-col {
    padding-left: 0;
    padding-top: 12px;
    border-left: none;
  }
}

/* ── Dark mode: nav + footer only (content area stays light always) ── */
@media (prefers-color-scheme: dark) {
  .ff-nav {
    background: #12141C;
    border-bottom-color: rgba(255,255,255,0.10);
  }

  .ff-nav.scrolled {
    background: rgba(18, 20, 28, 0.95);
    border-bottom-color: rgba(255,255,255,0.10);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  }

  /* nav mark: gold bg, dark icon */
  .ff-nav-mark {
    background: #C9A840;
    color: #12141C;
  }

  .ff-nav-name {
    color: #C9A840;
  }

  .ff-nav-cta {
    background: #F5F1EB;
    color: #12141C;
  }

  .ff-nav-cta:hover {
    background: #e8e4dc;
  }

  /* footer */
  .site-footer {
    background: #12141C;
    border-top-color: rgba(255,255,255,0.10);
  }

  .site-footer-top {
    border-bottom-color: rgba(255,255,255,0.10);
  }

  .site-footer-product {
    color: #a09880;
  }

  .site-footer-byline,
  .site-footer-byline a {
    color: #a09880;
  }

  .site-footer-byline a:hover {
    color: #F5F1EB;
  }

  .site-footer-bottom {
    color: #a09880;
  }

  .site-footer-links a {
    color: #a09880;
  }

  .site-footer-links a:hover {
    color: #F5F1EB;
  }
}
