:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --ink: #10201b;
  --ink-2: #374a43;
  --muted: #6b7d75;
  --line: #e2e8e5;
  --line-strong: #cfd9d4;
  --accent: #0f766e;
  --accent-2: #0b5a54;
  --accent-soft: #e3f2ee;
  --gold: #b7791f;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --ok: #15803d;
  --ok-soft: #e8f6ed;
  --sidebar: #0b241d;
  --sidebar-2: #0f2e26;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 27, .04), 0 8px 24px -18px rgba(16, 32, 27, .35);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
::selection { background: #b7e4d7; }

/* ---------------------------------------------------------------- shell */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 258px;
  flex: 0 0 258px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #081a15 100%);
  color: #d7e5df;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px 20px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px; }
.brand-name { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.brand-tag { font-size: 10.5px; color: #7fb3a2; letter-spacing: .07em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  color: #b9cec6; font-size: 13.6px; font-weight: 500;
  transition: background .14s, color .14s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -10px rgba(15,118,110,.9); }
.nav .ic { width: 17px; text-align: center; opacity: .9; font-size: 14px; }

.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255,255,255,.09); }
.status-line { font-size: 11.6px; color: #89b3a4; margin-bottom: 4px; }
.status-line.muted { color: #5f8577; }
.status-line.on { color: #4ade80; }
.status-line.off { color: #fbbf24; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; display: flex; align-items: center; gap: 14px;
  padding: 0 26px; background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
.crumb { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.chip {
  font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.chip.ok { background: var(--ok-soft); border-color: #c6e7d2; color: var(--ok); }
.chip.warn { background: var(--warn-soft); border-color: #f0dcb8; color: var(--warn); }

.view { padding: 26px; max-width: 1280px; width: 100%; margin: 0 auto; }
.menu-btn { display: none; }

/* ---------------------------------------------------------------- primitives */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 9px; font-size: 13.4px; font-weight: 600;
  cursor: pointer; transition: background .14s, border-color .14s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { color: var(--danger); border-color: #f1c9c4; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 11px; font-size: 12.6px; border-radius: 8px; }
.btn-lg { padding: 11px 20px; font-size: 14.5px; }
.icon-btn { background: none; border: 0; font-size: 19px; color: var(--ink-2); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12.4px; color: var(--muted); margin-top: 1px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; letter-spacing: -.025em; }
.page-head .desc { color: var(--muted); font-size: 13.4px; margin-top: 4px; max-width: 720px; }
.page-head .right { margin-left: auto; display: flex; gap: 9px; }

.label { display: block; font-size: 12.4px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.hint { font-size: 11.8px; color: var(--muted); margin-top: 5px; }
.req { color: var(--danger); margin-left: 2px; }

input[type=text], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  font-family: inherit; font-size: 13.6px; color: var(--ink); background: #fff;
  transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%236b7d75' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.4px; font-weight: 650;
  padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em;
}
.badge.draft { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb8; }
.badge.final { background: var(--ok-soft); color: var(--ok); border-color: #c6e7d2; }
.badge.accent { background: var(--accent-soft); color: var(--accent-2); border-color: #bfe3d8; }
.badge.risk-tinggi, .badge.risk-high { background: var(--danger-soft); color: var(--danger); border-color: #f1c9c4; }
.badge.risk-sederhana, .badge.risk-medium { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb8; }
.badge.risk-rendah, .badge.risk-low { background: var(--ok-soft); color: var(--ok); border-color: #c6e7d2; }

.table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
.table th { text-align: left; font-size: 11.6px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfb; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.2px; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }

/* ---------------------------------------------------------------- dashboard */
.hero {
  background: linear-gradient(120deg, #0b241d 0%, #11473a 62%, #17695a 100%);
  color: #eaf6f1; border-radius: 18px; padding: 26px 28px; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -70px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(52,211,153,.28), transparent 68%);
}
.hero h1 { font-size: 26px; letter-spacing: -.03em; }
.hero p { color: #b9d8cd; max-width: 620px; margin-top: 7px; font-size: 13.8px; }
.hero .tags { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.hero .tags span { font-size: 11.6px; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); }

.stat { padding: 17px 18px; }
.stat .k { font-size: 11.8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 27px; font-weight: 700; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12.2px; color: var(--muted); margin-top: 2px; }

.module-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.module-card .step { font-size: 11.4px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.module-card h3 { font-size: 15.6px; }
.module-card p { font-size: 13px; color: var(--muted); margin: 0; }
.module-card .foot { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.module-card.soon { opacity: .72; }

/* ---------------------------------------------------------------- generator */
.gen-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.gen-side { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 14px; }
.form-section { padding: 20px; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section h3 { font-size: 14px; margin-bottom: 2px; }
.form-section .lead { font-size: 12.6px; color: var(--muted); margin-bottom: 14px; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row-item { display: grid; gap: 8px; align-items: center; }
.row-item.committee { grid-template-columns: 1.3fr 1fr 34px; }
.row-item.activity { grid-template-columns: 110px 1fr 34px; }
.row-item.budget { grid-template-columns: 1.6fr 80px 110px 100px 34px; }
.row-item .del { color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 15px; padding: 4px; border-radius: 6px; }
.row-item .del:hover { color: var(--danger); background: var(--danger-soft); }
.row-item .total { font-size: 12.6px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.meter { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, #0f766e, #34d399); transition: width .3s; }
.meter.warn > span { background: linear-gradient(90deg, #b45309, #f59e0b); }
.side-block { padding: 16px; }
.side-block h4 { font-size: 12.6px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.missing-list { list-style: none; margin: 0; padding: 0; font-size: 12.6px; }
.missing-list li { padding: 5px 0; border-bottom: 1px dashed var(--line); color: var(--warn); display: flex; gap: 7px; }
.missing-list li:last-child { border-bottom: 0; }
.missing-list li::before { content: '!'; font-weight: 800; }
.missing-list li.done { color: var(--ok); }
.missing-list li.done::before { content: '✓'; }

.toggle { display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; }
.toggle input { width: 34px; height: 19px; appearance: none; background: var(--line-strong); border-radius: 99px; position: relative; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ''; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform .15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(15px); }

/* ---------------------------------------------------------------- editor */
.doc-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.doc-nav { position: sticky; top: 78px; padding: 12px; }
.doc-nav a { display: block; padding: 7px 9px; border-radius: 7px; font-size: 12.8px; color: var(--ink-2); }
.doc-nav a:hover { background: var(--surface-2); }
.doc-nav a span { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
.doc-title-bar { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.doc-title-bar h1 { font-size: 22px; letter-spacing: -.025em; }
.doc-title-bar .meta { font-size: 12.6px; color: var(--muted); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }

.sec-card { margin-bottom: 14px; }
.sec-card .sec-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.sec-card .sec-head h3 { font-size: 13.8px; }
.sec-card .sec-head .no { width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-2); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.sec-card .sec-body { padding: 16px 18px; font-size: 13.8px; color: var(--ink-2); }
.sec-card .sec-body p { margin: 0 0 9px; }
.sec-card .sec-body p:last-child { margin-bottom: 0; }
.sec-card .sec-body h3, .sec-card .sec-body h4 { font-size: 13.6px; margin: 12px 0 6px; color: var(--ink); }
.sec-card .sec-body ul, .sec-card .sec-body ol { margin: 0 0 10px 20px; padding: 0; }
.sec-card .sec-body table { width: 100%; border-collapse: collapse; font-size: 12.8px; margin: 8px 0 10px; }
.sec-card .sec-body th, .sec-card .sec-body td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.sec-card .sec-body th { background: var(--surface-2); font-weight: 650; }
.sec-card .sec-body blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); }
.sec-card textarea { min-height: 200px; font-family: var(--mono); font-size: 12.6px; }
.placeholder-mark { background: var(--warn-soft); color: var(--warn); padding: 1px 4px; border-radius: 4px; font-size: .94em; }

.alert { display: flex; gap: 11px; padding: 13px 16px; border-radius: 11px; font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.alert .ic { font-weight: 800; }
.alert.warn { background: var(--warn-soft); border-color: #f0dcb8; color: #7c4a09; }
.alert.info { background: var(--accent-soft); border-color: #bfe3d8; color: var(--accent-2); }
.alert.danger { background: var(--danger-soft); border-color: #f1c9c4; color: var(--danger); }
.alert ul { margin: 6px 0 0 18px; padding: 0; }

/* ---------------------------------------------------------------- forecast */
.kpi { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.kpi .k { font-size: 11.8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 32px; font-weight: 700; letter-spacing: -.035em; margin-top: 3px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .v small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi .d { font-size: 12.4px; color: var(--muted); margin-top: 5px; }
.kpi.accent { background: linear-gradient(140deg, #0f766e, #115e57); color: #fff; border-color: transparent; }
.kpi.accent .k, .kpi.accent .d { color: #bfe3d8; }
.kpi.accent .v small { color: #bfe3d8; }

.interval-bar { margin-top: 14px; }
.interval-bar .track { height: 10px; border-radius: 99px; background: rgba(255,255,255,.22); position: relative; }
.interval-bar .fill { position: absolute; height: 100%; border-radius: 99px; background: #6ee7b7; }
.interval-bar .pin { position: absolute; top: -4px; width: 3px; height: 18px; background: #fff; border-radius: 2px; }
.interval-labels { display: flex; justify-content: space-between; font-size: 11px; margin-top: 5px; color: rgba(255,255,255,.8); }

.driver { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.driver:last-child { border-bottom: 0; }
.driver .val { font-variant-numeric: tabular-nums; font-weight: 650; }
.driver .effect { font-size: 11.4px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.risk { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.risk:last-child { border-bottom: 0; }
.risk .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 8px; background: var(--muted); }
.risk.tinggi .dot, .risk.high .dot { background: var(--danger); }
.risk.sederhana .dot, .risk.medium .dot { background: var(--warn); }
.risk.rendah .dot, .risk.low .dot { background: var(--ok); }

/* ---------------------------------------------------------------- modal / toast */
.overlay { position: fixed; inset: 0; background: rgba(9, 22, 18, .55); display: grid; place-items: center; z-index: 90; padding: 24px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 16px; max-width: 640px; width: 100%; max-height: 88vh; overflow: auto; box-shadow: 0 30px 80px -30px rgba(0,0,0,.5); }
.modal.wide { max-width: 940px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 100; }
.toast {
  background: #10201b; color: #e6f0ec; padding: 11px 15px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); animation: slide .18s ease; max-width: 380px;
  border-left: 3px solid #34d399;
}
.toast.err { border-left-color: #f87171; }
.toast.warn { border-left-color: #fbbf24; }
@keyframes slide { from { transform: translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }

.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.spinner.dark { border-color: rgba(15,118,110,.25); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg) } }

.skeleton { background: linear-gradient(90deg, #eef2f0 25%, #f7faf8 50%, #eef2f0 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0 } }

/* ---------------------------------------------------------------- dashboard & new pages */
.dash-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 380px at 92% -20%, rgba(45, 212, 191, .22), transparent 62%),
    linear-gradient(120deg, #0a1f19 0%, #0f3b31 55%, #12695c 100%);
  color: #eaf6f1; border-radius: 20px; padding: 26px 28px;
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 22px; align-items: center;
  box-shadow: 0 24px 60px -40px rgba(9, 40, 34, .9);
}
.dash-hero .eyebrow { font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: #7fd8c4; font-weight: 700; }
.dash-hero h1 { font-size: 25px; letter-spacing: -.03em; margin: 6px 0 6px; color: #fff; }
.dash-hero p { color: #b7d8cd; font-size: 13.6px; max-width: 520px; margin: 0; }
.hero-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.hero-actions .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #eaf6f1; backdrop-filter: blur(6px); }
.hero-actions .btn:hover { background: rgba(255,255,255,.18); }
.hero-actions .btn-primary { background: #2ad3ab; border-color: #2ad3ab; color: #06231c; }
.hero-actions .btn-primary:hover { background: #45e0bd; border-color: #45e0bd; }
.next-up { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-radius: 14px; padding: 14px 16px; backdrop-filter: blur(8px); }
.next-up .k { font-size: 10.8px; letter-spacing: .1em; text-transform: uppercase; color: #8fd8c7; font-weight: 700; }
.next-up .v { font-size: 15px; font-weight: 650; color: #fff; margin-top: 3px; line-height: 1.35; }
.next-up .d { font-size: 12.2px; color: #a9cfc3; margin-top: 3px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.kpi-tile { padding: 15px 16px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-top > span:first-child { font-size: 11.7px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .045em; }
.kpi-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; background: var(--accent-soft); color: var(--accent-2); }
.kpi-tile .v { font-size: 26px; font-weight: 700; letter-spacing: -.035em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-tile .v small { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-tile .d { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi-tile.accent { background: linear-gradient(140deg, #0f766e, #0b5a54); border-color: transparent; }
.kpi-tile.accent .kpi-top > span:first-child, .kpi-tile.accent .d { color: #bfe3d8; }
.kpi-tile.accent .v, .kpi-tile.accent .v small { color: #fff; }
.kpi-tile.accent .kpi-ic { background: rgba(255,255,255,.16); color: #fff; }
.kpi-tile.warn .kpi-ic { background: var(--warn-soft); color: var(--warn); }
.kpi-tile.ok .kpi-ic { background: var(--ok-soft); color: var(--ok); }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; align-items: start; }
.dash-grid .span-2 { grid-column: span 2; }
.dash-grid.two { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.chart-card .card-pad { padding: 14px 16px 16px; }
.legend { display: inline-flex; align-items: center; gap: 5px; font-size: 11.6px; color: var(--muted); margin-left: 10px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.metrics { display: flex; gap: 20px; flex-wrap: wrap; }
.metrics > div { display: flex; flex-direction: column; gap: 1px; }
.metrics span { font-size: 11.2px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.metrics strong { font-size: 20px; letter-spacing: -.02em; }

.mini-list { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.6px; padding: 4px 0; color: var(--ink-2); }
.mini-row span:last-child { color: var(--muted); }

.activity { list-style: none; margin: 0; padding: 6px 0; }
.activity li { display: flex; gap: 11px; align-items: flex-start; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.activity li.empty { color: var(--muted); font-size: 13px; }
.act-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 12.5px; background: var(--surface-2); color: var(--ink-2); flex: 0 0 28px; }
.act-ic.audit { background: var(--accent-soft); color: var(--accent-2); }
.act-ic.document { background: #eef2ff; color: #3730a3; }
.act-ic.programme { background: var(--warn-soft); color: var(--warn); }
.act-body { min-width: 0; flex: 1; }
.act-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-detail { font-size: 11.9px; color: var(--muted); }
.act-time { font-size: 11.3px; color: var(--muted); white-space: nowrap; }

.user-chip { background: var(--accent-soft); border-color: #bfe3d8; color: var(--accent-2); }

/* ---------------------------------------------------------------- dark mode */
[data-theme="dark"] {
  --bg: #0a1411;
  --surface: #101d19;
  --surface-2: #0d1916;
  --ink: #e8f1ed;
  --ink-2: #c3d4cd;
  --muted: #8ba49b;
  --line: #1f312b;
  --line-strong: #2b423a;
  --accent: #2ad3ab;
  --accent-2: #16b892;
  --accent-soft: #123028;
  --warn-soft: #2b2113;
  --danger-soft: #2c1614;
  --ok-soft: #112b1c;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -22px rgba(0,0,0,.9);
  color-scheme: dark;
}
[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .topbar { background: rgba(13, 25, 21, .9); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea,
[data-theme="dark"] .modal, [data-theme="dark"] .modal-head, [data-theme="dark"] .modal-foot { background: #0d1916; color: var(--ink); }
[data-theme="dark"] .btn { background: #14241f; border-color: var(--line-strong); color: var(--ink); }
[data-theme="dark"] .btn:hover { background: #1a2f28; }
[data-theme="dark"] .btn-primary { background: var(--accent); border-color: var(--accent); color: #06231c; }
[data-theme="dark"] .btn-primary:hover { background: #45e0bd; border-color: #45e0bd; }
[data-theme="dark"] .hero-actions .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #eaf6f1; }
[data-theme="dark"] .hero-actions .btn-primary { background: #2ad3ab; border-color: #2ad3ab; color: #06231c; }
[data-theme="dark"] .table th { background: #0d1916; }
[data-theme="dark"] .table tbody tr:hover { background: #14241f; }
[data-theme="dark"] .act-ic.document { background: #1a2350; color: #a5b4fc; }
[data-theme="dark"] .chip { background: #0d1916; }
[data-theme="dark"] .sec-card .sec-body th { background: #0d1916; }
[data-theme="dark"] mark.ph, [data-theme="dark"] .placeholder-mark { background: #3a2b12; color: #fbbf24; }

/* ---------------------------------------------------------------- pages: programmes / reports / settings */
.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.report-item { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.report-item:last-child { border-bottom: 0; }
.score-ring { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: 0 0 46px; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .body { flex: 1; min-width: 0; }
.setting-row .body strong { display: block; font-size: 13.4px; }
.setting-row .body span { font-size: 12.3px; color: var(--muted); }
.upload-zone { border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-soft); }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-grid .span-2 { grid-column: span 2; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .dash-hero { grid-template-columns: minmax(0, 1fr); }
  .dash-grid, .dash-grid.two { grid-template-columns: minmax(0, 1fr); }
  .dash-grid .span-2 { grid-column: auto; }
}
@media (max-width: 620px) {
  .kpi-grid, .stat-strip { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- audit module */
.audit-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); font-size: 12.8px; font-weight: 600; padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,32,27,.08); }

.report-top { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.score-ring.big { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 96px; }
.score-inner { width: 76px; height: 76px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; line-height: 1; }
.score-inner strong { font-size: 25px; letter-spacing: -.03em; }
.score-inner span { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.report-meta { display: flex; gap: 26px; flex-wrap: wrap; }
.report-meta .rm { display: flex; flex-direction: column; gap: 2px; }
.report-meta .rm span { font-size: 10.8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.report-meta .rm strong { font-size: 16px; letter-spacing: -.01em; }

.rubric-row { margin-bottom: 12px; }
.rubric-head { display: flex; justify-content: space-between; font-size: 12.6px; margin-bottom: 4px; }

.finding-group { margin-bottom: 16px; }
.fg-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.finding { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; margin-bottom: 9px; background: var(--surface-2); }
.finding-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.2px; }
.finding-body { font-size: 12.8px; color: var(--ink-2); margin-top: 6px; }
.finding-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; margin-top: 9px; font-size: 12.4px; }
.finding-cols .hint { display: block; font-size: 10.6px; text-transform: uppercase; letter-spacing: .05em; }
.sev { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 5px; }
.sev.high { background: var(--danger-soft); color: var(--danger); }
.sev.medium { background: var(--warn-soft); color: var(--warn); }
.sev.low { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }

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

@media (max-width: 1120px) {
  .gen-layout { grid-template-columns: minmax(0, 1fr); }
  .gen-side { position: static; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 50px -30px rgba(0,0,0,.5); }
  .sidebar.open { transform: none; }
  .menu-btn { display: block; }
  .view { padding: 18px; }
  .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-nav { position: static; display: none; }
  .top-actions .chip { display: none; }
}
@media (max-width: 620px) {
  .g-4 { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: 1fr; }
  .row-item.budget { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 20px; }
}
