:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --color-bg: #f5f4f0;
  --color-surface: #faf9f6;
  --color-surface-2: #ffffff;
  --color-surface-offset: #ede9e2;
  --color-divider: #dbd7cf;
  --color-border: #ccc8bf;
  --color-text: #1a1713;
  --color-text-muted: #6b6a66;
  --color-text-faint: #b0aea9;
  --color-text-inverse: #f5f4f0;
  --color-primary: #b8872e;
  --color-primary-hover: #9a6e1e;
  --color-primary-active: #7c5610;
  --color-primary-highlight: #f0e4cc;
  --color-success: #437a22;
  --color-error: #a12c2c;
  --color-warning: #c46700;
  --shadow-sm: 0 1px 3px oklch(0.2 0.01 80 / 0.08);
  --shadow-md: 0 4px 16px oklch(0.2 0.01 80 / 0.1);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.14);
  --sidebar-w: 240px;
}

[data-theme="dark"] {
  --color-bg: #111010;
  --color-surface: #171614;
  --color-surface-2: #1e1c1a;
  --color-surface-offset: #232120;
  --color-divider: #2c2b29;
  --color-border: #373533;
  --color-text: #e4e2de;
  --color-text-muted: #8a8884;
  --color-text-faint: #555350;
  --color-text-inverse: #111010;
  --color-primary: #d4a44c;
  --color-primary-hover: #e8bc6a;
  --color-primary-active: #f0cc88;
  --color-primary-highlight: #3a2e1a;
  --color-success: #6daa45;
  --color-error: #dd6464;
  --color-warning: #e8961e;
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
input, select { font: inherit; color: inherit; background: none; border: none; outline: none; }
button, input, select { transition: color var(--transition-interactive), background var(--transition-interactive), border-color var(--transition-interactive), box-shadow var(--transition-interactive); }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  transition: grid-template-columns var(--transition-interactive);
}

.app.sidebar-collapsed {
  --sidebar-w: 0px;
}

.sidebar {
  grid-row: 1 / -1;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: opacity var(--transition-interactive), visibility var(--transition-interactive);
}

.app.sidebar-collapsed .sidebar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  border-right-color: transparent;
}

.sidebar-logo {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0 var(--space-3) 0 var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.sidebar-logo-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.logo-mark {
  width: 34px;
  height: 34px;
  color: var(--color-primary);
  flex: 0 0 auto;
}
.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-sm);
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.logo-text span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border-top: 1px solid var(--color-divider);
}
.sidebar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
}
.user-name { font-size: var(--text-xs); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--color-text-faint); }

.sidebar-toggle--in-panel { flex-shrink: 0; }
.app:not(.sidebar-collapsed) .icon-btn.sidebar-toggle--header {
  display: none;
}
.app.sidebar-collapsed .icon-btn.sidebar-toggle--header {
  display: grid;
  flex-shrink: 0;
}

.header {
  grid-column: 2;
  height: 56px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  min-width: 0;
}
.header-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  white-space: nowrap;
}
.header-sep { width: 1px; height: 24px; background: var(--color-divider); }
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}
.filter-group {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  white-space: nowrap;
}
.filter-group label {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.filter-group input, .filter-group select {
  height: 30px;
  max-width: 120px;
  font-size: var(--text-xs);
  color: var(--color-text);
  background: var(--color-surface-2);
  color-scheme: light;
}
[data-theme="dark"] .filter-group select {
  color-scheme: dark;
}
.filter-group select option,
.filter-group select optgroup {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.filter-group--dept select { max-width: 132px; }
.filter-group--manager select { max-width: 168px; }
.filter-group--manager select:disabled {
  color: var(--color-text-muted);
  cursor: wait;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid color-mix(in oklch, var(--color-primary) 35%, var(--color-border));
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--color-primary) 10%, var(--color-surface-2));
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.filter-chip[hidden] { display: none !important; }
.date-range-picker { position: relative; padding-right: var(--space-1); }
.date-range-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 30px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}
.date-range-trigger:hover { background: var(--color-surface-offset); }
.date-range-trigger svg { width: 14px; height: 14px; color: var(--color-text-muted); flex: 0 0 auto; }
.date-range-label { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-range-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  width: min(300px, calc(100vw - 32px));
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-md);
}
.date-range-popover-head {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.date-range-month {
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--color-text);
}
.date-range-nav {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
}
.date-range-nav:hover { background: var(--color-surface-offset); color: var(--color-text); }
.date-range-nav svg { width: 16px; height: 16px; }
.date-range-weekdays,
.date-range-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.date-range-weekdays {
  margin-bottom: var(--space-2);
  color: var(--color-text-faint);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.date-range-weekdays span { text-align: center; }
.date-range-day {
  aspect-ratio: 1;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}
.date-range-day:hover:not(:disabled) { background: var(--color-surface-offset); }
.date-range-day.other-month { color: var(--color-text-faint); }
.date-range-nav:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.date-range-day.today { box-shadow: inset 0 0 0 1px var(--color-text-faint); }
.date-range-day.in-range { background: color-mix(in oklch, var(--color-primary) 14%, transparent); border-radius: 0; }
.date-range-day.range-start,
.date-range-day.range-end {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-sm);
}
.date-range-day:disabled { opacity: 0.35; cursor: default; }
.date-range-hint {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.4;
}
.disabled-filter { opacity: 0.72; }
.disabled-filter select { color: var(--color-text-muted); cursor: not-allowed; }
.hotkeys {
  display: inline-flex;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}
.hotkey-btn {
  min-width: 48px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 800;
  color: var(--color-text-muted);
}
.hotkey-btn:hover { color: var(--color-text); background: var(--color-surface-offset); }
.hotkey-btn.active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.header-actions { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--color-surface-offset); color: var(--color-text); }
.source-badge {
  padding: 5px 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.main {
  grid-column: 2;
  overflow: auto;
  min-width: 0;
  background:
    radial-gradient(circle at top right, color-mix(in oklch, var(--color-primary) 5%, transparent), transparent 28rem),
    var(--color-bg);
}
.content {
  width: min(100%, 1280px);
  padding: var(--space-4);
}
.page-tabs {
  display: flex;
  align-items: flex-end;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.page-tab {
  height: 38px;
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 800;
}
.page-tab:hover { color: var(--color-text); background: var(--color-surface); }
.page-tab.active {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.page-view { display: none; }
.page-view.active { display: block; }
.dashboard-section { margin-bottom: var(--space-4); }
.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-5) 0 var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--color-text);
}
.section-title-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  flex: 0 0 auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: var(--space-4);
}
.kpi-card {
  min-height: 112px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-interactive), transform var(--transition-interactive);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-accent, var(--color-primary));
  opacity: 0.6;
}
.kpi-label {
  max-width: calc(100% - 36px);
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.kpi-value {
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: 1;
  color: var(--color-text);
  font-variant-numeric: tabular-nums lining-nums;
}
.kpi-meta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 800;
}
.kpi-delta.up { background: color-mix(in oklch, var(--color-success) 12%, transparent); color: var(--color-success); }
.kpi-delta.down { background: color-mix(in oklch, var(--color-error) 12%, transparent); color: var(--color-error); }
.kpi-delta.neutral { background: color-mix(in oklch, var(--color-text-faint) 15%, transparent); color: var(--color-text-muted); }
.kpi-sublabel { color: var(--color-text-faint); font-size: var(--text-xs); }
.kpi-icon {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-3);
  color: var(--card-accent, var(--color-primary));
  opacity: 0.15;
}
.kpi-icon svg { width: 36px; height: 36px; }
.kpi-card.placeholder {
  background: color-mix(in oklch, var(--color-warning) 5%, var(--color-surface));
  border-color: color-mix(in oklch, var(--color-warning) 38%, var(--color-border));
}
.kpi-card.ratio-card .kpi-value { font-size: var(--text-lg); }
.ratio-bar {
  height: 4px;
  margin-top: var(--space-2);
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
}
.ratio-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-error);
}

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.chart-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
}
.chart-subtitle {
  margin-top: 2px;
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}
.chart-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.legend-dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex: 0 0 auto; }
.chart-wrap { position: relative; height: 200px; }

.table-card {
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}
.table-card-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
}
.table-period {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}
.scrollable-table { max-height: calc(100dvh - 180px); overflow: auto; }
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums lining-nums;
}
.summary-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-offset);
}
.summary-table th {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.summary-table th:first-child { padding-left: var(--space-5); }
.summary-table th:last-child { padding-right: var(--space-5); text-align: right; }
.summary-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap;
}
.summary-table td:first-child { padding-left: var(--space-5); }
.summary-table td:last-child { padding-right: var(--space-5); text-align: right; }
.summary-table tr:hover td { background: var(--color-surface-offset); }
.summary-table .td-num {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  text-align: right;
}
.summary-table .row-section {
  background: color-mix(in oklch, var(--color-primary) 6%, var(--color-surface));
}
.summary-table .row-section td {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.summary-table .row-total { background: var(--color-surface-offset); }
.summary-table .row-total td {
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-text);
  font-weight: 800;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
}
.badge-gold {
  background: color-mix(in oklch, var(--color-primary) 14%, transparent);
  color: var(--color-primary);
}

.deal-terms-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.deal-terms-kpi-grid {
  grid-template-columns: minmax(min(240px, 100%), 320px);
}
.deal-terms-caption {
  margin-top: calc(var(--space-2) * -1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.deal-terms-chart-card {
  margin-top: var(--space-1);
}
.deal-terms-chart-wrap {
  position: relative;
  min-height: 220px;
}
.deal-terms-chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--color-text-faint);
  font-size: var(--text-sm);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
}

.notes-card {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.notes-title {
  margin-bottom: var(--space-2);
  color: var(--color-text);
  font-family: var(--font-display);
  font-weight: 800;
}

@media (max-width: 1100px) {
  .charts-row { grid-template-columns: 1fr; }
  .source-badge { display: none; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .sidebar-toggle { display: none; }
  .app { grid-template-columns: 1fr; }
  .header, .main { grid-column: 1; }
  .header {
    height: auto;
    min-height: 56px;
    align-items: flex-start;
    padding: var(--space-3);
    flex-wrap: wrap;
  }
  .filter-bar { order: 3; width: 100%; flex-direction: column; align-items: flex-start; }
}

@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deal-terms-kpi-grid { grid-template-columns: 1fr; }
  .filter-group { max-width: 100%; }
  .charts-row { grid-template-columns: 1fr; }
}

.metric-drilldown {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.metric-drilldown[hidden] { display: none !important; }
.metric-drilldown-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 45%);
}
.metric-drilldown-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(80dvh, 680px);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.metric-drilldown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}
.metric-drilldown-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
}
.metric-drilldown-body {
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
  padding: var(--space-4) var(--space-5);
}
.metric-drilldown-status {
  margin-bottom: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.metric-drilldown-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.metric-drilldown-link {
  display: block;
  padding: var(--space-1) 0;
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
  word-break: break-all;
}
.metric-drilldown-link:hover { text-decoration: underline; }
.metric-drilldown-empty {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.metric-drilldown-footer {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-divider);
}
.metric-drilldown-close-btn {
  min-height: 36px;
  padding: var(--space-2) var(--space-5);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  cursor: pointer;
}
.metric-drilldown-close-btn:hover { filter: brightness(0.95); }
body.modal-open { overflow: hidden; }

.kpi-card--drilldown {
  cursor: pointer;
}
.kpi-card--drilldown:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.summary-table .td-drilldown {
  cursor: pointer;
  color: var(--color-primary);
}
.summary-table .td-drilldown:hover {
  background: color-mix(in oklch, var(--color-primary) 8%, var(--color-surface-offset));
}
.summary-table .td-drilldown:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}
