:root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --border: #e2e8f0;
    --text: #172033;
    --muted: #64748b;
    --primary: #70142e;
    --primary-soft: #fbe6ea;
    --primary-deep: #3f0b1b;
    --success: #12a150;
    --info: #2f73ff;
    --info-soft: #d9e7ff;
    --warning: #ff7a30;
    --danger: #df375f;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.mobile-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 90; opacity: 0; pointer-events: none; transition: .25s ease; }
.mobile-backdrop.show { opacity: 1; pointer-events: auto; }
.app-shell { display: grid; grid-template-columns: 300px minmax(0,1fr); min-height: 100vh; }
.sidebar {
    background: linear-gradient(180deg, #70142e 0%, #5a1026 100%);
    color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; justify-content: space-between; gap: 24px; box-shadow: none;
}
.brand-block { display: flex; gap: 12px; align-items: center; padding: 8px 10px 18px; border-bottom: 1px solid rgba(255,255,255,.10); }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.15); color: #fff; display: grid; place-items: center; font-weight: 800; letter-spacing: .08em; }
.brand-block h1 { font-size: 1rem; margin: 0 0 4px; }
.brand-block p { margin: 0; color: rgba(255,255,255,.60); font-size: .78rem; }
.sidebar-mini-card, .sidebar-footer { margin: 18px 8px 0; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.08); display: grid; gap: 6px; }
.sidebar-mini-card .mini-title { color: rgba(255,255,255,.68); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; }
.sidebar-mini-card strong { font-size: .98rem; }
.sidebar-mini-card span, .sidebar-footer div { color: rgba(255,255,255,.72); font-size: .88rem; }
.menu-group-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,.42); margin: 16px 12px 8px; font-weight: 700; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; margin-bottom: 4px; color: rgba(255,255,255,.94); transition: background-color .15s ease, color .15s ease; font-size: .92rem; font-weight: 500; }
.menu-item:hover { background: rgba(255,255,255,.10); color: #fff; transform: none; }
.menu-item.active { background: var(--primary-deep); color: #fff; }
.sidebar-footer { grid-template-columns: auto 1fr; align-items: center; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; background: #63f498; box-shadow: 0 0 0 6px rgba(99,244,152,.18); }
.main-panel { padding: 26px 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: -6px -6px 18px; background: rgba(248,250,252,.96); border-bottom: 1px solid var(--border); padding: 12px 6px 14px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06); position: sticky; top: 0; z-index: 40; backdrop-filter: blur(10px); }
.topbar-left, .topbar-right { display: flex; gap: 14px; align-items: center; }
.topbar h2 { margin: 0 0 4px; font-size: 1.75rem; }
.topbar p { margin: 0; color: var(--muted); }
.icon-btn { border: 1px solid var(--border); background: #fff; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.05rem; color: var(--primary); box-shadow: none; cursor: pointer; }
.top-chip { border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.top-chip-soft { background: #eef4ff; color: #1d4ed8; }
.board-role-chip { display: inline-flex; align-items: center; padding: 9px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .82rem; font-weight: 800; }
.hero-strip { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(240px,.7fr); gap: 18px; margin-bottom: 22px; }
.summary-strip { display:block; }
.hero-copy, .hero-stat-card, .kpi-card, .panel-card { background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 16px; }
.hero-copy { padding: 24px; }
.hero-copy h3 { margin: 0 0 10px; font-size: clamp(1.4rem, 2vw, 2.15rem); line-height: 1.2; }
.hero-copy p { margin: 0; color: var(--muted); line-height: 1.7; }
.hero-stats { display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hero-stat-card { padding: 20px; display: grid; gap: 8px; }
.hero-stat-card span { color: var(--muted); font-weight: 600; }
.hero-stat-card strong { font-size: 1.45rem; }
.eyebrow { display: inline-flex; margin-bottom: 10px; color: var(--primary); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .78rem; }
.alerts-strip { display: grid; gap: 14px; margin-bottom: 24px; }
.alert-card { display: grid; grid-template-columns: 12px 1fr auto; gap: 16px; align-items: start; padding: 18px 20px; border-radius: 14px; color: var(--text); background:#fff; border:1px solid var(--border); box-shadow: var(--shadow); }
.alert-card.warning { border-left: 4px solid #f59e0b; }
.alert-card.danger { border-left: 4px solid #df375f; }
.alert-card.success, .alert-card.info { border-left: 4px solid var(--primary); }
.alert-marker { width: 10px; height: 10px; border-radius: 999px; background: var(--primary); margin-top: 5px; }
.alert-meta-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; color: var(--muted); }
.badge-inline { padding: 4px 9px; border-radius: 999px; background: #f8fafc; color: var(--muted); font-size: .72rem; font-weight: 700; border:1px solid var(--border); }
.alert-copy h3 { margin: 0 0 6px; font-size: 1.12rem; }
.alert-copy p { margin: 0; color: var(--muted); line-height: 1.55; }
.alert-close { border: 0; background: transparent; color: var(--muted); font-size: 1rem; cursor: pointer; }
.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin: 8px 0 14px; }
.section-head h3, .panel-head h4 { margin: 0 0 4px; font-size: 1.55rem; }
.section-head p, .panel-head p { margin: 0; color: var(--muted); }
.kpi-grid, .chart-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 18px; margin-bottom: 18px; }
.kpi-card { grid-column: span 3; padding: 20px; position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 999px; }
.kpi-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 16px; background: #f8fafc; color: var(--primary); }
.tone-success::before { background: var(--success); }
.tone-info::before { background: var(--info); }
.tone-primary::before { background: var(--primary); }
.tone-danger::before { background: var(--danger); }
.kpi-label { font-size: 1rem; color: var(--muted); margin-bottom: 10px; }
.kpi-value { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; line-height: 1; margin-bottom: 8px; }
.kpi-detail { color: var(--muted); font-size: .95rem; }
.panel-card { padding: 20px; grid-column: span 12; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 16px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-btn { border: 1px solid var(--border); background: #fff; color: var(--muted); border-radius: 999px; padding: 9px 14px; cursor: pointer; font-weight: 700; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-btn:hover { border-color: rgba(112,20,46,.35); color: var(--primary); }
.panel-body { min-height: 220px; min-width: 0; }
.compact-body { display: grid; align-content: center; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.table-wrap { overflow: auto; border-radius: 18px; border: 1px solid rgba(23,32,51,.06); }
table { width: 100%; border-collapse: collapse; min-width: 640px; background: #fff; }
thead th { text-align: left; font-size: .88rem; color: var(--muted); background: #fafbff; padding: 14px; border-bottom: 1px solid #edf0f5; }
tbody td { padding: 14px; border-bottom: 1px solid #f0f2f8; vertical-align: top; }
.rank-list { display: grid; gap: 12px; }
.rank-item { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 16px; border-radius: 18px; background: linear-gradient(180deg, #fff, #fafbff); border: 1px solid rgba(23,32,51,.06); }
.rank-item strong { display: block; margin-bottom: 4px; }
.rank-item span { color: var(--muted); font-size: .92rem; }
.rank-metric { font-size: 1.35rem; font-weight: 800; color: var(--primary); }
.treemap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; min-height: 220px; }
.tree-item { border-radius: 16px; background: linear-gradient(180deg, #cc95a3, #a84a64); color: #fff; padding: 16px; display: flex; flex-direction: column; justify-content: center; min-height: 88px; }
[data-chart="strategic-programme-mix"] .tree-item {
    background: linear-gradient(180deg, #8d1735, #70142e);
}
[data-chart="admissions-programme-mix"] .tree-item {
    background: linear-gradient(180deg, #8d1735, #70142e);
}
.tree-item strong { font-size: 1.4rem; }
.tree-item span { opacity: .92; }
.mini-bars { display: grid; gap: 14px; }
.mini-bar-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; }
.mini-bar-label, .mini-bar-value { font-weight: 700; }
.mini-bar-track { height: 14px; border-radius: 999px; background: #edf1f7; overflow: hidden; }
.mini-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #9b4157, #7b1730); }
.ring-grid { display: grid; place-items: center; min-height: 210px; }
.ring-card { display: grid; place-items: center; }
.ring-chart { width: 220px; height: 220px; border-radius: 50%; display: grid; place-items: center; }
.ring-inner { width: 130px; height: 130px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(23,32,51,.05); text-align: center; }
.ring-inner span { color: var(--muted); }
.ring-inner strong { font-size: 2rem; }
.legend-list { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.legend-list.vertical { flex-direction: column; align-items: flex-start; }
.legend-item { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.legend-item strong { color: var(--text); }
.legend-swatch { width: 12px; height: 12px; border-radius: 999px; }
.status-pill { padding: 6px 10px; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.status-accepted { background: rgba(18,161,80,.12); color: var(--success); }
.status-pending { background: rgba(255,122,48,.12); color: var(--warning); }
.status-rejected { background: rgba(223,55,95,.12); color: var(--danger); }
.empty-state { display: grid; place-items: center; min-height: 120px; color: var(--muted); background: linear-gradient(180deg, #fff, #fafbff); border: 1px dashed rgba(23,32,51,.12); border-radius: 18px; }
canvas { width: 100%; background: linear-gradient(180deg, rgba(112,20,46,.03), transparent 90%); border-radius: 14px; }
code { background: #f7f8fc; padding: 3px 7px; border-radius: 8px; }
@media (max-width: 1200px) {
    .kpi-card { grid-column: span 6; }
    .hero-strip, .span-4, .span-6, .span-8 { grid-column: span 12; grid-template-columns: 1fr; }
    .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; width: 292px; transform: translateX(-102%); transition: .25s ease; }
    .sidebar.open { transform: translateX(0); }
    .main-panel { padding: 14px; }
    .topbar { margin: 0 0 18px; padding: 14px; }
    .topbar h2 { font-size: 1.12rem; }
    .section-head { flex-direction: column; align-items: start; }
}
@media (max-width: 760px) {
    .hero-strip, .kpi-grid, .chart-grid { gap: 14px; }
    .kpi-card, .span-4, .span-6, .span-8, .span-12 { grid-column: span 12; }
    .hero-stats { grid-template-columns: 1fr; }
    .alert-card { grid-template-columns: 14px 1fr; }
    .alert-close { display: none; }
    .topbar, .topbar-right, .panel-head { flex-direction: column; align-items: start; }
    .main-panel { padding-bottom: 90px; }
    table { min-width: 560px; }
    .mini-bar-row { grid-template-columns: 1fr; }
    .ring-chart { width: 190px; height: 190px; }
    .ring-inner { width: 112px; height: 112px; }
}
@media (max-width: 520px) {
    .main-panel { padding: 12px; }
    .topbar, .hero-copy, .hero-stat-card, .kpi-card, .panel-card { border-radius: 20px; }
}
.analysis-toolbar { display:grid; grid-template-columns: 1fr auto; align-items:center; gap:18px; margin-bottom:18px; }
.compact-toolbar { min-height:auto; }
.kpi-card[data-drilldown-target], .panel-card[data-drilldown-target] { cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.kpi-card[data-drilldown-target]:hover, .panel-card[data-drilldown-target]:hover { transform: translateY(-2px); box-shadow: 0 20px 48px rgba(16,24,40,.12); }
.detail-drawer { position: fixed; inset: 0; z-index: 220; pointer-events: none; }
.detail-drawer.show { pointer-events: auto; }
.detail-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .42); opacity: 0; transition: .2s ease; }
.detail-drawer.show .detail-backdrop { opacity: 1; }
.detail-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(1120px, 95vw); background: #fff; box-shadow: -24px 0 60px rgba(15,23,42,.16); transform: translateX(102%); transition: .25s ease; display: grid; grid-template-rows: auto auto auto auto minmax(0,1fr) auto; gap: 16px; padding: 22px; }
.detail-drawer.show .detail-panel { transform: translateX(0); }
.detail-head { display:flex; justify-content:space-between; gap:16px; align-items:start; }
.detail-head h3 { margin:0 0 6px; }
.detail-head p { margin:0; color: var(--muted); }
.detail-summary { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:12px; }
.detail-stat { background: linear-gradient(180deg,#fff,#fafbff); border:1px solid rgba(23,32,51,.08); border-radius:18px; padding:16px; }
.detail-stat span { display:block; color:var(--muted); margin-bottom:6px; }
.detail-stat strong { font-size:1.35rem; }
.detail-filters { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:12px; }
.detail-filters label { display:grid; gap:8px; font-size:.92rem; color:var(--muted); }
.detail-filters input, .detail-filters select { border:1px solid var(--border); border-radius:14px; padding:12px 14px; font:inherit; background:#fff; color:var(--text); }
.analysis-note { padding:14px 16px; border-radius:18px; background: linear-gradient(180deg, rgba(123,23,48,.06), rgba(123,23,48,.02)); border:1px solid rgba(123,23,48,.12); color:var(--text); line-height:1.6; }
.detail-table-wrap { min-height: 320px; }
.detail-pagination { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.pagination-actions { display:flex; gap:10px; }
button:disabled { opacity:.55; cursor:not-allowed; }
@media (max-width: 980px) {
  .analysis-toolbar, .detail-summary, .detail-filters { grid-template-columns: 1fr; }
  .detail-panel { width: 100vw; padding: 16px; }
}
.chart-hint { margin-top: 10px; color: var(--muted); font-size: .9rem; }
.tree-item-btn, .mini-bar-row-btn, .legend-action { border: 0; width: 100%; text-align: left; cursor: pointer; }
.tree-item-btn:hover, .mini-bar-row-btn:hover, .legend-action:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(16,24,40,.08); }
.legend-action { background: transparent; padding: 8px 0; justify-content: flex-start; }
.detail-toolbar { display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap; }
.detail-context-wrap { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.detail-context { display:inline-flex; align-items:center; padding:8px 12px; border-radius:999px; background:#f3f4f8; color:var(--muted); font-weight:700; }
.detail-context.active { background: var(--primary-soft); color: var(--primary); }
.per-page-control { display:grid; gap:8px; color:var(--muted); font-size:.92rem; }
.per-page-control select { border:1px solid var(--border); border-radius:14px; padding:10px 14px; font:inherit; background:#fff; color:var(--text); }
.badge-ok { display:inline-flex; align-items:center; padding:6px 12px; border-radius:999px; font-size:.78rem; font-weight:700; background:#dcfce7; color:#166534; }
.source-chip { display:inline-flex; align-items:center; justify-content:center; padding:7px 11px; border-radius:999px; font-size:.76rem; font-weight:800; letter-spacing:.03em; background:#eef2ff; color:#3050a5; }
.status-live { background: rgba(18,161,80,.14); color: var(--success); }
.status-hybrid { background: rgba(47,115,255,.12); color: var(--info); }
.status-placeholder, .status-missing { background: rgba(255,122,48,.14); color: var(--warning); }
.strategic-kpi-grid .kpi-card { min-height:225px; display:grid; align-content:start; }
.source-status-list, .matrix-list { display:grid; gap:12px; align-content:start; }
.source-status-card { padding:16px; border-radius:18px; background:linear-gradient(180deg,#fff,#fafbff); border:1px solid rgba(23,32,51,.07); }
.source-status-card p { margin:10px 0 0; color:var(--muted); line-height:1.55; }
.source-status-top { display:flex; justify-content:space-between; gap:12px; align-items:center; }
.trend-pill { display:inline-flex; align-items:center; padding:6px 10px; border-radius:999px; font-weight:800; font-size:.82rem; }
.trend-pill.positive { background: rgba(18,161,80,.14); color: var(--success); }
.trend-pill.negative { background: rgba(223,55,95,.14); color: var(--danger); }
.budget-panel { display:grid; grid-template-columns:minmax(180px,240px) 1fr; gap:18px; align-items:center; }
@media (max-width: 980px) {
  .analysis-toolbar, .detail-summary, .detail-filters, .budget-panel { grid-template-columns: 1fr; }
  .detail-panel { width: 100vw; padding: 16px; }
}
