:root {
  /* Kursi brand palette, sampled from the Kursi Group logo. */
  --brand-plum: #3a1b55;
  --brand-plum-700: #4c2670;
  --brand-plum-50: #f3eef7;
  --brand-gold: #b08f55;
  --brand-gold-700: #8f7240;
  --brand-gold-50: #f7f1e5;
  --brand-green: #1a5b3a;
  --brand-green-700: #134d30;
  --brand-green-50: #e7f1ec;
  --brand-cream: #faf7f0;

  /* xnetwux-dashboard-style tokens (accent = plum 268/45%) */
  --accent-h: 268; --accent-s: 45%;
  --a-900: hsl(var(--accent-h) var(--accent-s) 14%);
  --a-700: hsl(var(--accent-h) var(--accent-s) 24%);
  --a-600: hsl(var(--accent-h) var(--accent-s) 30%);
  --a-500: hsl(var(--accent-h) var(--accent-s) 38%);
  --a-300: hsl(var(--accent-h) calc(var(--accent-s) - 8%) 62%);
  --a-100: hsl(var(--accent-h) 40% 93%);
  --canvas: #EFEBF2; --shell: #F7F5F9; --card: #FFFFFF; --sunk: #F2EFF5;
  --line: #E6E1EB; --line-strong: #CFC6D7;
  --ink: #141917; --ink-2: #4F4855; --ink-3: #6E6878;
  --crit: #C2362B; --crit-bg: #FCEBE9;
  --warn: #9A6A00; --warn-bg: #FBF1DC;
  --good: #1E7A45; --good-bg: #E5F4EA;
  --hatch: repeating-linear-gradient(135deg, var(--line-strong) 0 2px, transparent 2px 7px);
  --r-xl: 22px; --r-lg: 16px; --r-md: 12px; --r-pill: 999px; --tap: 44px;
  --sh: 0 1px 2px rgba(20,25,23,.04), 0 8px 24px -16px rgba(20,25,23,.18);
  --ease: cubic-bezier(.2,.8,.2,1);

  --bg: var(--brand-cream);
  --surface: #ffffff;
  --border: #e8e3d8;
  --border-strong: #d6cfbe;
  --text: #1f1a26;
  --text-muted: #6b6478;

  --primary: var(--brand-plum);
  --primary-hover: var(--brand-plum-700);
  --accent: var(--brand-gold);
  --success: var(--brand-green);
  --danger: #b03a3a;

  --amber-bg: #fef3c7;
  --amber-fg: #92400e;
  --gray-bg: #ece7dc;
  --gray-fg: #3a3645;
  --green-bg: var(--brand-green-50);
  --green-fg: var(--brand-green-700);
  --blue-bg: #e1e8f5;
  --blue-fg: #243465;
  --red-bg: #fde0dd;
  --red-fg: #8a1f1f;
  --teal-bg: #d5efe6;
  --teal-fg: #0f5a44;
  --purple-bg: var(--brand-plum-50);
  --purple-fg: var(--brand-plum);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
}
.brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--brand-plum-50) 0%, #ffffff 100%);
}
.brand-logo { display: block; width: 100%; max-width: 180px; height: auto; }
.brand-sub {
  font-size: 11px;
  color: var(--brand-plum);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-top: 6px;
  font-weight: 600;
}
.sidebar nav { display: flex; flex-direction: column; flex: 1; padding: 12px 0; gap: 2px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 14px;
  font-weight: 500;
}
.sidebar nav a .icon { color: var(--text-muted); flex-shrink: 0; }
.sidebar nav a:hover { background: var(--brand-plum-50); text-decoration: none; }
.sidebar nav a.active {
  background: var(--brand-plum-50);
  border-left-color: var(--brand-plum);
  color: var(--brand-plum);
}
.sidebar nav a.active .icon { color: var(--brand-plum); }
.sidebar nav a.nav-sub {
  padding: 6px 20px 6px 44px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}
.sidebar nav a.nav-sub.active {
  color: var(--brand-plum);
  font-weight: 500;
  background: var(--brand-plum-50);
  border-left-color: var(--brand-gold);
}
.side-foot {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
}
.user-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.side-foot .btn { display: inline-flex; align-items: center; gap: 6px; }

/* ── Main ────────────────────────────────────────────── */
.main { padding: 28px 40px 60px; max-width: 1280px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-head h1 { margin: 0; }
.page-head-title p.muted { margin: 4px 0 0; }

/* Page-head KPI row (W1 advanced-dashboard) */
.page-head-kpi { align-items: center; }
.kpi-row { display: flex; gap: 28px; }
.kpi { display: flex; align-items: center; gap: 12px; }
.kpi-chip {
  width: 44px; height: 44px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: var(--brand-plum);
  flex-shrink: 0;
}
.kpi-chip-green { background: var(--brand-green); }
.kpi-chip-amber { background: var(--brand-gold); }
.kpi-chip-blue  { background: var(--brand-plum); }
.kpi-value { font-size: 22px; font-weight: 600; line-height: 1.1; }
.kpi-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

h1 { margin: 0 0 15px; font-size: 24px; font-weight: 600; color: var(--brand-plum); letter-spacing: -0.2px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; color: var(--text); }
h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; }
.muted { color: var(--text-muted); }

/* ── Headline cards (W2 — big figure + context sentence) ─ */
.headline-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.headline-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.headline-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(58, 27, 85, 0.08);
  border-color: var(--border-strong);
  text-decoration: none;
}
.headline-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-plum-50);
  color: var(--brand-plum);
  margin-bottom: 12px;
}
.headline-icon-amber { background: var(--brand-gold-50); color: var(--brand-gold-700); }
.headline-icon-blue  { background: #e1e8f5; color: #243465; }
.headline-figure { font-size: 32px; font-weight: 700; line-height: 1; color: var(--text); letter-spacing: -0.5px; }
.headline-sentence { color: var(--text-muted); font-size: 13px; margin-top: 6px; }

/* ── Panels ──────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.panel-sentence { font-size: 12.5px; margin: 2px 0 0; }

/* ── Flash ───────────────────────────────────────────── */
.flash {
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  border: 1px solid var(--border);
}
.flash-success { background: var(--green-bg); border-color: #b6dcc3; color: var(--green-fg); }
.flash-error   { background: var(--red-bg); border-color: #e7b8b4; color: var(--red-fg); }
.flash-info    { background: var(--blue-bg); border-color: #c0cbe3; color: var(--blue-fg); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  line-height: 1.3;
  font-family: inherit;
  font-weight: 500;
}
.btn:hover { background: var(--brand-plum-50); border-color: var(--brand-plum); color: var(--brand-plum); text-decoration: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #8e2d2d; border-color: #8e2d2d; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn .icon { flex-shrink: 0; }

/* ── Pill tabs ──────────────────────────────────────── */
.pill-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--brand-plum-50);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.pill-tabs a {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  color: var(--brand-plum);
  font-size: 13px;
  text-decoration: none;
  text-transform: capitalize;
  font-weight: 500;
}
.pill-tabs a:hover { background: #fff; text-decoration: none; }
.pill-tabs a.active { background: var(--brand-plum); color: #fff; }

/* ── Tables ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
table.list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--brand-plum-50);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--brand-plum-50); }
a { color: var(--brand-plum); text-decoration: none; }
a:hover { text-decoration: underline; }
td.actions form { margin-bottom: 4px; display: flex; gap: 4px; align-items: center; }
td.actions input { max-width: 150px; }

/* ── Forms ───────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filters input, .filters select { padding: 6px 10px; width: auto; }
input, select, textarea {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-plum);
  box-shadow: 0 0 0 3px var(--brand-plum-50);
}
input[type="checkbox"] { width: auto; }
textarea { font-family: inherit; }
label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
label input, label select, label textarea { margin-top: 4px; color: var(--text); }
.form, .milestone-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  max-width: 800px;
}
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }
.form .row .full { grid-column: 1 / -1; }
.milestone-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-top: 15px; }
.milestone-form .full { grid-column: 1 / -1; }
.milestone-form button { grid-column: 1 / -1; justify-self: start; }

.props { display: grid; grid-template-columns: 150px 1fr; gap: 10px 15px; margin: 0; }
.props dt { color: var(--text-muted); font-size: 13px; }
.props dd { margin: 0; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}
.badge-active, .badge-sent, .badge-m-paid       { background: var(--green-bg); color: var(--green-fg); }
.badge-expiring, .badge-m-payment_requested     { background: var(--amber-bg); color: var(--amber-fg); }
.badge-expired, .badge-terminated, .badge-cancelled, .badge-m-cancelled { background: var(--gray-bg); color: var(--gray-fg); }
.badge-archived                                 { background: var(--purple-bg); color: var(--purple-fg); }
.badge-draft, .badge-queued, .badge-m-pending   { background: var(--blue-bg); color: var(--blue-fg); }
.badge-failed                                   { background: var(--red-bg); color: var(--red-fg); }
.badge-m-delivered                              { background: var(--teal-bg); color: var(--teal-fg); }

/* ── Role chips ──────────────────────────────────────── */
.role {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--gray-bg);
  color: var(--gray-fg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.role-admin   { background: var(--purple-bg); color: var(--brand-plum); }
.role-legal   { background: var(--blue-bg); color: var(--blue-fg); }
.role-finance { background: var(--green-bg); color: var(--green-fg); }
.role-manager { background: var(--brand-gold-50); color: var(--brand-gold-700); }

/* ── Auth (login) ────────────────────────────────────── */
body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--brand-plum-50) 0%, var(--brand-cream) 60%, var(--brand-gold-50) 100%);
  margin: 0;
}
.auth-card {
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 8px 32px rgba(58, 27, 85, 0.12);
}
.auth-card .auth-logo {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
  margin: 0 auto 20px;
}
.auth-card h1 { margin-bottom: 8px; font-size: 22px; text-align: center; color: var(--brand-plum); }
.auth-lead { text-align: center; margin: 0 0 20px; font-size: 13px; }
.auth-card button { width: 100%; margin-top: 10px; justify-content: center; }
.auth-card .hint { color: var(--text-muted); font-size: 12px; margin-top: 15px; text-align: center; }

/* ── Login v2: floating two-pane card ─────────────────── */
body.auth.auth-card-v2 {
  background: var(--brand-cream);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-shell { width: 100%; max-width: 1180px; }
.auth-card-wrap {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(400px, 1.15fr);
  background: var(--surface);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 60px -20px rgba(58, 27, 85, 0.18), 0 2px 6px rgba(0,0,0,0.04);
  min-height: 620px;
}

/* Form pane */
.auth-form-pane {
  position: relative;
  padding: 56px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-form-body {
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
}
.auth-form-logo {
  display: block;
  width: 180px;
  height: auto;
  margin: 0 0 28px;
  mix-blend-mode: multiply;
}
.auth-h1 { color: var(--brand-plum); font-size: 30px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.5px; }
.auth-lead { color: var(--text-muted); margin: 0 0 32px; font-size: 14px; }
.auth-form { display: grid; gap: 14px; }
.auth-form .flash { margin-bottom: 4px; }

/* Floating-label input */
.float-field { position: relative; }
.float-field input {
  background: var(--brand-plum-50);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 22px 18px 10px;
  font-size: 15px;
  width: 100%;
  transition: border-color .15s ease, background .15s ease;
}
.float-field input:focus {
  background: var(--surface);
  border-color: var(--brand-plum);
  box-shadow: 0 0 0 3px rgba(58,27,85,0.08);
}
.float-field label {
  position: absolute;
  left: 18px;
  top: 14px;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
  transition: transform .15s ease, font-size .15s ease, color .15s ease;
}
.float-field input:focus + label,
.float-field input:not(:placeholder-shown) + label {
  transform: translateY(-8px);
  font-size: 11px;
  color: var(--brand-plum);
  letter-spacing: 0.3px;
}
.btn-pill {
  border-radius: 999px !important;
  padding: 14px 20px !important;
  justify-content: center;
  font-weight: 600;
  margin-top: 6px;
}

/* Visual pane */
.auth-visual-pane {
  position: relative;
  overflow: hidden;
  min-height: 620px;
}
.visual-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 70% 20%, rgba(176,143,85,0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 80%, rgba(26,91,58,0.30) 0%, transparent 55%),
    linear-gradient(135deg, var(--brand-plum) 0%, #2a1340 100%);
}

/* The one honest headline figure, bottom-left of visual */
.visual-stat {
  position: absolute;
  left: 40px;
  bottom: 40px;
  color: #fff;
  z-index: 2;
}
.visual-stat-fig {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1.5px;
}
.visual-stat-label {
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  margin-top: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* The one expiring-items panel, top-right */
.visual-panel {
  position: absolute;
  top: 40px;
  right: 40px;
  left: 40px;
  background: rgba(255,255,255,0.98);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,0.25);
  z-index: 2;
}
.visual-panel-head {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 600;
}
.visual-panel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.visual-panel-list li {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}
.visual-panel-kind {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  text-align: center;
}
.visual-panel-kind-contract { background: var(--brand-plum-50); color: var(--brand-plum); }
.visual-panel-kind-license  { background: var(--brand-green-50); color: var(--brand-green-700); }
.visual-panel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visual-panel-due  { color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 12px; }

/* The one secondary pill, mid-right */
.visual-pill {
  position: absolute;
  right: 40px;
  bottom: 56px;
  background: var(--brand-gold);
  color: #241a0b;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 2;
  box-shadow: 0 10px 24px -8px rgba(0,0,0,0.25);
}

@media (max-width: 960px) {
  body.auth.auth-card-v2 { padding: 0; align-items: stretch; }
  .auth-card-wrap { grid-template-columns: 1fr; border-radius: 0; min-height: 100vh; }
  .auth-visual-pane { display: none; }
  .auth-form-pane { padding: 32px 24px; }
  .auth-form-body { margin-top: 32px; }
}

.error-dump {
  background: #1a1a1a;
  color: #eee;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12px;
}
.notes { white-space: pre-wrap; }

/* ─────────────────────────────────────────────────────── */
/*  Dashboard "calm cards" (xnetwux-dashboard-style)       */
/* ─────────────────────────────────────────────────────── */

.dash-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 24px;
}
.dash-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin: 0 0 4px;
  font-variant-numeric: tabular-nums;
}
.dash-sub { color: var(--ink-3); margin: 0; font-size: 14px; }

/* ── KPI grid (1 hero + 3 tiles) ───────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.kpi-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px 20px;
  min-height: 150px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--sh);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  animation: card-rise .6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(20,25,23,.05), 0 14px 32px -16px rgba(20,25,23,.25);
  text-decoration: none;
}
.kpi-tile-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.kpi-tile-label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.kpi-tile-value {
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.kpi-tile-ctx { color: var(--ink-3); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi-arrow {
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
  flex-shrink: 0;
}
.kpi-tile:hover .kpi-arrow { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Hero tile — one per row, filled accent gradient */
.kpi-tile-hero {
  background: linear-gradient(160deg, var(--a-600) 0%, var(--a-900) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(20,25,23,.08), 0 20px 36px -18px rgba(58,27,85,0.55);
}
.kpi-tile-hero .kpi-tile-label { color: rgba(255,255,255,.75); }
.kpi-tile-hero .kpi-tile-value { color: #fff; }
.kpi-tile-hero .kpi-tile-ctx   { color: rgba(255,255,255,.72); }
.kpi-arrow-light {
  border-color: rgba(255,255,255,.35);
  color: #fff;
  background: rgba(255,255,255,.08);
}
.kpi-tile-hero:hover .kpi-arrow { background: #fff; color: var(--a-900); border-color: #fff; }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 1px solid transparent;
}
.chip-good { background: var(--good-bg); color: var(--good); border-color: #c6e4d1; }
.chip-warn { background: var(--warn-bg); color: var(--warn); border-color: #ead9a8; }
.chip-crit { background: var(--crit-bg); color: var(--crit); border-color: #f1c0bc; }
.kpi-tile-hero .chip { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.22); }

/* ── Rows ──────────────────────────────────────────── */
.row { display: grid; gap: 14px; margin-bottom: 14px; }
.row-3 { grid-template-columns: 2fr 1fr; }   /* wide chart + reminder */
.row-2 { grid-template-columns: 2fr 1fr; }   /* list + tracker */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--sh);
  animation: card-rise .6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--ink); }
.card-sub { color: var(--ink-3); font-size: 12.5px; margin: 2px 0 0; }

/* ── Pill bar chart ─────────────────────────────────── */
.pill-bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  align-items: end;
  height: 220px;
  padding: 10px 2px 0;
}
.pill-bar-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 8px;
  position: relative;
}
.pill-bar {
  width: 100%;
  max-width: 46px;
  height: var(--h, 4%);
  min-height: 6px;
  border-radius: 999px;
  background: var(--a-500);
  animation: bar-grow .6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms + 200ms);
  transform-origin: bottom;
}
.pill-bar-low   { background: var(--a-300); }
.pill-bar-mid   { background: var(--a-500); }
.pill-bar-peak  { background: var(--a-700); }
.pill-bar-empty {
  background: var(--hatch);
  border: 1px solid var(--line-strong);
}
.pill-bar-label {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pill-bar-chip {
  position: absolute;
  top: -4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* ── Reminder / next-action card ───────────────────── */
.card-reminder {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
}
.card-reminder-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 1.1px;
}
.card-reminder-title {
  font-size: 21px;
  font-weight: 600;
  color: var(--a-600);
  line-height: 1.25;
  letter-spacing: -0.2px;
}
.card-reminder-sub { color: var(--ink-3); font-size: 13px; }
.btn-block { width: 100%; justify-content: center; margin-top: auto; }

/* ── List card rows ─────────────────────────────────── */
.list-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.list-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.list-row-ico-work { background: var(--warn-bg); color: var(--warn); }
.list-row-ico-pay  { background: var(--crit-bg); color: var(--crit); }
.list-row-name { font-weight: 600; color: var(--ink); }
.list-row-name a { color: var(--ink); }
.list-row-name a:hover { color: var(--a-600); }
.list-row-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.status-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: 1.5px solid;
  white-space: nowrap;
}
.status-pill-good { color: var(--good); border-color: var(--good); background: var(--good-bg); }
.status-pill-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.status-pill-crit { color: var(--crit); border-color: var(--crit); background: var(--crit-bg); }

/* ── Dark tracker card ──────────────────────────────── */
.tracker-card {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 30%, var(--a-700) 0%, var(--a-900) 70%);
  color: #fff;
  border: none;
  padding: 24px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tracker-rings {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.10) 0 1px, transparent 2px 60px),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0 1px, transparent 2px 120px),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.04) 0 1px, transparent 2px 180px);
  pointer-events: none;
}
.tracker-eyebrow {
  position: relative;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 1.1px;
}
.tracker-value {
  position: relative;
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tracker-unit { font-size: 22px; font-weight: 500; opacity: 0.6; margin-left: 4px; }
.tracker-sub {
  position: relative;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  margin-bottom: auto;
}
.tracker-gauge { position: relative; margin-top: 18px; }
.tracker-gauge-bar {
  background: rgba(255,255,255,0.14);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
}
.tracker-gauge-fill {
  height: 100%;
  width: var(--p, 0%);
  background: #fff;
  border-radius: 999px;
  transition: width .9s var(--ease);
}
.tracker-gauge-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  margin-top: 8px;
}
.tracker-gauge-pct { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Motion ─────────────────────────────────────────── */
@keyframes card-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bar-grow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .kpi-tile, .card, .pill-bar { animation: none !important; }
  .tracker-gauge-fill { transition: none !important; }
}

/* ── Dashboard responsive ───────────────────────────── */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .row-3, .row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .pill-bars { grid-template-columns: repeat(6, 1fr); gap: 6px; height: 180px; }
  .pill-bar-slot:nth-child(n+7) { display: none; }
}

/* ── Documents ───────────────────────────────────────── */
.doc-section { margin-top: 28px; }
.doc-list { margin-bottom: 14px; }
.doc-upload {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--brand-plum-50);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 14px;
}
.doc-upload input[type="file"] {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.doc-viewer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}
.doc-viewer iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 600px;
  border: 0;
}
.doc-viewer img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .headline-cards { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .kpi-row { gap: 18px; }
}
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .main { padding: 20px; }
  .headline-cards { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .kpi-row { flex-wrap: wrap; gap: 14px; }
}
