/* ================================================================
   SAHM — Bloomberg Terminal Dark Theme
   ================================================================ */

/* ── Design tokens ──────────────────────────────────────────────── */
:root {
  --bb-bg:        #0a0c0f;
  --bb-surface:   #0e1117;
  --bb-surface-2: #131720;
  --bb-surface-3: #1a2030;
  --bb-border:    #1e2535;
  --bb-border-2:  #263044;
  --bb-text:      #e2e8f0;
  --bb-text-2:    #a8bbd4;   /* was #8899b4 — lifted for readability */
  --bb-text-3:    #6e8aa8;   /* was #4a5870 — was nearly invisible, now legible */
  --bb-orange:    #ff6b00;
  --bb-orange-d:  #cc5500;
  --bb-orange-glow: rgba(255,107,0,.18);
  --bb-cyan:      #00d4ff;
  --bb-cyan-d:    rgba(0,212,255,.12);
  --bb-green:     #00c853;
  --bb-green-d:   rgba(0,200,83,.12);
  --bb-red:       #ff3d5a;
  --bb-red-d:     rgba(255,61,90,.12);
  --bb-yellow:    #ffd600;
  --bb-yellow-d:  rgba(255,214,0,.12);
  --bb-purple:    #b388ff;
  --bb-font:      'Inter', 'Segoe UI', system-ui, sans-serif;
  --bb-mono:      'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --bb-radius:    4px;
  --bb-radius-lg: 6px;
  --bb-shadow:    0 2px 16px rgba(0,0,0,.5);
  --bb-glow:      0 0 20px rgba(255,107,0,.15);
  --bb-trans:     .14s ease;
}

/* ── Reset & base ───────────────────────────────────────────────── */
.sahm-app *,
.sahm-app *::before,
.sahm-app *::after { box-sizing: border-box; }

.sahm-app {
  font-family: var(--bb-font);
  background: var(--bb-bg) !important;
  color: var(--bb-text) !important;
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex !important;
  flex-direction: column !important;
  -webkit-font-smoothing: antialiased;
  position: relative !important;
  width: 100vw !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
  left: 0;
}

/* Dark bg applied via JS class on body when SAHM is present */
body.sahm-page {
  background: var(--bb-bg) !important;
}

/* ── Typography ─────────────────────────────────────────────────── */
.sahm-app h1, .sahm-app h2, .sahm-app h3, .sahm-app h4 {
  font-family: var(--bb-font);
  color: var(--bb-text);
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

/* ── Top bar / masthead ─────────────────────────────────────────── */
.sahm-masthead {
  background: var(--bb-surface);
  border-bottom: 1px solid var(--bb-border);
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.sahm-masthead-logo {
  font-family: var(--bb-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--bb-orange);
  letter-spacing: .12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sahm-masthead-logo::before {
  content: '▶';
  color: var(--bb-orange);
  font-size: 13px;
}
.sahm-masthead-time {
  font-family: var(--bb-mono);
  font-size: 14px;
  color: #6e8aa8;
  margin-left: auto;
}
.sahm-masthead-credits {
  font-family: var(--bb-mono);
  font-size: 14px;
  color: var(--bb-cyan);
  padding: 3px 10px;
  border: 1px solid var(--bb-border-2);
  border-radius: var(--bb-radius);
}

/* ── Panel / card ───────────────────────────────────────────────── */
.sahm-panel {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-lg);
}
.sahm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bb-border);
}
.sahm-panel-title {
  font-family: var(--bb-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--bb-orange);
  text-transform: uppercase;
  letter-spacing: .12em;
}
.sahm-panel-body { padding: 16px; }

/* Alias .sahm-card → .sahm-panel for backward compat */
.sahm-card {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.sahm-card h3 {
  font-family: var(--bb-mono);
  font-size: 14px;
  font-weight: 700;
  color: #c8d8ea;            /* bright readable blue-white, not dim orange */
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 14px;
}

/* ── Grid ───────────────────────────────────────────────────────── */
.sahm-grid { display: grid; gap: 12px; }
.sahm-grid-2 { grid-template-columns: 1fr 1fr; }
.sahm-grid-3 { grid-template-columns: repeat(3, 1fr); }
.sahm-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .sahm-grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 860px)  { .sahm-grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px)  { .sahm-grid-2, .sahm-grid-3, .sahm-grid-4 { grid-template-columns: 1fr; } }

/* ── Buttons ────────────────────────────────────────────────────── */
.sahm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  font-family: var(--bb-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: var(--bb-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--bb-trans);
  text-decoration: none;
  white-space: nowrap;
}
.sahm-btn-primary {
  background: var(--bb-orange);
  color: #000;
  border-color: var(--bb-orange);
}
.sahm-btn-primary:hover {
  background: #ff8533;
  box-shadow: 0 0 14px rgba(255,107,0,.4);
  color: #000;
}
.sahm-btn-ghost {
  background: transparent;
  color: var(--bb-orange);
  border-color: var(--bb-orange);
}
.sahm-btn-ghost:hover {
  background: var(--bb-orange-glow);
  color: var(--bb-orange);
}
.sahm-btn-cyan {
  background: transparent;
  color: var(--bb-cyan);
  border-color: var(--bb-cyan);
}
.sahm-btn-cyan:hover {
  background: var(--bb-cyan-d);
}
.sahm-btn-block { width: 100%; justify-content: center; }
.sahm-btn-sm { padding: 6px 14px; font-size: 16px; }

/* ── Tags / chips ───────────────────────────────────────────────── */
.sahm-tag {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--bb-mono);
  font-size: 14px;
  font-weight: 600;
  border-radius: 2px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.sahm-tag-orange { background: rgba(255,107,0,.15); color: var(--bb-orange); border: 1px solid rgba(255,107,0,.3); }
.sahm-tag-cyan   { background: var(--bb-cyan-d); color: var(--bb-cyan); border: 1px solid rgba(0,212,255,.25); }
.sahm-tag-green  { background: var(--bb-green-d); color: var(--bb-green); border: 1px solid rgba(0,200,83,.25); }
.sahm-tag-red    { background: var(--bb-red-d); color: var(--bb-red); border: 1px solid rgba(255,61,90,.25); }
.sahm-tag-grey   { background: rgba(255,255,255,.06); color: var(--bb-text-2); border: 1px solid var(--bb-border); }

/* ── Divider ────────────────────────────────────────────────────── */
.sahm-divider { height: 1px; background: var(--bb-border); margin: 16px 0; }

/* ── Ticker tape / marquee ──────────────────────────────────────── */
.sahm-ticker-tape {
  background: var(--bb-surface-2);
  border-bottom: 1px solid var(--bb-border);
  height: 30px;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.sahm-tape-track {
  display: flex;
  gap: 0;
  animation: sahm-tape 60s linear infinite;
  white-space: nowrap;
}
@keyframes sahm-tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.sahm-tape-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  border-right: 1px solid var(--bb-border);
  font-family: var(--bb-mono);
  font-size: 14px;
}
.sahm-tape-ticker { color: var(--bb-orange); font-weight: 600; }
.sahm-tape-val    { color: var(--bb-text); }
.sahm-tape-up     { color: var(--bb-green); }
.sahm-tape-dn     { color: var(--bb-red); }

/* ── ══════════════════════════════════════════════
   SEARCH PAGE
   ══════════════════════════════════════════════ */
.sahm-search-app { padding: 0; }

/* Command bar */
.sahm-cmd-bar {
  background: var(--bb-surface);
  border-bottom: 1px solid var(--bb-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sahm-cmd-label {
  font-family: var(--bb-mono);
  font-size: 14px;
  color: var(--bb-orange);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  flex-shrink: 0;
}
.sahm-cmd-input-wrap {
  flex: 1;
  position: relative;
  max-width: 600px;
}
.sahm-cmd-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bb-text-3);
  pointer-events: none;
}
.sahm-search-input {
  width: 100%;
  background: var(--bb-surface-3);
  border: 1px solid var(--bb-border-2);
  border-radius: var(--bb-radius);
  color: var(--bb-text);
  font-family: var(--bb-mono);
  font-size: 16px;
  padding: 9px 12px 9px 40px;
  outline: none;
  transition: border-color var(--bb-trans), box-shadow var(--bb-trans);
}
.sahm-search-input::placeholder { color: var(--bb-text-3); }
.sahm-search-input:focus {
  border-color: var(--bb-orange);
  box-shadow: 0 0 0 2px var(--bb-orange-glow);
}

/* Filter row */
.sahm-filter-row {
  padding: 8px 24px;
  background: var(--bb-surface-2);
  border-bottom: 1px solid var(--bb-border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sahm-filter {
  background: var(--bb-surface-3);
  border: 1px solid var(--bb-border-2);
  border-radius: var(--bb-radius);
  color: #a8bbd4;
  font-family: var(--bb-mono);
  font-size: 14px;
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
}
.sahm-filter:focus { border-color: var(--bb-orange); }
.sahm-filter option { background: #1a2030; color: var(--bb-text); }
.sahm-filter-num { width: 120px; }
.sahm-filter-reset {
  background: transparent;
  border: 1px solid var(--bb-border-2);
  border-radius: var(--bb-radius);
  color: #7a9bb8;
  font-family: var(--bb-mono);
  font-size: 14px;
  padding: 5px 10px;
  cursor: pointer;
  margin-left: auto;
}
.sahm-filter-reset:hover { color: var(--bb-red); border-color: var(--bb-red); }

/* Results bar */
.sahm-results-bar {
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--bb-border);
}
.sahm-results-bar-label {
  font-family: var(--bb-mono);
  font-size: 14px;
  color: #7a9bb8;
  text-transform: uppercase;
  letter-spacing: .1em;
}
#sahm-results-count {
  font-family: var(--bb-mono);
  font-size: 14px;
  color: var(--bb-orange);
  font-weight: 600;
}

/* Results table */
.sahm-results-table-wrap {
  padding: 0 0 24px 0;
  overflow-x: auto;
  min-height: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
}
.sahm-results-table {
  width: 100% !important;
  min-width: 100% !important;
  border-collapse: collapse;
  font-size: 15px;
  table-layout: auto;
}
.sahm-results-table thead th {
  padding: 12px 14px;
  text-align: left;
  font-family: var(--bb-mono);
  font-size: 16px;
  font-weight: 700;
  color: #7a9bb8;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--bb-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.sahm-results-table thead th:hover { color: var(--bb-orange); }
.sahm-results-table thead th.sort-asc::after  { content: ' ▲'; color: var(--bb-orange); }
.sahm-results-table thead th.sort-desc::after { content: ' ▼'; color: var(--bb-orange); }
.sahm-results-table tbody tr {
  border-bottom: 1px solid var(--bb-border);
  cursor: pointer;
  transition: background var(--bb-trans);
}
.sahm-results-table tbody tr:hover { background: var(--bb-surface-2); }
.sahm-results-table tbody td {
  padding: 10px 12px;
  vertical-align: middle;
  color: #a8bbd4;
}
.sahm-results-table .col-ticker {
  font-family: var(--bb-mono);
  font-weight: 700;
  color: var(--bb-orange);
  font-size: 16px;
}
.sahm-results-table .col-name { color: var(--bb-text); font-weight: 500; }
.sahm-results-table .col-name small {
  display: block;
  font-size: 14px;
  color: var(--bb-text-3);
  direction: rtl;
  text-align: left;
}
.sahm-results-table .col-num {
  font-family: var(--bb-mono);
  font-size: 15px;
  text-align: right;
  color: var(--bb-text-2);
}
.sahm-results-table .col-sector { color: var(--bb-text-2); font-size: 14px; }

/* ── ══════════════════════════════════════════════
   COMPANY PAGE
   ══════════════════════════════════════════════ */

/* Company header bar */
.sahm-co-header {
  background: var(--bb-surface);
  border-bottom: 1px solid var(--bb-border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.sahm-co-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--bb-radius);
  object-fit: contain;
  background: var(--bb-surface-3);
  border: 1px solid var(--bb-border);
  flex-shrink: 0;
}
.sahm-co-logo-placeholder {
  width: 44px;
  height: 44px;
  border-radius: var(--bb-radius);
  background: var(--bb-surface-3);
  border: 1px solid var(--bb-border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--bb-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--bb-orange);
  flex-shrink: 0;
}
.sahm-co-meta { flex: 1; min-width: 0; }
.sahm-co-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--bb-text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sahm-co-name-ar {
  font-size: 15px;
  color: var(--bb-text-3);
  direction: rtl;
  margin-bottom: 6px;
}
.sahm-co-tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* Quick stat pills */
.sahm-co-stats {
  display: flex;
  gap: 1px;
  background: var(--bb-border);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius);
  overflow: hidden;
  margin-left: auto;
}
.sahm-co-stat {
  background: var(--bb-surface-2);
  padding: 8px 16px;
  text-align: center;
  min-width: 100px;
}
.sahm-co-stat-label {
  font-family: var(--bb-mono);
  font-size: 16px;
  color: #7a9bb8;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 3px;
}
.sahm-co-stat-value {
  font-family: var(--bb-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--bb-cyan);
}

/* Tab bar */
.sahm-tab-bar {
  background: var(--bb-surface);
  border-bottom: 1px solid var(--bb-border);
  padding: 0 24px;
  display: flex;
  align-items: flex-end;
  gap: 0;
  overflow-x: auto;
}
.sahm-tab {
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #7a9bb8;            /* readable inactive tab color */
  font-family: var(--bb-mono);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--bb-trans);
  margin-bottom: -1px;
}
.sahm-tab:hover { color: #c8d8ea; }
.sahm-tab-active { color: var(--bb-orange) !important; border-bottom-color: var(--bb-orange); }
.sahm-tabpane { display: none; padding: 16px 24px; }
.sahm-tabpane-active { display: block; }

/* ── KPI tiles ──────────────────────────────────────────────────── */
.sahm-kpi {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.sahm-kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--bb-orange);
  opacity: .6;
}
.sahm-kpi-label {
  font-family: var(--bb-mono);
  font-size: 16px;
  color: #7a9bb8;            /* dedicated readable color, not global text-3 */
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 6px;
}
.sahm-kpi-value {
  font-family: var(--bb-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--bb-text);
  line-height: 1;
  margin-bottom: 4px;
}
.sahm-kpi-delta {
  font-family: var(--bb-mono);
  font-size: 14px;
}
.sahm-kpi-delta.pos { color: var(--bb-green); }
.sahm-kpi-delta.pos::before { content: '▲ '; }
.sahm-kpi-delta.neg { color: var(--bb-red); }
.sahm-kpi-delta.neg::before { content: '▼ '; }

/* KPI accent variants */
.sahm-kpi.cyan  .sahm-kpi-value { color: var(--bb-cyan); }
.sahm-kpi.cyan::before  { background: var(--bb-cyan); }
.sahm-kpi.green .sahm-kpi-value { color: var(--bb-green); }
.sahm-kpi.green::before { background: var(--bb-green); }
.sahm-kpi.red   .sahm-kpi-value { color: var(--bb-red); }
.sahm-kpi.red::before   { background: var(--bb-red); }

/* ── Data tables ────────────────────────────────────────────────── */
.sahm-table-wrap { overflow-x: auto; }
.sahm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.sahm-table thead th {
  padding: 8px 12px;
  text-align: center;
  font-family: var(--bb-mono);
  font-size: 13px;
  font-weight: 700;
  color: #7a9bb8;            /* readable table header color */
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--bb-border);
  white-space: nowrap;
  background: var(--bb-surface-2);
}
.sahm-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--bb-border);
  font-family: var(--bb-mono);
  font-size: 15px;
  text-align: center;
  color: #c0d0e0;
}
/* Spec: every cell — including the first-column row label — is centered
   in its column. No first-child override; labels and values align the same. */
.sahm-table tbody tr:hover { background: var(--bb-surface-2); }
.sahm-table tbody tr:last-child td { border-bottom: none; }

/* Positive/negative cell colouring */
.sahm-table .v-pos { color: var(--bb-green); }
.sahm-table .v-neg { color: var(--bb-red); }

/* ── Chart wrappers ─────────────────────────────────────────────── */
.sahm-chart-wrap { position: relative; }
.sahm-card canvas { width: 100% !important; min-height: 380px; }

/* ── CAPM / WACC metric rows ──────────────────────────────────────
 * Sized to match the financial-table rows in other tabs. Previously
 * the label was 14px and the value 16px, which made this tab look
 * noticeably larger and out of step with the rest of the analysis
 * pages. Now: label 12px, value 13px (matching .sahm-table tbody td).
 */
.sahm-metric-grid { display: grid; gap: 2px; }
.sahm-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: var(--bb-surface-2);
}
.sahm-metric-row:first-child { border-radius: var(--bb-radius) var(--bb-radius) 0 0; }
.sahm-metric-row:last-child  { border-radius: 0 0 var(--bb-radius) var(--bb-radius); }
.sahm-metric-label {
  font-family: var(--bb-mono);
  font-size: 12px;
  color: #a8bbd4;
}
.sahm-metric-value {
  font-family: var(--bb-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--bb-cyan);
}

/* ── DCF verdict pill ───────────────────────────────────────────── */
.sahm-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 2px;
  font-family: var(--bb-mono);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.sahm-verdict.undervalued  { background: var(--bb-green-d); color: var(--bb-green); border: 1px solid rgba(0,200,83,.3); }
.sahm-verdict.overvalued   { background: var(--bb-red-d); color: var(--bb-red); border: 1px solid rgba(255,61,90,.3); }
.sahm-verdict.fairly_valued{ background: var(--bb-yellow-d); color: var(--bb-yellow); border: 1px solid rgba(255,214,0,.3); }

/* ── Paywall ─────────────────────────────────────────────────────  */
.sahm-paywall {
  padding: 80px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background: var(--bb-bg);
  position: relative;
}
.sahm-paywall::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255,107,0,.04) 0%, transparent 70%);
  pointer-events: none;
}
.sahm-paywall-inner {
  text-align: center;
  max-width: 480px;
  position: relative;
  z-index: 1;
}
.sahm-paywall-lock {
  width: 64px;
  height: 64px;
  background: var(--bb-surface-2);
  border: 1px solid var(--bb-border-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.sahm-paywall-lock svg { color: var(--bb-orange); }
.sahm-paywall-inner h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}
.sahm-paywall-inner p {
  color: var(--bb-text-2);
  line-height: 1.6;
  margin-bottom: 28px;
  font-size: 14px;
}
.sahm-paywall-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sahm-credit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--bb-surface-2);
  border: 1px solid var(--bb-border-2);
  border-radius: var(--bb-radius);
  font-family: var(--bb-mono);
  font-size: 14px;
  color: var(--bb-text-2);
  margin-bottom: 20px;
}
.sahm-credit-badge span { color: var(--bb-cyan); font-weight: 700; }

/* ── Pricing page ───────────────────────────────────────────────── */
.sahm-pricing-app { padding: 40px 24px; background: var(--bb-bg); }
.sahm-pricing-hero { text-align: center; margin-bottom: 48px; }
.sahm-pricing-hero h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 10px;
}
.sahm-pricing-hero h1 span { color: var(--bb-orange); }
.sahm-pricing-hero p { color: var(--bb-text-2); font-size: 14px; max-width: 500px; margin: 0 auto; }
.sahm-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 920px;
  margin: 0 auto 56px;
}
@media(max-width:700px){ .sahm-pricing-grid{ grid-template-columns: 1fr; } }
.sahm-pricing-card {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-lg);
  padding: 28px 24px;
  text-align: center;
  position: relative;
  transition: border-color var(--bb-trans), box-shadow var(--bb-trans);
}
.sahm-pricing-card:hover {
  border-color: var(--bb-border-2);
  box-shadow: var(--bb-shadow);
}
.sahm-pricing-card-featured {
  border-color: var(--bb-orange) !important;
  box-shadow: 0 0 0 1px var(--bb-orange), var(--bb-glow);
}
.sahm-pricing-ribbon {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bb-orange);
  color: #000;
  font-family: var(--bb-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.sahm-pricing-name { font-family: var(--bb-mono); font-size: 14px; color: var(--bb-text-2); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 20px; }
.sahm-pricing-price { margin-bottom: 4px; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.sahm-pricing-currency { font-size: 18px; font-weight: 600; color: var(--bb-text-2); margin-bottom: 6px; }
.sahm-pricing-amount { font-size: 44px; font-weight: 800; color: var(--bb-text); line-height: 1; }
.sahm-pricing-credits { font-family: var(--bb-mono); font-size: 15px; color: var(--bb-orange); margin-bottom: 4px; font-weight: 600; }
.sahm-pricing-per { font-family: var(--bb-mono); font-size: 14px; color: var(--bb-text-3); margin-bottom: 24px; }
.sahm-pricing-features { list-style: none; padding: 0; margin: 0 0 24px; text-align: left; }
.sahm-pricing-features li { padding: 6px 0; border-bottom: 1px solid var(--bb-border); font-size: 15px; color: #a8bbd4; display: flex; align-items: center; gap: 8px; }
.sahm-pricing-features li::before { content: '✓'; color: var(--bb-green); font-weight: 700; font-family: var(--bb-mono); }
.sahm-pricing-features li:last-child { border-bottom: none; }
.sahm-faq { border: 1px solid var(--bb-border); border-radius: var(--bb-radius); padding: 12px 16px; margin-bottom: 6px; }
.sahm-faq summary { cursor: pointer; font-weight: 600; font-size: 15px; color: var(--bb-text); }
.sahm-faq p { margin: 10px 0 0; color: var(--bb-text-2); font-size: 15px; line-height: 1.6; }

/* ── Dashboard ──────────────────────────────────────────────────── */
.sahm-dashboard-app { padding: 24px; background: var(--bb-bg); min-height: 80vh; }
.sahm-dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bb-border);
}
.sahm-dashboard-header h1 { font-size: 16px; font-family: var(--bb-mono); }
.sahm-dashboard-header h1 span { color: var(--bb-orange); }
.sahm-stat-primary { border-left: 2px solid var(--bb-orange); }
.sahm-stat-card {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius);
  padding: 16px 20px;
}
.sahm-stat-label { font-family: var(--bb-mono); font-size: 16px; color: #7a9bb8; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.sahm-stat-value { font-family: var(--bb-mono); font-size: 28px; font-weight: 800; }
.sahm-saved-list { list-style: none; padding: 0; margin: 0; }
.sahm-saved-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--bb-border); }
.sahm-saved-item a { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 10px; }
.sahm-saved-item a:hover .sahm-saved-name { color: var(--bb-orange); }
.sahm-saved-ticker { font-family: var(--bb-mono); font-weight: 700; color: var(--bb-orange); font-size: 16px; }
.sahm-saved-name { font-size: 16px; color: #c8d8ea; }
.sahm-link-danger { background: none; border: none; color: var(--bb-text-3); font-size: 16px; cursor: pointer; padding: 4px 8px; }
.sahm-link-danger:hover { color: var(--bb-red); }
.sahm-export-row { display: flex; gap: 10px; align-items: center; }
.sahm-muted { color: var(--bb-text-3); font-size: 15px; }

/* ── Account page ───────────────────────────────────────────────── */
.sahm-account-app { padding: 24px; background: var(--bb-bg); }
.sahm-table-kv tbody td:first-child { text-align: left; font-family: var(--bb-font); font-size: 15px; }
.sahm-table-kv tbody td:last-child  { color: var(--bb-text); font-weight: 600; }

/* ── Loader / spinner ───────────────────────────────────────────── */
.sahm-loader { display: flex; align-items: center; justify-content: center; padding: 60px; }
.sahm-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--bb-border);
  border-top-color: var(--bb-orange);
  border-radius: 50%;
  animation: sahm-spin .7s linear infinite;
}
@keyframes sahm-spin { to { transform: rotate(360deg); } }

/* Loading skeleton */
.sahm-skel {
  background: linear-gradient(90deg, var(--bb-surface-2) 25%, var(--bb-surface-3) 50%, var(--bb-surface-2) 75%);
  background-size: 200% 100%;
  animation: sahm-skel 1.4s ease infinite;
  border-radius: var(--bb-radius);
  height: 14px;
}
@keyframes sahm-skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Notification toast ─────────────────────────────────────────── */
.sahm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sahm-toast-item {
  padding: 10px 18px;
  border-radius: var(--bb-radius);
  font-family: var(--bb-mono);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--bb-shadow);
  animation: sahm-slide-in .2s ease;
}
@keyframes sahm-slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.sahm-toast-item.success { background: var(--bb-surface-2); border: 1px solid rgba(0,200,83,.4); color: var(--bb-green); }
.sahm-toast-item.error   { background: var(--bb-surface-2); border: 1px solid rgba(255,61,90,.4); color: var(--bb-red); }
.sahm-toast-item.info    { background: var(--bb-surface-2); border: 1px solid rgba(0,212,255,.3); color: var(--bb-cyan); }

/* ── Empty state ────────────────────────────────────────────────── */
.sahm-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--bb-text-3);
  font-family: var(--bb-mono);
  font-size: 15px;
  letter-spacing: .06em;
}
.sahm-empty::before {
  content: '// NO DATA';
  display: block;
  font-size: 14px;
  color: var(--bb-orange);
  margin-bottom: 8px;
  opacity: .8;
}

/* ── RTL ────────────────────────────────────────────────────────── */
[dir="rtl"] .sahm-co-header,
[dir="rtl"] .sahm-dashboard-header { flex-direction: row-reverse; }
/* Per product spec: all values in all tables are centered in their column.
   Previously the first column (row labels) right-aligned in RTL; that
   exception is removed so labels and values align consistently. */
[dir="rtl"] .sahm-table thead th,
[dir="rtl"] .sahm-table tbody td { text-align: center; }

/* ── Scrollbar ──────────────────────────────────────────────────── */
.sahm-app ::-webkit-scrollbar { width: 6px; height: 6px; }
.sahm-app ::-webkit-scrollbar-track { background: var(--bb-surface); }
.sahm-app ::-webkit-scrollbar-thumb { background: var(--bb-border-2); border-radius: 3px; }
.sahm-app ::-webkit-scrollbar-thumb:hover { background: var(--bb-text-3); }

/* ── Search page layout ─────────────────────────────────────────── */
.sahm-search-app { background: var(--bb-bg); }

/* ================================================================
   THEME RESET — override WordPress theme styles within .sahm-app
   ================================================================ */

/* Hard-reset common theme overrides */
.sahm-app,
.sahm-app * {
  -webkit-font-smoothing: antialiased;
}

/* Fix themes that set inputs/selects to width:100% or display:block */
.sahm-masthead,
.sahm-cmd-bar,
.sahm-filter-row,
.sahm-filter-row-v2,
.sahm-results-bar,
.sahm-tab-bar,
.sahm-co-header,
.sahm-co-stats {
  display: flex !important;
}

.sahm-cmd-bar .sahm-cmd-input-wrap,
.sahm-filter-row,
.sahm-filter-row-v2,
.sahm-masthead {
  flex-wrap: nowrap !important;
}

/* Fix theme input/select overrides */
.sahm-filter,
.sahm-filter-num {
  display: inline-block !important;
  width: auto !important;
  max-width: none !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  border-radius: var(--bb-radius) !important;
}

.sahm-cmd-input-wrap .sahm-search-input {
  width: 100% !important;
  display: block !important;
}

/* Fix themes setting h1-h6 color/font on everything inside page content */
.sahm-app h1,
.sahm-app h2,
.sahm-app h3,
.sahm-app h4,
.sahm-app h5,
.sahm-app h6 {
  font-family: var(--bb-font) !important;
  color: var(--bb-text) !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1.25 !important;
  font-weight: 600 !important;
}

/* Fix themes that add padding/border to tables */
.sahm-app table,
.sahm-app th,
.sahm-app td {
  border: none !important;
  background: none !important;
  padding: 0 !important;
}
.sahm-results-table th,
.sahm-results-table td,
.sahm-table th,
.sahm-table td {
  padding: 9px 10px !important;
  border-bottom: 1px solid var(--bb-border) !important;
}
.sahm-results-table thead th,
.sahm-table thead th {
  border-bottom: 1px solid var(--bb-border) !important;
  background: var(--bb-surface-2) !important;
}

/* Fix themes adding margin/padding to ul/li inside shortcode output */
.sahm-app ul,
.sahm-app ol {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

/* Fix themes adding box-shadow or border to button */
.sahm-app button,
.sahm-app .sahm-btn {
  box-shadow: none !important;
  text-decoration: none !important;
  outline: none !important;
}

/* Fix themes that color links */
.sahm-app a {
  color: inherit !important;
  text-decoration: none !important;
}
.sahm-app a:hover { text-decoration: none !important; }

/* Ensure the dark background actually shows */
.sahm-app {
  background: var(--bb-bg) !important;
  color: var(--bb-text) !important;
}

/* Ensure filter row lays out horizontally */
.sahm-filter-row {
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 7px 16px !important;
  flex-wrap: wrap !important;
}

/* Ensure masthead is horizontal */
.sahm-masthead {
  flex-direction: row !important;
  align-items: center !important;
  height: 44px !important;
}

/* Override theme paragraph margins inside app */
.sahm-app p {
  margin: 0 0 8px !important;
}

/* ================================================================
   RTL — Arabic layout overrides
   Applied when .sahm-app has dir="rtl" or .sahm-rtl class
   ================================================================ */

.sahm-app[dir="rtl"],
.sahm-rtl {
  font-family: 'Segoe UI', 'Noto Sans Arabic', 'Cairo', 'Tajawal', var(--bb-font);
  text-align: right;
}

/* Masthead: logo on right, clock on left */
.sahm-app[dir="rtl"] .sahm-masthead { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-masthead-time { margin-left: 0; margin-right: auto; }

/* Command bar */
.sahm-app[dir="rtl"] .sahm-cmd-bar { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-cmd-input-wrap svg {
    left: auto; right: 12px;
}
.sahm-app[dir="rtl"] .sahm-search-input { padding: 9px 40px 9px 12px; }

/* Filter row */
.sahm-app[dir="rtl"] .sahm-filter-row { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-filter-reset { margin-left: 0; margin-right: auto; }

/* Results table */
.sahm-app[dir="rtl"] .sahm-results-table thead th,
.sahm-app[dir="rtl"] .sahm-results-table tbody td { text-align: right; }
.sahm-app[dir="rtl"] .sahm-results-table .col-ticker,
.sahm-app[dir="rtl"] .sahm-results-table .col-name,
.sahm-app[dir="rtl"] .sahm-results-table .col-sector { text-align: right; }
.sahm-app[dir="rtl"] .sahm-results-table .col-num { text-align: left; }

/* Company header */
.sahm-app[dir="rtl"] .sahm-co-header { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-co-stats { margin-left: 0; margin-right: auto; }
.sahm-app[dir="rtl"] .sahm-co-tags { flex-direction: row-reverse; }

/* Tabs: right-to-left */
.sahm-app[dir="rtl"] .sahm-tab-bar { flex-direction: row-reverse; }

/* Data tables */
.sahm-app[dir="rtl"] .sahm-table thead th { text-align: center; }
.sahm-app[dir="rtl"] .sahm-table thead th:first-child { text-align: right; }
.sahm-app[dir="rtl"] .sahm-table tbody td { text-align: center; }
.sahm-app[dir="rtl"] .sahm-table tbody td:first-child { text-align: right; }

/* Metric rows */
.sahm-app[dir="rtl"] .sahm-metric-row { flex-direction: row-reverse; }

/* KPI grid */
.sahm-app[dir="rtl"] .sahm-kpi { text-align: right; }
.sahm-app[dir="rtl"] .sahm-kpi::before { right: auto; left: 0; }

/* Paywall */
.sahm-app[dir="rtl"] .sahm-paywall-actions { flex-direction: row-reverse; }

/* Dashboard */
.sahm-app[dir="rtl"] .sahm-dashboard-header { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-saved-item { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-saved-item a { flex-direction: row-reverse; }

/* Tags */
.sahm-app[dir="rtl"] .sahm-co-stat-label,
.sahm-app[dir="rtl"] .sahm-kpi-label,
.sahm-app[dir="rtl"] .sahm-metric-label { text-align: right; letter-spacing: 0; }

/* Monospace numbers stay LTR even in RTL layout */
.sahm-app[dir="rtl"] .sahm-kpi-value,
.sahm-app[dir="rtl"] .sahm-co-stat-value,
.sahm-app[dir="rtl"] .sahm-metric-value,
.sahm-app[dir="rtl"] .sahm-table tbody td:not(:first-child) {
    direction: ltr;
    unicode-bidi: embed;
}

/* Pricing page RTL */
.sahm-app[dir="rtl"] .sahm-pricing-features li { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-pricing-features li::before { margin-right: 0; margin-left: 8px; }

/* Arabic font enhancement — load Noto Sans Arabic from Google Fonts via JS */
.sahm-rtl .sahm-panel-title,
.sahm-rtl .sahm-co-name,
.sahm-rtl h3,
.sahm-app[dir="rtl"] .sahm-panel-title,
.sahm-app[dir="rtl"] .sahm-co-name {
    font-family: 'Noto Sans Arabic', 'Cairo', 'Tajawal', system-ui;
}

/* ── Full-width body override ── */
body.sahm-page .entry-content,
body.sahm-page .post-content,
body.sahm-page .page-content,
body.sahm-page article.page {
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ================================================================
   RTL — Forced Arabic layout (always applied)
   ================================================================ */

/* Global RTL reset when sahm-rtl is present on any ancestor */
html:has(.sahm-app),
body:has(.sahm-app) {
  direction: rtl;
}

/* Base direction */
.sahm-app, .sahm-app * {
  font-family: 'Noto Sans Arabic', 'Cairo', 'Segoe UI', var(--bb-font) !important;
}
.sahm-app[dir="rtl"], .sahm-rtl {
  direction: rtl;
  text-align: right;
}

/* Masthead */
.sahm-app[dir="rtl"] .sahm-masthead {
  flex-direction: row-reverse;
}
.sahm-app[dir="rtl"] .sahm-masthead-time {
  margin-left: 0;
  margin-right: auto;
}

/* Nav bar */
.sahm-app[dir="rtl"] .sahm-nav,
.sahm-nav {
  direction: rtl;
}
.sahm-app[dir="rtl"] .sahm-nav-links {
  flex-direction: row-reverse;
}
.sahm-nav-user {
  margin-left: 0 !important;
  margin-right: auto;
}
.sahm-app[dir="rtl"] .sahm-nav-dropdown {
  right: auto;
  left: 0;
}
.sahm-app[dir="rtl"] .sahm-nav-user-info {
  text-align: right;
}

/* Company header */
.sahm-app[dir="rtl"] .sahm-co-header {
  flex-direction: row-reverse;
}
.sahm-app[dir="rtl"] .sahm-co-tags {
  flex-direction: row-reverse;
}
.sahm-app[dir="rtl"] .sahm-co-stats {
  flex-direction: row-reverse;
  margin-left: 0;
  margin-right: auto;
}
.sahm-app[dir="rtl"] .sahm-co-stat {
  text-align: right;
}
.sahm-app[dir="rtl"] .sahm-co-stat-label { text-align: right; }
.sahm-app[dir="rtl"] .sahm-co-stat-value { text-align: right; }

/* Tabs */
.sahm-app[dir="rtl"] .sahm-tab-bar {
  flex-direction: row-reverse;
}

/* Tables */
.sahm-app[dir="rtl"] .sahm-table thead th,
.sahm-app[dir="rtl"] .sahm-results-table thead th { text-align: right; }
.sahm-app[dir="rtl"] .sahm-table tbody td,
.sahm-app[dir="rtl"] .sahm-results-table tbody td { text-align: right; }
/* Numbers stay LTR */
.sahm-app[dir="rtl"] .sahm-table tbody td:not(:first-child),
.sahm-app[dir="rtl"] .sahm-results-table tbody td:last-child,
.sahm-app[dir="rtl"] .sahm-results-table tbody td:nth-last-child(2) {
  direction: ltr;
  unicode-bidi: embed;
  text-align: left;
}

/* Search */
.sahm-app[dir="rtl"] .sahm-cmd-bar { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-cmd-input-wrap svg {
  left: auto;
  right: 12px;
}
.sahm-app[dir="rtl"] .sahm-search-input {
  padding: 9px 40px 9px 12px;
  text-align: right;
}
.sahm-app[dir="rtl"] .sahm-filter-row { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-filter-reset { margin-left: 0; margin-right: 0; }
.sahm-app[dir="rtl"] .sahm-results-bar { flex-direction: row-reverse; }

/* Metric rows */
.sahm-app[dir="rtl"] .sahm-metric-row { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-metric-label { text-align: right; }
.sahm-app[dir="rtl"] .sahm-metric-value { text-align: left; direction: ltr; }

/* KPI grid */
.sahm-app[dir="rtl"] .sahm-kpi { text-align: right; }
.sahm-app[dir="rtl"] .sahm-kpi-label { text-align: right; letter-spacing: 0; }
.sahm-app[dir="rtl"] .sahm-kpi-value { direction: ltr; text-align: right; }

/* Cards */
.sahm-app[dir="rtl"] .sahm-card h3 { text-align: right; }

/* Paywall */
.sahm-app[dir="rtl"] .sahm-paywall-inner { text-align: center; }
.sahm-app[dir="rtl"] .sahm-paywall-actions { flex-direction: row-reverse; justify-content: center; }

/* Dashboard */
.sahm-app[dir="rtl"] .sahm-stat-card { text-align: right; }
.sahm-app[dir="rtl"] .sahm-saved-item { flex-direction: row-reverse; }
.sahm-app[dir="rtl"] .sahm-saved-item a { flex-direction: row-reverse; }

/* Pricing */
.sahm-app[dir="rtl"] .sahm-pricing-hero { text-align: center; }
.sahm-app[dir="rtl"] .sahm-pricing-card { text-align: right; }
.sahm-app[dir="rtl"] .sahm-pricing-features li { text-align: right; }
.sahm-app[dir="rtl"] .sahm-pricing-features li::before { margin-right: 0; margin-left: 8px; }

/* Account */
.sahm-app[dir="rtl"] .sahm-profile-row { flex-direction: row-reverse; }

/* Buttons in RTL */
.sahm-app[dir="rtl"] .sahm-btn { letter-spacing: 0; }


/* ── Overview chart panels — full width, proper height ─────── */
.sahm-tabpane[data-pane="overview"] .sahm-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  min-height: 340px;
}
.sahm-tabpane[data-pane="overview"] .sahm-card h3 {
  margin: 0 0 16px 0;
  flex-shrink: 0;
}
.sahm-tabpane[data-pane="overview"] .sahm-card canvas {
  flex: 1;
  width: 100% !important;
  min-height: 260px;
  max-height: 320px;
}

/* All other chart cards */
.sahm-tabpane:not([data-pane="overview"]) .sahm-card canvas {
  width: 100% !important;
  min-height: 200px;
  max-height: 280px;
}

/* KPI grid — tighter, no overflow */
#sahm-kpi-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 900px) {
  #sahm-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .sahm-tabpane[data-pane="overview"] .sahm-card { min-height: 380px; }
  .sahm-tabpane[data-pane="overview"] .sahm-card canvas { min-height: 380px; }
}

/* Fix chart container to fill card width */
.sahm-card { position: relative; overflow: hidden; }

/* ── Chart wrapper — controls canvas dimensions precisely ─── */
.sahm-chart-card {
  display: flex;
  flex-direction: column;
  min-height: 380px;
  padding: 20px 20px 14px !important;
}
.sahm-chart-card h3 {
  margin: 0 0 14px !important;
  flex-shrink: 0;
  font-size: 14px !important;
}
.sahm-chart-wrap {
  flex: 1;
  position: relative;
  width: 100%;
  min-height: 380px;
}
.sahm-chart-wrap canvas {
  position: absolute !important;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Fix other tab chart cards */
.sahm-tabpane:not([data-pane="overview"]) .sahm-card canvas {
  display: block;
  width: 100% !important;
  min-height: 220px;
  max-height: none !important;
}

/* KPI cards — consistent height */
.sahm-kpi {
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ── Table center alignment (final override) ─────────────────────── */
.sahm-table thead th,
.sahm-app .sahm-table thead th,
.sahm-app[dir="rtl"] .sahm-table thead th,
[dir="rtl"] .sahm-table thead th { text-align: center !important; }

.sahm-table tbody td,
.sahm-app .sahm-table tbody td,
.sahm-app[dir="rtl"] .sahm-table tbody td,
[dir="rtl"] .sahm-table tbody td { text-align: center !important; }

.sahm-table thead th:first-child,
.sahm-app .sahm-table thead th:first-child,
.sahm-app[dir="rtl"] .sahm-table thead th:first-child,
[dir="rtl"] .sahm-table thead th:first-child { text-align: center !important; }

.sahm-table tbody td:first-child,
.sahm-app .sahm-table tbody td:first-child,
.sahm-app[dir="rtl"] .sahm-table tbody td:first-child,
[dir="rtl"] .sahm-table tbody td:first-child { text-align: right !important; }

/* ═══════════════════════════════════════════════════════════════
   DCF TAB — Professional Section Layout
═══════════════════════════════════════════════════════════════ */

/* Section wrapper — adds consistent vertical rhythm */
.sahm-dcf-section {
  margin-bottom: 20px;
}

/* Section header — numbered divider with accent dot */
.sahm-dcf-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--bb-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--bb-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bb-border);
}

.sahm-dcf-section-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bb-orange);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--bb-orange);
}

/* Card sub-label inside section cards */
.sahm-card-label {
  font-family: var(--bb-mono);
  font-size: 11px;
  color: var(--bb-text-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bb-border);
  text-transform: uppercase;
}

/* DCF summary card — full bleed, no extra margin */
#sahm-dcf-summary {
  padding: 20px 24px;
}

/* Tighter table wrap inside DCF projections */
#sahm-dcf-projections .sahm-table {
  font-size: 12px;
}
#sahm-dcf-projections .sahm-table thead th,
#sahm-dcf-projections .sahm-table tbody td {
  padding: 7px 10px;
}

/* Scenario cards in prob engine — horizontal layout */
#sahm-prob-engine > div:first-child {
  margin-bottom: 12px;
}

/* Sensitivity matrix — compact */
#sahm-sensitivity-matrix .sahm-table {
  font-size: 12px;
}
#sahm-sensitivity-matrix .sahm-table thead th,
#sahm-sensitivity-matrix .sahm-table tbody td {
  padding: 6px 10px;
}

/* Reverse DCF grid cards — equal height */
#sahm-reverse-dcf > div {
  height: 100%;
}

/* Export button — right aligned */
#sahm-export-csv {
  margin-left: auto;
}

/* Responsive: stack to single column on small screens */
@media (max-width: 768px) {
  .sahm-dcf-section-header {
    font-size: 11px;
  }
  #sahm-dcf-summary {
    padding: 14px 16px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SEARCH — Hero Bar v2
═══════════════════════════════════════════════════════════════ */

@keyframes sahm-spin { to { transform: rotate(360deg); } }

/* Full-width hero */
.sahm-search-hero {
  background: #0a0c0f;
  border-bottom: 2px solid #1e2535;
  padding: 32px 48px 28px;
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  box-sizing: border-box !important;
}

/* Center content, RTL-safe */
.sahm-search-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  direction: rtl;
  text-align: right;
}

/* Label row */
.sahm-search-hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--bb-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--bb-orange);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* Input wrapper — full width */
.sahm-search-hero-input-wrap {
  position: relative;
  width: 100%;
  display: block !important;
}

/* Search icon — right side for RTL */
.sahm-search-hero-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #4a6080;
  pointer-events: none;
}

/* The input field */
.sahm-search-hero-field {
  width: 100% !important;
  display: block !important;
  background: #111827 !important;
  color: #e2e8f0 !important;
  border: 2px solid #1e2d40;
  border-radius: 12px;
  color: #e2e8f0;
  font-family: var(--bb-mono);
  font-size: 17px;
  /* RTL: text on left, icon on right */
  padding: 15px 50px 15px 48px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: rtl;
  text-align: right;
}

.sahm-search-hero-field::placeholder {
  color: #3a4a60;
}

.sahm-search-hero-field:focus {
  border-color: var(--bb-orange);
  box-shadow: 0 0 0 4px rgba(255,107,0,0.10), 0 8px 32px rgba(0,0,0,0.5);
  background: #131c2e;
}

/* Spinner — left side (start of input in RTL) */
.sahm-search-hero-spinner {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bb-orange);
  line-height: 0;
}
.sahm-search-hero-spinner svg {
  animation: sahm-spin 0.8s linear infinite;
}

/* ── Filters row v2 ──────────────────────────────────────── */
.sahm-filter-row-v2 {
  padding: 10px 48px;
  background: #0d1117;
  border-bottom: 1px solid #1a2232;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  direction: rtl;
}

.sahm-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sahm-filter-label {
  font-family: var(--bb-mono);
  font-size: 10px;
  color: #4a6a88;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sahm-filter-v2 {
  background: #111827;
  border: 1px solid #1e2d40;
  border-radius: 6px;
  color: #a8bbd4;
  font-family: var(--bb-mono);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  min-width: 110px;
  direction: rtl;
}
.sahm-filter-v2:focus,
.sahm-filter-v2:hover { border-color: var(--bb-orange); color: #e2e8f0; }
.sahm-filter-v2 option { background: #111827; }

.sahm-filter-reset-v2 {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid #1e2d40;
  border-radius: 6px;
  color: #4a6a88;
  font-family: var(--bb-mono);
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-left: auto;
}
.sahm-filter-reset-v2:hover { color: #ff3d5a; border-color: #ff3d5a; }

.sahm-results-pill {
  font-family: var(--bb-mono);
  font-size: 11px;
  color: #a8bbd4;
  background: #111827;
  border: 1px solid #1e2d40;
  border-radius: 20px;
  padding: 4px 14px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .sahm-search-hero { padding: 20px 16px 18px; }
  .sahm-filter-row-v2 { padding: 10px 16px; }
  .sahm-search-hero-field { font-size: 15px; padding: 13px 46px 13px 40px; }
}
/* Force search input dark background regardless of theme */
#sahm-search-input,
#sahm-search-input:focus,
#sahm-search-input:active {
  background: #111827 !important;
  background-color: #111827 !important;
  color: #e2e8f0 !important;
  border-color: #1e2d40 !important;
}
#sahm-search-input:focus {
  border-color: #ff6b00 !important;
  box-shadow: 0 0 0 3px rgba(255,107,0,0.12) !important;
}

