/* Design tokens — keep in sync with theme.py TOKENS (see DESIGN.md). */

:root,
:root[data-theme="light"] {
  --bg: #FAFAF8;
  --panel: #FFFFFF;
  --text: #0F2A43;
  --muted: #5B6B7C;
  --border: #E3E0D8;
  --accent: #1A2F5A;
  --pos: #1B7F4D;
  --neg: #B3392E;
}

:root[data-theme="dark"] {
  --bg: #0B0E14;
  --panel: #11161F;
  --text: #D7DEE8;
  --muted: #8A97A8;
  --border: #1E2633;
  --accent: #7FA8D9;
  --pos: #2BBF77;
  --neg: #E4574A;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.2s ease, color 0.2s ease;
}

/* ---- Header ---- */

.app-header {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 0 32px;
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  gap: 6px;
  align-items: baseline;
  letter-spacing: 0.02em;
}

.brand-strong {
  font-weight: 700;
  font-size: 16px;
}

.brand-light {
  font-weight: 300;
  font-size: 16px;
  color: var(--muted);
}

.app-nav {
  display: flex;
  gap: 24px;
  flex: 1;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: var(--text);
}

/* The language and theme toggles are one pair of pills, set closer to each
   other than to the rest of the header. */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.lang-toggle {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.theme-toggle:hover,
.lang-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* ---- Refresh control ---- */

.refresh-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.data-freshness {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.refresh-status {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
}

.refresh-button {
  background: var(--accent);
  color: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.refresh-button:hover {
  opacity: 0.9;
}

.refresh-button:disabled {
  opacity: 0.5;
  cursor: progress;
}

/* ---- Layout ---- */

/* Column shell so the footer sits at the bottom of short pages. */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px 48px;
  flex: 1 0 auto;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 8px 0 4px;
}

.page-subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 13px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px 24px;
  margin-bottom: 28px;
}

.panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.01em;
}

.panel-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.control-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---- Status strip (ML page) ---- */

.status-strip {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 28px;
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.status-value {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.footnote {
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
}

/* Stale-data warning (e.g. an outdated forecast). Text-only, no icon. */
.notice {
  color: var(--neg);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 16px;
  margin-bottom: 28px;
  background: var(--panel);
  border: 1px solid var(--neg);
  border-radius: 6px;
}

/* ---- Dropdown / date picker theming ---- */

.Select-control,
.Select-menu-outer,
.Select-menu,
.DateInput,
.DateInput_input,
.DateRangePickerInput {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  font-size: 13px !important;
}

.Select-value-label,
.Select-option {
  color: var(--text) !important;
}

.Select-option {
  background: var(--panel) !important;
}

.Select-option.is-focused {
  background: var(--bg) !important;
}

.Select-placeholder,
.Select-arrow-zone {
  color: var(--muted) !important;
}

/* Tabular numerals everywhere numbers appear in tables. */
.dash-table-container {
  font-variant-numeric: tabular-nums;
}

/* ---- Market Overview briefing ---- */

.briefing-masthead {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 8px 0 6px;
}

.briefing-title {
  font-size: 28px;
  margin-top: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.briefing-section {
  margin: 36px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.section-num {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.section-intro {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
}

/* Bullets keep list semantics; the leading rule is drawn, not an icon. */
.bullet-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.bullet {
  padding: 0 0 14px 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid var(--border);
  padding-left: 14px;
  font-size: 14px;
}

.bullet:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.bullet-topic {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.bullet-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

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

.bullet-summary {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 0;
}

.bullet-meta {
  margin-top: 6px;
}

.source-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.source-tag-dim {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.conclusion {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.conclusion-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 600;
}

.conclusion-value {
  font-size: 16px;
  color: var(--accent);
}

.conclusion-delta {
  color: var(--muted);
  font-size: 12px;
}

.conclusion-detail {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.cal-day-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 16px 0 6px;
}

.cal-list {
  margin-bottom: 8px;
}

.cal-event {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.cal-event:last-child {
  border-bottom: none;
}

.cal-when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 150px;
}

.cal-name {
  flex: 1;
  min-width: 220px;
}

.cal-impact {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.briefing-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 2px solid var(--accent);
}

/* ---- Site footer (all pages) ---- */

.app-footer {
  flex-shrink: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 22px 32px 28px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
}

.footer-colophon,
.footer-contact {
  font-size: 12px;
  color: var(--muted);
}

.footer-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

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

.footer-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Disclaimer: legally load-bearing, so it stays readable — measure capped,
   line-height opened up, never smaller than the footnote scale. */
.footer-disclaimer {
  max-width: 78ch;
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
