/* ──────────────────────────────────────────────────────────────────
   Insight — GA4 + LinkedIn Ads reporting
   Design system carried over from data.blazelab.co.uk: yellow #FFCF00
   (always with ink text) on ink #111125, white cards over a cool-gray
   canvas. Inter throughout.

   Re-branding: every colour lives in the :root block below. Change
   --yellow / --ink there and the whole app follows.
   ────────────────────────────────────────────────────────────────── */

:root {
  /* Brand */
  --yellow:        #FFCF00;
  --yellow-hover:  #eec000;
  --yellow-soft:   #fff7d1;
  --yellow-ghost:  #fffbe8;
  --ink:           #111125;
  --ink-2:         #32373c;

  /* Surfaces */
  --canvas:        #f6f6f8;
  --card:          #ffffff;
  --bg-hover:      #f7f7fa;

  /* Borders */
  --border:        #e5e6ec;
  --border-soft:   #f0f0f4;
  --border-strong: #d9dae3;

  /* Text */
  --text:          #111125;
  --text-soft:     #40424f;
  --muted:         #6f7180;
  --muted-soft:    #a3a5b1;

  /* Semantic */
  --blue:          #0693e3;
  --green:         #00d084;
  --danger:        #cf2e2e;
  --danger-bg:     #fdf0f0;
  --danger-border: #f3c6c6;

  /* Channels */
  --ga:            #E8710A;
  --linkedin:      #0A66C2;

  /* Shadows */
  --shadow-xs:     0 1px 2px rgba(17, 17, 37, .05);
  --shadow-sm:     0 1px 3px rgba(17, 17, 37, .07), 0 1px 2px rgba(17, 17, 37, .05);
  --shadow:        0 4px 10px -2px rgba(17, 17, 37, .08), 0 2px 4px -2px rgba(17, 17, 37, .05);
  --shadow-lg:     0 16px 40px -8px rgba(17, 17, 37, .18), 0 8px 16px -8px rgba(17, 17, 37, .08);

  /* Radii */
  --r-sm:          6px;
  --r:             10px;
  --r-lg:          14px;
  --r-full:        9999px;

  /* Layout */
  --topbar-h:      58px;
  --sidebar-w:     324px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
*:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

a { color: var(--ink); text-decoration: none; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
h2 { font-size: 1.02rem; line-height: 1.3; }
h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.h3-note {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted-soft);
  margin-left: 0.4rem;
}

.muted { color: var(--muted); }
.num   { font-variant-numeric: tabular-nums; }

/* ── Top bar (ink) ───────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: var(--ink);
  color: #fff;
}
.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.4rem;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.brand-mark { display: inline-flex; align-items: center; }
.brand {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  padding-left: 0.7rem;
  margin-left: 0.15rem;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
}
.user-chip { display: inline-flex; align-items: center; gap: 0.5rem; }
.user-chip strong { color: #fff; font-weight: 600; }
.user-dot {
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.inline { display: inline; margin: 0; }
.topbar .link {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--r-sm);
  padding: 0.36rem 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.12s;
}
.topbar .link:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* ── Page nav / back button ──────────────────────────────────── */

.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--card);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.back-btn:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.page-nav-here { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.crumb-sep { color: var(--muted-soft); }

/* ── App shell ───────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.4rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.sidebar-footer {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--card);
  font-size: 0.8rem;
  min-height: 3rem;
}
.side-head h2 { font-size: 1rem; margin-bottom: 0.3rem; }
.side-head p  { margin: 0; font-size: 0.82rem; line-height: 1.45; }

.field-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.filter-controls { display: flex; flex-direction: column; gap: 1.35rem; }

/* Generic small link-button */
.link {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.32rem 0.65rem;
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.12s;
}
.link:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--bg-hover);
}

/* ── Nav list (sidebar sections) ─────────────────────────────── */

.nav-list { display: flex; flex-direction: column; gap: 0.15rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-sm);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: var(--yellow-ghost);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--yellow);
}
.nav-item svg { flex: none; color: var(--muted); }
.nav-item.active svg { color: var(--ink); }

/* ── Chips ───────────────────────────────────────────────────── */

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.field-head .field-label { margin-bottom: 0; }
.field-aside {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.link-inline {
  background: none;
  border: 0;
  padding: 0 0 0 0.15rem;
  margin: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-inline:hover { color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.36rem 0.75rem 0.36rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--card);
  cursor: pointer;
  user-select: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: all 0.12s;
}
.chip input { display: none; }
.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--muted-soft);
  flex: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.03);
}
.chip:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.chip:has(input:checked) {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.chip:has(input:checked) .cat-dot { box-shadow: 0 0 0 2px rgba(17, 17, 37, 0.12); }
.chip em { font-style: normal; color: var(--muted-soft); font-weight: 400; }
.chip:has(input:checked) em { color: rgba(17, 17, 37, 0.55); }

/* Per-channel dot colours */
.chip[data-channel="ga"]       .cat-dot { background: var(--ga); }
.chip[data-channel="linkedin"] .cat-dot { background: var(--linkedin); }
.chip[data-channel="organic"]  .cat-dot { background: var(--green); }
.chip[data-channel="paid"]     .cat-dot { background: #8b5cf6; }
.chip[data-channel="referral"] .cat-dot { background: #f59e0b; }
.chip[data-channel="direct"]   .cat-dot { background: var(--blue); }
.chip[data-channel="other"]    .cat-dot { background: var(--muted-soft); }

/* ── Date range ──────────────────────────────────────────────── */

.date-range { display: flex; align-items: center; gap: 0.4rem; }
.date-range input[type="date"] {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--card);
  font: 13px var(--font);
  font-weight: 500;
  color: var(--text);
}
.date-range input[type="date"]:focus {
  outline: 0;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 37, 0.08);
}
.date-sep { color: var(--muted-soft); font-size: 0.8rem; }

/* ── Main canvas ─────────────────────────────────────────────── */

.main {
  position: relative;
  padding: 1.75rem 2rem 3.5rem;
  min-width: 0;
}
#report-area {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-xs);
}

/* ── Loading indicator (htmx) ────────────────────────────────── */

.report-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 5.5rem;
  background: rgba(246, 246, 248, 0.72);
  backdrop-filter: blur(2px);
}
.report-loading.htmx-request { display: flex; }
.loading-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.1rem 1.4rem;
  max-width: 420px;
}
.loading-card strong { font-size: 0.92rem; }
.loading-card p { margin: 0.15rem 0 0; font-size: 0.8rem; line-height: 1.4; }
.spinner {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  border: 3px solid var(--yellow-soft);
  border-top-color: var(--yellow);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Report hero ─────────────────────────────────────────────── */

.report-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.25rem 0.15rem 0;
}
.report-hero h2 {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 0.45rem;
}
.hero-range {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.5rem;
  letter-spacing: 0;
}
.hero-meta { margin: 0; color: var(--muted); font-size: 0.88rem; }
.hero-meta strong { color: var(--text); font-weight: 600; }
.dot { color: var(--muted-soft); padding: 0 0.15rem; }
.report-hero-actions { flex: none; padding-top: 0.3rem; }

/* ── KPI cards ───────────────────────────────────────────────── */

.kpis-primary {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.kpi-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.15rem 1.25rem 1.2rem;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.kpi-card.accent::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--yellow);
}
.kpi-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}
.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--canvas);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.kpi-card.accent .kpi-icon { background: var(--yellow-soft); color: var(--ink); }
.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.kpi-sub { margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted); }
.kpi-sub .rate { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-sub .up   { color: var(--green); font-weight: 700; }
.kpi-sub .down { color: var(--danger); font-weight: 700; }

.kpis-secondary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.mini-kpi {
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-left: 1px solid var(--border-soft);
}
.mini-kpi:first-child { border-left: 0; }
.mini-label { font-size: 0.72rem; font-weight: 500; color: var(--muted); }
.mini-value { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-value em {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.3rem;
}

/* ── Charts ──────────────────────────────────────────────────── */

.charts {
  display: grid;
  gap: 1.35rem;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
}
.chart-card h3 { margin-bottom: 1rem; }

/* ── Data table ──────────────────────────────────────────────── */

.card.table-card { padding: 0; overflow: hidden; }
.table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.15rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.table-count { font-size: 0.78rem; color: var(--muted-soft); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
}
.data-table th, .data-table td {
  padding: 0.72rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.data-table th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: #fafafb;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table th:first-child, .data-table td:first-child { padding-left: 1.5rem; }
.data-table th:last-child,  .data-table td:last-child  { padding-right: 1.5rem; }
.data-table td:first-child { font-weight: 600; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table tbody tr { transition: background 0.08s; }
.data-table tbody tr:hover td { background: var(--bg-hover); }

.pct-col { min-width: 130px; }
.pct-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.22rem;
  min-width: 110px;
}
.pct-num { font-weight: 600; }
.pct-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-soft);
  position: relative;
  overflow: hidden;
}
.pct-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: var(--yellow);
  border-radius: 2px;
}

.data-table tr.total-row td {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  border-bottom: 0;
}
.data-table tr.total-row td:first-child { box-shadow: inset 3px 0 0 var(--yellow); }
.data-table tr.total-row:hover td { background: var(--ink); }
.data-table tr.total-row .pct-bar { background: rgba(255, 255, 255, 0.18); }

/* ── Buttons ─────────────────────────────────────────────────── */

.downloads { display: flex; gap: 0.7rem; flex-wrap: wrap; padding: 0 0.15rem; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.12s;
  box-shadow: var(--shadow-xs);
}
.button:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.button.primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
}
.button.primary:hover { background: var(--yellow-hover); border-color: var(--yellow-hover); }
.button.ghost { background: transparent; box-shadow: none; }
.button.ghost:hover { background: var(--card); }

/* ── Status pills ────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
}
.pill .cat-dot { width: 7px; height: 7px; box-shadow: none; }
.pill.connected     { background: #f0fdf7; border-color: #b8ebd5; color: #067a4d; }
.pill.connected     .cat-dot { background: var(--green); }
.pill.disconnected  { background: var(--canvas); color: var(--muted); }
.pill.disconnected  .cat-dot { background: var(--muted-soft); }

/* ── Preset chips (act as submit buttons) ────────────────────── */

.chip.preset {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.36rem 0.7rem;
}
.chip.preset.on {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* ── Severity variants ───────────────────────────────────────── */

.pill.danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.pill.warn   { background: #fff8e6; border-color: #f5deA0; color: #8a6100; }
.pill svg    { width: 12px; height: 12px; }

.kpi-card.danger-accent::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--danger);
}
.kpi-card.danger-accent .kpi-icon { background: var(--danger-bg); color: var(--danger); }

/* ── Findings (data health) ──────────────────────────────────── */

.finding {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.finding.sev-critical { border-left-color: var(--danger); }
.finding.sev-warning  { border-left-color: var(--yellow); }
.finding.sev-info     { border-left-color: var(--muted-soft); }

.finding > summary {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.35rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.12s;
}
.finding > summary::-webkit-details-marker { display: none; }
.finding > summary:hover { background: var(--bg-hover); }

.sev-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
  padding: 0.22rem 0.6rem;
  border-radius: var(--r-full);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sev-badge svg { width: 12px; height: 12px; }
.sev-badge.sev-critical { background: var(--danger-bg); color: var(--danger); }
.sev-badge.sev-warning  { background: var(--yellow-soft); color: #8a6100; }
.sev-badge.sev-info     { background: var(--canvas); color: var(--muted); }

.finding-title {
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  min-width: 0;
}
.finding-metric {
  margin-left: auto;
  flex: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.finding-chevron {
  flex: none;
  color: var(--muted-soft);
  font-size: 1.1rem;
  transition: transform 0.15s;
}
.finding[open] .finding-chevron { transform: rotate(90deg); }

.finding-body { padding: 0 1.35rem 1.35rem; }
.finding-summary {
  margin: 0 0 1rem;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 82ch;
}
.finding-table {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 1rem;
}
.finding-table .data-table th:first-child,
.finding-table .data-table td:first-child { padding-left: 1rem; }
.finding-table .data-table th:last-child,
.finding-table .data-table td:last-child  { padding-right: 1rem; }
.finding-table .data-table tr:last-child td { border-bottom: 0; }

.finding-fix {
  background: var(--yellow-ghost);
  border: 1px solid #f6ecc4;
  border-radius: var(--r);
  padding: 0.85rem 1rem;
}
.finding-fix p {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-soft);
  max-width: 82ch;
}

/* ── Report builder ──────────────────────────────────────────── */

.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem;
}
.picker {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--card);
  font: inherit;
  font-size: 0.82rem;
  color: var(--text);
}
.picker:focus {
  outline: 0;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 37, 0.08);
}
.picker optgroup {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.picker option { padding: 0.25rem 0.35rem; color: var(--text); font-weight: 400; }

.builder-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}
.builder-limit select {
  display: block;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--card);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}
.builder-hint { font-size: 0.76rem; margin-left: auto; }

/* ── Empty state ─────────────────────────────────────────────── */

.empty {
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.empty svg { color: var(--muted-soft); margin-bottom: 0.5rem; }
.empty h3 { text-transform: none; letter-spacing: -0.01em; font-size: 0.95rem; color: var(--text); }
.empty p { margin: 0; font-size: 0.86rem; max-width: 40ch; }
.empty .downloads { margin-top: 1rem; justify-content: center; }

/* ── Login ───────────────────────────────────────────────────── */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: var(--ink);
  position: relative;
  overflow: hidden;
}
.login-arcs { position: absolute; inset: 0; pointer-events: none; }
.login-arcs .arc { position: absolute; opacity: 0.14; }
.arc-a { width: 420px; top: -120px; right: -110px; transform: rotate(18deg); }
.arc-b { width: 300px; bottom: -110px; left: -80px; transform: rotate(-160deg); opacity: 0.1; }

.login-card {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2.2rem 2.1rem 1.6rem;
  width: 100%;
  max-width: 392px;
}
.login-brand { margin-bottom: 1rem; }
.login-card h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
  letter-spacing: -0.02em;
}
.login-card > p.muted { margin: 0 0 1.5rem; font-size: 0.88rem; }
.login-card label {
  display: block;
  margin-bottom: 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
}
.login-card input[type="text"],
.login-card input[type="password"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.62rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--card);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
  transition: all 0.12s;
}
.login-card input:focus {
  outline: 0;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 37, 0.08);
}
.login-card button[type="submit"] {
  width: 100%;
  padding: 0.72rem;
  background: var(--yellow);
  color: var(--ink);
  border: 0;
  border-radius: var(--r-sm);
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.12s;
}
.login-card button[type="submit"]:hover {
  background: var(--yellow-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.login-foot {
  margin: 1.4rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted-soft);
}
.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
  font-size: 0.86rem;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-scroll { height: auto; overflow: visible; padding: 1.2rem 1.25rem 1.4rem; }
  .main { padding: 1.4rem 1.25rem 2.5rem; }
  .charts { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .brand-sub { display: none; }
  .report-hero { flex-direction: column; }
  .report-hero h2 { font-size: 1.25rem; }
  .kpi-value { font-size: 1.5rem; }
  .kpis-secondary { grid-template-columns: 1fr 1fr; }
  .mini-kpi { border-left: 0; border-top: 1px solid var(--border-soft); }
  .mini-kpi:first-child, .mini-kpi:nth-child(2) { border-top: 0; }
  .mini-kpi:nth-child(even) { border-left: 1px solid var(--border-soft); }
}
