/* ═══════════════════════════════════════════════════════════
   Treasury Desk — style.css
   
   Institutional dark theme. Calm, focused, premium.
   Design language: deep charcoal, generous whitespace,
   strong typographic hierarchy, clean hover states.
   ═══════════════════════════════════════════════════════════ */

/* === TOKENS ================================================ */

:root {
  /* Backgrounds — layered depth */
  --bg:          #0f1217;   /* page base — deep charcoal, not pure black */
  --bg-raised:   #171e2a;   /* card / section surface */
  --bg-inset:    #0b0f17;   /* inside cards — slightly deeper */
  --bg-hover:    #1e2840;   /* hover state */

  /* Borders */
  --border:      #1e2d40;
  --border-md:   #2e4057;
  --border-hi:   #3d5570;

  /* Typography */
  --text:        #e8edf3;   /* primary */
  --text-2:      #8fa3bb;   /* secondary / labels */
  --text-3:      #4e6378;   /* dimmed / dates */

  /* Accents */
  --blue:        #3b82f6;
  --blue-lt:     #60a5fa;
  --blue-bg:     rgba(59,130,246,0.10);
  --blue-border: rgba(59,130,246,0.28);

  --indigo:      #6366f1;
  --indigo-bg:   rgba(99,102,241,0.10);

  --green:       #22d3a0;   /* approx teal-green — calm, not garish */
  --green-bg:    rgba(34,211,160,0.09);
  --green-border:rgba(34,211,160,0.28);

  --red:         #f87171;
  --red-bg:      rgba(248,113,113,0.09);
  --red-border:  rgba(248,113,113,0.28);

  --amber:       #f59e0b;
  --amber-bg:    rgba(245,158,11,0.09);
  --amber-border:rgba(245,158,11,0.28);

  /* Typography */
  --font:      -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --mono:      'Cascadia Code', 'JetBrains Mono', 'Consolas', 'SF Mono', monospace;

  /* Layout */
  --max-w:       1320px;
  --section-gap: 24px;      /* tighter for 2-col grid rows */
  --section-pad: 24px;
  --card-radius: 10px;
  --radius-sm:   5px;
}

/* === RESET ================================================= */

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border-md); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--border-hi); }


/* === MARKET TICKER ========================================= */
/* Slim scrolling strip. Pauses on hover.                    */

#market-ticker {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  height: 34px;
  overflow: hidden;
  position: relative;
  /* Edge fade for a clean look */
  -webkit-mask-image: linear-gradient(90deg,transparent 0%,#000 4%,#000 96%,transparent 100%);
  mask-image:         linear-gradient(90deg,transparent 0%,#000 4%,#000 96%,transparent 100%);
}

#ticker-content {
  display: inline-flex;
  align-items: center;
  height: 34px;
  white-space: nowrap;
  /* Duration tuned to item count — 80s for comfortable reading */
  animation: ticker-scroll 80s linear infinite;
  will-change: transform;
}
#ticker-content:hover { animation-play-state: paused; cursor: default; }

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.tk-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 18px;
  font-family: var(--mono);
  font-size: 11.5px;
}
.tk-lbl {
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tk-val  { color: var(--text); font-weight: 600; }
.tk-chg  { font-size: 10.5px; font-weight: 600; }
.tk-up   { color: var(--green); }
.tk-dn   { color: var(--red);   }
.tk-flat { color: var(--text-3); }
.tk-sep  { color: var(--border-md); font-size: 10px; padding: 0 4px; }


/* === HEADER ================================================ */

#app-header {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-mark {
  font-size: 24px;
  color: var(--blue);
  line-height: 1;
  opacity: 0.9;
}
.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.brand-sub {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}
.brand-beta {
  font-size: 9px;
  font-weight: 700;
  color: var(--blue-lt);
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  vertical-align: 1px;
}

/* Status cluster */
.header-status {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.header-meta {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
  white-space: nowrap;
}

/* Badges */
.mkt-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.7px; white-space: nowrap;
}
.mkt-open   { background:var(--green-bg); color:var(--green); border:1px solid var(--green-border); }
.mkt-closed { background:rgba(80,80,90,0.15); color:var(--text-3); border:1px solid var(--border); }
.fomc-badge {
  font-size: 10px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
  background: var(--blue-bg); color: var(--blue-lt); border: 1px solid var(--blue-border);
}
.fomc-imminent {
  background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border);
}

/* Action buttons */
.header-actions { display:flex; gap:6px; flex-shrink:0; }
.action-btn {
  width:30px; height:30px;
  background:transparent; border:1px solid var(--border);
  color:var(--text-3); border-radius:var(--radius-sm);
  cursor:pointer; font-size:14px;
  display:flex; align-items:center; justify-content:center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.action-btn:hover { background:var(--bg-hover); border-color:var(--border-md); color:var(--text); }
.action-btn.spinning { animation: spin 0.85s linear infinite; pointer-events:none; opacity:0.5; }
@keyframes spin { to { transform:rotate(360deg); } }


/* === ALERT BAR ============================================= */

#alert-bar { display:none; max-width:var(--max-w); margin:0 auto; padding:6px 32px; }
.alert-item {
  display:flex; align-items:center; gap:8px;
  padding:8px 14px; border-radius:var(--radius-sm);
  font-size:12px; font-weight:500; margin-bottom:4px;
}
.alert-pip { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.alert-red    { background:var(--red-bg);   border:1px solid var(--red-border);   color:var(--red);   }
.alert-yellow { background:var(--amber-bg); border:1px solid var(--amber-border); color:var(--amber); }
.alert-green  { background:var(--green-bg); border:1px solid var(--green-border); color:var(--green); }
.alert-red    .alert-pip { background:var(--red);   }
.alert-yellow .alert-pip { background:var(--amber); }
.alert-green  .alert-pip { background:var(--green); }


/* === RISK SUMMARY PILLS ==================================== */

.risk-pills {
  max-width: var(--max-w); margin: 0 auto;
  padding: 8px 32px 0;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.risk-pills:empty { display: none; }
.risk-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700; font-family: var(--mono);
  white-space: nowrap;
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--text-2);
  transition: border-color 0.15s;
}
.risk-pill-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-3); font-weight: 600;
}
.risk-pill-green  { background:var(--green-bg);  color:var(--green);  border-color:var(--green-border); }
.risk-pill-yellow { background:var(--amber-bg);  color:var(--amber);  border-color:var(--amber-border); }
.risk-pill-red    { background:var(--red-bg);     color:var(--red);    border-color:var(--red-border); }


/* === RATE MOVEMENT ALERTS ================================== */

.rate-alerts {
  max-width: var(--max-w); margin: 0 auto;
  padding: 6px 32px 0;
  display: flex; flex-direction: column; gap: 4px;
}
.rate-alerts:empty { display: none; }
.rate-alert-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 11.5px; font-weight: 500; font-family: var(--mono);
  background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber);
}
.rate-alert-item.rate-alert-red {
  background: var(--red-bg); border-color: var(--red-border); color: var(--red);
}
.rate-alert-pip {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--amber);
}
.rate-alert-red .rate-alert-pip { background: var(--red); }


/* === LOADING / SETUP ======================================= */

.loading-screen {
  display:flex; align-items:center; justify-content:center;
  min-height: 65vh;
}
.loading-inner { text-align:center; color:var(--text-3); }
.spinner {
  width:28px; height:28px; border-radius:50%;
  border:2px solid var(--border); border-top-color:var(--blue);
  animation:spin 0.7s linear infinite;
  margin:0 auto 12px;
}
.loading-inner p { font-size:13px; }
.load-err { color:var(--red); font-size:13px; text-align:center; padding:48px; line-height:1.7; }
.setup-banner {
  max-width:var(--max-w); margin:8px auto;
  padding:12px 32px; border-radius:var(--radius-sm);
  background:var(--amber-bg); border:1px solid var(--amber-border);
  color:var(--amber); font-size:13px;
}
.setup-banner code { background:rgba(245,158,11,0.15); padding:2px 6px; border-radius:3px; font-family:var(--mono); font-size:12px; }


/* === MAIN LAYOUT — TWO-COLUMN GRID =========================== */

#dashboard {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* === DASH ROW — 50/50 equal-height pairs ===================== */
.dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;         /* forces equal height */
}
.dash-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;                 /* allow shrink inside grid */
}
/* Content areas fill remaining height after section-hd */
.dash-cell .yields-chart-wrap,
.dash-cell .tv-cal-body,
.dash-cell .funding-grid,
.dash-cell .fx-cross-table,
.dash-cell .fx-conv-inline,
.dash-cell .catalyst-frame-wrap,
.dash-cell .news-feed {
  flex: 1 1 auto;
}

/* Row 3 compact — lock catalyst + news to ~320px */
.dash-row-compact > .dash-cell { max-height: 340px; overflow: hidden; }
.dash-row-compact .news-feed   { max-height: 240px; }

@media (max-width: 960px) {
  .dash-row { grid-template-columns: 1fr; }
  .dash-row-compact > .dash-cell { max-height: none; }
}


/* === DESK SECTIONS ========================================= */

.desk-section {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: var(--section-pad);
  transition: border-color 0.2s;
}
.desk-section:hover { border-color: var(--border-md); }

/* Section header */
.section-hd {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.section-hd-left { display:flex; flex-direction:column; gap:3px; }
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.section-desc {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}
.section-hd-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.data-source {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--mono);
  white-space: nowrap;
}


/* === SECTION 1 — TREASURY YIELDS ========================== */

/* Spread pill */
.spread-pill {
  font-size: 11px; font-weight: 600;
  font-family: var(--mono);
  padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
}
.spread-positive { background:var(--green-bg);  color:var(--green); border:1px solid var(--green-border); }
.spread-flat     { background:var(--amber-bg);  color:var(--amber); border:1px solid var(--amber-border); }
.spread-inverted { background:var(--red-bg);    color:var(--red);   border:1px solid var(--red-border);   }

/* === YIELDS GROUPED BAR CHART — standalone wrapper === */
.yields-chart-wrap {
  position: relative;
  min-height: 280px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px 8px;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.yields-chart-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Chart legend — bar color swatches */
.chart-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 22px;
  padding-left: 2px;
}
.leg-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--text-2);
  font-family: var(--mono);
}
.leg-swatch {
  width: 16px; height: 10px;
  border-radius: 3px; flex-shrink: 0;
}

/* === ECONOMIC CALENDAR — TradingView Widget ==================== */

.tv-cal-body {
  flex: 1 1 auto;
  min-height: 400px;
  position: relative;
}
.tv-cal-body .tradingview-widget-container {
  height: 100%;
  width: 100%;
}
.tv-cal-body .tradingview-widget-container__widget {
  height: 100%;
  width: 100%;
}
/* Hide TradingView branding link at bottom */
.tv-cal-body .tradingview-widget-copyright { display: none !important; }


/* === FUNDING in 50% column — 3-col grid ====================== */
.dash-cell .funding-grid { grid-template-columns: repeat(3, 1fr); }
.dash-cell .fund-value { font-size: 22px; }


/* === SECTION 2 — FUNDING & LIQUIDITY ====================== */

/* Signal strip — 3 compact signals below title */
.fund-signals {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.fund-signals:empty { display: none; }
.fs-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px;
}
.fs-label {
  color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; font-size: 9px;
}
.fs-val { font-weight: 700; }
.fs-green { color: var(--green); }
.fs-amber { color: var(--amber); }
.fs-red   { color: var(--red); }

/* SOFR–EFFR anchor metric — promoted to primary signal */
.fund-anchor {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 10px;
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.fund-anchor:empty { display: none; }
.fa-spread {
  font-size: 18px; font-weight: 700; font-family: var(--mono);
  color: var(--text); letter-spacing: -0.3px;
}
.fa-label {
  font-size: 10px; color: var(--text-3); font-family: var(--mono);
  font-weight: 500;
}
.fa-status {
  font-size: 10px; font-weight: 700; font-family: var(--mono);
  padding: 2px 8px; border-radius: 3px; margin-left: auto;
}
.fa-green { color: var(--green); background: var(--green-bg); border: 1px solid var(--green-border); }
.fa-amber { color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-border); }
.fa-red   { color: var(--red);   background: var(--red-bg);   border: 1px solid var(--red-border); }

/* Micro-context descriptors on cards */
.fund-micro {
  font-size: 9px; color: var(--text-3); font-family: var(--mono);
  margin-bottom: 6px; letter-spacing: 0.2px;
}

/* Auto-generated takeaway */
.fund-takeaway {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.fund-takeaway:empty { display: none; }
.ft-text {
  font-size: 11px; color: var(--text-2); line-height: 1.5;
  font-style: italic;
}

/* Legacy spread (no longer in header — keep for compat) */
.sofr-effr-spread {
  font-size: 11px; font-weight: 600;
  font-family: var(--mono); color: var(--text-2);
}

/* 5-card responsive grid (OBFR removed) */
.funding-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
@media (max-width:1080px) { .funding-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 680px) { .funding-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 420px) { .funding-grid { grid-template-columns: 1fr; } }

/* Individual funding card */
.fund-card {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 16px 18px 14px;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
  position: relative; overflow: hidden;
}
.fund-card::before {
  content: '';
  position: absolute; top:0; left:0; right:0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue-bg), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.fund-card:hover {
  border-color: var(--border-md);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
}
.fund-card:hover::before { opacity: 1; }
.fund-card-stale { opacity: 0.72; }

/* Status dot */
.fund-dot {
  display: inline-block; width:7px; height:7px;
  border-radius: 50%; margin-right: 5px; flex-shrink: 0;
}
.fund-dot-ok   { background: var(--green);  box-shadow:0 0 4px var(--green);  }
.fund-dot-warn { background: var(--amber);  box-shadow:0 0 4px var(--amber);  }
.fund-dot-na   { background: var(--red);    box-shadow:0 0 4px var(--red);    }

.fund-label {
  display: flex; align-items: center;
  font-size: 10px; font-weight: 800;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.7px;
  margin-bottom: 2px;
}
.fund-sub {
  font-size: 10px; color: var(--text-3);
  margin-bottom: 12px; line-height: 1.25;
}
.fund-value {
  font-size: 28px; font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
  letter-spacing: -0.6px;
  line-height: 1;
  margin-bottom: 6px;
}
.fund-na { color: var(--text-3); font-size: 20px; }
.fund-stale {
  font-size: 12px; color: var(--amber); margin-left: 2px;
  vertical-align: super; line-height: 0;
}
.fund-delta {
  font-size: 11px; font-family: var(--mono); font-weight: 600; margin-bottom: 2px;
}
.fd-up { color: var(--green); }
.fd-dn { color: var(--red);   }
.fund-extra { font-size: 10px; color: var(--text-3); font-family: var(--mono); }
.fund-date  { font-size: 10px; color: var(--text-3); font-family: var(--mono); margin-top: 4px; }


/* === SECTION 3 — FOREIGN EXCHANGE — UNIFIED PANEL =========== */

/* Rate table — full width, no split */
.fx-cross-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 14px;
}
.fx-cross-table thead th {
  padding: 6px 12px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.xr-th-rate, .xr-th-chg { text-align: right !important; }
.fx-cross-table tbody tr {
  height: 36px;
  border-bottom: 1px solid rgba(30,45,64,0.3);
  transition: background 0.1s;
}
.fx-cross-table tbody tr:hover { background: var(--bg-hover); }
.fx-cross-table tbody tr:last-child { border-bottom: none; }

/* Currency cell: code + name stacked */
.xr-ccy {
  padding: 4px 12px;
}
.xr-code {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  display: block;
  line-height: 1.1;
}
.xr-name {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
  display: block;
  line-height: 1.2;
}
.xr-rate {
  padding: 4px 12px;
  text-align: right;
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}
.xr-chg {
  padding: 4px 12px;
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.xr-up   { color: var(--green); }
.xr-dn   { color: var(--red); }
.xr-flat { color: var(--text-3); }
.xr-arrow { font-size: 9px; margin-right: 2px; }
.xr-pips {
  display: inline;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  margin-left: 4px;
}

/* === INLINE CONVERTER === */
.fx-conv-inline {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.fx-conv-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.fx-conv-amt {
  flex: 1.5;
  min-width: 110px;
  position: relative;
}
.fx-conv-ccy {
  flex: 0 0 60px;
  min-width: 60px;
}
.fx-conv-eq {
  font-size: 16px;
  color: var(--text-3);
  font-weight: 300;
  flex-shrink: 0;
}

/* Amount input */
.fx-amount-inner { position: relative; display: flex; align-items: center; }
.fx-base-badge {
  position: absolute; right: 8px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--text-3); pointer-events: none;
  letter-spacing: 0.4px; user-select: none;
}
.fx-amount {
  width: 100%; padding-right: 36px;
  background: var(--bg-inset); border: 1px solid var(--border);
  color: var(--text); padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  transition: border-color 0.15s;
}
.fx-amount:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.12); }

/* Currency inputs */
.fx-ccy-wrap { position: relative; }
.fx-ccy-input {
  width: 100%; text-transform: uppercase;
  background: var(--bg-inset); border: 1px solid var(--border);
  color: var(--text); padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  letter-spacing: 0.5px; text-align: center;
  transition: border-color 0.15s;
}
.fx-ccy-input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.12); }

/* Dropdown */
.fx-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  z-index: 300; max-height: 200px; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  min-width: 180px;
}
.fx-drop-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.fx-drop-item:last-child { border-bottom: none; }
.fx-drop-item:hover { background: var(--bg-hover); }
.fx-drop-code { font-family:var(--mono); font-size:11px; font-weight:700; color:var(--text); min-width:30px; }
.fx-drop-name { font-size:10px; color:var(--text-2); }

/* Swap button */
.fx-swap {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--bg-inset); border: 1px solid var(--border);
  color: var(--text-2); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.fx-swap:hover { background: var(--bg-hover); color: var(--blue-lt); border-color: var(--blue-border); }

/* Inline result */
.fx-result-main {
  font-size: 18px; font-weight: 700; font-family: var(--mono);
  color: var(--text); letter-spacing: -0.3px; line-height: 1;
  white-space: nowrap; flex-shrink: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}
.fx-result-main.fx-flash { animation: fx-flash 0.4s ease-out; }
@keyframes fx-flash { 0%{color:var(--blue-lt);} 100%{color:var(--text);} }

/* Copy button — small inline */
.fx-copy-btn {
  background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text-3); font-size: 12px; font-family: var(--mono);
  padding: 4px 6px; border-radius: 3px; cursor: pointer;
  transition: all 0.12s; flex-shrink: 0; line-height: 1;
}
.fx-copy-btn:hover { border-color: var(--blue-border); color: var(--blue-lt); }

/* Meta line: rates + change */
.fx-conv-meta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px;
  font-family: var(--mono); font-size: 10px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.fx-rate-fwd { color: var(--text-2); }
.fx-rate-rev { color: var(--text-3); }
.fx-rate-sep { color: var(--border-md); font-size: 8px; }

/* Change display inline */
.fx-result-change {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10px;
}
.fx-chg-arrow { font-size: 8px; }
.fx-chg-pct   { font-weight: 700; }
.fx-chg-pips  { color: var(--text-3); font-size: 9px; }
.fx-chg-up    { color: var(--green); }
.fx-chg-dn    { color: var(--red); }
.fx-chg-flat  { color: var(--text-3); }

/* Trend badge in header */
.fx-trend {
  font-size: 11px; font-family: var(--mono); font-weight: 600;
  padding: 2px 9px; border-radius: 20px; white-space: nowrap;
}
.fx-trend-up   { color:var(--green); background:var(--green-bg); border:1px solid var(--green-border); }
.fx-trend-dn   { color:var(--red);   background:var(--red-bg);   border:1px solid var(--red-border);   }
.fx-trend-flat { color:var(--text-3); }


/* News in grid cell — fills to match catalyst height */
#sec-news .section-hd { margin-bottom: 14px; padding-bottom: 10px; }
#sec-news .news-feed { max-height: none; flex: 1 1 auto; overflow-y: auto; }
#sec-news .news-item { padding: 8px 2px 8px 0; }
#sec-news .news-title { font-size: 12px; margin-bottom: 2px; }
#sec-news .news-meta  { font-size: 10px; }
#sec-news .news-tag   { font-size: 8px; margin-bottom: 3px; }


/* === LIVE CATALYST ========================================= */

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.live-pip {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.live-on  { color: var(--green); }
.live-on  .live-pip { background: var(--green); box-shadow: 0 0 5px var(--green); animation: pulse-pip 2s ease-in-out infinite; }
.live-off { color: var(--text-3); }
.live-off .live-pip { background: var(--text-3); }

@keyframes pulse-pip {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.catalyst-ext-link {
  font-size: 14px;
  color: var(--text-3);
  text-decoration: none;
  line-height: 1;
  transition: color 0.15s;
}
.catalyst-ext-link:hover { color: var(--text-2); }

.catalyst-frame-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;   /* 16:9 */
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
/* Live Catalyst in grid cell — iframe fills remaining height */
#sec-catalyst .section-hd { margin-bottom: 14px; padding-bottom: 10px; }
#sec-catalyst .catalyst-frame-wrap { padding-top: 0; flex: 1 1 auto; min-height: 200px; }
.catalyst-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.catalyst-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
}


/* === NEWS & INTELLIGENCE =================================== */

.news-count-badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  color: var(--blue-lt);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  font-family: var(--mono);
}
.news-count-badge:empty { display: none; }

.news-feed {
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-md) transparent;
}
.news-feed::-webkit-scrollbar       { width: 4px; }
.news-feed::-webkit-scrollbar-track { background: transparent; }
.news-feed::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }

.news-item {
  padding: 11px 2px 11px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover      { background: rgba(255,255,255,0.025); }

.news-tag {
  display: inline-block;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  padding: 1px 6px; border-radius: 3px; margin-bottom: 5px;
  font-family: var(--mono);
  background: var(--bg-hover); color: var(--text-3); border: 1px solid var(--border);
}
.news-tag-FED, .news-tag-RATES   { background: var(--blue-bg);   color: var(--blue-lt);  border-color: var(--blue-border); }
.news-tag-MARKETS                { background: var(--green-bg);  color: var(--green);    border-color: var(--green-border); }
.news-tag-ECONOMY                { background: var(--indigo-bg); color: #a5b4fc;         border-color: rgba(99,102,241,0.3); }
.news-tag-USNEWS                 { background: rgba(14,165,233,0.09); color: #38bdf8;    border-color: rgba(14,165,233,0.28); }
.news-tag-FOMC                   { background: var(--amber-bg);  color: var(--amber);    border-color: var(--amber-border); }

.news-title {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  line-height: 1.45; margin-bottom: 4px;
}
.news-title a { color: inherit; text-decoration: none; transition: color 0.12s; }
.news-title a:hover { color: var(--blue-lt); }

.news-meta {
  display: flex; align-items: center; gap: 5px;
  flex-wrap: wrap; font-size: 10.5px;
}
.news-source { color: var(--text-2); font-weight: 600; font-family: var(--mono); }
.news-sep    { color: var(--text-3); }
.news-time   { color: var(--text-3); font-family: var(--mono); }

.news-empty {
  font-size: 12px; color: var(--text-3);
  font-family: var(--mono); padding: 24px 0; text-align: center;
}


/* ── FX result loading state ─────────────────────────────── */
.fx-result-main.fx-loading {
  color: var(--text-3) !important;
  font-size: 15px !important;
  font-family: var(--mono);
  letter-spacing: 0.4px;
}

/* ── Catalyst loading overlay ────────────────────────────── */
.catalyst-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.92);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  pointer-events: none;
  transition: opacity 0.45s ease-out;
  z-index: 2;
}
.catalyst-spinner {
  width: 30px; height: 30px;
  border: 2px solid var(--border-md);
  border-top-color: var(--blue-lt);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
[data-state="loaded"] .catalyst-overlay { opacity: 0; }
[data-state="error"]  .catalyst-overlay { display: none; }

/* ── Catalyst error fallback ─────────────────────────────── */
.catalyst-error {
  display: none;
  position: absolute; inset: 0;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  background: var(--bg-inset);
  z-index: 2;
}
[data-state="error"] .catalyst-error { display: flex; }
.catalyst-err-title {
  font-size: 12px;
  color: var(--text-2);
  font-family: var(--mono);
}
.catalyst-err-link {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--blue-bg);
  color: var(--blue-lt);
  border: 1px solid var(--blue-border);
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.catalyst-err-link:hover {
  background: var(--bg-hover);
  border-color: var(--blue-lt);
}


/* === FOOTER ================================================ */

#app-footer {
  max-width: var(--max-w); margin: 0 auto;
  padding: 18px 32px 32px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 10px; color: var(--text-3); font-family: var(--mono);
  border-top: 1px solid var(--border);
}
.footer-dot { color: var(--border-md); }
#app-footer kbd {
  background: var(--bg-raised); border:1px solid var(--border-md);
  padding:1px 5px; border-radius:3px; font-family:var(--mono); font-size:10px;
}


/* === QUICK NOTES =========================================== */

.notes-panel {
  position:fixed; bottom:20px; right:20px; width:340px;
  background:var(--bg-raised); border:1px solid var(--border-md);
  border-radius:var(--card-radius); z-index:900;
  box-shadow:0 16px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03);
}
.notes-hd {
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 14px; border-bottom:1px solid var(--border);
  font-size:11px; font-weight:700; color:var(--text-2);
  text-transform:uppercase; letter-spacing:0.5px;
}
.notes-body {
  width:100%; height:175px; background:transparent; border:none;
  color:var(--text); font-family:var(--mono); font-size:12px;
  padding:12px 14px; resize:vertical; line-height:1.6;
}
.notes-body:focus { outline:none; }
.notes-body::placeholder { color:var(--text-3); }
.notes-ft {
  display:flex; justify-content:space-between; align-items:center;
  padding:7px 14px; border-top:1px solid var(--border);
}
.notes-saved { font-size:10px; color:var(--green); }
.notes-clear { font-size:10px; background:none; border:1px solid var(--border); color:var(--text-3); padding:2px 9px; border-radius:3px; cursor:pointer; }
.notes-clear:hover { color:var(--red); border-color:var(--red); }


/* === SHORTCUTS MODAL ======================================= */

.modal-bg {
  position:fixed; inset:0; background:rgba(0,0,0,0.7);
  display:flex; align-items:center; justify-content:center;
  z-index:1000; backdrop-filter:blur(6px);
}
.modal-card {
  background:var(--bg-raised); border:1px solid var(--border-md);
  border-radius:var(--card-radius); padding:26px 30px;
  min-width:280px; max-width:340px;
  box-shadow:0 24px 64px rgba(0,0,0,0.65);
}
.modal-card h3 { font-size:14px; font-weight:700; margin-bottom:18px; color:var(--text); }
.shortcut-table { width:100%; margin-bottom:20px; }
.shortcut-table td { padding:6px 0; font-size:12px; }
.shortcut-table td:first-child { width:70px; }
.shortcut-table kbd {
  background:var(--bg-inset); border:1px solid var(--border-md);
  padding:2px 9px; border-radius:4px; font-family:var(--mono);
  font-size:11px; color:var(--text-2);
}
.modal-close {
  width:100%; background:var(--bg-inset); border:1px solid var(--border);
  color:var(--text-2); padding:9px; border-radius:var(--radius-sm);
  cursor:pointer; font-size:12px; transition:all 0.15s;
}
.modal-close:hover { background:var(--bg-hover); color:var(--text); }

/* X close button for modals */
.modal-close-x {
  position:absolute; top:16px; right:16px;
  background:none; border:none; color:var(--text-3);
  font-size:16px; cursor:pointer; padding:4px;
  transition: color 0.15s;
}
.modal-close-x:hover { color:var(--text); }


/* === ABOUT MODAL =========================================== */

.about-card {
  max-width:420px; min-width:320px; position:relative;
  padding:28px 30px 22px;
}
.about-hd {
  display:flex; align-items:center; gap:10px;
  margin-bottom:16px; padding-bottom:14px;
  border-bottom:1px solid var(--border);
}
.about-icon {
  font-size:24px; color:var(--blue); opacity:0.9; line-height:1;
}
.about-hd h3 {
  font-size:16px; font-weight:700; color:var(--text);
  margin-bottom:2px; letter-spacing:-0.2px;
}
.about-version {
  font-size:10px; font-weight:600; color:var(--blue-lt);
  background:var(--blue-bg); border:1px solid var(--blue-border);
  padding:1px 6px; border-radius:3px; font-family:var(--mono);
}
.about-desc {
  font-size:12px; color:var(--text-2); line-height:1.6;
  margin-bottom:14px;
}
.about-section-title {
  font-size:9px; font-weight:700; color:var(--text-3);
  text-transform:uppercase; letter-spacing:0.8px;
  margin-bottom:6px; margin-top:12px;
}
.about-features {
  list-style:none; padding:0; margin:0 0 6px;
}
.about-features li {
  font-size:11px; color:var(--text-2); line-height:1.5;
  padding:2px 0 2px 14px; position:relative;
}
.about-features li::before {
  content:''; position:absolute; left:0; top:8px;
  width:5px; height:5px; border-radius:50%;
  background:var(--blue); opacity:0.5;
}
.about-tech {
  font-size:11px; color:var(--text-3); font-family:var(--mono);
  margin-bottom:4px;
}
.about-footer {
  display:flex; align-items:center; justify-content:space-between;
  margin-top:16px; padding-top:12px;
  border-top:1px solid var(--border);
}
.about-updated {
  font-size:10px; color:var(--text-3); font-family:var(--mono);
}
.about-gh-link {
  font-size:10px; font-family:var(--mono); font-weight:600;
  color:var(--blue-lt); text-decoration:none;
  padding:4px 10px; border-radius:3px;
  background:var(--blue-bg); border:1px solid var(--blue-border);
  transition:all 0.12s;
}
.about-gh-link:hover {
  background:var(--bg-hover); border-color:var(--blue-lt);
}

/* About button in header */
.action-btn-about {
  font-size:12px; font-weight:700;
}


/* === RESPONSIVE ============================================ */

@media (max-width: 900px) {
  :root { --section-pad: 24px; --section-gap: 40px; }
  #dashboard    { padding: 24px 20px 48px; }
  .header-inner { padding: 12px 20px; flex-wrap: wrap; }
  .header-status { order: 3; flex-basis: 100%; }
  .chart-shell  { height: 280px; }
  #app-footer   { padding: 14px 20px 24px; }
}

@media (max-width: 640px) {
  :root { --section-pad: 18px; --section-gap: 32px; }
  #dashboard    { padding: 16px 14px 40px; }
  .section-title { font-size: 17px; }
  .section-hd   { flex-direction: column; align-items: flex-start; gap: 8px; }
  .chart-shell  { height: 230px; }
  .fx-inputs    { flex-direction: column; }
  .fx-amount-wrap,.fx-ccy-col { width: 100%; }
  .fx-swap      { width: 100%; height: 38px; }
  .fx-result-main { font-size: 26px; }
  .notes-panel  { width: calc(100% - 24px); right: 12px; }
}

/* Print */
@media print {
  body { background:#fff; color:#111; font-size:11px; }
  :root { --bg:#fff; --bg-raised:#fff; --bg-inset:#f5f5f5;
          --border:#ccc; --text:#111; --text-2:#555; --text-3:#888;
          --green:#16a34a; --red:#dc2626; }
  #app-header { position:static; }
  .header-actions,.notes-panel,.modal-bg { display:none!important; }
  .desk-section { border:1px solid #ddd; break-inside:avoid; }
}


