/* Base layout: design tokens, page shell (sidebar, top bar), buttons, cards and the stat-card grid.
 * Loaded first; components.css and the page styles build on it. Unused rules were removed, so add new shared styles to
 * components.css rather than here. */

:root {
  --brand: #dc5b5d;
  --brand-d: #234a94;
  --brand-mid: #2a59a6;
  --accent: #2a59a6;
  --accent-l: #e8eefa;
  --accent-tint: #f3f6fc;
  --green: #2a59a6;
  --amber: #c9a227;
  --ink: #1e1e1e;
  --body: #3d3d3d;
  --muted: #7a7570;
  --faint: #9a9590;
  --line: #e3e6ea;
  --bg: #f3f4f6;
  --card: #fff;
  --sidebar: #243b6b;
  --sidebar-2: #1b2e56;
  --shadow: 0 1px 2px rgba(42, 89, 166, 0.04), 0 6px 22px rgba(42, 89, 166, 0.07);
  --shadow-hover: 0 8px 30px rgba(42, 89, 166, 0.12);
  --font: "Source Sans 3", system-ui, sans-serif;
  --display: "Source Sans 3", system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  line-height: 1.15;
  font-weight: 700;
}

a { color: inherit; text-decoration: none; }

.ic {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: currentColor;
}

.ic-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  color: #e8eefa;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sb-head {
  padding: 1.1rem 1.15rem 1rem;
  background: #fff;
  border-bottom: 1px solid rgba(42, 89, 166, 0.08);
}

.sb-title {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-d);
  letter-spacing: 0.01em;
}

.sb-nav { padding: 0.9rem 0.65rem; flex: 1; }

.nav-item {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.65rem 0.7rem;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  border: 1px solid transparent;
  margin-bottom: 0.15rem;
  color: rgba(255, 255, 255, 0.82);
}

.nav-item:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(220, 91, 93, 0.55);
  color: #fff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
  transition: 0.18s;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  color: #fff;
  background: var(--brand);
}

.nav-label { font-size: 0.88rem; font-weight: 600; }

/* First hero stat: full-bleed brand banner instead of a plain white tile */

/* Colour-rotate the middle stat tiles so the grid doesn't read as one flat block */

.sb-foot {
  padding: 1rem 0.85rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sb-credit {
  margin-top: 0.35rem;
  padding: 0.7rem 0.45rem 0.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.62);
}

.sb-credit-copy {
  min-width: 0;
}

.sb-credit a {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sb-credit a:hover {
  color: #fff;
}

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; }

.main-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(245, 243, 240, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.9rem;
  background: transparent;
  border-bottom: 1px solid var(--line);
}

.tb-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tb-title .tb-icon {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  background: var(--accent-l);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.95rem;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: 0.16s;
}

.btn-ghost {
  background: #fff;
  color: var(--body);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.btn-ghost:hover { border-color: #d5d0c8; }

.content { padding: 1.7rem 1.9rem 4rem; width: 100%; }

/* KPIs */

/* Chart grid */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.3rem;
  align-items: stretch;
}

.block {
  grid-column: span var(--span, 6);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
  overflow: visible;
}

.block:hover { box-shadow: var(--shadow-hover); }

@keyframes block-pulse {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 3px rgba(42, 89, 166, 0.35), var(--shadow-hover); }
}

/* Narrow cards: same affordance, tighter packing */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding: 0 1.4rem 1.3rem;
  font-size: 0.8rem;
  color: var(--body);
}

.legend:has(+ .explore-bridge) {
  padding-bottom: 0.4rem;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

/* Included in chart → amber prompt to exclude */

/* Excluded from chart → green “filter on” state */

/* Filter drawer */

/* Modals */

@media (max-width: 1000px) {
  .grid { grid-template-columns: 1fr; }
  .block { grid-column: 1 / -1; }
}

/* Mobile nav toggle */
.tb-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 95;
    width: min(300px, 88vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 14px 0 40px rgba(15, 23, 42, 0.18);
    flex-direction: column;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .topbar {
    padding: 0.7rem 0.9rem;
    gap: 0.55rem;
    flex-wrap: wrap;
  }
  .tb-title { font-size: 1.05rem; }
  .tb-right {
    width: 100%;
    justify-content: flex-start;
    gap: 0.45rem;
  }
  .btn { padding: 0.5rem 0.7rem; }
  .content { padding: 1.1rem 0.9rem 3rem; }
  .legend { padding: 0 1rem 1rem; }
  .grid { gap: 1rem; }
}


/* PDF export modal */
