:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --card-bg: #ffffff;
  --table-header-bg: #eef1f5;
  --surface-alt: #fafbfd;
  --text: #152033;
  --muted: #5f6b7c;
  --border: #d8e0ea;
  --accent: #0f62fe;
  --accent-dark: #0043ce;
  --success: #0e6027;
  --error: #a2191f;
  --shadow: 0 18px 50px rgba(21, 32, 51, 0.08);
  --bg-gradient-top: #eef3fa;
  --bg-glow: rgba(15, 98, 254, 0.12);
  --hover-overlay: rgba(255, 255, 255, 0.72);
  --row-hover-bg: #f3f5f8;
  --success-bg: #e6f4ea;
  --warning: #b54708;
  --warning-bg: #fff4e5;
  --error-bg: #fdecea;
  --info-bg: #eef4ff;
  --neutral-bg: #f3f4f6;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #131c2e;
  --card-bg: #131c2e;
  --table-header-bg: #1a2438;
  --surface-alt: #1a2438;
  --text: #e8edf5;
  --muted: #9aa7bd;
  --border: #283449;
  --accent: #4c8dff;
  --accent-dark: #82b1ff;
  --success: #4ea36b;
  --error: #ff6b6b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --bg-gradient-top: #0f1828;
  --bg-glow: rgba(76, 141, 255, 0.18);
  --hover-overlay: rgba(255, 255, 255, 0.06);
  --row-hover-bg: #1c2840;
  --success-bg: rgba(78, 163, 107, 0.20);
  --warning: #ffa940;
  --warning-bg: rgba(255, 169, 64, 0.20);
  --error-bg: rgba(255, 107, 107, 0.20);
  --info-bg: rgba(76, 141, 255, 0.20);
  --neutral-bg: rgba(255, 255, 255, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #0b1220;
    --surface: #131c2e;
    --card-bg: #131c2e;
    --table-header-bg: #1a2438;
    --surface-alt: #1a2438;
    --text: #e8edf5;
    --muted: #9aa7bd;
    --border: #283449;
    --accent: #4c8dff;
    --accent-dark: #82b1ff;
    --success: #4ea36b;
    --error: #ff6b6b;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    --bg-gradient-top: #0f1828;
    --bg-glow: rgba(76, 141, 255, 0.18);
    --hover-overlay: rgba(255, 255, 255, 0.06);
    --row-hover-bg: #1c2840;
    --success-bg: rgba(78, 163, 107, 0.20);
    --warning: #ffa940;
    --warning-bg: rgba(255, 169, 64, 0.20);
    --error-bg: rgba(255, 107, 107, 0.20);
    --info-bg: rgba(76, 141, 255, 0.20);
    --neutral-bg: rgba(255, 255, 255, 0.06);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, var(--bg-glow), transparent 28%),
    linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}

body:has(.portfolio-full-width-section) {
  overflow-x: clip;
}

a {
  color: var(--accent);
}

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.portfolio-page.container {
  width: min(1400px, calc(100% - 2rem));
  padding: 0.75rem 0 1.25rem;
}

.portfolio-page .hero {
  margin-bottom: 0.35rem;
}

.portfolio-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.portfolio-hero-copy {
  min-width: 0;
}

.portfolio-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding-top: 0;
}

.portfolio-share-wrap {
  position: relative;
}

.portfolio-share-panel {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 30;
  padding-top: 0.45rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.portfolio-share-panel-icons {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(21, 32, 51, 0.12);
}

.portfolio-share-wrap:hover .portfolio-share-panel,
.portfolio-share-wrap:focus-within .portfolio-share-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.portfolio-share-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

.portfolio-share-option svg {
  width: 1rem;
  height: 1rem;
}

.portfolio-share-option:hover,
.portfolio-share-option:focus-visible {
  color: var(--accent);
  background: var(--bg);
}

.portfolio-action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.portfolio-action-btn:hover:not(:disabled),
.portfolio-action-btn:focus-visible:not(:disabled) {
  background: var(--bg);
  color: var(--accent);
  border-color: rgba(15, 98, 254, 0.35);
}

.portfolio-action-btn.saved {
  color: var(--success);
  border-color: rgba(14, 96, 39, 0.35);
}

.portfolio-action-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.portfolio-action-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.portfolio-action-tooltip {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 20;
  width: max-content;
  max-width: 14rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(21, 32, 51, 0.12);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.portfolio-action-btn:hover .portfolio-action-tooltip,
.portfolio-action-btn:focus-visible .portfolio-action-tooltip,
.portfolio-action-btn.bookmark-feedback .portfolio-action-tooltip {
  opacity: 1;
  visibility: visible;
}

a.portfolio-action-btn,
a.portfolio-action-link {
  text-decoration: none;
}

.settings-page {
  min-height: 100vh;
}

.settings-container {
  width: min(960px, calc(100% - 2rem));
  padding: 1rem 0 1.5rem;
}

.settings-topnav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.settings-back-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
}

.settings-back-arrow:hover,
.settings-back-arrow:focus-visible {
  color: var(--accent);
  border-color: rgba(15, 98, 254, 0.35);
  background: var(--bg);
}

.settings-hero {
  margin-bottom: 0.6rem;
}

.settings-hero h1 {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  line-height: 1.05;
}

.settings-hero .subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
}

.settings-card {
  padding: 0.85rem 1rem 1rem;
}

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.settings-section-header .section-title {
  margin: 0;
}

.settings-reset-btn {
  width: 2.1rem;
  height: 2.1rem;
}

.settings-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 1rem;
  margin-top: 0.75rem;
}

.settings-form .settings-fieldset,
.settings-form .settings-section-header {
  grid-column: 1 / -1;
}

.settings-field label,
.settings-fieldset legend {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.settings-field {
  min-width: 0;
}

.settings-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.settings-section-header {
  background: rgba(26,115,232,0.08);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent, #1a73e8);
  border-left: 3px solid var(--accent, #1a73e8);
  margin-bottom: 0.75rem;
  grid-column: 1 / -1;
}

.settings-section-hint {
  margin: -0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.settings-field-hint code {
  font-size: 0.82rem;
}

.settings-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  color: var(--muted);
  background: var(--border);
  cursor: help;
  vertical-align: middle;
  flex-shrink: 0;
  user-select: none;
}

.settings-tip:hover {
  color: #ffffff;
  background: var(--primary, #0f62fe);
}

.global-instant-tooltip {
  position: fixed;
  z-index: 999999;
  padding: 0.55rem 0.85rem;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.05s ease-out;
  max-width: 310px;
  white-space: normal;
  text-align: left;
}

.global-instant-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

.last-price-header {
  display: inline-flex;
  align-items: center;
  gap: 0;
  max-width: 100%;
}

.last-price-col .sort-col-btn {
  min-width: 0;
  margin-right: 0;
}

.last-price-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: -0.18rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.last-price-refresh-btn:hover:not(:disabled),
.last-price-refresh-btn:focus-visible:not(:disabled) {
  color: var(--text);
  border-color: var(--border);
  background: transparent;
  outline: none;
}

.last-price-refresh-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.last-price-refresh-btn.is-loading .last-price-refresh-icon {
  animation: last-price-refresh-spin 0.85s linear infinite;
}

@keyframes last-price-refresh-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.last-price-refresh-icon {
  width: 0.72rem;
  height: 0.72rem;
}

.settings-field-hint {
  margin: -0.1rem 0 0.4rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

.settings-field input[type="text"],
.settings-field input[type="password"] {
  width: min(100%, 24rem);
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  box-sizing: border-box;
}

.settings-field input[type="text"]:focus,
.settings-field input[type="password"]:focus {
  outline: 2px solid rgba(15, 98, 254, 0.25);
  border-color: rgba(15, 98, 254, 0.45);
}

.settings-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.settings-input-wrap input[type="number"] {
  width: 6.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  box-sizing: border-box;
}

.settings-input-wrap input[type="number"]:focus {
  outline: 2px solid rgba(15, 98, 254, 0.25);
  border-color: rgba(15, 98, 254, 0.45);
}

.settings-input-suffix {
  color: var(--muted);
  font-size: 0.85rem;
}

.settings-radio {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.settings-radio input {
  margin: 0;
}

.settings-save-status {
  min-height: 1.2rem;
  margin: 0;
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 600;
  grid-column: 1 / -1;
}

.settings-last-saved {
  grid-column: 1 / -1;
}

.settings-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.settings-cutoff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.5rem 1rem;
  margin-bottom: 0.3rem;
}

.settings-credential-hint {
  margin: 0.35rem 0 0;
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 600;
}

.settings-credentials-summary {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(25, 128, 56, 0.22);
  border-radius: 8px;
  background: rgba(25, 128, 56, 0.08);
  color: #198038;
  font-size: 0.86rem;
  font-weight: 600;
}

.settings-credentials-summary.is-flash {
  animation: settings-credentials-flash 1.2s ease;
}

.settings-last-saved {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

@keyframes settings-credentials-flash {
  0% {
    background: rgba(25, 128, 56, 0.2);
  }
  100% {
    background: rgba(25, 128, 56, 0.08);
  }
}

.portfolio-page .eyebrow {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.15;
}

.portfolio-page h1 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.05;
  margin: 0;
}

.portfolio-page .subtitle {
  margin: 0.05rem 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.portfolio-parse-notice {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(15, 98, 254, 0.22);
  border-radius: 8px;
  background: rgba(15, 98, 254, 0.06);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.45;
}

.portfolio-page .portfolio-overview {
  gap: 0.65rem;
}

.portfolio-page .portfolio-summary-card,
.portfolio-page .chart-card,
.portfolio-page .table-card {
  padding: 0.75rem 0.9rem;
}

.portfolio-page .chart-card {
  display: flex;
  flex-direction: column;
  padding-bottom: 0.55rem;
}

.portfolio-page .portfolio-data-card {
  margin-top: 0.65rem;
}

.portfolio-page .portfolio-full-width-section {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  box-sizing: border-box;
}

.portfolio-page .portfolio-overview.portfolio-full-width-section,
.portfolio-page .portfolio-topnav.portfolio-full-width-section,
.portfolio-page .portfolio-hero.portfolio-full-width-section,
.portfolio-page .portfolio-parse-notice.portfolio-full-width-section {
  padding-left: 1rem;
  padding-right: 1rem;
}

.portfolio-page .portfolio-data-card.portfolio-full-width-section {
  border-radius: 0;
  border-left: none;
  border-right: none;
  padding-left: 1rem;
  padding-right: 1rem;
}

.portfolio-page .section-title {
  font-size: 1rem;
}

.portfolio-page .column-toggle-hint {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.82rem;
  line-height: 1.3;
}

.portfolio-page .column-toggle-hint:has(.hidden-columns-restore.hidden) {
  margin: 0;
}

.hidden-columns-restore {
  color: var(--muted);
}

.hidden-columns-restore.hidden {
  display: none;
}

button.hidden-column-restore-btn,
button.hidden-column-restore-all-btn,
button.column-hide-undo-btn {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: inherit;
  font-weight: 600;
  line-height: inherit;
  cursor: pointer;
  white-space: nowrap;
}

button.hidden-column-restore-btn:hover:not(:disabled),
button.hidden-column-restore-all-btn:hover:not(:disabled),
button.column-hide-undo-btn:hover:not(:disabled),
button.hidden-column-restore-btn:focus-visible:not(:disabled),
button.hidden-column-restore-all-btn:focus-visible:not(:disabled),
button.column-hide-undo-btn:focus-visible:not(:disabled) {
  color: var(--accent);
  background: transparent;
  text-decoration: underline;
}

.column-hide-undo-toast {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.45rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  box-shadow: 0 4px 14px rgba(21, 32, 51, 0.08);
}

.column-hide-undo-toast.hidden {
  display: none;
}

.portfolio-page .portfolio-topline {
  gap: 1.25rem;
}

.portfolio-page .summary-value {
  margin: 0.15rem 0 0;
  font-size: 1.25rem;
}

.portfolio-page .chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-height: 2.35rem;
  flex-shrink: 0;
}

.portfolio-page .chart-card-header-spacer {
  visibility: hidden;
  pointer-events: none;
}

.portfolio-page .chart-wrap {
  height: 220px;
  min-height: 220px;
  margin-top: 0;
  flex-shrink: 0;
  overflow: visible;
}

.portfolio-page .chart-custom-legend {
  position: relative;
  margin-top: 0.15rem;
  padding-right: 2rem;
}

.portfolio-page .chart-custom-legend.has-more:not(.is-expanded) {
  padding-bottom: 0.45rem;
}

.portfolio-page .chart-custom-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.12rem 0.85rem;
}

.portfolio-page .chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 1.15rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.15rem;
  color: var(--text);
  cursor: pointer;
}

button.chart-legend-item:hover:not(:disabled),
button.chart-legend-item:focus-visible {
  color: inherit;
  background: transparent;
}

.portfolio-page .chart-legend-swatch {
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(21, 32, 51, 0.12);
  flex-shrink: 0;
}

.portfolio-page .chart-custom-legend-expand {
  position: absolute;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0 0.2rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.portfolio-page .chart-custom-legend-expand:hover,
.portfolio-page .chart-custom-legend-expand:focus-visible {
  color: var(--accent);
}

.lookthrough-pie-view {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.lookthrough-pie-main {
  flex: 1;
  min-width: 0;
}

.lookthrough-holdings-panel {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: 1.25rem;
}

.lookthrough-list-title {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.lookthrough-list-count {
  margin: -0.4rem 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.lookthrough-holdings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.lookthrough-holdings-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
}

.lookthrough-holdings-item:last-child {
  border-bottom: none;
}

.lookthrough-holdings-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.lookthrough-holdings-rank {
  font-weight: 700;
  color: var(--muted);
  width: 1.6rem;
  text-align: right;
  flex-shrink: 0;
}

.lookthrough-holdings-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lookthrough-holdings-pct {
  font-weight: 600;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .lookthrough-pie-view {
    flex-direction: column;
  }
  .lookthrough-holdings-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1rem;
  }
}

.lookthrough-mktcap-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.sector-stock-popup {
  position: fixed;
  z-index: 1005;
  width: 320px;
  max-width: calc(100vw - 2rem);
  max-height: min(60vh, 480px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 0.85rem;
}

.sector-stock-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.sector-stock-popup-title {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-stock-popup-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.sector-stock-popup-close:hover {
  background: var(--hover-overlay, rgba(128, 128, 128, 0.15));
  color: var(--text);
}

.sector-stock-popup-count {
  margin: 0;
  padding: 0.4rem 0.8rem 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.sector-stock-popup-list {
  overflow-y: auto;
  padding: 0.35rem 0.6rem 0.6rem;
}

.sector-stock-popup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.28rem 0.15rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
}

.sector-stock-popup-row:last-child {
  border-bottom: none;
}

.sector-stock-popup-symbol {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-stock-popup-value {
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.lookthrough-mktcap-content {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 0.25rem;
}

.lookthrough-mktcap-pie-wrap {
  flex: 1;
  min-width: 0;
  max-width: 420px;
}

.lookthrough-mktcap-list {
  flex: 1;
  min-width: 0;
  border-left: 1px solid var(--border);
  padding-left: 1.25rem;
}

@media (max-width: 860px) {
  .lookthrough-mktcap-content {
    flex-direction: column;
  }
  .lookthrough-mktcap-pie-wrap {
    max-width: none;
    width: 100%;
  }
  .lookthrough-mktcap-list {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 0.75rem;
  }
}

.portfolio-page table th,
.portfolio-page table td {
  padding: 0 0.32rem;
  font-size: 0.88rem;
  line-height: 1.05;
}

.portfolio-page table th {
  font-size: 0.76rem;
  background: var(--table-header-bg);
}

.portfolio-page #portfolio-table thead th {
  background: var(--table-header-bg);
}

.portfolio-page #portfolio-table {
  border-collapse: separate;
  border-spacing: 0;
}

#portfolio-table-wrap:not(.column-toggle-row-collapsed) #portfolio-table thead tr.column-toggle-row th:first-child {
  border-top-left-radius: 6px;
}

#portfolio-table-wrap:not(.column-toggle-row-collapsed) #portfolio-table thead tr.column-toggle-row th:last-child {
  border-top-right-radius: 6px;
}

#portfolio-table-wrap.column-toggle-row-collapsed #portfolio-table thead tr.header-sort-row th:first-child {
  border-top-left-radius: 6px;
}

#portfolio-table-wrap.column-toggle-row-collapsed #portfolio-table thead tr.header-sort-row th:last-child {
  border-top-right-radius: 6px;
}

#portfolio-table thead tr.header-sort-row th:first-child {
  border-bottom-left-radius: 6px;
}

#portfolio-table thead tr.header-sort-row th:last-child {
  border-bottom-right-radius: 6px;
}

.portfolio-page #portfolio-table thead .column-toggle-row th {
  background: var(--surface);
}

.portfolio-page .column-toggle-row th {
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
}

.column-toggle-lead-cell {
  white-space: nowrap;
}

.column-toggle-collapse-btn {
  display: inline-block;
  margin: 0 0.2rem 0 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.column-toggle-collapse-btn:hover:not(:disabled),
.column-toggle-collapse-btn:focus-visible:not(:disabled) {
  color: var(--text);
  background: transparent;
}

.column-toggle-row-collapsed .column-toggle-row .column-toggle {
  display: none;
}

.column-toggle-row-collapsed .column-toggle-row th {
  padding-top: 0.08rem;
  padding-bottom: 0.08rem;
}

.column-toggle-row-collapsed .column-toggle-row th:not(.column-toggle-lead-cell) {
  font-size: 0;
  line-height: 0;
}

.sortable-col {
  vertical-align: bottom;
}

.sort-col-btn {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.15rem;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
  white-space: normal;
}

.sort-col-label {
  line-height: 1.15;
  overflow-wrap: normal;
  word-break: normal;
}

.status-col .sort-col-btn,
.valuation-col .sort-col-btn,
.last-price-col .sort-col-btn {
  white-space: nowrap;
}

.status-col .sort-col-label,
.valuation-col .sort-col-label,
.last-price-col .sort-col-label {
  white-space: nowrap;
  overflow-wrap: normal;
}

button.sort-col-btn:hover:not(:disabled),
button.sort-col-btn:focus-visible {
  color: inherit;
  background: transparent;
}

.sort-col-btn.sort-active {
  color: var(--text);
}

.sort-indicator {
  display: inline-block;
  flex: 0 0 auto;
  width: 0.55rem;
  margin-top: 0.1rem;
  font-size: 0.55rem;
  line-height: 1;
  color: var(--accent);
  text-align: center;
}

.portfolio-page .sortable-col {
  padding: 0.1rem 0.32rem;
  min-width: min-content;
}

.portfolio-topnav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}

.portfolio-back-arrow {
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  color: var(--text);
}

.portfolio-back-arrow:hover {
  text-decoration: underline;
}

.portfolio-topnav .eyebrow {
  margin: 0;
}

.portfolio-topnav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.portfolio-topnav-links .button-link {
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
}

.portfolio-page .back-link-wrap-bottom {
  margin: 0.65rem 0 0;
}

.portfolio-page ~ .site-footer {
  width: min(1400px, calc(100% - 2rem));
  padding: 0 0 1rem;
}

.extractor-page.container {
  padding: 0.75rem 0 1.25rem;
}

.extractor-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.extractor-hero-copy {
  min-width: 0;
}

.extractor-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.extractor-page .hero {
  margin-bottom: 0.65rem;
}

.extractor-page h1 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.15;
}

.extractor-page .subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.extractor-page .upload-card,
.extractor-page .search-card,
.extractor-page .results-card {
  padding: 0.85rem 1rem;
}

.extractor-page .upload-card {
  margin-bottom: 0.65rem;
}

.extractor-page .section-title {
  font-size: 1rem;
}

.extractor-page .section-copy,
.extractor-page .upload-hint {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.extractor-page .saved-portfolio-link-wrap {
  margin-top: 0.5rem;
}

.extractor-page .upload-form {
  margin-top: 0.65rem;
}

.extractor-page .search-form label {
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
}

.extractor-page .status {
  margin: 0.5rem 0 0;
  min-height: 1.25rem;
}

.extractor-page .results-card {
  margin-top: 0.65rem;
}

.extractor-page .results-header {
  margin-bottom: 0.65rem;
}

.extractor-page .results-header h2 {
  font-size: 1.2rem;
}

.extractor-page .meta {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
}

.extractor-page .outlook-section {
  margin-bottom: 0.65rem;
  padding: 0.65rem 0.75rem;
}

.extractor-page .outlook-label {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.15rem;
}

.extractor-page .trends-section {
  margin-bottom: 0.65rem;
}

.extractor-page .trends-title {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
}

.extractor-page .trends-grid {
  gap: 0.5rem;
}

.extractor-page .trend-card {
  padding: 0.55rem 0.65rem;
}

.extractor-page .trend-value {
  margin: 0.25rem 0 0.1rem;
  font-size: 1.05rem;
}

.extractor-page .footnote {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

.extractor-page ~ .site-footer {
  padding: 0 0 1rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
}

.subtitle {
  max-width: 46rem;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.search-card {
  padding: 1.5rem;
}

.upload-card {
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.section-title {
  margin: 0;
  font-size: 1.15rem;
}

.section-copy,
.upload-hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.upload-form {
  margin-top: 1rem;
}

.upload-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.upload-row input[type="file"] {
  flex: 1;
  min-width: 0;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}

.search-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.search-row {
  display: flex;
  gap: 0.75rem;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  text-transform: uppercase;
}

input[type="text"]:focus {
  outline: 2px solid rgba(15, 98, 254, 0.25);
  border-color: var(--accent);
}

button {
  padding: 0.9rem 1.25rem;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.status {
  min-height: 1.5rem;
  margin: 0.85rem 0 0;
  color: var(--muted);
}

.status.loading {
  color: var(--accent);
}

.status.error {
  color: var(--error);
}

.results-card {
  margin-top: 1.25rem;
  padding: 1.5rem;
}

.hidden {
  display: none;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.results-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.outlook-section {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
}

.outlook-eyebrow {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.dcf-estimate {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
}

.dcf-estimate .dcf-eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.dcf-estimate .dcf-summary {
  margin: 0 0 0.4rem;
  line-height: 1.5;
}

.dcf-estimate .dcf-link {
  font-weight: 600;
}

.dcf-estimate-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dcf-estimate-text {
  flex: 1 1 18rem;
  min-width: 0;
}

.dcf-estimate-row .dcf-valuation-badge {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-top: 0.2rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
}

.dcf-price-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.dcf-price-row input {
  width: 8rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.dcf-price-note {
  font-size: 0.78rem;
  color: var(--muted);
}

.outlook-label {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.45rem;
  font-weight: 700;
}

.outlook-summary {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.outlook-section.growing {
  border-color: rgba(14, 96, 39, 0.25);
  background: rgba(14, 96, 39, 0.06);
}

.outlook-section.growing .outlook-label {
  color: var(--success);
}

.outlook-section.declining {
  border-color: rgba(162, 25, 31, 0.25);
  background: rgba(162, 25, 31, 0.06);
}

.outlook-section.declining .outlook-label {
  color: var(--error);
}

.outlook-section.stable {
  border-color: rgba(95, 107, 124, 0.25);
  background: rgba(95, 107, 124, 0.08);
}

.outlook-section.stable .outlook-label {
  color: var(--muted);
}

.outlook-section.unknown .outlook-label {
  color: var(--muted);
}

.trends-section {
  margin-bottom: 1.25rem;
}

.trends-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.trends-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.trend-card {
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
}

.trend-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.trend-value {
  margin: 0.45rem 0 0.2rem;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.trend-direction {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.trend-card.growth {
  border-color: rgba(14, 96, 39, 0.25);
  background: rgba(14, 96, 39, 0.06);
}

.trend-card.growth .trend-value,
.trend-card.growth .trend-direction {
  color: var(--success);
}

.trend-card.decline {
  border-color: rgba(162, 25, 31, 0.25);
  background: rgba(162, 25, 31, 0.06);
}

.trend-card.decline .trend-value,
.trend-card.decline .trend-direction {
  color: var(--error);
}

.trend-card.neutral .trend-value,
.trend-card.neutral .trend-direction {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.screener-table {
  border-collapse: separate;
  border-spacing: 0;
}

.screener-table thead,
.screener-table thead tr {
  position: sticky;
  top: 0;
  z-index: 20;
}

.screener-table th {
  border-bottom: 1px solid var(--border);
}

.screener-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card-bg, #ffffff);
}

.screener-table.screener-header-pinned thead th {
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.portfolio-pinned-header {
  position: fixed;
  top: 0;
  z-index: 30;
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 10px rgba(21, 32, 51, 0.12);
  pointer-events: none;
  overflow: hidden;
}

.portfolio-pinned-header.hidden {
  display: none;
}

.portfolio-pinned-header-scroll {
  overflow: hidden;
}

.portfolio-pinned-header-table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.portfolio-pinned-header-table th {
  padding: 0 0.32rem;
  font-size: 0.76rem;
  line-height: 1.05;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--border);
  vertical-align: bottom;
}

.portfolio-pinned-header-table .column-toggle-row th {
  background: var(--surface);
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
}

.portfolio-pinned-header-scroll:not(.column-toggle-row-collapsed) .portfolio-pinned-header-table thead tr.column-toggle-row th:first-child {
  border-top-left-radius: 6px;
}

.portfolio-pinned-header-scroll:not(.column-toggle-row-collapsed) .portfolio-pinned-header-table thead tr.column-toggle-row th:last-child {
  border-top-right-radius: 6px;
}

.portfolio-pinned-header-scroll.column-toggle-row-collapsed .portfolio-pinned-header-table thead tr.header-sort-row th:first-child {
  border-top-left-radius: 6px;
}

.portfolio-pinned-header-scroll.column-toggle-row-collapsed .portfolio-pinned-header-table thead tr.header-sort-row th:last-child {
  border-top-right-radius: 6px;
}

.portfolio-pinned-header-table thead tr.header-sort-row th:first-child {
  border-bottom-left-radius: 6px;
}

.portfolio-pinned-header-table thead tr.header-sort-row th:last-child {
  border-bottom-right-radius: 6px;
}

.portfolio-pinned-header-table .sort-col-btn {
  pointer-events: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.25rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

td {
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
  border-bottom: none;
}

.footnote {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.portfolio-summary-card,
.chart-card,
.table-card {
  padding: 1.5rem;
}

.portfolio-overview {
  display: grid;
  grid-template-columns: minmax(220px, 280px) repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
}

.portfolio-overview-no-chart {
  grid-template-columns: minmax(220px, 280px);
}

.portfolio-summary-card {
  display: flex;
  align-items: center;
}

.portfolio-topline {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  width: 100%;
}

.summary-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.summary-value {
  margin: 0.35rem 0 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.portfolio-data-card {
  margin-top: 1rem;
}

.column-toggle-hint {
  margin: 0.35rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.column-toggle-row th {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  background: var(--surface);
}

.column-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.column-toggle input {
  margin: 0;
  cursor: pointer;
}

.column-hidden {
  display: none;
}

.sticky-col-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.portfolio-footer-note {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.portfolio-footer-note.hidden {
  display: none;
}

.portfolio-add-import {
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.portfolio-add-import-form {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.portfolio-add-import-file {
  display: inline-block;
}

.portfolio-add-import-btn {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.portfolio-add-import-btn:hover:not(:disabled),
.portfolio-add-import-btn:focus-visible:not(:disabled) {
  border-color: var(--muted);
  background: var(--surface-alt);
  color: var(--muted);
  filter: brightness(0.97);
}

.portfolio-add-import-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.portfolio-add-import-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.portfolio-add-import-error {
  margin: 0;
}

.pin-header-controls {
  margin-top: 0.35rem;
  padding-top: 0;
  border-top: none;
}

.portfolio-valuation-legend {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.portfolio-valuation-legend-mark {
  font-weight: 700;
}

.sticky-col-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.sticky-col-toggle {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

.sticky-col-toggle-btn {
  padding: 0.35rem 0.75rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.sticky-col-toggle-btn:hover:not(:disabled),
.sticky-col-toggle-btn:focus-visible:not(:disabled) {
  background: transparent;
  color: var(--muted);
}

.sticky-col-toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(21, 32, 51, 0.12);
}

.sticky-col-toggle-btn.active:hover:not(:disabled),
.sticky-col-toggle-btn.active:focus-visible:not(:disabled) {
  background: var(--surface);
  color: var(--text);
}

.sticky-col-toggle-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sticky-cols-active #portfolio-table {
  border-collapse: separate;
  border-spacing: 0;
}

#portfolio-table .sticky-col {
  position: sticky;
  background: var(--surface);
  z-index: 2;
}

#portfolio-table thead .sticky-col {
  z-index: 4;
  background: var(--table-header-bg);
}

#portfolio-table thead .column-toggle-row .sticky-col {
  background: var(--surface);
}

#portfolio-table .sticky-col-edge {
  position: sticky;
}

#portfolio-table .sticky-col-edge::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(100%);
  box-shadow: 4px 0 8px rgba(21, 32, 51, 0.1);
  pointer-events: none;
}

.portfolio-page .sticky-col-controls {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
}

.portfolio-page .sticky-col-label {
  font-size: 0.78rem;
}

.portfolio-page .sticky-col-toggle-btn {
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
}

.chart-card .section-title {
  margin-bottom: 0;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.gain-loss-toggle {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

.gain-loss-toggle-btn {
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.gain-loss-toggle-btn:hover:not(:disabled),
.gain-loss-toggle-btn:focus-visible:not(:disabled) {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}

.gain-loss-toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(21, 32, 51, 0.12);
}

.gain-loss-toggle-btn.active:hover:not(:disabled),
.gain-loss-toggle-btn.active:focus-visible:not(:disabled) {
  background: var(--surface);
  color: var(--text);
  text-decoration: underline;
}

.gain-loss-toggle-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chart-card-losses {
  border-color: rgba(162, 25, 31, 0.18);
}

.chart-card-gains {
  border-color: rgba(25, 128, 56, 0.22);
}

.status-col {
  min-width: 6.25rem;
}

.valuation-col {
  min-width: 5.25rem;
}

.portfolio-page th.status-col,
.portfolio-page td.status-col {
  padding-right: 0.12rem;
}

.portfolio-page th.valuation-col,
.portfolio-page td.valuation-col {
  padding-left: 0.12rem;
}

.portfolio-pinned-header-table th.status-col {
  padding-right: 0.12rem;
}

.portfolio-pinned-header-table th.valuation-col {
  padding-left: 0.12rem;
}

.portfolio-page #portfolio-table td.description-col-cell {
  white-space: normal;
  vertical-align: top;
}

.portfolio-page #portfolio-table .description-cell-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.description-tooltip {
  position: fixed;
  z-index: 1200;
  max-width: min(24rem, calc(100vw - 1.5rem));
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(21, 32, 51, 0.18);
  pointer-events: none;
  white-space: normal;
  line-height: 1.35;
  font-size: 0.82rem;
  color: var(--text);
  transform: translate(-50%, -100%);
}

.description-tooltip.hidden {
  display: none;
}

td.status-col,
.status-cell,
td.valuation-col,
.valuation-cell {
  white-space: nowrap;
}

.status-cell,
.valuation-cell {
  display: inline-block;
  min-width: 3.75rem;
}

.valuation-cell {
  min-width: 3.1rem;
}

.status-loading {
  color: var(--muted);
}

.status-link {
  padding: 0.1rem 0.42rem;
  border: none;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

button.status-link {
  padding: 0.06rem 0.34rem;
  font-size: 0.72rem;
  line-height: 1.25;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-weight: 700;
  white-space: nowrap;
}

button.status-link.status-growing {
  background: rgba(14, 96, 39, 0.12);
  color: var(--success);
}

button.status-link.status-stable {
  background: rgba(95, 107, 124, 0.14);
  color: var(--muted);
}

button.status-link.status-declining {
  background: rgba(162, 25, 31, 0.12);
  color: var(--error);
}

button.status-link.status-growing:hover:not(:disabled),
button.status-link.status-growing:focus-visible:not(:disabled) {
  background: var(--success-bg, rgba(14, 96, 39, 0.22));
  color: var(--success);
}

button.status-link.status-stable:hover:not(:disabled),
button.status-link.status-stable:focus-visible:not(:disabled) {
  background: var(--neutral-bg, rgba(95, 107, 124, 0.22));
  color: var(--text);
}

button.status-link.status-declining:hover:not(:disabled),
button.status-link.status-declining:focus-visible:not(:disabled) {
  background: var(--error-bg, rgba(162, 25, 31, 0.22));
  color: var(--error);
}

.status-link.status-growing:hover,
.status-link.status-growing:focus-visible {
  background: var(--success-bg, rgba(14, 96, 39, 0.22));
  color: var(--success);
}

.status-link.status-stable:hover,
.status-link.status-stable:focus-visible {
  background: var(--neutral-bg, rgba(95, 107, 124, 0.22));
  color: var(--text);
}

.status-link.status-declining:hover,
.status-link.status-declining:focus-visible {
  background: var(--error-bg, rgba(162, 25, 31, 0.22));
  color: var(--error);
}

.status-growing {
  background: rgba(14, 96, 39, 0.12);
  color: var(--success);
}

.status-stable {
  background: rgba(95, 107, 124, 0.14);
  color: var(--muted);
}

.status-declining {
  background: rgba(162, 25, 31, 0.12);
  color: var(--error);
}

#portfolio-table td.pinned-highlight-growing {
  background-color: var(--success-bg) !important;
  color: var(--success);
  font-weight: 700;
}

#portfolio-table td.pinned-highlight-stable {
  background-color: var(--neutral-bg) !important;
  color: var(--muted);
  font-weight: 700;
}

#portfolio-table td.pinned-highlight-declining {
  background-color: var(--error-bg) !important;
  color: var(--error);
  font-weight: 700;
}

#portfolio-table td.sticky-col.pinned-highlight-growing,
#portfolio-table td.sticky-col.pinned-highlight-stable,
#portfolio-table td.sticky-col.pinned-highlight-declining {
  background-clip: padding-box;
}

#portfolio-table td.row-status-hover-highlight,
#portfolio-table td.row-hover-highlight {
  font-weight: 700;
  background-color: var(--row-hover-bg);
}

.status-tooltip {
  position: fixed;
  z-index: 1100;
  width: min(22rem, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.5rem);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(21, 32, 51, 0.16);
  pointer-events: none;
  transform: translate(-50%, -100%);
  box-sizing: border-box;
}

.status-tooltip.hidden {
  display: none;
}

.status-tooltip-title {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}

.status-tooltip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.status-tooltip .trend-card {
  padding: 0.45rem 0.35rem;
  border-radius: 999px;
  text-align: center;
}

.status-tooltip .trend-label {
  font-size: 0.58rem;
  line-height: 1.2;
}

.status-tooltip .trend-value {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  line-height: 1.15;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 32, 51, 0.45);
}

.modal-dialog {
  position: relative;
  width: min(920px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  margin: 1rem auto;
  padding: 0.35rem 1.25rem 1.25rem;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.status-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.status-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--surface-subtle, #f1f5f9);
  border: 1px solid var(--border, #cbd5e1);
  color: var(--fg-muted, #64748b);
  font-size: 0.75rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: help;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
  padding: 0;
}

.status-info-btn:hover,
.status-info-btn:focus {
  background: #475569;
  color: #ffffff;
  border-color: #334155;
}

.status-info-btn--page-corner {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 700;
  border-width: 1.5px;
  background: var(--surface, #ffffff);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.status-info-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  padding: 0.85rem 1rem;
  background: var(--surface-raised, #1e293b);
  color: var(--fg, #f8fafc);
  border: 1px solid var(--border, #334155);
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  font-size: 0.8rem;
  line-height: 1.45;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
}

.status-info-popover--right {
  left: auto;
  right: 0;
  transform: none;
}

.status-info-wrap:hover .status-info-popover,
.status-info-wrap:focus-within .status-info-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.status-info-wrap:hover .status-info-popover--right,
.status-info-wrap:focus-within .status-info-popover--right {
  transform: none;
}

.status-info-popover h4 {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--fg-bright, #ffffff);
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
  padding-bottom: 0.3rem;
}

.status-info-popover p {
  margin: 0 0 0.5rem;
}

.status-info-popover ul {
  margin: 0;
  padding-left: 1rem;
}

.status-info-popover li {
  margin-bottom: 0.35rem;
}

.modal-top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin: 0 0 0.15rem;
}

.modal .modal-close {
  position: static;
  flex-shrink: 0;
  padding: 0.15rem 0.4rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.modal .modal-close:hover:not(:disabled),
.modal .modal-close:focus-visible {
  color: var(--text);
  background: var(--table-header-bg);
  outline: none;
}

#modal-content {
  display: flex;
  flex-direction: column;
}

#modal-content > h2 {
  margin: 0 2rem 0 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

#modal-content > .meta {
  margin: 0.2rem 0 0.65rem;
}

.modal-data-footer {
  margin: 0;
}

#modal-content .table-wrap,
.modal-data-footer .table-wrap {
  margin: 0;
}

.modal-data-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.65rem 0 0;
  padding: 0;
}

.modal-data-actions .modal-footnote {
  margin: 0;
}

.modal-unit-footnote {
  margin: 0.65rem 0 0;
}

.modal-data-actions .modal-extend-years {
  margin-left: auto;
}

.modal-footnote {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.modal-section-title {
  margin: 1rem 0 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.modal-section {
  margin: 0.25rem 0 0;
}
.modal-section-eyebrow {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.2rem;
}
.modal-meta {
  margin: 0.05rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

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

.modal-extend-years {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.modal-extend-years:hover,
.modal-extend-years:focus-visible {
  color: var(--text);
  border-color: rgba(15, 98, 254, 0.35);
  background: rgba(15, 98, 254, 0.05);
  text-decoration: none;
}

.financials-page.container {
  position: relative;
  width: min(1200px, calc(100% - 2rem));
  padding: 0 0 1.25rem;
}

.portfolio-page.financials-page.financials-ten-year.container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 1.25rem;
}

.financials-ten-year .financials-header {
  padding: 0 1rem;
}

.financials-ten-year button.dcf-close-btn-top {
  right: 1rem;
}

.financials-ten-year .financials-card {
  width: 100%;
  border-radius: 0;
  border-left: none;
  border-right: none;
  box-shadow: none;
  padding: 0.85rem 1rem 0.9rem;
}

.financials-ten-year .financials-table-wrap {
  max-height: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.financials-ten-year .financials-table-wrap::-webkit-scrollbar {
  height: 0;
}

.financials-ten-year-page {
  padding-bottom: 1.1rem;
}

.financials-scroll-rail {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  overflow-x: auto;
  overflow-y: hidden;
  height: 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 14px rgba(21, 32, 51, 0.08);
}

.financials-scroll-rail.hidden {
  display: none;
}

.financials-scroll-rail-inner {
  height: 1px;
}

.financials-header {
  margin: 0 0 0.5rem;
}

.financials-header-with-ticker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.financials-header-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}

.financials-header-left .financials-title {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.financials-ticker-search-form {
  display: flex;
  align-items: center;
  margin: 0;
  flex-shrink: 0;
}

.dcf-ticker-form {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0 0.75rem;
  margin: 0 0 0.5rem;
  border-bottom: 1px solid var(--border);
}

.dcf-ticker-form .financials-ticker-input {
  width: 9rem;
}

.financials-ticker-input {
  width: 7.5rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  outline: none;
  height: 1.85rem;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.financials-ticker-input:hover {
  border-color: var(--muted);
}

.financials-ticker-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.18);
  background: var(--surface);
}

.financials-header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.financials-header-with-close {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.financials-header-with-close .financials-title {
  min-width: 0;
}

.financials-header-with-close .dcf-close-btn {
  flex-shrink: 0;
}

.financials-bottom-close {
  display: flex;
  justify-content: flex-end;
  margin: 0.5rem 0 0;
}

.financials-ten-year .financials-bottom-close {
  padding-right: 1rem;
}

.financials-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  line-height: 1.15;
}

.financials-back-arrow {
  flex-shrink: 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.financials-back-arrow:hover,
.financials-back-arrow:focus-visible {
  color: var(--accent);
}

.financials-card {
  padding: 0.85rem 0.9rem 0.9rem;
}

.statement-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.statement-nav-with-dcf {
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.statement-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.statement-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: -1px;
}

.stats-nav-link {
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--accent);
  border-radius: 0.35rem;
  transition: background 0.15s, color 0.15s;
}
.stats-nav-link:hover {
  background: var(--accent);
  color: var(--accent-bg, #fff);
}

.dcf-estimate-link {
  margin: 0 0 -1px;
  padding: 0.15rem 0 0.2rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.dcf-estimate-link:hover,
.dcf-estimate-link:focus-visible {
  color: var(--accent-dark);
  border-bottom-color: rgba(15, 98, 254, 0.35);
}

.dcf-estimate-unavailable {
  margin: 0 0 -1px;
  padding: 0.15rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.dcf-page {
  min-height: 100vh;
}

.dcf-container {
  position: relative;
  width: min(920px, calc(100% - 2rem));
  padding: 0.5rem 0 0.75rem;
}

.dcf-card {
  padding: 0.75rem 1rem 0.85rem;
}

button.dcf-close-btn {
  padding: 0.15rem 0.35rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.financials-page button.dcf-close-btn {
  font-size: 1.6rem;
}

button.dcf-close-btn:hover:not(:disabled),
button.dcf-close-btn:focus-visible {
  color: var(--text);
  background: var(--table-header-bg);
  outline: none;
}

a.dcf-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  background: var(--surface, #ffffff);
  color: var(--text, #111827);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

a.dcf-export-btn:hover,
a.dcf-export-btn:focus-visible {
  background: var(--hover-overlay, #f3f5f8);
  color: var(--text, #111827);
  outline: none;
}

.dcf-card a.button-link {
  transition: background 0.15s ease, color 0.15s ease;
}

.dcf-card a.button-link:hover,
.dcf-card a.button-link:focus-visible {
  background: var(--hover-overlay, #f3f5f8);
  color: var(--text, #111827);
  outline: none;
}

.dcf-sheets-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.dcf-close-btn-top {
  position: absolute;
  top: -0.35rem;
  right: 0;
  z-index: 2;
}

.dcf-close-btn-bottom {
  display: block;
  margin: 0.75rem 0 0 auto;
}

.dcf-currency-warning {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-left: 4px solid #dc2626;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
.dcf-currency-warning strong {
  color: #991b1b;
  font-size: 0.88rem;
}
.dcf-currency-warning ul {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
  color: #991b1b;
  font-size: 0.85rem;
  line-height: 1.5;
}
.dcf-currency-warning li {
  margin-bottom: 0.25rem;
}
.dcf-currency-warning li:last-child {
  margin-bottom: 0;
}
[data-theme="dark"] .dcf-currency-warning {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  border-left-color: #ef4444;
}
[data-theme="dark"] .dcf-currency-warning strong,
[data-theme="dark"] .dcf-currency-warning ul {
  color: #fecaca;
}
.dcf-sales-weakening {
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-left: 4px solid #d97706;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  margin-bottom: 1.25rem;
}
.dcf-sales-weakening strong {
  color: #92400e;
  font-size: 0.88rem;
}
.dcf-sales-weakening p {
  margin: 0.35rem 0 0;
  color: #92400e;
  font-size: 0.85rem;
  line-height: 1.5;
}
[data-theme="dark"] .dcf-sales-weakening {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.35);
  border-left-color: #f59e0b;
}
[data-theme="dark"] .dcf-sales-weakening strong,
[data-theme="dark"] .dcf-sales-weakening p {
  color: #fde68a;
}
.dcf-sales-accelerating {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.3);
  border-left-color: #16a34a;
}
.dcf-sales-accelerating strong,
.dcf-sales-accelerating p {
  color: #14532d;
}
[data-theme="dark"] .dcf-sales-accelerating {
  background: rgba(22, 163, 74, 0.14);
  border-color: rgba(22, 163, 74, 0.35);
  border-left-color: #22c55e;
}
[data-theme="dark"] .dcf-sales-accelerating strong,
[data-theme="dark"] .dcf-sales-accelerating p {
  color: #bbf7d0;
}
.dcf-high-risk {
  background: rgba(220, 38, 38, 0.09);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-left: 4px solid #dc2626;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
.dcf-high-risk strong {
  color: #991b1b;
  font-size: 0.88rem;
}
.dcf-high-risk p {
  margin: 0.4rem 0 0;
  color: #7f1d1d;
  font-size: 0.85rem;
  line-height: 1.5;
}
.dcf-high-risk .dcf-risk-source {
  font-size: 0.78rem;
  color: #b91c1c;
  font-style: italic;
}
.dcf-high-risk .dcf-risk-footnote {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #991b1b;
  opacity: 0.85;
  border-top: 1px dashed rgba(220, 38, 38, 0.25);
  padding-top: 0.5rem;
}
[data-theme="dark"] .dcf-high-risk {
  background: rgba(220, 38, 38, 0.16);
  border-color: rgba(220, 38, 38, 0.4);
  border-left-color: #ef4444;
}
[data-theme="dark"] .dcf-high-risk strong,
[data-theme="dark"] .dcf-high-risk p {
  color: #fecaca;
}
[data-theme="dark"] .dcf-high-risk .dcf-risk-source {
  color: #fca5a5;
}
.dcf-rebound-note {
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.4);
  border-left: 4px solid #d97706;
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.75rem;
  color: #92400e;
  font-size: 0.82rem;
  line-height: 1.45;
}
[data-theme="dark"] .dcf-rebound-note {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
  border-left-color: #f59e0b;
  color: #fde68a;
}
.dcf-predictability {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-left: 4px solid #ef4444;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  color: #991b1b;
  font-size: 0.88rem;
  line-height: 1.5;
}
.dcf-predictability-moderate {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.4);
  border-left-color: #d97706;
  color: #92400e;
}
.dcf-predictability-stable,
.dcf-predictability-unknown {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
  border-left-color: #10b981;
  color: #047857;
}
.dcf-predictability strong {
  font-weight: 700;
}
[data-theme="dark"] .dcf-predictability {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  border-left-color: #ef4444;
  color: #fecaca;
}
[data-theme="dark"] .dcf-predictability-moderate {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
  border-left-color: #f59e0b;
  color: #fde68a;
}
[data-theme="dark"] .dcf-predictability-stable,
[data-theme="dark"] .dcf-predictability-unknown {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  border-left-color: #10b981;
  color: #a7f3d0;
}
.dcf-unavailable-banner {
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.4);
  border-left: 4px solid #d97706;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
.dcf-unavailable-banner .dcf-unavailable-reason {
  margin: 0;
  color: #92400e;
  font-size: 0.88rem;
  line-height: 1.5;
  font-weight: 500;
}
[data-theme="dark"] .dcf-unavailable-banner {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
  border-left-color: #f59e0b;
}
[data-theme="dark"] .dcf-unavailable-banner .dcf-unavailable-reason {
  color: #fde68a;
}
.dcf-unavailable-banner-bottom {
  margin-top: 1.25rem;
  margin-bottom: 0;
  border-left-width: 1px;
}
.dcf-unavailable-banner-bottom .dcf-unavailable-reason {
  color: var(--muted, #6b7280);
  font-size: 0.82rem;
  font-weight: normal;
}
[data-theme="dark"] .dcf-unavailable-banner-bottom .dcf-unavailable-reason {
  color: #94a3b8;
}
.dcf-unavailable-banner-bottom .dcf-unavailable-reason:first-child {
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.dcf-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.modal .dcf-header {
  margin-bottom: 0.35rem;
}
.modal .dcf-header .dcf-eyebrow {
  margin: 0;
}
.modal .dcf-header .modal-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.dcf-header h1 {
  margin: 0.15rem 0 0;
  font-size: 1.45rem;
  line-height: 1.15;
}

.dcf-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dcf-total-value {
  margin: 0;
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 700;
  white-space: nowrap;
}

.dcf-value-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.dcf-price-per-share {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

.dcf-valuation-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.dcf-data-warning-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.dcf-ticker-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.dcf-ticker-link:hover {
  color: var(--accent-hover, #0353e9);
  text-decoration: underline;
}

.dcf-ticker-link .dcf-ticker-ext-icon {
  font-size: 0.75rem;
  opacity: 0.6;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.dcf-ticker-link:hover .dcf-ticker-ext-icon {
  opacity: 1;
  transform: translate(1px, -1px);
}

.dcf-model-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-decoration-color: var(--muted);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.dcf-model-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.dcf-info-icon {
  display: inline-block;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.75;
  font-weight: bold;
  cursor: help;
  white-space: nowrap;
}

.dcf-model-link:hover .dcf-info-icon {
  opacity: 1;
}

.dcf-data-warning-btn.hidden {
  display: none;
}

.dcf-data-warning-mark {
  color: #da1e28;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.dcf-data-warning-tooltip {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 20;
  width: max-content;
  max-width: 14rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(21, 32, 51, 0.12);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.dcf-data-warning-btn:hover .dcf-data-warning-tooltip,
.dcf-data-warning-btn:focus-visible .dcf-data-warning-tooltip,
.dcf-data-warning-btn.is-open .dcf-data-warning-tooltip {
  opacity: 1;
  visibility: visible;
}

.dcf-valuation-badge {
  display: inline-block;
  margin: 0;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.dcf-valuation-badge.dcf-valuation-empty {
  display: none;
}

.dcf-valuation-badge.dcf-valuation-undervalued {
  background: #198038;
  color: #ffffff;
}

.dcf-valuation-badge.dcf-valuation-overvalued {
  background: #da1e28;
  color: #ffffff;
}

.dcf-valuation-badge.dcf-valuation-fair {
  background: #5f6b7c;
  color: #ffffff;
}

.dcf-valuation-badge.dcf-valuation-na {
  background: #6b7280;
  color: #d1d5db;
  cursor: pointer;
  text-decoration: none;
}
.dcf-valuation-badge.dcf-valuation-na:hover {
  background: #4b5563;
  color: #f3f4f6;
}

.dcf-na {
  color: #9ca3af;
  font-size: 0.78rem;
}

a.dcf-valuation-badge-link {
  text-decoration: none;
  cursor: pointer;
}

a.dcf-valuation-badge-link:hover,
a.dcf-valuation-badge-link:focus-visible {
  filter: brightness(1.06);
  box-shadow: 0 1px 3px rgba(21, 32, 51, 0.18);
}

.statement-nav-with-dcf .dcf-valuation-badge-link {
  margin: 0;
  max-width: none;
  white-space: nowrap;
}

.financials-page .statement-nav-with-dcf .dcf-valuation-badge-link {
  margin: 0;
  max-width: none;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.modal-top-bar .dcf-valuation-badge-link {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dcf-price-per-share-row,
.dcf-current-price-row {
  margin-top: 0.15rem !important;
  font-size: 0.95rem;
}

.dcf-net-debt-row {
  margin-top: 0.15rem !important;
  font-size: 0.88rem;
  color: var(--muted);
}

.dcf-net-debt-row strong {
  color: var(--text);
  font-weight: 600;
}

.dcf-price-per-share-row #dcf-price-per-share-summary,
.dcf-current-price-row #dcf-current-price {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.dcf-summary-valuation-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.dcf-summary-valuation-row .dcf-current-price-row {
  margin: 0 !important;
}

.dcf-summary-valuation-row .dcf-valuation-badge {
  margin: 0;
}

.dcf-shares-note {
  margin-top: 0.35rem !important;
  color: var(--muted);
  font-size: 0.82rem;
}

.dcf-controls {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.dcf-controls-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.15rem;
}

.dcf-controls-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.dcf-growth-display {
  margin: 0.2rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}


.dcf-reset-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.dcf-reset-btn:hover:not(:disabled) .portfolio-action-tooltip,
.dcf-reset-btn:focus-visible:not(:disabled) .portfolio-action-tooltip {
  opacity: 1;
  visibility: visible;
}

.dcf-reset-btn:hover:not(:disabled),
.dcf-reset-btn:focus-visible:not(:disabled) {
  color: var(--accent);
  border-color: rgba(15, 98, 254, 0.35);
  background: var(--bg);
}

.dcf-reset-icon {
  width: 1.3rem;
  height: 1.3rem;
}

.dcf-metric-slider {
  margin-bottom: 0.4rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.dcf-metric-slider.is-active {
  background: var(--surface);
  border-color: rgba(15, 98, 254, 0.18);
  box-shadow: 0 0 0 1px rgba(15, 98, 254, 0.06);
}

.dcf-metric-slider.is-inactive {
  opacity: 0.55;
  cursor: pointer;
}

.dcf-metric-slider.is-inactive:hover,
.dcf-metric-slider.is-inactive:focus-visible {
  opacity: 0.78;
  background: var(--hover-overlay);
  border-color: var(--border);
  outline: none;
}

.dcf-metric-rate {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.dcf-metric-slider.is-active .dcf-metric-rate {
  color: var(--accent);
}

.dcf-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.dcf-slider-label-main {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.dcf-sparkline {
  flex-shrink: 0;
  margin: 0;
}

.dcf-slider-scale {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.dcf-growth-table td:first-child {
  font-weight: 600;
}

.dcf-endpoint-alt {
  font-size: 0.82rem;
  color: var(--muted, #888);
  font-weight: 400;
}

.dcf-growth-table .negative {
  color: var(--error, #dc2626);
}

.dcf-growth-slider {
  width: 100%;
}

.dcf-metric-slider.is-inactive .dcf-growth-slider {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.dcf-custom-growth {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.dcf-custom-growth-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.dcf-custom-growth-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.dcf-custom-growth-input-wrap.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.12);
}

.dcf-growth-custom-input {
  width: 5.5rem;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
}

.dcf-growth-custom-input:focus {
  outline: none;
}

.dcf-custom-growth-suffix {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.dcf-slider-hint {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.dcf-section-title {
  margin: 0.65rem 0 0.4rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.dcf-table th,
.dcf-table td {
  font-size: 0.88rem;
}

.dcf-yoy-up {
  color: var(--success, #16a34a);
}

.dcf-yoy-down {
  color: var(--danger, #dc2626);
}

.dcf-yoy-inline {
  font-size: 0.78rem;
  white-space: nowrap;
  margin-left: 0.35rem;
}

.dcf-assumptions,
.dcf-summary {
  margin-top: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.dcf-assumptions p,
.dcf-summary p {
  margin: 0.1rem 0;
}

.dcf-enterprise-value {
  margin-top: 0.45rem !important;
  font-size: 1rem;
}

.dcf-unit-note,
.dcf-base-mode-note,
.dcf-disclaimer {
  color: var(--muted);
}

.statement-nav-link {
  position: relative;
  margin-bottom: -1px;
  padding: 0.15rem 0 0.2rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.statement-nav-link:hover,
.statement-nav-link:focus-visible {
  color: var(--text);
}

.statement-nav-link.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.financials-scale-notice {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(15, 98, 254, 0.18);
  border-radius: 8px;
  background: rgba(15, 98, 254, 0.05);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.financials-table-wrap {
  overflow: visible;
}

.financials-table-wrap table {
  border-collapse: separate;
  border-spacing: 0;
}

.financials-table-wrap .financials-label-col {
  min-width: 5rem;
  max-width: none;
  width: var(--fin-col-width, 22rem);
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 2px 0 0 var(--border);
  position: relative;
}

/* Draggable cell dividing border along the entire column */
.financials-label-col::after {
  content: "";
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 25;
}

.financials-label-col:hover::after,
.financials-table-wrap.is-resizing-col .financials-label-col::after {
  background: rgba(15, 98, 254, 0.4);
}

.financials-table-wrap thead {
  z-index: 10;
}

.financials-table-wrap thead tr {
  z-index: 11;
}

.financials-table-wrap thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 12;
  background: var(--table-header-bg);
  box-shadow: 0 2px 8px rgba(21, 32, 51, 0.12);
}

.financials-table-wrap thead th.financials-label-col {
  z-index: 13;
}

.financials-thead-clone {
  position: fixed;
  top: 0;
  z-index: 50;
  background: var(--table-header-bg);
  border-collapse: separate;
  border-spacing: 0;
  box-shadow: 0 2px 8px rgba(21, 32, 51, 0.12);
  table-layout: fixed;
}

.financials-thead-clone th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--table-header-bg);
  padding: 0.25rem 0.6rem;
}

.financials-table-wrap tbody tr.is-abstract td {
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  background: var(--surface-alt);
  padding-top: 0.4rem;
  padding-bottom: 0.35rem;
  line-height: 1.2;
}

.financials-table-wrap tbody tr.is-supplementary-header td {
  padding-top: 1.4rem;
  padding-bottom: 0.45rem;
  border-top: 2px solid var(--border);
  letter-spacing: 0.06em;
}

.financials-table-wrap tbody tr.is-major-total td {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--text);
  background: rgba(15, 98, 254, 0.06);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
}

.financials-table-wrap tbody tr.is-total td {
  font-weight: 700;
  background: rgba(15, 98, 254, 0.025);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.financials-table-wrap tbody td {
  vertical-align: middle;
}

.financials-trend-col {
  width: 5rem;
  min-width: 5rem;
  text-align: center;
  white-space: nowrap;
  vertical-align: bottom;
}

.financials-value-col {
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}

.financials-value-col.is-negative,
.financials-val-num.is-negative {
  color: var(--error);
  font-weight: 600;
}

.financials-val-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
}

.financials-val-num {
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.financials-val-pct {
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.financials-val-pct.pct-positive {
  color: #16a34a;
}

.financials-val-pct.pct-negative {
  color: #dc2626;
}

.financials-val-pct.pct-neutral {
  color: var(--muted, #5f6b7c);
}

[data-theme="dark"] .financials-val-pct.pct-positive {
  color: #34d399;
}

[data-theme="dark"] .financials-val-pct.pct-negative {
  color: #f87171;
}

[data-theme="dark"] .financials-val-pct.pct-neutral {
  color: var(--muted, #9aa7bd);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .financials-val-pct.pct-positive {
    color: #34d399;
  }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .financials-val-pct.pct-negative {
    color: #f87171;
  }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .financials-val-pct.pct-neutral {
    color: var(--muted, #9aa7bd);
  }
}

.financials-sparkline {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 4.75rem;
  height: 1.85rem;
  margin: 0 auto;
}

.financials-sparkline-cell {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  max-width: 0.65rem;
}

.financials-sparkline-bar {
  width: 100%;
  min-height: 2px;
  display: block;
}

.financials-sparkline-bar.up {
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}

.financials-sparkline-bar.down {
  background: #da1e28;
  border-radius: 1px 1px 0 0;
}

.financials-sparkline-bar.neutral {
  height: 2px !important;
  background: var(--border, rgba(255, 255, 255, 0.2));
  border-radius: 1px;
}

.financials-page .footnote {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.financials-footnotes {
  min-width: 0;
}

.financials-footnotes .footnote + .footnote {
  margin-top: 0.35rem;
}

.financials-unit-footnote {
  color: var(--muted);
  margin: 0.65rem 0 0;
}

.financials-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.65rem;
}

.financials-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.financials-extend-link {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.extractor-page .results-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.extractor-page .results-footer-actions.hidden {
  display: none;
}

.extractor-page .results-financials-extend-link,
.extractor-page .financials-extend-link {
  color: var(--accent);
}

.extractor-page .financials-extend-link:hover,
.extractor-page .financials-extend-link:focus-visible {
  color: var(--accent-dark);
}

.financials-extend-link:hover,
.financials-extend-link:focus-visible {
  color: var(--accent);
}

.chart-wrap {
  position: relative;
  height: 280px;
  margin-top: 0.75rem;
}

.chart-legend-tooltip {
  position: fixed;
  z-index: 1200;
  max-width: min(20rem, calc(100vw - 1.5rem));
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(21, 32, 51, 0.18);
  pointer-events: none;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  transform: translate(-50%, -100%);
}

.chart-legend-tooltip.hidden {
  display: none;
}

.back-link-wrap {
  margin: 1.25rem 0 0;
}

.back-link {
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.site-footer {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 2rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 640px) {
  .container {
    width: min(100%, calc(100% - 1rem));
    padding-top: 1.5rem;
  }

  .portfolio-page.container {
    padding-top: 0.5rem;
  }

.financials-page.container {
    padding-top: 0;
  }

  .extractor-page.container {
    padding-top: 0.5rem;
  }

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

  .upload-row,
  .search-row {
    flex-direction: column;
  }

  .portfolio-overview {
    grid-template-columns: 1fr;
  }

  .portfolio-page .chart-wrap,
  .chart-wrap {
    height: 210px;
    min-height: 210px;
  }

  button:not(.portfolio-action-btn):not(.archive-refresh-one):not(.archive-yahoo-one):not(.dcf-close-btn):not(.modal-close):not(.status-link) {
    width: 100%;
  }
}

.archive-page.container {
  max-width: none;
  width: calc(100% - 2rem);
  padding-top: 0;
}

.screener-page .container {
  padding-top: 0;
}

.screener-page .status-link.status-link-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}
.screener-page .status-link.status-link-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.6rem;
  height: 0.6rem;
  margin: -0.3rem 0 0 -0.3rem;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: screener-spin 0.7s linear infinite;
}
@keyframes screener-spin {
  to { transform: rotate(360deg); }
}

.archive-header {
  position: relative;
  margin-bottom: 0.3rem;
}

.archive-intro {
  color: var(--muted);
  margin: 0.35rem 0 0.25rem;
  max-width: 52rem;
}

.archive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

.button-link,
.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.archive-status,
.archive-progress {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.archive-job {
  margin: 0.5rem 0 0;
}

.archive-job-bar {
  margin-top: 0.4rem;
  height: 6px;
  width: 100%;
  max-width: 32rem;
  border-radius: 999px;
  background: var(--border, #d0d5dd);
  overflow: hidden;
}

.archive-job-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent, #2f6df6);
  transition: width 0.4s ease;
}

.archive-job-done {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: rgba(47, 109, 246, 0.08);
  border: 1px solid rgba(47, 109, 246, 0.25);
  color: var(--text, #1f2937);
  font-size: 0.85rem;
}

/* ─── Modern Archive Toolbar ─── */
.archive-card {
  padding: 0;
  overflow: visible;
  border-radius: 16px;
}

.archive-card .table-wrap {
  overflow-x: auto;
  padding: 0.2rem 0 0;
}

.archive-table {
  table-layout: fixed;
}
.archive-table td {
  vertical-align: middle;
  padding: 0.4rem 0.35rem;
  font-size: 0.88rem;
}
.archive-table tbody tr td:nth-child(2) {
  overflow-wrap: break-word;
}
.archive-table th {
  vertical-align: middle;
  padding: 0.4rem 0.35rem;
}
.archive-table th:nth-child(1) { width: 9%; }
.archive-table th:nth-child(2) { width: 28%; }
.archive-table th:nth-child(3) { width: 14%; }
.archive-table th:nth-child(4) { width: 11%; }
.archive-table th:nth-child(5) { width: 10%; }
.archive-table th:nth-child(6) { width: 11%; }
.archive-table th:nth-child(7) { width: 17%; }

.archive-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.archive-table th.sortable:hover {
  background: var(--row-hover-bg);
}
.sort-arrow {
  display: inline-block;
  width: 0.7rem;
  margin-left: 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
}
th.sort-asc .sort-arrow::after { content: "▲"; }
th.sort-desc .sort-arrow::after { content: "▼"; }
th:not(.sort-asc):not(.sort-desc) .sort-arrow::after { content: "⇅"; opacity: 0.3; }

.archive-badge {
  display: inline-block;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.archive-badge-ok {
  background: var(--success-bg);
  color: var(--success);
}

.archive-badge-partial {
  background: var(--warning-bg);
  color: var(--warning);
}

.archive-badge-pending {
  background: var(--neutral-bg);
  color: var(--muted);
}

.archive-badge-error {
  background: var(--error-bg);
  color: var(--error);
}

.archive-integrity {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
}

.archive-integrity-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.archive-integrity-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.archive-integrity-value {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
}

.archive-integrity-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.archive-integrity-downloaded {
  background: var(--info-bg);
}

.archive-integrity-complete {
  background: var(--success-bg);
}

.archive-integrity-partial {
  background: var(--warning-bg);
}

.archive-integrity-error {
  background: var(--error-bg);
}

.archive-integrity-missing {
  background: var(--neutral-bg);
}

.archive-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.65rem;
  padding: 0.7rem 1rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.archive-alphabet-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  padding: 0.4rem 1rem 0.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.4;
  user-select: none;
}

.archive-letter {
  cursor: pointer;
  color: var(--link);
  text-decoration: underline;
  padding: 0 0.1rem;
}

.archive-letter:hover {
  color: var(--link-hover);
}

.archive-letter.active {
  font-weight: 700;
  color: var(--text);
  cursor: default;
  text-decoration: none;
}

.archive-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  flex: 0 0 auto;
}

.archive-filter-group--search {
  flex: 1 1 300px;
  min-width: 200px;
  max-width: 420px;
}

.archive-filter-group--select {
  flex: 0 0 auto;
  width: auto;
  min-width: 170px;
}

.archive-filter-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
  padding-left: 0.1rem;
}

.archive-search-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}

.archive-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.archive-input-wrap--search .archive-input,
.archive-input-wrap--search .archive-search,
.archive-input-wrap--search .archive-status-filter,
.archive-input-wrap--search .archive-sector-filter {
  padding-left: 2rem;
}

.archive-search-icon {
  position: absolute;
  left: 0.6rem;
  width: 0.9rem;
  height: 0.9rem;
  color: var(--muted);
  pointer-events: none;
  opacity: 0.8;
}

.archive-input,
.archive-search,
.archive-status-filter,
.archive-sector-filter {
  height: 2.05rem;
  width: 100%;
  padding: 0.32rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.2;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  -webkit-appearance: none;
  appearance: none;
}

.archive-input::placeholder,
.archive-search::placeholder {
  color: var(--muted);
  opacity: 0.7;
  font-weight: 400;
}

.archive-input:hover,
.archive-search:hover,
.archive-status-filter:hover,
.archive-sector-filter:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
}

.archive-input:focus,
.archive-search:focus,
.archive-status-filter:focus,
.archive-sector-filter:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--accent) 16%, transparent);
  background: var(--surface);
}

.archive-input--select,
.archive-status-filter,
.archive-sector-filter {
  padding-right: 1.85rem;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-select-chevron {
  position: absolute;
  right: 0.5rem;
  width: 0.9rem;
  height: 0.9rem;
  color: var(--muted);
  pointer-events: none;
}

.archive-toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.75rem 1.15rem 0.2rem;
  min-height: 0.5rem;
}

.archive-toolbar-secondary:empty {
  display: none;
}

.archive-meta,
#archive-table-meta {
  margin: 0;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  line-height: 1.35;
}

#archive-table-meta[hidden] {
  display: none !important;
}

.archive-pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}

.archive-pagination[hidden] {
  display: none !important;
}

.archive-pagination #archive-page-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.archive-pagination button {
  height: 1.7rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.archive-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .archive-filters {
    padding: 0.7rem 0.85rem 0.7rem;
    gap: 0.55rem;
  }
  .archive-filter-group {
    flex: 1 1 100%;
  }
  .archive-filter-group--search {
    max-width: none;
  }
  .archive-toolbar-secondary {
    padding: 0.5rem 0.85rem 0.1rem;
    flex-direction: column;
    align-items: flex-start;
  }
}

.archive-years {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .archive-integrity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.archive-updated,
.archive-sector,
.archive-years {
  white-space: nowrap;
}
.archive-row-actions {
  white-space: nowrap;
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.archive-refresh-one,
.archive-yahoo-one {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

/* DCF: hide the 10-year growth option when a company lacks full 10/10/10 coverage. */
.dcf-no-10yr .dcf-growth-table th:nth-child(2),
.dcf-no-10yr .dcf-growth-table td:nth-child(2) {
  display: none;
}

.dcf-no-10yr [id$="-ten-label"] {
  display: none;
}

.dcf-unavailable-reason {
  margin: 0.6rem 0;
  color: var(--muted);
  line-height: 1.5;
}

.archive-login-container {
  display: flex;
  justify-content: center;
}

.archive-login-card {
  width: min(30rem, 100%);
}

.archive-login-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.5rem;
}

.archive-login-error {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error);
  font-weight: 600;
}

.archive-login-disabled {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--neutral-bg);
  color: var(--muted);
  line-height: 1.5;
}

.archive-login-back {
  margin-top: 1rem;
}

.archive-logout-form {
  display: inline;
}

.archive-logout-btn {
  background: transparent;
}

.stmt-derived {
  color: var(--muted);
  font-size: 0.78em;
  font-style: italic;
  cursor: help;
}

.screener-verdict {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.screener-verdict-undervalued {
  background: var(--success-bg);
  color: var(--success);
}

.screener-verdict-overvalued {
  background: var(--error-bg);
  color: var(--error);
}

.screener-verdict-fair {
  background: var(--neutral-bg);
  color: var(--muted);
}

.screener-verdict-unknown {
  background: var(--neutral-bg);
  color: var(--muted);
}

.screener-page table tbody tr:hover {
  background-color: var(--row-hover-bg);
}

.screener-caution {
  color: var(--warning);
  cursor: help;
}

.screener-pred {
  display: inline-block;
  padding: 0.05rem 0.3rem;
  border-radius: 0.25rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  cursor: help;
  white-space: nowrap;
}

.screener-pred-unstable {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.screener-pred-moderate {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.settings-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.settings-footer a {
  color: var(--accent);
  text-decoration: none;
}

.settings-footer a:hover {
  text-decoration: underline;
}

.screener-hero-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.screener-chart-icon {
  margin-left: 0.3rem;
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s ease;
  user-select: none;
  text-decoration: none;
  color: inherit;
}

.screener-chart-icon:hover {
  opacity: 1;
}

.screener-adr-badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
  vertical-align: middle;
  cursor: help;
  text-transform: uppercase;
}

tr.screener-row-adr {
  background: rgba(245, 158, 11, 0.05);
}

.screener-currency {
  display: inline-block;
  padding: 0.05rem 0.3rem;
  border-radius: 0.25rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted, #8b95a5);
  border: 1px solid rgba(148, 163, 184, 0.3);
  vertical-align: middle;
  cursor: help;
}

.screener-inflation {
  display: inline-block;
  padding: 0.05rem 0.3rem;
  border-radius: 0.25rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  vertical-align: middle;
  cursor: help;
}

.screener-lp-badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(139, 92, 246, 0.18);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.35);
  vertical-align: middle;
  cursor: help;
  text-transform: uppercase;
}

tr.screener-row-lp {
  background: rgba(139, 92, 246, 0.05);
}

.screener-bdc-badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
  vertical-align: middle;
  cursor: help;
  text-transform: uppercase;
}

tr.screener-row-bdc {
  background: rgba(16, 185, 129, 0.05);
}

.screener-reit-badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.35);
  vertical-align: middle;
  cursor: help;
  text-transform: uppercase;
}

tr.screener-row-reit {
  background: rgba(245, 158, 11, 0.05);
}

.screener-foreign-badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(59, 130, 246, 0.18);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.35);
  vertical-align: middle;
  cursor: help;
  text-transform: uppercase;
}

tr.screener-row-foreign {
  background: rgba(59, 130, 246, 0.04);
}

tr.screener-row-incalculable {
  background: rgba(107, 114, 128, 0.06);
}
tr.screener-row-incalculable td:first-child {
  opacity: 0.6;
}
tr.screener-row-incalculable:hover {
  background: rgba(107, 114, 128, 0.12);
}

tr.screener-row-growth-failed {
  background: rgba(239, 68, 68, 0.06);
}
tr.screener-row-growth-failed td:first-child {
  opacity: 0.6;
}
tr.screener-row-growth-failed:hover {
  background: rgba(239, 68, 68, 0.12);
}

tr.screener-growth-separator td {
  padding: 0.5rem 0.5rem !important;
  border-bottom: none !important;
}
tr.screener-growth-separator td:first-child {
  padding-left: 0.25rem !important;
}
tr.screener-growth-sep-nodata .screener-growth-sep-label {
  color: #d97706;
  border-left-color: #d97706;
}
tr.screener-growth-sep-nodata .screener-growth-sep-line {
  background: #d97706;
}
tr.screener-growth-sep-incalc .screener-growth-sep-label {
  color: var(--muted);
  border-left-color: var(--muted);
}
tr.screener-growth-sep-incalc .screener-growth-sep-line {
  background: var(--muted);
}
.screener-growth-sep-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.screener-growth-sep-label {
  font-weight: 800;
  font-size: 0.85rem;
  color: #ef4444;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-left: 0.5rem;
  border-left: 4px solid #ef4444;
  line-height: 1;
}
.screener-growth-sep-line {
  flex: 1;
  height: 2px;
  background: #ef4444;
  border-radius: 1px;
}

.settings-separator {
  border: none;
  border-top: 1px solid var(--border, #d1d5db);
  margin: 0.25rem 0 0.75rem;
  grid-column: 1 / -1;
}

/* Filter toolbar pill buttons */
/* Dropdown surface palette: scoped values for all filter dropdowns (including the
   range popovers). A global --card-bg default is defined on :root; these scoped
   values still win inside dropdowns. */
.screener-pill-dropdown {
  --card-bg: #ffffff;
  --foreground: #152033;
  --input-bg: #fafbfd;
}

:root[data-theme="dark"] .screener-pill-dropdown {
  --card-bg: #1e293b;
  --foreground: #f8fafc;
  --input-bg: rgba(15, 23, 42, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .screener-pill-dropdown {
    --card-bg: #1e293b;
    --foreground: #f8fafc;
    --input-bg: rgba(15, 23, 42, 0.6);
  }
}

.screener-pill-dropdown {
  position: absolute;
  top: 100%;
  margin-top: 0.35rem;
  min-width: 12rem;
  padding: 0.4rem 0.5rem;
  background: var(--card-bg, #1e293b);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 0.55rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  z-index: 60;
}
.screener-pill-dropdown.hidden { display: none; }
.screener-pill-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--foreground, #f8fafc);
}
.screener-pill-menu-item:hover {
  background: var(--row-hover-bg);
}
.screener-pill-menu-item input[type="checkbox"] {
  cursor: pointer;
}

.screener-pill-config-footer {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.screener-pill-config-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.screener-pill-config-toggle:hover {
  color: var(--foreground);
  background: var(--row-hover-bg);
}

.screener-pill-config-toggle-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.screener-pill-config-toggle.is-open {
  color: var(--accent);
}

.screener-pill-config-toggle.is-open .screener-pill-config-chevron {
  transform: rotate(180deg);
}

.screener-pill-config-chevron {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.screener-pill-config-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.5rem 0.25rem 0.35rem;
  margin-top: 0.25rem;
  border-top: 1px dashed var(--border);
}

.screener-pill-config-panel.hidden {
  display: none;
}

.screener-pill-config-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.screener-pill-config-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.screener-pill-config-select,
.screener-pill-config-panel input[type="number"] {
  width: 100%;
  height: 1.85rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.8rem;
  background: var(--input-bg, #fafbfd);
  color: var(--foreground, #152033);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 0.35rem;
  outline: none;
  box-sizing: border-box;
}

.screener-pill-config-select:focus,
.screener-pill-config-panel input[type="number"]:focus {
  border-color: var(--accent);
}

/* Margin Growth / Sales Growth Custom Dropdown & Sliders */
.screener-mg-dropdown {
  min-width: 19rem;
  max-width: 23rem;
  padding: 0.85rem 0.95rem 1rem;
}

.screener-mg-growth-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.4rem 0.1rem 0.85rem;
}

.screener-mg-growth-field {
  position: relative;
  display: flex;
  align-items: center;
}

.screener-mg-growth-field input {
  padding-right: 1.8rem !important;
  font-weight: 600;
  height: 2.25rem !important;
  font-size: 0.92rem !important;
}

.screener-mg-unit {
  position: absolute;
  right: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}

.screener-mg-dropdown .screener-pill-config-panel {
  gap: 0.95rem;
  padding: 0.85rem 0 0.5rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.screener-mg-dropdown .screener-pill-config-group {
  gap: 0.45rem;
}

.screener-mg-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.screener-mg-slider-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(15, 98, 254, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.screener-period-method-select {
  height: 1.5rem;
  padding: 0.05rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(15, 98, 254, 0.08);
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  outline: none;
  cursor: pointer;
}

.screener-period-method-select:hover {
  border-color: var(--accent);
}

.screener-mg-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
  margin: 0.5rem 0 0.1rem;
  cursor: pointer;
}

.screener-mg-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform 0.1s ease;
}

.screener-mg-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.screener-mg-range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.screener-mg-slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.15rem;
  margin-top: 0.05rem;
}

.screener-mg-diff-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0.45rem 0 0.2rem;
}

.screener-mg-diff-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.screener-mg-diff-formula {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--foreground);
}

.screener-mg-diff-target {
  color: var(--accent);
  font-weight: 700;
}

.screener-mg-diff-base {
  color: var(--text);
  font-weight: 700;
}

.screener-mg-diff-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  background: rgba(36, 161, 72, 0.12);
  color: #198038;
}

.screener-mg-hint {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 0.35rem;
}

:root[data-theme="dark"] .screener-mg-diff-badge {
  background: rgba(36, 161, 72, 0.25);
  color: #42be65;
}

/* ─── Modern Screener Toolbar ─── */
.screener-card {
  padding: 0;
  overflow: visible;
  border-radius: 16px;
}

.screener-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.7rem 1rem 0.65rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.screener-toolbar-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.65rem;
}

.screener-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.screener-filter-group--search {
  flex: 1 1 260px;
  min-width: 200px;
  max-width: 380px;
}

.screener-filter-group--sort {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 260px;
  margin-left: auto;
}

.screener-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
  padding-left: 0.1rem;
}

.screener-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.screener-input-wrap--search .screener-input {
  padding-left: 2rem;
}

.screener-search-icon {
  position: absolute;
  left: 0.6rem;
  width: 0.9rem;
  height: 0.9rem;
  color: var(--muted);
  pointer-events: none;
  opacity: 0.8;
}

.screener-input {
  height: 2.05rem;
  width: 100%;
  padding: 0.32rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.2;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  -webkit-appearance: none;
  appearance: none;
}

.screener-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
  font-weight: 400;
}

.screener-input:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
}

.screener-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--accent) 16%, transparent);
  background: var(--surface);
}

.screener-input--narrow {
  width: 5.85rem;
  padding-right: 1.65rem;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.screener-input-wrap--with-addon .screener-addon {
  position: absolute;
  right: 0.55rem;
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
  letter-spacing: 0.02em;
}

.screener-input-wrap--select .screener-select {
  padding-right: 1.85rem;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screener-select-chevron {
  position: absolute;
  right: 0.5rem;
  width: 0.9rem;
  height: 0.9rem;
  color: var(--muted);
  pointer-events: none;
}

.screener-toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding-top: 0.15rem;
  border-top: 1px dashed color-mix(in srgb, var(--border) 85%, transparent);
  margin-top: 0.15rem;
}

.screener-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.4rem;
  align-items: center;
}

.screener-pill-wrap {
  position: relative;
}

.screener-pill-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 1.7rem;
  padding: 0 0.5rem;
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
  white-space: nowrap;
  line-height: 1;
  overflow: visible;
}

.screener-pill-btn:hover,
.screener-pill-btn:focus-visible {
  border-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  outline: none;
}

.screener-pill-btn.screener-pill-btn-active,
.screener-pill-btn[aria-expanded="true"] {
  color: #ffffff !important;
  background: #000000 !important;
  border-color: #000000 !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}

.screener-pill-btn.screener-pill-btn-on {
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.38);
}

.screener-input.screener-input-on {
  color: #b45309 !important;
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  font-weight: 700 !important;
}

.screener-input.screener-input-on:focus {
  border-color: rgba(245, 158, 11, 0.7) !important;
  box-shadow: 0 0 0 2.5px rgba(245, 158, 11, 0.25) !important;
  background: rgba(245, 158, 11, 0.12) !important;
}

.screener-input.screener-input-on + .screener-addon {
  color: #b45309 !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .screener-pill-btn.screener-pill-btn-on {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
}

[data-theme="dark"] .screener-input.screener-input-on {
  color: #fbbf24 !important;
  background: rgba(245, 158, 11, 0.16) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .screener-input.screener-input-on:focus {
  border-color: rgba(245, 158, 11, 0.7) !important;
  box-shadow: 0 0 0 2.5px rgba(245, 158, 11, 0.25) !important;
  background: rgba(245, 158, 11, 0.16) !important;
}

[data-theme="dark"] .screener-input.screener-input-on + .screener-addon {
  color: #fbbf24 !important;
  font-weight: 700 !important;
}

/* Floating overlay tag sitting over the top half and slightly above the button */
.screener-pill-floating-tag,
.screener-pill-watermark {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  height: 14px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  color: #b45309;
  background: var(--surface, #ffffff);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  user-select: none;
  z-index: 3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: all 0.18s ease;
}

.screener-pill-btn.screener-pill-btn-on .screener-pill-floating-tag:not(:empty),
.screener-pill-btn.screener-pill-btn-on .screener-pill-watermark:not(:empty) {
  display: inline-flex;
}

[data-theme="dark"] .screener-pill-floating-tag,
[data-theme="dark"] .screener-pill-watermark {
  background: #1e293b;
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.screener-pill-btn > span:not(.screener-pill-floating-tag):not(.screener-pill-watermark) {
  position: relative;
  z-index: 1;
}

.screener-pill-dot {
  display: none;
}

.screener-pill-caret {
  font-size: 0.65rem;
  opacity: 0.7;
  margin-left: 0.05rem;
}

.screener-pill-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  min-width: 14rem;
  max-width: 18rem;
  max-height: 22rem;
  overflow-y: auto;
  padding: 0.45rem;
  background: var(--card-bg, #1e293b);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 70;
}

.screener-pill-dropdown.hidden { display: none; }

.screener-pill-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--foreground, #f8fafc);
  transition: background 0.12s ease;
}

.screener-pill-menu-item:hover {
  background: var(--row-hover-bg);
}

.screener-pill-menu-item input[type="checkbox"] {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

.screener-meta {
  margin: 0;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.screener-card .table-wrap {
  padding: 0.2rem 0 0;
}

.screener-table {
  width: 100%;
  table-layout: auto !important;
}

.screener-table th,
.screener-table td {
  padding: 0.4rem 0.6rem !important;
  font-size: 0.85rem;
  vertical-align: middle;
}

.screener-table th {
  white-space: nowrap;
}

.screener-table th.screener-col-ticker,
.screener-table td.screener-col-ticker {
  width: 1%;
  white-space: nowrap;
  text-align: left;
}

.screener-table th.screener-col-company,
.screener-table td.screener-col-company {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.screener-table th.screener-col-mcap,
.screener-table td.screener-col-mcap,
.screener-table th.screener-col-dcf,
.screener-table td.screener-col-dcf,
.screener-table th.screener-col-price,
.screener-table td.screener-col-price {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.screener-table th.screener-col-valuation,
.screener-table td.screener-col-valuation,
.screener-table th.screener-col-trend,
.screener-table td.screener-col-trend {
  text-align: center;
  white-space: nowrap;
  width: 1%;
}

.screener-table th.screener-col-pred,
.screener-table td.screener-col-pred {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.screener-pred-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: help;
  white-space: nowrap;
}

.screener-pred-cell.screener-pred-stable {
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.screener-pred-sigma {
  font-size: 0.58rem;
  font-weight: 600;
  opacity: 0.85;
}

.screener-table td .dcf-valuation-badge,
.screener-table td .dcf-trend-badge {
  margin: 0 auto;
}

th.screener-col-roe,
td.screener-col-roe,
th.screener-col-margin,
td.screener-col-margin,
th.screener-col-pe,
td.screener-col-pe,
th.screener-col-pb,
td.screener-col-pb,
th.screener-col-div,
td.screener-col-div,
th.screener-col-dg,
td.screener-col-dg,
th.screener-col-ps,
td.screener-col-ps,
th.screener-col-sales,
td.screener-col-sales,
th.screener-col-sg,
td.screener-col-sg,
th.screener-col-ni,
td.screener-col-ni,
th.screener-col-ni-inc,
td.screener-col-ni-inc,
th.screener-col-fcf,
td.screener-col-fcf {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

th.screener-col-margingrowth {
  text-align: right;
  white-space: normal;
  line-height: 1.15;
  vertical-align: bottom;
  width: 1%;
  padding: 0.35rem 0.5rem !important;
}

td.screener-col-margingrowth {
  text-align: right;
  white-space: nowrap;
  width: 1%;
  padding: 0.35rem 0.5rem !important;
}

th.screener-col-growth,
td.screener-col-growth {
  text-align: right;
  white-space: nowrap;
}

th.screener-col-sector,
td.screener-col-sector,
th.screener-col-industry,
td.screener-col-industry {
  text-align: left;
  white-space: nowrap;
}

th.hidden,
td.hidden {
  display: none !important;
}

/* Ensure archive-filters override only on screener */
.screener-page .archive-filters {
  display: none;
}

/* Responsive */
@media (max-width: 980px) {
  .screener-filter-group--sort {
    margin-left: 0;
    flex: 1 1 100%;
    max-width: none;
  }
  .screener-filter-group--sort .screener-input-wrap {
    max-width: 320px;
  }
}

@media (max-width: 720px) {
  .screener-toolbar {
    padding: 0.9rem 0.9rem 0.8rem;
    gap: 0.75rem;
  }
  .screener-toolbar-primary {
    gap: 0.65rem;
  }
  .screener-filter-group--search {
    flex: 1 1 100%;
    max-width: none;
  }
  .screener-input--narrow {
    width: 100%;
    min-width: 5.5rem;
  }
  .screener-filter-group {
    flex: 1 1 calc(50% - 0.65rem);
    min-width: 0;
  }
  .screener-filter-group--sort {
    flex: 1 1 100%;
  }
  .screener-toolbar-secondary {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .screener-filter-group {
    flex: 1 1 100%;
  }
  .screener-input--narrow {
    width: 100%;
  }
}

/* How to Upload Modal Styles */
.link-how-to-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: all 0.2s ease;
  vertical-align: baseline;
}

.link-how-to-upload:hover {
  color: var(--accent-dark);
  text-decoration-color: var(--accent-dark);
}

.link-how-to-upload svg {
  color: var(--accent);
  transition: transform 0.2s ease;
}

.link-how-to-upload:hover svg {
  transform: scale(1.1);
}

.upload-guide-backdrop {
  display: none !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 18, 32, 0.75);
  backdrop-filter: blur(6px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.upload-guide-backdrop.active {
  display: flex !important;
  animation: fadeInModal 0.25s ease-out forwards;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.upload-guide-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-alt);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--neutral-bg);
  color: var(--text);
}

.upload-guide-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.export-guide-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.guide-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
}

.guide-broker-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.guide-img-container {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.guide-img-container img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 130px; /* ~25% of previous 480px height */
  object-fit: contain;
  display: block;
  border-radius: 4px;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  justify-content: flex-end;
}

.btn-secondary {
  padding: 0.4rem 1rem;
  border-radius: 6px;
  background: var(--neutral-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--border);
}

