/* Project Monitor styles.
   Data colours: series-1..3 are the validated categorical slots (one per project),
   good/warning/serious/critical are the status palette. Neither is used for chrome.
   Chrome colour is the navy brand, kept apart from the project hues on purpose. */

:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --page: #f5f6f8;
  --surface: #ffffff;
  --raised: #ffffff;
  --sunken: #f8f9fb;
  --text: #101828;
  --text-2: #475467;
  --muted: #8a94a6;
  --grid: #eaecf0;
  --track: #eef0f3;
  --border: rgba(16, 24, 40, 0.075);
  --border-strong: rgba(16, 24, 40, 0.14);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 8px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 4px 10px -2px rgba(16, 24, 40, 0.05), 0 16px 36px -8px rgba(16, 24, 40, 0.14);
  --radius: 16px;

  --brand: #17345c;
  --brand-2: #1f4a80;
  --brand-ink: #ffffff;
  --brand-soft: #edf2fa;
  --brand-text: #1f4a80;

  /* Sidebar follows the page surface (light in light mode, dark in dark mode) */
  --side-bg: var(--surface);
  --side-bg-2: var(--surface);
  --side-text: var(--text-2);
  --side-strong: var(--text);
  --side-muted: var(--muted);
  --side-hover: var(--sunken);
  --side-active: var(--brand-soft);
  --side-border: var(--border);

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --progress: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --raised: #222221;
    --sunken: #151514;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --track: #2c2c2a;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 20px 48px rgba(0, 0, 0, 0.5);
    --brand: #dbe6f5;
    --brand-2: #b9cdea;
    --brand-ink: #0d1b2e;
    --brand-soft: rgba(143, 179, 232, 0.14);
    --brand-text: #8fb3e8;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --progress: #3987e5;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --raised: #222221;
  --sunken: #151514;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --track: #2c2c2a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 20px 48px rgba(0, 0, 0, 0.5);
  --brand: #dbe6f5;
  --brand-2: #b9cdea;
  --brand-ink: #0d1b2e;
  --brand-soft: rgba(143, 179, 232, 0.14);
  --brand-text: #8fb3e8;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --progress: #3987e5;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 0.92rem; font-weight: 650; }
p { margin: 0; }
code { font-size: 0.85em; background: var(--track); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.num { font-variant-numeric: tabular-nums; }

/* Line icons from _icons.html */
.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

/* ---------- Layout ---------- */

.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 20px 14px 14px; display: flex; flex-direction: column; gap: 18px;
  background: var(--side-bg);
  border-right: 1px solid var(--side-border);
  color: var(--side-text);
  scrollbar-width: thin;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; color: var(--side-strong); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #ffffff 0%, #d6e3f5 100%); color: #17345c;
  font-weight: 800; font-size: 0.9rem; letter-spacing: -0.02em;
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.45);
}
.brand-title { font-weight: 700; line-height: 1.15; font-size: 0.98rem; }
.brand-sub { font-size: 0.74rem; color: var(--side-muted); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--side-muted);
  padding: 14px 10px 6px; font-weight: 650;
}
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--side-text); font-size: 0.875rem; font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a .i { width: 18px; height: 18px; opacity: 0.8; }
.nav a:hover { background: var(--side-hover); color: var(--side-strong); text-decoration: none; }
.nav a.active { background: var(--side-active); color: var(--brand-text); font-weight: 600; }
.nav a.active .i { opacity: 1; }
.nav .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; margin: 0 4px 0 5px; }
.nav-group summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px; user-select: none;
  border-radius: 9px; padding-top: 8px; padding-bottom: 8px; margin-top: 2px; line-height: 1.3;
}
.nav-group summary:hover { background: var(--side-hover); color: var(--side-strong); }
.nav-group[open] { padding-bottom: 6px; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
  content: ""; margin-left: auto; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s ease; margin-right: 4px;
}
.nav-group[open] summary::after { transform: rotate(45deg); }
.nav-group summary .dot { margin: 0 6px 0 0; }
.nav-count { font-size: 0.66rem; padding: 0 6px; border-radius: 999px; background: var(--track); color: var(--side-text); letter-spacing: 0; }
.nav-group a { font-size: 0.84rem; padding: 6px 10px 6px 12px; margin-left: 9px; border-left: 1px solid var(--border); border-radius: 0 9px 9px 0; }
.nav-group a.active { border-left-color: var(--brand-text); }
.nav-group a .i { width: 16px; height: 16px; opacity: 0.65; }
.nav .badge {
  margin-left: auto; font-size: 0.7rem; font-weight: 650; padding: 1px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--text);
}

.user-box {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 12px; background: var(--sunken); border: 1px solid var(--side-border);
}
.user-box .avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #1f4a80, #3987e5); color: #fff; font-weight: 700; font-size: 0.85rem; text-transform: uppercase;
}
.user-box .who { min-width: 0; flex: 1; }
.user-box .who strong { display: block; font-size: 0.86rem; color: var(--side-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .who a, .user-box .who span { font-size: 0.74rem; color: var(--side-muted); }
.user-box .who a:hover { color: var(--side-strong); }
.user-box form { margin: 0; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--side-border); background: transparent; color: var(--side-text);
}
.icon-btn:hover { background: var(--track); color: var(--side-strong); }

.main { padding: 28px clamp(16px, 3vw, 40px) 64px; min-width: 0; max-width: 1480px; width: 100%; }

.topbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.topbar > div:first-child { flex: 1 1 460px; min-width: 0; }
.topbar .sub { color: var(--text-2); font-size: 0.92rem; margin-top: 6px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  margin-bottom: 8px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.section { margin-top: 30px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 1.05rem; }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.grid-projects { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }

/* ---------- Cards ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); min-width: 0;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 12px; }
.card-title .title-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand-text);
}
.card-title p { margin-top: 2px; }

/* KPI tiles */
.kpi { display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; --tone: var(--brand-text); padding: 20px; }
.kpi-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 2px; }
.kpi .label { font-size: 0.8rem; font-weight: 550; color: var(--text-2); }
.kpi-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--tone) 10%, transparent); color: var(--tone);
}
.kpi-icon .i { width: 17px; height: 17px; }
.kpi .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.kpi .value small { font-size: 0.95rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.kpi .foot { font-size: 0.8rem; color: var(--text-2); margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi .meter { margin-top: 10px; height: 6px; }
.kpi.tone-critical { --tone: var(--critical); }
.kpi.tone-good { --tone: var(--good); }

.delta {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; font-weight: 650;
  padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--brand-text)) 12%, transparent); color: var(--text);
}

/* Project cards */
.project-card {
  --accent: var(--series-1);
  position: relative; display: flex; flex-direction: column; gap: 18px; color: inherit; text-decoration: none;
  padding: 20px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.project-card:hover {
  text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.project-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.pc-head { display: flex; gap: 12px; align-items: center; }
.pc-icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.pc-icon .i { width: 21px; height: 21px; stroke-width: 1.9; }
.pc-title { min-width: 0; flex: 1; }
.pc-title .title { font-weight: 650; font-size: 1.02rem; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-title .code { font-size: 0.76rem; color: var(--muted); margin-top: 1px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-head .pill { flex: none; align-self: flex-start; }

/* Two headline numbers side by side, each with its bar */
.pc-progress { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.pc-stat { min-width: 0; }
.pc-stat-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pc-stat-label { font-size: 0.78rem; color: var(--text-2); font-weight: 550; }
.pc-stat-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pc-stat-value small { font-size: 0.8rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 1px; }
.pc-stat .bar-track { height: 6px; }
.pc-stat-sub { font-size: 0.75rem; color: var(--muted); margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pc-status .stack { height: 6px; gap: 2px; }
.pc-status .legend { margin-top: 9px; font-size: 0.76rem; gap: 4px 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 0.8rem; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-item b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.ldot { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.pc-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 14px; margin-top: auto;
  border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--text-2);
}
.pc-foot > span { display: inline-flex; align-items: center; gap: 5px; }
.pc-foot .i { width: 15px; height: 15px; color: var(--muted); }
.pc-open {
  margin-left: auto; width: 28px; height: 28px; border-radius: 50%; justify-content: center;
  background: var(--sunken); color: var(--text-2) !important; transition: background 0.18s ease, color 0.18s ease;
}
.pc-open .i { color: inherit !important; transition: transform 0.18s ease; }
.project-card:hover .pc-open { background: var(--accent); color: #fff !important; }
.project-card:hover .pc-open .i { transform: translateX(1px); }

/* Progress ring (kept for detail views) */
.ring {
  --size: 64px; --stroke: 7px; --ring: var(--accent, var(--series-1));
  width: var(--size); height: var(--size); border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--ring) calc(var(--p) * 1%), var(--track) 0);
  display: grid; place-items: center;
}
.ring::after { content: ""; position: absolute; inset: var(--stroke); border-radius: 50%; background: var(--surface); }
.ring span { position: relative; z-index: 1; font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Segmented status bar: 2px surface gap between fills */
.stack { display: flex; gap: 2px; height: 10px; border-radius: 6px; overflow: hidden; background: var(--track); }
.stack > span { display: block; height: 100%; min-width: 0; }
.stack-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 0.82rem; color: var(--text-2); }
.stack-legend .item { display: inline-flex; align-items: center; gap: 6px; }

/* Icon + label status chips (status colour never carries meaning alone) */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chip.good { --c: var(--good); }
.chip.warning { --c: var(--warning); }
.chip.progress { --c: var(--progress); }
.chip.muted { --c: var(--muted); }
.chip.critical { --c: var(--critical); }
.chip.serious { --c: var(--serious); }
.bg-good { background: var(--good); }
.bg-warning { background: var(--warning); }
.bg-progress { background: var(--progress); }
.bg-muted { background: var(--muted); }
.bg-series-1 { background: var(--series-1); }
.bg-series-2 { background: var(--series-2); }
.bg-series-3 { background: var(--series-3); }
.bg-remaining { background: var(--track); box-shadow: inset 0 0 0 1px var(--border-strong); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; background: var(--track); color: var(--text-2); white-space: nowrap;
}
.pill .i { width: 13px; height: 13px; }
.pill.alert {
  background: color-mix(in srgb, var(--critical) 11%, transparent); color: var(--critical);
  border: 1px solid color-mix(in srgb, var(--critical) 22%, transparent);
}
.pill.ghost { background: transparent; border: 1px solid var(--border-strong); }

/* Horizontal bars */
.bar-row { display: grid; grid-template-columns: 84px 1fr 52px; gap: 12px; align-items: center; padding: 5px 0; }
.bar-track { height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--c, var(--progress)); }
.bar-value { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.bar-group { display: grid; gap: 2px; padding: 12px 0; }
.bar-group + .bar-group { border-top: 1px solid var(--border); }
.bar-group .group-title { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 4px; }

/* Budget breakdown */
.budget { display: flex; height: 16px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--track); }
.budget > span { display: block; height: 100%; min-width: 0; }
.budget-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; margin-top: 20px; }
.budget-legend .item {
  display: flex; gap: 10px; align-items: flex-start; font-size: 0.8rem; color: var(--text-2);
  padding: 0 0 0 2px;
}
.budget-legend .item strong { display: block; color: var(--text); font-size: 1rem; font-variant-numeric: tabular-nums; margin-bottom: 1px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; margin-top: 5px; flex: none; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 650;
  background: var(--sunken); position: sticky; top: 0; white-space: nowrap; padding-top: 10px; padding-bottom: 10px;
}
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: var(--sunken); }
td .name { font-weight: 600; }
td .meta { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.mini { display: inline-flex; align-items: center; gap: 10px; min-width: 140px; }
.mini .bar-track { flex: 1; height: 6px; }
.mini .num { font-size: 0.82rem; min-width: 36px; text-align: right; font-weight: 600; }
.details-table td { padding: 11px 0; }
.details-table td:first-child { color: var(--muted); width: 46%; }
.details-table td:last-child { font-weight: 550; }

/* ---------- Controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px;
  border: 1px solid var(--border-strong); background: var(--raised); color: var(--text);
  padding: 0 14px; border-radius: 10px; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn .i { width: 16px; height: 16px; }
.btn:hover { text-decoration: none; background: var(--sunken); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand); border-color: transparent; color: var(--brand-ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-primary:hover { background: var(--brand-2); box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--brand) 60%, transparent); }
.btn-danger { color: var(--critical); }
.btn-small { height: 30px; padding: 0 11px; font-size: 0.78rem; border-radius: 8px; }

.input, select, textarea,
input[type="text"], input[type="number"], input[type="date"], input[type="search"], input[type="password"], input[type="email"] {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--raised); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 9px 12px; width: 100%; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; }
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-text) 20%, transparent);
}
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
input:disabled, select:disabled, textarea:disabled { background: var(--sunken); color: var(--text-2); cursor: not-allowed; }
label { display: grid; gap: 6px; font-size: 0.82rem; color: var(--text-2); font-weight: 600; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px;
  padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.toolbar label { min-width: 160px; flex: 1 1 160px; }
.toolbar .search { flex: 2 1 260px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.errorlist { color: var(--critical); list-style: none; padding: 0; margin: 4px 0 0; font-size: 0.8rem; }
.hint { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 16px; padding: 26px 20px; text-align: center;
  background: var(--sunken); color: var(--text-2); display: grid; justify-items: center; gap: 8px;
}
.dropzone .drop-icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-text);
}
.dropzone strong { color: var(--text); }
.dropzone input[type="file"] { font: inherit; font-size: 0.85rem; max-width: 100%; }

/* Underlined tabs */
.tabs {
  display: flex; gap: 6px; margin: 26px 0 22px; max-width: 100%; overflow-x: auto;
  border-bottom: 1px solid var(--border-strong); scrollbar-width: none;
}
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px 11px;
  color: var(--text-2); font-weight: 550; font-size: 0.88rem; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s ease, border-color 0.15s ease;
}
.tabs a .i { width: 16px; height: 16px; opacity: 0.8; }
.tabs a:hover { text-decoration: none; color: var(--text); border-bottom-color: var(--border-strong); }
.tabs a.active { color: var(--brand-text); border-bottom-color: var(--brand-text); font-weight: 650; }
.tabs a.active .i { opacity: 1; }

/* Photos & documents */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.photo {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow-sm); color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.photo:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--track); }
.photo .cap { padding: 11px 13px 6px; font-size: 0.85rem; font-weight: 600; }
.photo .cap .meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; font-weight: 500; }
.photo .foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 13px 12px; gap: 8px; }

.doc-list .doc { display: flex; gap: 14px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); }
.doc-list .doc:first-child { border-top: 0; }
.doc-list .doc:hover { background: var(--sunken); }
.doc .type {
  width: 42px; height: 48px; border-radius: 10px; display: grid; place-items: center; font-size: 0.66rem; font-weight: 750;
  background: var(--brand-soft); color: var(--brand-text); flex: none; text-transform: uppercase; letter-spacing: 0.04em;
}
.doc .grow { flex: 1; min-width: 0; }
.doc .grow .name { font-weight: 600; overflow-wrap: anywhere; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: grid; justify-items: center; gap: 4px; }
.empty .empty-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 8px;
  background: var(--track); color: var(--muted);
}
.empty strong { display: block; color: var(--text-2); }

/* Flash messages */
.flashes { display: grid; gap: 8px; margin-bottom: 20px; }
.flash {
  position: relative; padding: 12px 16px 12px 18px; border-radius: 12px; font-size: 0.88rem;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden;
}
.flash::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-text); }
.flash.success::before { background: var(--good); }
.flash.error { color: var(--critical); }
.flash.error::before { background: var(--critical); }
.flash.note::before { background: var(--warning); }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 11px 0; position: relative; }
.timeline li + li { border-top: 1px solid var(--border); }
.timeline .tick {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-text);
}
.timeline .tick .i { width: 15px; height: 15px; }
.timeline .tick.warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--text); }
.timeline .when { font-size: 0.76rem; color: var(--muted); margin-top: 1px; }

.back { font-size: 0.82rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.back:hover { color: var(--text); text-decoration: none; }

.page-title { display: flex; align-items: center; gap: 14px; }
.page-title .pc-icon { width: 52px; height: 52px; border-radius: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.theme-toggle { width: 38px; padding: 0; }

.callout {
  display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--warning) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--text); font-size: 0.85rem;
}
.callout:hover { text-decoration: none; background: color-mix(in srgb, var(--warning) 15%, transparent); }
.callout .i { color: #b77d00; }
.callout .i:last-child { margin-left: auto; color: var(--text-2); }

/* ---------- Bill payments ---------- */

.balance {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; margin-top: 16px;
  padding: 14px 16px; border-radius: 14px; background: var(--sunken); border: 1px solid var(--border);
}
.balance span { display: block; font-size: 0.7rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.balance strong { display: block; font-size: 0.95rem; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }
.label-text { display: inline-flex; align-items: center; gap: 6px; }
.label-text .i { width: 12px; height: 12px; color: var(--muted); }
.balance-bar { grid-column: 1 / -1; height: 8px; display: flex; }
.balance-bar .bar-fill { border-radius: 0; }
.balance-bar .bar-fill:first-child { border-radius: 999px 0 0 999px; }
/* The pending payment shows as a striped extension of the paid bar */
.balance-new {
  background: repeating-linear-gradient(135deg, var(--good) 0 4px, color-mix(in srgb, var(--good) 55%, transparent) 4px 8px);
  border-radius: 0 999px 999px 0 !important;
}
.pay-preview {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; font-weight: 550;
  background: color-mix(in srgb, var(--good) 10%, transparent); border: 1px solid color-mix(in srgb, var(--good) 28%, transparent);
}
.pay-preview.over {
  background: color-mix(in srgb, var(--critical) 9%, transparent); border-color: color-mix(in srgb, var(--critical) 30%, transparent);
  color: var(--critical);
}
.money { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.who-cell { display: inline-flex; align-items: center; gap: 8px; }
.who-cell .name { white-space: nowrap; }
.who-cell .avatar-sm {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand-text); font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
}

/* ---------- Facility page ---------- */

.tab-count {
  font-size: 0.7rem; font-weight: 650; min-width: 20px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border);
}
.tabs a.active .tab-count { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }

.component-list { list-style: none; margin: 0; padding: 0; }
.component-list li { padding: 12px 22px; border-top: 1px solid var(--border); }
.component-row { display: flex; align-items: center; gap: 14px; }
.component-row .grow { flex: 1; min-width: 0; }
.component-row .name { font-weight: 600; font-size: 0.9rem; }
.component-row .meta { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.component-row .mini { min-width: 150px; }
.component-edit { margin-top: 6px; }
.component-edit summary { cursor: pointer; color: var(--brand-text); font-weight: 600; width: fit-content; }
.component-edit[open] { padding: 10px 12px; margin-top: 8px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--border); }
.component-edit > form + form { margin-top: 8px; }
.component-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(90px, 1fr) auto; gap: 10px; align-items: end; margin-top: 10px; }
.component-form.add {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(90px, 0.8fr) auto;
  padding: 16px 22px; border-top: 1px solid var(--border); background: var(--sunken); margin: 0;
}

/* ---------- Users & roles ---------- */

.role-picker { border: 0; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.role-picker legend { font-size: 0.82rem; font-weight: 600; color: var(--text-2); margin-bottom: 8px; padding: 0; }
.role-option {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 13px; cursor: pointer;
  border: 1.5px solid var(--border-strong); background: var(--raised); font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.role-option:hover { border-color: var(--brand-text); }
.role-option:has(input:checked) { border-color: var(--brand-text); background: var(--brand-soft); }
.role-option:has(input:disabled) { cursor: not-allowed; opacity: 0.75; }
.role-option input { position: absolute; opacity: 0; pointer-events: none; }
.role-option:has(input:focus-visible) { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.role-option strong { display: block; color: var(--text); font-size: 0.9rem; }
.role-option .hint { display: block; margin-top: 2px; }
.role-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--track); color: var(--text-2);
}
.role-option:has(input:checked) .role-icon { background: var(--brand); color: var(--brand-ink); }
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-weight: 600; color: var(--text); }
.check-row input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- Login ---------- */

.login-shell { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }

.login-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px clamp(24px, 5vw, 64px); color: #fff;
  background:
    radial-gradient(circle at 85% 12%, rgba(57, 135, 229, 0.35) 0, transparent 40%),
    radial-gradient(circle at 8% 92%, rgba(27, 175, 122, 0.28) 0, transparent 45%),
    linear-gradient(150deg, #0b1b33 0%, #13294b 55%, #17345c 100%);
}
.login-brand::after {
  content: ""; position: absolute; width: 560px; height: 560px; right: -200px; bottom: -220px; border-radius: 50%;
  border: 60px solid rgba(255, 255, 255, 0.05);
}
.login-brand .brand { padding: 0; position: relative; z-index: 1; }
.login-brand .brand-sub { color: rgba(255, 255, 255, 0.65); }
.login-pitch { max-width: 470px; position: relative; z-index: 1; }
.login-pitch h1 { font-size: clamp(1.9rem, 3vw, 2.6rem); letter-spacing: -0.03em; line-height: 1.1; }
.login-pitch p { margin-top: 16px; color: rgba(255, 255, 255, 0.78); font-size: 1rem; }
.login-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.login-points li {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 13px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(6px);
}
.login-points .check {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: #fff; color: #17345c;
}
.login-points .check .i { width: 14px; height: 14px; stroke-width: 2.6; }
.login-foot { font-size: 0.8rem; color: rgba(255, 255, 255, 0.55); position: relative; z-index: 1; }

.login-panel { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(410px, 100%); padding: 34px; box-shadow: var(--shadow-lg); }
.login-card h2 { font-size: 1.5rem; font-weight: 750; }
.login-card-brand { display: none; margin-bottom: 18px; }
.login-card-brand .brand-mark { width: 46px; height: 46px; border-radius: 13px; background: var(--brand); color: var(--brand-ink); }
.login-fields { display: grid; gap: 16px; margin-top: 24px; }
.login-fields input { padding: 11px 13px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 74px; }
.password-field .btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); box-shadow: none; }
.login-submit { width: 100%; height: 44px; margin-top: 24px; font-size: 0.95rem; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 12px;
    padding: 10px 14px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--side-border); min-width: 0;
  }
  .sidebar .nav { flex-direction: row; gap: 4px; }
  .sidebar .nav-label, .sidebar .brand-sub, .sidebar .brand-title { display: none; }
  .sidebar .nav a { white-space: nowrap; padding: 8px 11px; }
  .sidebar .nav a.active::before { display: none; }
  .sidebar .brand { flex: none; padding: 0; }
  .user-box { margin-top: 0; flex: none; padding: 4px; background: transparent; border: 0; }
  .user-box .who, .user-box .avatar { display: none; }
  .main { padding: 22px 16px 48px; }
  .kpi .value { font-size: 1.6rem; }
  .budget-legend { grid-template-columns: minmax(0, 1fr); }
  .balance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-picker { grid-template-columns: minmax(0, 1fr); }
  .component-form, .component-form.add { grid-template-columns: minmax(0, 1fr); }
  .component-row { flex-wrap: wrap; }
  .login-shell { grid-template-columns: minmax(0, 1fr); }
  .login-brand { display: none; }
  .login-card { padding: 26px 22px; }
}

@media (max-width: 420px) {
  .pc-metrics { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  .bar-fill { transition: width 0.6s ease; }
}

@media (prefers-reduced-motion: reduce) {
  .project-card, .photo, .btn { transition: none; }
  .project-card:hover, .photo:hover { transform: none; }
}

/* Photo, document and map links under each facility in the facilities table */
.file-counts { display: flex; gap: 12px; margin-top: 4px; }
.file-counts a { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 600; }
.file-counts a:hover { color: var(--brand-text); text-decoration: none; }
.file-counts .i { width: 13px; height: 13px; }

/* Programme section headings */
.programme-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.programme-title .ldot { width: 11px; height: 11px; border-radius: 4px; }
.programme-sub { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.68rem; font-weight: 650; padding-top: 14px; }

/* Facility details list */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 0; }
.facts > div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: 0.7rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.facts dd { margin: 3px 0 0; font-weight: 550; overflow-wrap: anywhere; }

/* Photo viewer (static/tracker/lightbox.js) */
.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(1100px, 94vw); width: 100%;
  color: #f0efec;
}
.lightbox::backdrop { background: rgba(8, 12, 20, 0.86); }
.lightbox-frame { position: relative; display: grid; place-items: center; }
.lightbox-frame img { max-width: 100%; max-height: 78vh; border-radius: 14px; display: block; background: #1a1a19; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  border: 0; cursor: pointer; font-size: 1.8rem; line-height: 1; background: rgba(255, 255, 255, 0.9); color: #0b1220;
}
.lightbox-nav.prev { left: 10px; }
.lightbox-nav.next { right: 10px; }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 4px 0; }
.lightbox-meta, .lightbox-count { color: rgba(240, 239, 236, 0.7); font-size: 0.85rem; }
.lightbox-actions { display: flex; align-items: center; gap: 8px; }

/* Clickable facility rows in tables */
tr[data-href] { cursor: pointer; }
a.row-link { color: var(--text); }
a.row-link:hover { color: var(--brand-text); }

@media (max-width: 900px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
}

/* Logo (PMU BRCs & PTCs Balochistan emblem) */
.brand-logo {
  width: 52px; height: 52px; border-radius: 50%; flex: none; display: block;
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.55);
}
.sidebar .brand-title { font-size: 0.95rem; letter-spacing: -0.01em; }
.login-brand .brand { gap: 18px; }
.login-brand .brand-logo { width: 96px; height: 96px; box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.6); }
.login-brand .brand-title { font-size: 1.3rem; font-weight: 750; letter-spacing: -0.015em; }
.login-brand .brand-sub { font-size: 0.85rem; margin-top: 4px; }
.login-card-logo { display: none; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-card-logo img { width: 72px; height: 72px; border-radius: 50%; flex: none; }
.login-card-name { font-weight: 700; line-height: 1.25; }
@media (max-width: 900px) {
  .login-card-logo { display: flex; }  /* the brand panel is hidden on small screens */
}

/* ---------- 2026 refresh: light sidebar, hero band ---------- */

.sidebar .brand { padding: 2px 6px 4px; gap: 11px; }
.sidebar .brand-logo { width: 42px; height: 42px; box-shadow: 0 2px 8px -2px rgba(16, 24, 40, 0.25); }
.sidebar .brand-title { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.sidebar .brand-sub { color: var(--muted); }
.login-brand .brand { color: #fff; }

.topbar .actions .theme-toggle { color: var(--text-2); }

/* Overview hero: the portfolio's headline figures on the brand navy */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; color: #fff;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px 36px; align-items: center;
  background:
    radial-gradient(circle at 100% 0%, rgba(57, 135, 229, 0.38) 0, transparent 46%),
    radial-gradient(circle at 0% 100%, rgba(27, 175, 122, 0.22) 0, transparent 42%),
    linear-gradient(135deg, #0f2240 0%, #17345c 60%, #1f4a80 100%);
  box-shadow: 0 18px 40px -22px rgba(15, 34, 64, 0.65);
}
.hero::after {
  content: ""; position: absolute; width: 380px; height: 380px; right: -140px; bottom: -220px; border-radius: 50%;
  border: 46px solid rgba(255, 255, 255, 0.04); pointer-events: none;
}
.hero-main { display: flex; align-items: center; gap: 20px; position: relative; z-index: 1; }
.hero-ring {
  --size: 118px; width: var(--size); height: var(--size); border-radius: 50%; position: relative; flex: none;
  display: grid; place-items: center; text-align: center;
}
.hero-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(#ffffff calc(var(--p) * 1%), rgba(255, 255, 255, 0.14) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
}
.hero-ring strong { display: block; font-size: 1.65rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1; }
.hero-ring strong small { font-size: 0.85rem; font-weight: 600; opacity: 0.7; margin-left: 1px; }
.hero-ring span { display: block; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.65; margin-top: 4px; font-weight: 600; }
.hero-caption h2 { font-size: 1.05rem; font-weight: 650; color: #fff; }
.hero-caption p { font-size: 0.85rem; color: rgba(255, 255, 255, 0.72); margin-top: 4px; max-width: 220px; }

.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: relative; z-index: 1; }
.hero-stat { padding: 4px 0 4px 24px; border-left: 1px solid rgba(255, 255, 255, 0.14); min-width: 0; }
.hero-stat .label { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; color: rgba(255, 255, 255, 0.7); font-weight: 550; }
.hero-stat .label .i { width: 15px; height: 15px; opacity: 0.8; }
.hero-stat .value { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; margin-top: 8px; white-space: nowrap; }
.hero-stat .value small { font-size: 0.85rem; font-weight: 600; opacity: 0.65; margin-left: 2px; letter-spacing: 0; }
.hero-stat .foot { font-size: 0.78rem; color: rgba(255, 255, 255, 0.72); margin-top: 6px; }
.hero-stat .bar-track { height: 5px; margin-top: 10px; background: rgba(255, 255, 255, 0.14); max-width: 220px; }
.hero-stat .bar-fill { background: #fff; }
.hero-flag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-weight: 600;
  background: rgba(255, 120, 120, 0.18); color: #ffd4d4; border: 1px solid rgba(255, 140, 140, 0.3);
}
.hero-flag.ok { background: rgba(80, 220, 150, 0.16); color: #c9f5de; border-color: rgba(80, 220, 150, 0.3); }

/* Section heading for each programme */
.section-head .programme-title { font-size: 1.02rem; }
.section-head .programme-title .muted { font-weight: 500; }

@media (max-width: 1180px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .hero { padding: 22px 20px; }
  .hero-stats { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .hero-stat { border-left: 0; padding: 14px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.14); }
  .hero-ring { --size: 100px; }
}
@media (max-width: 900px) {
  .sidebar .brand-logo { width: 36px; height: 36px; }
  .nav-group a { margin-left: 0; border-left: 0; border-radius: 9px; }
}
.nav-summary { padding: 8px 10px; font-size: 0.86rem; font-weight: 550; color: var(--side-text); }
.nav-summary .dot { margin: 0 8px 0 3px !important; width: 8px; height: 8px; border-radius: 50%; }
.nav-summary-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group[open] > .nav-summary { color: var(--side-strong); }
@media (max-width: 900px) {
  .sidebar .nav-group { display: none; }  /* projects are listed on the dashboard itself */
}
@media (max-width: 600px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 16px; }
  .kpi .value { font-size: 1.35rem; }
  .kpi-icon { display: none; }
}
