/* ==========================================================================
   Radar — UI foundation
   A modern, light-first financial intelligence design system.
   Palette: warm paper canvas, deep navy ink, teal + indigo accents.
   The theme layer (european-theme.css) adds the Radar-specific surfaces.
   ========================================================================== */

:root {
  /* Surfaces */
  --canvas: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f0f4f6;
  --surface-tint: #eaf5f2;

  /* Type colours */
  --ink: #0c1c2e;
  --ink-2: #1d3549;
  --text: #31485a;
  --muted: #6b7d8b;

  /* Lines */
  --line: #dfe7ec;
  --line-strong: #c8d6df;

  /* Brand + accents */
  --brand: #0e7c70;
  --brand-dark: #0a5c54;
  --brand-soft: #e5f4f1;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --amber: #b9740d;
  --amber-soft: #fdf4e3;
  --green: #0d9b6b;
  --green-soft: #e6f6ef;
  --red: #d0524c;
  --red-soft: #fdeceb;

  /* Dark surfaces */
  --navy: #0b1726;
  --navy-2: #123047;
  --mint: #8fe3cf;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(12, 28, 46, 0.05), 0 6px 18px -12px rgba(12, 28, 46, 0.22);
  --shadow-md: 0 2px 4px rgba(12, 28, 46, 0.04), 0 18px 40px -20px rgba(12, 28, 46, 0.28);
  --shadow-lg: 0 24px 60px -24px rgba(12, 28, 46, 0.4);

  /* Shape + type */
  --radius: 16px;
  --radius-sm: 10px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --container: 1180px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 88% -8%, rgba(14, 124, 112, 0.09), transparent 70%),
    radial-gradient(700px 380px at -5% 0%, rgba(79, 70, 229, 0.06), transparent 70%),
    var(--canvas);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.22;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2.6vw, 1.95rem); font-weight: 750; }
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1rem; color: var(--text); }
strong { color: var(--ink); font-weight: 650; }
small, .small { font-size: 0.82rem; }
.muted { color: var(--muted) !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

a { color: var(--brand); text-decoration: none; transition: color 0.16s ease; }
a:hover { color: var(--brand-dark); }

img, svg { max-width: 100%; }

:focus-visible { outline: 3px solid rgba(14, 124, 112, 0.35); outline-offset: 2px; }
::selection { background: var(--brand-soft); color: var(--ink); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 300;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}
.skip-link:focus { left: 16px; color: #fff; }

/* ---------- Layout ---------- */
.container {
  width: min(var(--container), calc(100% - 40px));
  margin-inline: auto;
}

.site-main { padding-bottom: 8px; }
section { padding: 48px 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.section-head h2 { margin: 0; }
.section-head .section-intro { margin: 0; max-width: 520px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: var(--mint);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.eyebrow.dark { color: var(--brand); }
.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.section-intro { margin: 0 0 24px; color: var(--muted); }
.hero-sub { color: var(--text); max-width: 720px; }

/* ---------- Header / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  box-shadow: 0 1px 0 rgba(12, 28, 46, 0.02);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 70px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(145deg, #0e7c70, #0b4f74);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(14, 124, 112, 0.6);
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.nav-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(13, 155, 107, 0.14);
  animation: status-pulse 2.4s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(13, 155, 107, 0.14); }
  50% { box-shadow: 0 0 0 7px rgba(13, 155, 107, 0.04); }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-primary { display: flex; gap: 2px; }

.nav-link, .nav-drop-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}
.nav-link:hover, .nav-drop-btn:hover,
.nav-link[aria-current="page"], .nav-drop-btn[aria-expanded="true"] {
  color: var(--ink);
  background: var(--surface-soft);
}
.nav-drop-btn { border-color: var(--line); background: var(--surface); }
.nav-drop-btn:hover { border-color: var(--line-strong); }
.nav-drop-btn svg { width: 14px; height: 14px; transition: transform 0.2s ease; }
.nav-drop.open .nav-drop-btn svg { transform: rotate(180deg); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  margin-left: auto;
  width: 42px;
  height: 42px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-2);
  transition: transform 0.2s, opacity 0.2s;
}

/* Dropdown */
.nav-drop { position: relative; }
.nav-drop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-height: min(78vh, 620px);
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.nav-drop.open .nav-drop-menu { display: flex; }
.nav-drop-menu::-webkit-scrollbar { width: 6px; }
.nav-drop-menu::-webkit-scrollbar-track { background: transparent; }
.nav-drop-menu::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--line-strong); }

.nav-drop-heading {
  margin-bottom: 4px;
  padding: 12px 10px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav-drop-heading:not(:first-child) { margin-top: 8px; }
.nav-drop-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text);
  font-size: 0.89rem;
}
.nav-drop-menu a:hover { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s, background 0.16s, border-color 0.16s;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}
.btn svg { width: 15px; height: 15px; }
.btn.small { padding: 7px 11px; border-radius: 8px; font-size: 0.77rem; box-shadow: none; }
.btn-primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn-primary:hover { border-color: var(--brand-dark); background: var(--brand-dark); color: #fff; }
.btn-ghost { border-color: rgba(255, 255, 255, 0.24); background: rgba(255, 255, 255, 0.08); color: #fff; box-shadow: none; }
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.16); color: #fff; }
.btn-quiet { background: transparent; box-shadow: none; }

/* ---------- Cards + grids ---------- */
.card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: 0;
  transition: opacity 0.22s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #bcd6d0;
  box-shadow: var(--shadow-md);
}
.card:hover::before { opacity: 1; }
.card h2, .card h3 { margin: 0 0 8px; }
.card p:last-child { margin-bottom: 0; }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-desc { color: var(--text); font-size: 0.91rem; }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-2);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.kpi-library-table, .trend-table, .kpi-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.kpi-library-table th, .trend-table th, .kpi-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.kpi-library-table td, .trend-table td, .kpi-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.kpi-library-table tbody tr:last-child td,
.trend-table tbody tr:last-child td,
.kpi-table tbody tr:last-child td { border-bottom: 0; }
.kpi-library-table tbody tr:hover, .trend-table tbody tr:hover { background: #f8fafb; }
.kpi-library-table td:first-child strong { color: var(--ink); }
.kpi-table th:first-child, .kpi-table td:first-child { width: 34%; font-weight: 600; color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--navy);
  color: rgba(255, 255, 255, 0.6);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
  padding: 56px 0 40px;
}
.footer-brand-col .brand { margin-bottom: 18px; }
.site-footer .brand-mark {
  background: linear-gradient(145deg, var(--mint), var(--brand));
  color: var(--navy);
  box-shadow: none;
}
.site-footer .brand-name { color: #fff; }
.footer-tagline { max-width: 320px; color: rgba(255, 255, 255, 0.6); font-size: 0.92rem; }
.footer-meta { margin: 0; color: rgba(255, 255, 255, 0.42); font-size: 0.78rem; }
.footer-heading {
  margin: 0 0 16px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.footer-col a {
  display: block;
  padding: 5px 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.88rem;
}
.footer-col a:hover { color: var(--mint); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.78rem;
}
.footer-bottom p { margin: 0; }
.footer-bottom a { color: var(--mint); }
.footer-gh {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  color: #fff !important;
  white-space: nowrap;
}
.footer-gh:hover { border-color: rgba(255, 255, 255, 0.4); color: #fff !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1050px) {
  .nav-status { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 70px);
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    overflow-y: auto;
    padding: 14px 20px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
  }
  .site-nav.open { display: flex; }
  .nav-primary { flex-direction: column; gap: 2px; }
  .nav-primary a, .nav-drop-btn { width: 100%; justify-content: space-between; }
  .nav-drop-menu {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 6px;
    padding: 8px;
    border: 0;
    background: var(--surface-soft);
    box-shadow: none;
  }
}

@media (max-width: 760px) {
  section { padding: 36px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; padding: 40px 0 28px; }
  .footer-brand-col { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 480px) {
  .container { width: calc(100% - 28px); }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Radar dashboards + snapshot disclosure
   Light-first foundation; the theme layer adds Radar surface refinements.
   Opaque badge backgrounds keep disclosure text legible on any surface.
   ========================================================================== */
.snapshot-badge, .live-badge {
  --snapshot-badge-bg: var(--amber-soft);
  --snapshot-badge-fg: #6b3f00;
  --snapshot-badge-line: rgba(107, 63, 0, 0.26);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 7px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--snapshot-badge-line);
  border-radius: 999px;
  background: var(--snapshot-badge-bg);
  color: var(--snapshot-badge-fg);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-align: left;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.snapshot-badge::before, .live-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}
.snapshot-badge.unavailable {
  --snapshot-badge-bg: var(--red-soft);
  --snapshot-badge-fg: #9c2f2a;
  --snapshot-badge-line: rgba(156, 47, 42, 0.28);
}
.snapshot-updated {
  flex: 1 1 100%;
  display: block;
  padding-top: 3px;
  border-top: 1px solid var(--snapshot-badge-line);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
.live-badge {
  --snapshot-badge-bg: var(--green-soft);
  --snapshot-badge-fg: #0a6b4a;
  --snapshot-badge-line: rgba(10, 107, 74, 0.26);
}
.disclosure-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.dashboard-grid, .snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 18px;
  align-items: start;
}
.dashboard-card, .snapshot-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.dashboard-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dashboard-card .card-top, .snapshot-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
}
.dashboard-card .card-top > * { min-width: 0; }
.snapshot-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-color: rgba(185, 116, 13, 0.3);
}
.snapshot-card h3 { margin: 0; }
.snapshot-card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

/* Snapshot tables scroll horizontally instead of crushing numeric columns. */
.snapshot-table-wrap {
  max-width: 100%;
  margin: 12px 0 14px;
  padding: 12px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.snapshot-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
}
.snapshot-table th, .snapshot-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.snapshot-table thead th {
  background: var(--surface-soft);
  color: var(--ink-2);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.snapshot-table tbody th {
  min-width: 220px;
  color: var(--ink-2);
  font-weight: 650;
}
.snapshot-table td.num { text-align: right; white-space: nowrap; }
.snapshot-table tbody tr:last-child th,
.snapshot-table tbody tr:last-child td { border-bottom: 0; }

.snapshot-kpi { border-color: rgba(185, 116, 13, 0.32); }
.unavailable-kpi {
  border-style: dashed;
  background: var(--surface-soft);
}
.unavailable-kpi .kpi-value { color: var(--ink-2); }

/* Dense dropdown items leave room for the dashboard link group. */
.nav-drop-menu.dense a,
.nav-drop-menu.compact a,
.nav-drop-menu .dashboard-links a,
.nav-drop-menu .nav-drop-dashboards a,
.nav-drop-menu a.dashboard-link {
  padding: 5px 9px;
  font-size: 0.82rem;
  line-height: 1.3;
}

@media (max-width: 760px) {
  .dashboard-grid, .snapshot-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-card .card-top, .snapshot-card-top { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .snapshot-badge, .live-badge { padding: 5px 8px; border-radius: 12px; }
  .snapshot-table { min-width: 560px; }
  .snapshot-table-wrap { padding: 10px; }
}
