:root {
  color-scheme: dark;
  --bg: #0b1117;
  --panel: #111820;
  --panel-2: #0f151d;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #1f2a36;
  --hover: #151f2a;
  --accent: #00d2c4;
  --orange: #a35a1f;
  --red: #ff4d4d;
  --blue: #38bdf8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #10212b 0, var(--bg) 38%);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1600px, calc(100% - clamp(20px, 3vw, 64px)));
  margin: 0 auto;
  padding: clamp(14px, 2.2vh, 28px) 0 clamp(16px, 3vh, 44px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(18px, 4vh, 42px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #00d2c455;
  border-radius: 8px;
  color: var(--accent);
  background: #00d2c414;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a,
.pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: #0f1720cc;
}

.nav a:hover,
.card:hover {
  border-color: #2e3d4d;
  background: var(--hover);
}

.pill,
.nav a,
.links a {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.pill:hover,
.pill:focus-visible,
.nav a:hover,
.nav a:focus-visible,
.links a:hover,
.links a:focus-visible {
  color: var(--text);
  border-color: #00d2c488;
  background: #00d2c414;
  box-shadow: 0 0 0 3px #00d2c418, 0 0 18px #00d2c433;
  transform: translateY(-1px);
}

.pill:active,
.nav a:active,
.links a:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 0 0 4px #00d2c426, 0 0 26px #00d2c455;
}

.hero {
  text-align: center;
  margin: 0 auto clamp(18px, 3vh, 34px);
  max-width: 760px;
}

.hero .pill {
  display: inline-flex;
  color: var(--accent);
  border-color: #00d2c433;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4.4vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.hero p,
.page-head p,
.card p,
.muted {
  color: var(--muted);
}

.hero p {
  margin: 16px auto 0;
  max-width: 620px;
  font-size: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 20px);
}

.card {
  min-height: clamp(178px, 20vh, 240px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #121a24, #0f151d);
  padding: clamp(18px, 2vw, 26px);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: attr(data-icon);
  position: absolute;
  right: 18px;
  top: 8px;
  font-size: 86px;
  line-height: 1;
  color: #ffffff08;
  font-weight: 700;
}

.icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #001311;
  font-weight: 800;
  margin-bottom: clamp(16px, 2.4vh, 28px);
}

.icon.orange {
  background: #ff9500;
  color: #170b00;
}

.icon.red {
  background: var(--red);
  color: #210000;
}

.icon.blue {
  background: var(--blue);
  color: #00121a;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

.links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: clamp(14px, 2vh, 20px);
}

.links a {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--text);
  background: #1e293b;
  font-size: 13px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: clamp(8px, 1.5vh, 18px);
}

.page-head h1 {
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.08;
}

.page-head p {
  margin-top: 6px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  overflow: hidden;
}

.panel-pad {
  padding: 24px;
}

.chart-frame {
  display: block;
  width: 100%;
  height: clamp(420px, calc(100dvh - 220px), 1180px);
  min-height: 0;
  border: 0;
  background: transparent;
}

.placeholder {
  min-height: clamp(300px, calc(100dvh - 150px), 680px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}

.placeholder h2 {
  margin: 0 0 10px;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 22px, 1180px);
    padding-top: 14px;
  }

  .topbar,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 168px;
  }

  .chart-frame {
    height: clamp(500px, calc(100dvh - 112px), 780px);
  }
}

@media (min-width: 1800px) {
  .shell {
    width: min(1760px, calc(100% - 96px));
  }

  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-height: 760px) and (min-width: 761px) {
  .shell {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .page-head {
    align-items: center;
  }

  .page-head p {
    display: none;
  }

  .chart-frame {
    height: calc(100dvh - 120px);
  }

  .hero p {
    margin-top: 10px;
  }

  .card {
    min-height: 156px;
  }
}


.admin-panel {
  margin: 0 0 clamp(18px, 2vw, 28px);
  padding: clamp(18px, 2vw, 26px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, #00d2c4 12%), var(--panel));
}

.admin-panel h2 {
  margin: 12px 0 8px;
}

.admin-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.admin-card-group {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.admin-card-group h3 {
  margin: 0;
  font-size: 14px;
}

.admin-link-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.admin-controls button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.admin-controls button:hover,
.admin-controls button:focus-visible {
  border-color: var(--accent);
  background: #00d2c414;
  box-shadow: 0 0 0 3px #00d2c418, 0 0 18px #00d2c433;
  transform: translateY(-1px);
}

.admin-controls button[aria-pressed="false"] {
  opacity: 0.55;
  text-decoration: line-through;
}

.side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 280px;
  padding: 18px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #0f151dcc;
  backdrop-filter: blur(14px);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 24px;
}

.side-section {
  display: grid;
  gap: 7px;
  margin: 0 0 20px;
}

.side-heading {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.side-heading::after {
  content: "▾";
  opacity: 0.38;
  font-size: 11px;
  transition: transform .18s ease, opacity .18s ease;
}

.side-heading:hover::after,
.side-heading:focus-visible::after {
  opacity: 0.75;
}

.side-items {
  display: grid;
  gap: 7px;
  max-height: 180px;
  opacity: 1;
  overflow: hidden;
  transition: max-height .22s ease, opacity .18s ease, transform .18s ease;
}

.side-section.is-collapsed .side-heading::after {
  transform: rotate(-90deg);
}

.side-section.is-collapsed .side-items {
  max-height: 0;
  opacity: 0;
  transform: translateX(-8px);
}

.side-section a,
.side-section span {
  display: block;
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--muted);
}

.side-section a:hover,
.side-section a:focus-visible {
  color: var(--text);
  background: #00d2c414;
  box-shadow: 0 0 0 3px #00d2c418, 0 0 18px #00d2c433;
}

.side-section a[aria-current="page"] {
  color: var(--text);
  border: 1px solid rgba(0, 210, 196, .55);
  background: #00d2c424;
  box-shadow: 0 0 0 3px #00d2c418, 0 0 18px #00d2c433;
}

@media (min-width: 1100px) {
  .shell {
    margin-left: max(300px, calc((100vw - 1600px) / 2 + 300px));
    margin-right: clamp(20px, 3vw, 64px);
    width: auto;
  }
}

@media (max-width: 1099px) {
  .side-menu {
    position: static;
    width: min(100% - 22px, 1180px);
    margin: 12px auto 0;
    border: 1px solid var(--border);
    border-radius: 18px;
  }
}


[hidden] {
  display: none !important;
}

/* A single, pre-paint state controls every page. No navigation animations. */
.side-items, .side-heading::after { transition: none !important; animation: none !important; }
html[data-sidebar-open] .side-section .side-items { max-height: 0; opacity: 0; transform: none; }
html[data-sidebar-open] .side-section .side-heading::after { transform: rotate(-90deg); }
html[data-sidebar-open~="indicators"] .side-section[data-nav-card="indicators"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="indicators"] .side-section[data-nav-card="indicators"] .side-heading::after { transform: none; }
html[data-sidebar-open~="rates"] .side-section[data-nav-card="rates"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="rates"] .side-section[data-nav-card="rates"] .side-heading::after { transform: none; }
html[data-sidebar-open~="seasonality"] .side-section[data-nav-card="seasonality"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="seasonality"] .side-section[data-nav-card="seasonality"] .side-heading::after { transform: none; }
html[data-sidebar-open~="aud"] .side-section[data-nav-card="aud"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="aud"] .side-section[data-nav-card="aud"] .side-heading::after { transform: none; }
html[data-sidebar-open~="cad"] .side-section[data-nav-card="cad"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="cad"] .side-section[data-nav-card="cad"] .side-heading::after { transform: none; }
html[data-sidebar-open~="chf"] .side-section[data-nav-card="chf"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="chf"] .side-section[data-nav-card="chf"] .side-heading::after { transform: none; }
html[data-sidebar-open~="eur"] .side-section[data-nav-card="eur"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="eur"] .side-section[data-nav-card="eur"] .side-heading::after { transform: none; }
html[data-sidebar-open~="gbp"] .side-section[data-nav-card="gbp"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="gbp"] .side-section[data-nav-card="gbp"] .side-heading::after { transform: none; }
html[data-sidebar-open~="jpy"] .side-section[data-nav-card="jpy"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="jpy"] .side-section[data-nav-card="jpy"] .side-heading::after { transform: none; }
html[data-sidebar-open~="nzd"] .side-section[data-nav-card="nzd"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="nzd"] .side-section[data-nav-card="nzd"] .side-heading::after { transform: none; }
html[data-sidebar-open~="us"] .side-section[data-nav-card="us"] .side-items { max-height: 180px; opacity: 1; transform: none; }
html[data-sidebar-open~="us"] .side-section[data-nav-card="us"] .side-heading::after { transform: none; }

/* Persistent content navigation */
.header { position: relative; padding-right: 86px; }
.admin-entry { position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 4px 12px; border: 1px solid var(--border, #2d3748); border-radius: 7px; background: var(--panel, #141b2b); color: var(--muted, #b6bed0); font-size: 12px; font-weight: 600; text-decoration: none; }
.admin-entry[hidden] { display: none !important; }
.admin-entry:hover { color: var(--text, #fff); border-color: var(--accent, #4da3ff); }
.admin-entry:focus-visible { outline: 2px solid var(--accent, #4da3ff); outline-offset: 3px; }

.navigation-error { padding: 16px; margin-bottom: 20px; border: 1px solid #e5a045; border-radius: 10px; background: #262119; color: #fff; }
.navigation-error button { padding: 6px 14px; cursor: pointer; }
main[aria-busy="true"] { cursor: progress; }

/* Stable sidebar: expansion is controlled only by the saved root attribute. */
.side-menu .side-items { display: none !important; max-height: none !important; opacity: 1 !important; overflow: visible !important; transition: none !important; animation: none !important; }
.side-menu .side-items a { border: 1px solid transparent; transition: none !important; }
.side-menu .side-items a.is-active { border-color: rgba(124,246,199,0.5); }
html[data-sidebar-open~="indicators"] .side-menu .side-section[data-nav-card="indicators"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="rates"] .side-menu .side-section[data-nav-card="rates"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="seasonality"] .side-menu .side-section[data-nav-card="seasonality"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="aud"] .side-menu .side-section[data-nav-card="aud"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="cad"] .side-menu .side-section[data-nav-card="cad"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="chf"] .side-menu .side-section[data-nav-card="chf"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="eur"] .side-menu .side-section[data-nav-card="eur"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="gbp"] .side-menu .side-section[data-nav-card="gbp"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="jpy"] .side-menu .side-section[data-nav-card="jpy"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="nzd"] .side-menu .side-section[data-nav-card="nzd"] .side-items { display: block !important; pointer-events: auto !important; }
html[data-sidebar-open~="us"] .side-menu .side-section[data-nav-card="us"] .side-items { display: block !important; pointer-events: auto !important; }
