/* ============================================================
   Shared Econ View styles (iter21AJ)
   ------------------------------------------------------------
   Factored out of ai-focus.css so the AI Focus tab and the
   Portfolio holdings rows render the same panel. Dark palette,
   hard-coded hex (no CSS variables), semantic red / amber /
   green. The Checks | Econ sub-tab chrome (.econ-subtabs /
   .econ-subtab) lives here too since both hosts use it; each
   host keeps its own detail-wrap shell.
   ============================================================ */

.econ-subtabs {
  display: flex; gap: 4px;
  padding: 10px 16px 0;
}
.econ-subtab {
  appearance: none; cursor: pointer;
  min-height: 30px; padding: 6px 16px;
  background: transparent; color: #94a3b8;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  transition: background-color 120ms ease, color 120ms ease;
}
/* iter21AR — both tabs get the same hover affordance: a tint slightly lighter
   than the active fill, so hovering reads as "selectable" in either theme. */
.econ-subtab:hover { color: #e2e8f0; background: hsl(210, 26%, 42%); }
/* Active tab: blue-grey fill with white-ish text — clearly distinct from the
   muted inactive tab, and legible in both light and dark panel themes. */
.econ-subtab.active {
  color: hsl(210, 15%, 92%);
  background: hsl(210, 28%, 35%);
  border-color: hsl(210, 28%, 30%);
  position: relative;
}
.econ-subtab.active:hover { background: hsl(210, 28%, 40%); }
.econ-subtab:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }

/* iter21AS — info icon button after each sub-tab label. Icon-only, neutral
   muted colour with a hover/focus tint consistent with the other icon buttons
   in the panel. Padding lifts the hit area to >= 28x28. */
.econ-info-btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 5px;
  margin: 0 6px 0 -2px;
  background: transparent; color: #8b98ad;
  border: 1px solid transparent; border-radius: 6px;
  vertical-align: middle;
  transition: background-color 120ms ease, color 120ms ease;
}
.econ-info-btn:hover { color: #e2e8f0; background: hsl(210, 26%, 42%); }
.econ-info-btn:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; color: #cbd5e1; }
.econ-info-btn svg { display: block; }

/* iter21AS — right-side info drawer. Overlays content (does not push it).
   Backdrop dims the page; the panel slides in from the right. Theme-safe. */
.econ-drawer-root {
  position: fixed; inset: 0; z-index: 12000;
}
.econ-drawer-root[hidden] { display: none; }
.econ-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(2, 6, 16, 0.55);
  opacity: 0; transition: opacity 200ms ease;
}
.econ-drawer-root.open .econ-drawer-backdrop { opacity: 1; }
.econ-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 460px; max-width: 100vw;
  display: flex; flex-direction: column;
  background: #0b1220; color: #d1d5db;
  border-left: 1px solid hsl(210, 28%, 30%);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(100%);
  transition: transform 220ms ease;
  outline: none;
}
.econ-drawer-root.open .econ-drawer-panel { transform: translateX(0); }
.econ-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; flex-shrink: 0;
  border-bottom: 1px solid hsl(210, 28%, 35%);
  background: #0f172a;
}
.econ-drawer-title {
  margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.01em;
  color: #e6edf7;
}
.econ-drawer-close {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 6px;
  background: transparent; color: #8b98ad;
  border: 1px solid transparent; border-radius: 6px;
  flex-shrink: 0;
  transition: background-color 120ms ease, color 120ms ease;
}
.econ-drawer-close:hover { color: #e2e8f0; background: hsl(210, 26%, 42%); }
.econ-drawer-close:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }
.econ-drawer-body {
  flex: 1 1 auto; overflow-y: auto;
  padding: 14px 18px 24px;
  -webkit-overflow-scrolling: touch;
}
.econ-drawer-entry {
  padding: 14px 0;
  border-bottom: 1px solid #131c31;
}
.econ-drawer-entry:last-child { border-bottom: none; }
.econ-drawer-entry-title {
  font-size: 13px; font-weight: 700; color: #e6edf7;
  margin-bottom: 6px;
  padding-left: 9px; border-left: 3px solid hsl(210, 28%, 45%);
}
.econ-drawer-p {
  margin: 6px 0 0; font-size: 12px; line-height: 1.55; color: #aab6c8;
}
.econ-drawer-lead { font-weight: 800; color: var(--accent-teal); }

@media (max-width: 720px) {
  .econ-drawer-panel { width: 100vw; border-left: none; }
}

/* Loading / error / empty states */
.econ-state {
  padding: 18px 16px; font-size: 12.5px; color: #94a3b8;
}
.econ-state-error { color: #f1a9a9; }
.econ-state-loading { color: #7d8da5; }
.econ-state-empty { color: #64748b; font-style: italic; }

/* Panel container */
.econ-panel {
  padding: 12px 16px 16px;
  font-variant-numeric: tabular-nums;
  color: #d1d5db;
}
.econ-num { font-variant-numeric: tabular-nums; color: #e6edf7; }
.econ-panel .aif-na { color: #5b6573; }

/* RAG badges + dots */
.econ-badge {
  display: inline-block;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  border: 1px solid transparent; vertical-align: middle;
}
.econ-badge-green { background: rgba(16,185,129,0.14); color: #6ee7b7; border-color: rgba(16,185,129,0.4); }
.econ-badge-amber { background: rgba(245,158,11,0.14); color: #fcd34d; border-color: rgba(245,158,11,0.4); }
.econ-badge-red   { background: rgba(194,74,74,0.16);  color: #f1a9a9; border-color: rgba(194,74,74,0.45); }
.econ-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-left: 6px; vertical-align: middle;
}
.econ-dot-green { background: #10b981; }
.econ-dot-amber { background: #f59e0b; }
.econ-dot-red   { background: #C24A4A; }

/* Info tooltip chip */
.econ-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: #1f2937; color: #94a3b8;
  font-size: 9px; font-weight: 700; font-style: normal;
  cursor: help; vertical-align: middle;
}
.econ-tip:hover, .econ-tip:focus-visible { background: #2b3a55; color: #cbd5e1; outline: none; }

/* Header card */
.econ-header {
  background: #0f172a; border: 1px solid #1f2937; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px;
}
.econ-header-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 6px;
}
.econ-header-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: #94a3b8;
}
.econ-header-badge { font-size: 11px; color: #94a3b8; }
.econ-headline { font-size: 13.5px; font-weight: 600; color: #e6edf7; line-height: 1.45; }
.econ-detail { font-size: 12.5px; color: #aab6c8; line-height: 1.5; margin-top: 5px; }
.econ-updated { font-size: 11px; color: #64748b; margin-top: 8px; }

/* KPI grid: 6x1 wide, 3x2 mid, 2-up small, single-column mobile */
.econ-kpi-grid {
  display: grid; gap: 8px; margin-bottom: 12px;
  grid-template-columns: repeat(6, 1fr);
}
.econ-kpi {
  background: #0f172a; border: 1px solid #1f2937; border-radius: 9px;
  padding: 9px 10px; min-width: 0;
}
.econ-kpi-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #8b98ad;
  display: flex; align-items: center; gap: 4px;
}
.econ-kpi-value { font-size: 17px; font-weight: 700; color: #e6edf7; margin-top: 3px; }
.econ-kpi-anchor { font-size: 11px; color: #7d8da5; margin-top: 2px; min-height: 14px; }
.econ-anchor-label { color: #5b6573; }
.econ-kpi-hint { font-size: 10.5px; color: #5b6573; margin-top: 4px; }

@media (max-width: 1100px) {
  .econ-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .econ-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .econ-panel { padding: 10px 12px 14px; }
}
@media (max-width: 460px) {
  .econ-kpi-grid { grid-template-columns: 1fr; }
  .econ-subtab { flex: 1; text-align: center; }
}

/* ── interpretation panels ─────────────────────────── */
.econ-section-grid {
  display: grid; gap: 8px; margin-bottom: 12px;
  grid-template-columns: repeat(3, 1fr);
}
.econ-section {
  background: #0f172a; border: 1px solid #1f2937; border-radius: 9px;
  padding: 10px 12px; margin-bottom: 12px; min-width: 0;
}
.econ-section-grid .econ-section { margin-bottom: 0; }
.econ-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.econ-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #94a3b8;
}
.econ-section-rows { display: flex; flex-direction: column; gap: 5px; }
.econ-mrow {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  align-items: baseline;
  padding: 3px 0; border-bottom: 1px solid #131c31;
}
.econ-mrow:last-child { border-bottom: none; }
.econ-mrow-label {
  font-size: 11.5px; color: #aab6c8;
  display: flex; align-items: center; gap: 4px;
}
.econ-mrow-value { font-size: 13px; font-weight: 600; color: #e6edf7; text-align: right; }
.econ-mrow-compare {
  grid-column: 1 / -1; font-size: 10.5px; color: #5b6573; text-align: right;
}
.econ-section-explain {
  font-size: 11.5px; color: #8b98ad; line-height: 1.5; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid #131c31;
}

/* Cycle state */
.econ-cycle-stagebar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin: 4px 0 8px;
}
.econ-stage-step {
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
  text-align: center; padding: 5px 2px; border-radius: 5px;
  background: #0b1220; color: #5b6573; border: 1px solid #1f2937;
}
.econ-stage-step.active {
  background: rgba(29,78,216,0.18); color: #93c5fd; border-color: #2b4a8b;
}
.econ-cycle-stagelabel { font-size: 13px; font-weight: 700; color: #e6edf7; }
.econ-cycle-conf { font-size: 11px; font-weight: 500; color: #7d8da5; }
.econ-cycle-drivers {
  list-style: none; margin: 8px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.econ-cycle-drivers li {
  font-size: 11.5px; color: #aab6c8; padding-left: 14px; position: relative; line-height: 1.45;
}
.econ-cycle-drivers li:before {
  content: '·'; position: absolute; left: 4px; color: #5b6573; font-weight: 700;
}

/* Flags grid */
.econ-flags-grid {
  display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr);
}
.econ-flag {
  background: #0b1220; border: 1px solid #1f2937; border-radius: 8px;
  border-left-width: 3px; padding: 8px 10px;
}
.econ-flag-green { border-left-color: #10b981; }
.econ-flag-amber { border-left-color: #f59e0b; }
.econ-flag-red   { border-left-color: #C24A4A; }
.econ-flag-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: #cbd5e1; margin-bottom: 4px;
}
.econ-flag-text { font-size: 11px; color: #8b98ad; line-height: 1.45; }

@media (max-width: 1100px) {
  .econ-section-grid { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .econ-flags-grid { grid-template-columns: 1fr; }
  .econ-cycle-stagebar { grid-template-columns: repeat(2, 1fr); }
}

/* ── 5Y mini trend sparklines ──────────────────────── */
.econ-trend-grid {
  display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr);
}
.econ-trend {
  background: #0b1220; border: 1px solid #1f2937; border-radius: 8px;
  padding: 8px 10px; min-width: 0;
}
.econ-trend-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
  margin-bottom: 6px;
}
.econ-trend-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: #8b98ad;
  display: flex; align-items: center; gap: 4px;
}
.econ-trend-latest { font-size: 12px; font-weight: 700; color: #e6edf7; }
.econ-spark {
  display: block; width: 100%; height: 30px;
}
.econ-spark-bar { fill: #2b4a8b; transition: fill 120ms ease; }
.econ-spark-bar:hover { fill: #3b82f6; }
.econ-spark-bar.last { fill: #5e9bf0; }
.econ-spark-empty { font-size: 10.5px; color: #5b6573; font-style: italic; padding: 8px 0; }

@media (max-width: 720px) {
  .econ-trend-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
  .econ-trend-grid { grid-template-columns: 1fr; }
}
