:root {
  --bg-base:        #F0F4FF;
  --bg-surface:     #F8FAFF;
  --bg-elevated:    #FFFFFF;
  --bg-overlay:     rgba(255, 255, 255, 0.95);

  --glass-bg:            rgba(255, 255, 255, 0.6);
  --glass-bg-hover:      rgba(255, 255, 255, 0.8);
  --glass-bg-strong:     rgba(255, 255, 255, 0.85);
  --glass-border:        rgba(255, 255, 255, 0.9);
  --glass-border-soft:   rgba(201, 168, 76, 0.15);
  --glass-border-hover:  rgba(201, 168, 76, 0.3);
  --glass-blur:          blur(20px);
  --glass-blur-lg:       blur(40px);
  --glass-shadow:        0 8px 32px rgba(100, 120, 180, 0.12);
  --glass-shadow-hover:  0 12px 48px rgba(100, 120, 180, 0.18);

  --gold:           #C9A84C;
  --gold-bright:    #E8C55A;
  --gold-dim:       #A67C2E;
  --gold-glow:      rgba(201, 168, 76, 0.12);
  --gold-glow-lg:   rgba(201, 168, 76, 0.2);

  --text-primary:   #1A2040;
  --text-secondary: #5A6380;
  --text-muted:     #9BA3BB;

  --success:        #16A34A;
  --success-bg:     rgba(22, 163, 74, 0.08);
  --warning:        #D97706;
  --warning-bg:     rgba(217, 119, 6, 0.08);
  --danger:         #DC2626;
  --danger-bg:      rgba(220, 38, 38, 0.08);
  --info:           #2563EB;
  --info-bg:        rgba(37, 99, 235, 0.08);

  --border:         rgba(201, 168, 76, 0.12);
  --border-2:       rgba(201, 168, 76, 0.22);
  --border-active:  rgba(201, 168, 76, 0.4);
  --border-focus:   rgba(201, 168, 76, 0.6);

  --shadow-sm:      0 2px 8px rgba(100, 120, 180, 0.08);
  --shadow-md:      0 4px 20px rgba(100, 120, 180, 0.12);
  --shadow-lg:      0 8px 40px rgba(100, 120, 180, 0.16);
  --shadow-gold:    0 4px 20px rgba(201, 168, 76, 0.2);

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --transition:      all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  --text-xs: 11px; --text-sm: 12px; --text-base: 13px; --text-md: 14px;
  --text-lg: 16px; --text-xl: 20px; --text-2xl: 24px; --text-3xl: 32px; --text-4xl: 48px;

  --sidebar-w: 224px; --sidebar-w-collapsed: 68px; --topbar-h: 56px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg-base); color: var(--text-primary);
  font-family: var(--font-sans); font-size: var(--text-md); -webkit-font-smoothing: antialiased;
}
body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(201,168,76,0.06) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(37,99,235,0.04) 0%, transparent 40%);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--gold-glow-lg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid var(--bg-base); }
::-webkit-scrollbar-track { background: transparent; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px;
}

h1, h2, h3 { font-family: var(--font-sans); color: var(--text-primary); }
h1 { margin: 0 0 4px; font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--text-lg); font-weight: 700; margin: 30px 0 12px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
h3 { font-size: var(--text-md); font-weight: 700; margin: 0; }
.muted { color: var(--text-secondary); }
.muted.small { font-size: var(--text-sm); }
.error { color: var(--danger); font-size: var(--text-base); }
.error-banner {
  background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.2);
  border-radius: var(--radius-md); padding: 10px 14px; font-size: var(--text-base); font-weight: 500; margin-bottom: 16px;
}

/* Money / reference numbers / dates — mono, tabular */
.mono, .amount-cell, td.num, .value, .kpi-value, .stat-card .value, .tp-value,
.activity-amount, .attention-amount, .notif-sub, td .ref, .amounts {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}

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

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--glass-bg-strong); backdrop-filter: var(--glass-blur) saturate(150%); -webkit-backdrop-filter: var(--glass-blur) saturate(150%);
  border-right: 1px solid var(--glass-border-soft); display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
  transition: var(--transition-slow);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
  box-shadow: var(--shadow-gold);
}
.brand-name { font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; color: var(--text-primary); }
.brand-sub { font-size: var(--text-xs); color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 1px; }

.sidebar-search {
  margin: 2px 12px 14px; display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: var(--radius-md); border: 1px solid var(--border-2);
  background: var(--bg-elevated); color: var(--text-secondary); font-size: var(--text-sm); font-weight: 500; cursor: pointer;
  transition: var(--transition); box-shadow: 0 1px 3px rgba(100,120,180,0.06);
}
.sidebar-search:hover { border-color: var(--gold); background: var(--bg-elevated); color: var(--text-primary); box-shadow: 0 2px 8px rgba(100,120,180,0.1); }
.sidebar-search svg { flex-shrink: 0; color: var(--text-muted); }
.sidebar-search:hover svg { color: var(--gold-dim); }
.sidebar-search kbd {
  margin-left: auto; font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 700;
  background: var(--bg-surface); border: 1px solid var(--border-2); border-radius: 5px;
  padding: 1px 6px; color: var(--text-muted);
}

.sidebar-label { padding: 10px 20px 6px; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-md);
  color: var(--text-secondary); font-weight: 500; font-size: var(--text-base);
  transition: var(--transition); position: relative;
}
.nav-icon { display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.nav-icon svg { width: 17px; height: 17px; }
.nav-item:hover { background: var(--gold-glow); color: var(--text-primary); }
.nav-item:hover .nav-icon { color: var(--gold); }
.nav-item.active { background: var(--gold-glow-lg); color: var(--text-primary); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--gold-dim); }
.nav-item .nav-badge {
  margin-left: auto; font-size: var(--text-xs); font-weight: 700; background: var(--gold); color: #fff;
  border-radius: 20px; padding: 1px 7px; min-width: 18px; text-align: center;
}

.sidebar-footer { padding: 12px 14px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.sidebar-utility { display: flex; gap: 6px; }
.icon-btn {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  padding: 0; gap: 0; flex-shrink: 0;
  border-radius: var(--radius-md); border: 1px solid var(--border-2); background: var(--bg-elevated);
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  box-shadow: 0 1px 3px rgba(100,120,180,0.08);
}
.icon-btn:hover { background: var(--gold-glow); color: var(--gold-dim); border-color: var(--border-active); }
.icon-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-collapse-btn svg { transition: transform 0.2s ease; }
:root.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: var(--radius-md); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--text-primary), #363c66); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: var(--text-xs); color: var(--text-muted); text-transform: capitalize; }
.sidebar-footer form { margin: 0; }
.logout-row { display: flex; }
.logout-row form { flex: 1; }
.logout-row .btn-ghost { width: 100%; justify-content: center; }

.sidebar-scrim { display: none; }

.main-area { margin-left: var(--sidebar-w); flex: 1; min-width: 0; transition: margin-left 0.3s ease; }

.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 40;
  background: var(--bg-overlay); backdrop-filter: var(--glass-blur) saturate(150%); -webkit-backdrop-filter: var(--glass-blur) saturate(150%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-btn { display: none; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: var(--text-base); min-width: 0; flex-wrap: wrap; }
.breadcrumbs a { color: var(--text-secondary); font-weight: 500; white-space: nowrap; }
.breadcrumbs a:hover { color: var(--gold-dim); }
.breadcrumbs .sep { color: var(--text-muted); }
.breadcrumbs .current { color: var(--text-primary); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.container { max-width: 1200px; margin: 0 auto; padding: 28px 28px 70px; animation: fadeIn 0.35s ease; }
.container-plain { max-width: none; margin: 0; padding: 0; min-height: 100vh; display: flex; align-items: stretch; justify-content: center; background: var(--bg-base); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons (exact per spec) ---------- */
.btn, button, input[type="submit"] {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 600; font-family: var(--font-sans);
  background: rgba(255,255,255,0.7); backdrop-filter: blur(10px);
  border: 1px solid rgba(201,168,76,0.2); color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(100,120,180,0.08), inset 0 1px 0 rgba(255,255,255,0.9);
  transition: var(--transition); cursor: pointer;
}
.btn:hover, button:hover { background: rgba(255,255,255,0.95); border-color: rgba(201,168,76,0.4); box-shadow: 0 4px 16px rgba(100,120,180,0.12); }
.btn:active, button:active { transform: scale(0.98); }
.btn svg, button svg { width: 14px; height: 14px; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, #B8922A 100%);
  color: #fff; font-weight: 700; border: none;
  box-shadow: 0 4px 12px rgba(201,168,76,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 100%); transform: translateY(-1px);
}

.btn-ghost, .btn-ghost button {
  background: transparent; border-color: var(--border); color: var(--text-secondary); box-shadow: none;
}
.btn-ghost:hover { background: var(--gold-glow); color: var(--text-primary); opacity: 1; box-shadow: none; }

.btn-danger {
  background: transparent; color: var(--danger); border-color: transparent; box-shadow: none;
}
.btn-danger:hover { background: var(--danger-bg); opacity: 1; box-shadow: none; }

.btn-sm { padding: 6px 13px; font-size: var(--text-sm); }
.sidebar-footer button { width: 100%; justify-content: center; }

/* ---------- Glass card (exact per spec) ---------- */
.card {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: var(--transition);
  padding: 22px 24px; margin-bottom: 16px;
}
.card:hover {
  background: rgba(255,255,255,0.85); border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow-hover), var(--shadow-gold), inset 0 1px 0 rgba(255,255,255,1);
  transform: translateY(-2px);
}
.card summary { cursor: pointer; font-weight: 600; color: var(--text-primary); list-style: none; }
.card summary::-webkit-details-marker { display: none; }
.card summary::before { content: '+ '; color: var(--gold); font-weight: 800; }
.card[open] summary::before { content: '\2013 '; }

/* Cards holding forms/tables shouldn't lift on hover — only pure info/nav cards do */
.card:has(form), .card:has(table), a.card { transition: var(--transition); }
a.card:hover, .card.project-card:hover { transform: translateY(-2px); }

/* ---------- Login (split screen) ---------- */
.login-shell { display: flex; width: 100%; min-height: 100vh; }
.login-brand-panel {
  flex: 1.1; background: radial-gradient(circle at 20% 20%, #232a52, var(--text-primary) 65%);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px; position: relative; overflow: hidden;
}
.login-brand-panel::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 80% 90%, rgba(201,168,76,0.25), transparent 55%); }
.login-brand-mark {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 21px;
  box-shadow: 0 8px 30px rgba(201,168,76,0.35); position: relative; z-index: 1;
}
.login-brand-copy { position: relative; z-index: 1; }
.login-brand-copy h1 { font-size: 30px; letter-spacing: -0.02em; margin-bottom: 8px; color: #fff; }
.login-brand-copy p { color: rgba(255,255,255,0.65); font-size: var(--text-md); max-width: 340px; line-height: 1.6; }
.login-brand-foot { position: relative; z-index: 1; font-size: var(--text-sm); color: rgba(255,255,255,0.4); }
.login-form-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg-base); }
.login-card { max-width: 380px; width: 100%; padding: 8px 4px; text-align: left; margin: 0; border: none; background: transparent; box-shadow: none; }
.login-card:hover { transform: none; box-shadow: none; }
.login-card h1 { margin-bottom: 2px; }
.login-card .muted { margin-bottom: 24px; font-size: var(--text-base); }
@media (max-width: 860px) { .login-brand-panel { display: none; } }

/* ---------- Grid / project cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.project-card { color: inherit; display: block; }
.project-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 4px; }

.stat-row { display: flex; justify-content: space-between; margin-top: 16px; gap: 10px; }
.stat-row .label { display: block; font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; font-weight: 700; }
.stat-row .value { display: block; font-weight: 700; font-size: var(--text-md); }
.outstanding { color: var(--gold-dim); }

.progress-track { height: 6px; border-radius: 20px; background: var(--border); overflow: hidden; margin-top: 12px; }
.progress-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--gold-bright), var(--gold)); transition: width 0.4s ease; }
.progress-fill.full { background: linear-gradient(90deg, #4ade80, var(--success)); }
.progress-label { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); margin-top: 6px; font-weight: 700; }

.empty-state { text-align: center; color: var(--text-secondary); padding: 46px 20px; }
.empty-state .empty-icon { width: 44px; height: 44px; margin: 0 auto 14px; color: var(--text-muted); opacity: 0.3; }
.empty-state p { margin: 0 0 14px; font-size: var(--text-base); }

/* ---------- Forms ---------- */
form label { display: block; margin-bottom: 14px; font-size: var(--text-base); font-weight: 500; color: var(--text-secondary); }
form input, form select, form textarea {
  width: 100%; padding: 9px 12px; margin-top: 5px; border: 1px solid var(--border);
  border-radius: var(--radius-md); font-size: var(--text-base); font-family: var(--font-sans); color: var(--text-primary);
  background: var(--bg-surface); transition: var(--transition);
}
form input:focus, form select:focus, form textarea:focus {
  outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--gold-glow); background: var(--bg-elevated);
}
.form-row { display: flex; gap: 14px; }
.form-row label { flex: 1; }
.ratio-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ratio-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ratio-row span { font-size: var(--text-base); }
.ratio-row input[type=number] { width: 100px; margin-top: 0; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; min-width: 150px; }

/* ---------- Tables (exact per spec) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th {
  background: rgba(201,168,76,0.06);
  text-align: left; padding: 12px 16px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 1px solid rgba(201,168,76,0.15);
  font-weight: 700; white-space: nowrap; cursor: pointer;
}
.table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid rgba(201,168,76,0.08); font-size: var(--text-sm); color: var(--text-primary); }
.table td.num, .table th.num { text-align: right; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover td { background: rgba(201,168,76,0.04); }
.table tbody tr.selected td { background: var(--gold-glow); }
.table-compact td { padding: 6px 12px; border-bottom: none; }

.event-card .event-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.event-header .value { font-weight: 700; color: var(--text-primary); font-size: 15px; }

/* ---------- Badges (exact per spec) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
  padding: 2px 9px; border-radius: 20px; white-space: nowrap; text-transform: capitalize;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: currentColor; }
.badge.green { background: var(--success-bg); color: var(--success); }
.badge.amber { background: var(--warning-bg); color: var(--warning); }
.badge.red   { background: var(--danger-bg); color: var(--danger); }
.badge.grey  { background: var(--bg-surface); color: var(--text-muted); }
.badge.blue  { background: var(--info-bg); color: var(--info); }

tr.status-paid td { color: var(--text-secondary); }
/* Overdue capital call — a left rail + wash, distinct from the status badges */
tr.row-overdue td { background: var(--danger-bg); }
tr.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.row-overdue:hover td { background: rgba(220, 38, 38, 0.12); }

/* ---------- Stat cards (exact per spec) — .kpi-card is an alias for existing markup ---------- */
.kpi-grid, .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; margin-bottom: 8px; }
.kpi-card, .stat-card {
  position: relative; background: var(--glass-bg-strong);
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.8);
  padding: 20px; overflow: hidden; display: flex; flex-direction: column; gap: 10px;
  animation: cardIn 0.3s ease both;
  min-width: 0; /* let grid items shrink so long money values can reflow instead of clipping */
}
.kpi-card::before, .stat-card::before {
  content: ''; position: absolute; top: -40px; left: -40px; width: 120px; height: 120px;
  background: radial-gradient(circle at top left, rgba(201,168,76,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.kpi-label, .stat-card .label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0; }
.kpi-icon { width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { width: 15px; height: 15px; }
.kpi-icon.gold { background: var(--gold-glow-lg); color: var(--gold-dim); }
.kpi-icon.success, .kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.warning, .kpi-icon.amber { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.info, .kpi-icon.blue { background: var(--info-bg); color: var(--info); }
.kpi-icon.purple { background: rgba(124,58,237,0.08); color: #7C3AED; }
.kpi-icon.teal { background: rgba(13,148,136,0.08); color: #0D9488; }
.kpi-icon.rose { background: rgba(225,29,72,0.08); color: #E11D48; }
/* Money in a fixed-width card: mono is wide, so scale with the viewport and allow the
   value to wrap (AED onto its own line) rather than be clipped by the card's overflow. */
.kpi-value, .stat-card .value {
  font-size: clamp(21px, 1.5vw + 8px, 30px);
  font-weight: 700; font-family: var(--font-mono); color: var(--text-primary);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; position: relative; z-index: 1;
  line-height: 1.15; min-width: 0; overflow-wrap: break-word;
}
.kpi-sub, .stat-card .meta { font-size: var(--text-sm); color: var(--text-muted); position: relative; z-index: 1; }
.kpi-sub.up, .stat-card .meta.up { color: var(--success); }
.kpi-sub.down, .stat-card .meta.down { color: var(--danger); }

/* ---------- Progress ring ---------- */
.ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--border-2); }
.ring-fill { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.8s cubic-bezier(0.4,0,0.2,1); }
.ring-fill.green { stroke: var(--success); }
.ring-fill.gold  { stroke: var(--gold); }
.ring-fill.red   { stroke: var(--danger); }
.ring-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-primary);
}

/* ---------- Charts (self-contained, no libs) ---------- */
.chart-card {
  background: var(--glass-bg-strong); backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.8);
  padding: 20px 22px 16px; margin-bottom: 16px;
}
.chart-card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; gap: 10px; flex-wrap: wrap; }
.chart-card-head h3 { font-size: var(--text-md); }
.chart-card-head .muted { font-size: var(--text-xs); }

.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 20px; }
.bar-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-chart-value { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: 0; transition: opacity .12s; }
.bar-chart-col:hover .bar-chart-value, .bar-chart-col.is-peak .bar-chart-value { opacity: 1; }
.bar-chart-bar { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: var(--border-2); transition: var(--transition); min-height: 3px; }
.bar-chart-col:hover .bar-chart-bar { transform: scaleX(1.08); }
.bar-chart-bar.filled { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); }
.bar-chart-axis { font-size: var(--text-xs); color: var(--text-muted); margin-top: 8px; font-weight: 600; white-space: nowrap; }

.meter-list { display: flex; flex-direction: column; gap: 16px; }
.meter-row { display: flex; flex-direction: column; gap: 6px; }
.meter-row-top { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-sm); gap: 10px; }
.meter-row-top .name { font-weight: 600; color: var(--text-primary); font-family: var(--font-sans); }
.meter-row-top .amounts { color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; }
.meter-track { height: 8px; border-radius: 20px; background: var(--border); overflow: hidden; position: relative; }
.meter-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--gold-bright), var(--gold)); transition: width 0.5s ease; }

/* ---------- Toasts ---------- */
.toast-container { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  background: var(--bg-overlay); backdrop-filter: blur(20px) saturate(150%); color: var(--text-primary);
  padding: 11px 16px; border-radius: var(--radius-md); font-size: var(--text-base); font-weight: 500;
  box-shadow: var(--shadow-lg); border: 1px solid var(--glass-border);
  display: flex; align-items: center; gap: 10px; animation: toastIn 0.25s ease; max-width: 340px;
}
.toast.success::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.toast.error::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }
.toast.fade-out { animation: toastOut 0.2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(0.97); } }

/* ---------- Command palette (as modal) ---------- */
.cmdk-overlay { position: fixed; inset: 0; background: rgba(26,32,64,0.35); backdrop-filter: blur(8px); z-index: 150; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk-overlay.open { display: flex; }
.cmdk-panel {
  width: 100%; max-width: 560px; background: rgba(255,255,255,0.92); backdrop-filter: blur(40px) saturate(200%);
  border-radius: var(--radius-xl); box-shadow: 0 20px 80px rgba(100,120,180,0.2), 0 0 0 1px rgba(201,168,76,0.1), inset 0 1px 0 rgba(255,255,255,1);
  border: 1px solid rgba(255,255,255,0.95); overflow: hidden; animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.cmdk-input-row { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: rgba(201,168,76,0.03); }
.cmdk-input-row svg { color: var(--text-muted); flex-shrink: 0; }
.cmdk-input-row input { flex: 1; border: none; background: transparent; outline: none; font-size: 15px; color: var(--text-primary); font-family: var(--font-sans); padding: 0; margin: 0; }
.cmdk-input-row kbd { font-size: var(--text-xs); color: var(--text-muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
.cmdk-results { max-height: 360px; overflow-y: auto; padding: 8px; }
.cmdk-group-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 8px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-md); color: var(--text-primary); font-size: var(--text-base); cursor: pointer; }
.cmdk-item .cmdk-item-icon { color: var(--text-muted); flex-shrink: 0; display: flex; }
.cmdk-item .cmdk-item-icon svg { width: 15px; height: 15px; }
.cmdk-item .cmdk-item-sub { margin-left: auto; color: var(--text-muted); font-size: var(--text-xs); }
.cmdk-item.active, .cmdk-item:hover { background: var(--gold-glow); }
.cmdk-empty { padding: 30px 10px; text-align: center; color: var(--text-muted); font-size: var(--text-base); }

/* ---------- Modal (generic, exact per spec) ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: 150; }
.modal.show { display: flex; }
.modal-box {
  background: rgba(255,255,255,0.92); backdrop-filter: blur(40px) saturate(200%);
  border-radius: var(--radius-xl); border: 1px solid rgba(255,255,255,0.95);
  box-shadow: 0 20px 80px rgba(100,120,180,0.2), 0 0 0 1px rgba(201,168,76,0.1), inset 0 1px 0 rgba(255,255,255,1);
  max-width: 560px; max-height: 90vh; overflow-y: auto; animation: modal-in 0.2s ease;
}
.modal-box-xl { max-width: 95vw; width: 900px; display: flex; flex-direction: column; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); background: rgba(201,168,76,0.03); }
.modal-header h3 { font-size: var(--text-lg); }
.modal-body { padding: 20px 24px 4px; }
.modal-body .form-row { gap: 16px; }
.modal-footer {
  padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--border); margin-top: 8px; position: sticky; bottom: 0;
  background: rgba(255,255,255,0.75); backdrop-filter: blur(10px);
}
@media (max-width: 620px) {
  .modal-box { max-width: 100%; margin: 0 12px; }
  .modal-body .form-row { flex-direction: column; gap: 0; }
}

/* Keep row action buttons on one line so they never stretch the row */
.row-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.table td { vertical-align: middle; }

/* ---------- Type picker (icon-card radio group) ---------- */
.type-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 5px; margin-bottom: 14px; }
.type-option {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px;
  border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-surface);
  cursor: pointer; text-align: center; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary);
  transition: var(--transition); position: relative;
}
.type-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.type-option svg { width: 21px; height: 21px; color: var(--text-muted); transition: color 0.15s; }
.type-option:hover { border-color: var(--border-active); background: var(--gold-glow); }
.type-option:has(input:checked) { border-color: var(--gold); background: var(--gold-glow-lg); color: var(--text-primary); }
.type-option:has(input:checked) svg { color: var(--gold-dim); }
.type-option:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Live total preview ---------- */
.total-preview { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: var(--radius-md); background: var(--gold-glow); border: 1px solid var(--border-2); margin-bottom: 16px; }
.total-preview .tp-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }
.total-preview .tp-value { font-size: 19px; font-weight: 700; color: var(--gold-dim); }
.vat-presets { display: inline-flex; gap: 6px; margin-left: 8px; }
.vat-preset-btn { padding: 3px 9px; font-size: var(--text-xs); font-weight: 700; border-radius: 20px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; box-shadow: none; }
.vat-preset-btn:hover { background: var(--gold-glow); border-color: var(--border-active); color: var(--text-primary); opacity: 1; box-shadow: none; }

/* ---------- VAT / amount breakdown strip ---------- */
.breakdown-strip {
  display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--gold-glow); border: 1px solid var(--border-2); margin-bottom: 14px;
}
.breakdown-strip .bd-item { display: flex; flex-direction: column; gap: 3px; min-width: 96px; }
.breakdown-strip .bd-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}
.breakdown-strip .bd-value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 14px; font-weight: 700; color: var(--text-primary); white-space: nowrap;
}
.breakdown-strip .bd-op {
  display: flex; align-items: center; font-size: 15px; font-weight: 700; color: var(--text-muted); padding: 0 2px;
}
.breakdown-strip .bd-total { margin-left: auto; text-align: right; }
.breakdown-strip .bd-total .bd-value { font-size: 17px; color: var(--gold-dim); }
.breakdown-strip.compact { padding: 10px 14px; margin-bottom: 0; background: var(--bg-surface); }
.breakdown-strip.compact .bd-value { font-size: 12.5px; }
.breakdown-strip.compact .bd-total .bd-value { font-size: 13.5px; }

/* ---------- Split preview table ---------- */
.split-preview tfoot td {
  border-top: 1px solid var(--border-2); border-bottom: none;
  background: rgba(201, 168, 76, 0.05);
}
.split-preview tbody tr:hover td { background: rgba(201, 168, 76, 0.04); }

/* ---------- Per-event supporting documents ---------- */
.event-docs {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--bg-surface); border: 1px solid var(--border);
}
.event-docs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.event-docs-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.event-docs .file-drop.compact { background: var(--bg-elevated); }

/* ---------- Wide card grid (contracts) ---------- */
/* auto-fit collapses the empty tracks that auto-fill leaves behind, so one or two
   cards fill the row instead of huddling narrow on the left. */
.grid-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.grid-wide .stat-row .value { white-space: nowrap; }

.contract-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.contract-card-head .cc-title { min-width: 0; }
.contract-card-head h3 { margin-bottom: 3px; }
.contract-card-head .badge { flex-shrink: 0; }
.contract-card .stat-row { margin-top: 16px; gap: 20px; }
.contract-card .stat-row > div { min-width: 0; }

/* ---------- Proof of payment thumbnail ---------- */
.proof-thumb {
  width: 34px; height: 34px; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); display: block; transition: var(--transition);
}
.proof-thumb:hover { transform: scale(1.06); border-color: var(--border-active); box-shadow: var(--shadow-sm); }
.proof-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: var(--radius-sm);
  background: var(--gold-glow); color: var(--gold-dim); border: 1px solid var(--border-2);
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.proof-chip:hover { background: var(--gold-glow-lg); }
.proof-chip svg { width: 12px; height: 12px; }

/* ---------- File drop zone ---------- */
.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 26px 20px; border-radius: var(--radius-lg); border: 1.5px dashed var(--border-2);
  background: var(--bg-surface); cursor: pointer; text-align: center; transition: var(--transition);
  position: relative;
}
.file-drop:hover { border-color: var(--border-active); background: var(--gold-glow); }
.file-drop.dragover { border-color: var(--gold); background: var(--gold-glow-lg); box-shadow: 0 0 0 4px var(--gold-glow); }
.file-drop:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.file-drop-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.file-drop-icon { width: 34px; height: 34px; color: var(--gold-dim); margin-bottom: 4px; }
.file-drop-title { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.file-drop-title strong { color: var(--gold-dim); }
.file-drop-hint { font-size: var(--text-xs); color: var(--text-muted); }

/* Compact variant for "attach more" zones on pages that already show a file list,
   where the drop zone is a secondary action rather than the point of the page. */
.file-drop.compact {
  flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 10px; padding: 11px 14px; text-align: left;
}
.file-drop.compact .file-drop-icon { width: 20px; height: 20px; margin-bottom: 0; flex-shrink: 0; }
.file-drop.compact .file-drop-title { font-size: var(--text-sm); }
.file-drop.compact .file-drop-hint { font-size: var(--text-xs); margin-left: auto; text-align: right; }
@media (max-width: 620px) {
  .file-drop.compact .file-drop-hint { display: none; }
}

.file-drop-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.file-drop-chip {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 1px solid var(--border-2); font-size: var(--text-sm);
  animation: cardIn 0.2s ease both;
}
.file-drop-chip svg { width: 15px; height: 15px; color: var(--gold-dim); flex-shrink: 0; }
.file-drop-chip .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); font-weight: 500; }
.file-drop-chip .size { color: var(--text-muted); font-size: var(--text-xs); flex-shrink: 0; }

/* ---------- Danger zone ---------- */
.danger-zone { border: 1px solid rgba(220,38,38,0.2); border-radius: var(--radius-md); padding: 14px 16px; margin-top: 18px; background: var(--danger-bg); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.danger-zone .dz-copy strong { display: block; font-size: var(--text-base); color: var(--text-primary); }
.danger-zone .dz-copy span { font-size: var(--text-xs); color: var(--text-secondary); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: rgba(220,38,38,0.3); }

/* ---------- Avatars ---------- */
.avatar-lg { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 16px; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 11px; flex-shrink: 0; }

/* ---------- Partner cards ---------- */
.partner-card { display: flex; flex-direction: column; gap: 16px; }
.partner-card-top { display: flex; align-items: center; gap: 12px; }
.partner-card-top .meta { min-width: 0; flex: 1; }
.partner-card-top .meta .p-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--text-primary); }
.partner-card-top .meta .p-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }
.partner-card-actions { display: flex; gap: 8px; }
.partner-card-actions form { flex: 1; }
.partner-card-actions form button { width: 100%; justify-content: center; }
.partner-card-actions a.btn { flex: 1; justify-content: center; }

/* ---------- Activity feed ---------- */
.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; padding-bottom: 2px; }
.activity-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.activity-icon svg { width: 15px; height: 15px; }
.activity-icon.paid { background: var(--success-bg); color: var(--success); }
.activity-icon.partial { background: var(--warning-bg); color: var(--warning); }
.activity-icon.pending { background: var(--bg-surface); color: var(--text-muted); }
.activity-body { min-width: 0; flex: 1; }
.activity-title { font-family: var(--font-sans); font-size: var(--text-base); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-right { text-align: right; flex-shrink: 0; }
.activity-amount { font-size: var(--text-base); font-weight: 700; color: var(--text-primary); }
.activity-time { font-family: var(--font-sans); font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }

/* ---------- Section card head (icon + title) ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h3 { display: flex; align-items: center; gap: 8px; }
.section-head h3 svg { width: 16px; height: 16px; color: var(--gold); }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.filter-search { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.filter-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; transition: var(--transition); z-index: 1; }
.filter-search input {
  padding: 10px 14px 10px 40px; margin-top: 0; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border-2);
  box-shadow: 0 1px 3px rgba(100,120,180,0.06);
}
.filter-search input:focus { box-shadow: 0 0 0 3px var(--gold-glow), 0 1px 3px rgba(100,120,180,0.06); }
.filter-search input:focus ~ svg, .filter-search:focus-within svg { color: var(--gold-dim); }
.filter-tabs { display: flex; gap: 3px; background: var(--bg-surface); padding: 4px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.filter-tab { padding: 6px 13px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); cursor: pointer; background: transparent; border: none; box-shadow: none; transition: var(--transition); }
.filter-tab:hover { opacity: 1; background: var(--bg-elevated); color: var(--text-primary); box-shadow: none; }
.filter-tab.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.filter-count { margin-left: auto; font-size: var(--text-sm); color: var(--text-muted); font-weight: 600; }
.filter-hidden { display: none !important; }

/* ---------- Getting started checklist ---------- */
.checklist-card { border-color: var(--border-2); }
.checklist-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.checklist-ring { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: conic-gradient(var(--gold) calc(var(--pct) * 1%), var(--border-2) 0); flex-shrink: 0; position: relative; }
.checklist-ring::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--bg-elevated); }
.checklist-ring span { position: relative; z-index: 1; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 800; color: var(--text-primary); }
.checklist-items { display: flex; flex-direction: column; gap: 2px; }
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checklist-item:last-child { border-bottom: none; padding-bottom: 0; }
.checklist-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.checklist-item.done .checklist-check { background: var(--success); border-color: var(--success); }
.checklist-check svg { width: 13px; height: 13px; }
.checklist-label { flex: 1; font-size: var(--text-base); font-weight: 500; color: var(--text-primary); }
.checklist-item.done .checklist-label { color: var(--text-muted); text-decoration: line-through; }

/* ---------- Sidebar collapse ---------- */
:root.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
:root.sidebar-collapsed .main-area { margin-left: var(--sidebar-w-collapsed); }
:root.sidebar-collapsed .sidebar-search span, :root.sidebar-collapsed .sidebar-search kbd,
:root.sidebar-collapsed .sidebar-label, :root.sidebar-collapsed .nav-label,
:root.sidebar-collapsed .nav-item .nav-badge, :root.sidebar-collapsed .user-meta {
  display: none;
}
:root.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 20px 8px 16px; }
:root.sidebar-collapsed .sidebar-brand > div { display: none; }
:root.sidebar-collapsed .sidebar-search { justify-content: center; padding: 10px 8px; }
:root.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 8px; }
:root.sidebar-collapsed .user-chip { justify-content: center; }
:root.sidebar-collapsed .logout-row form { display: flex; justify-content: center; }
:root.sidebar-collapsed .logout-row .btn-ghost { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* ---------- Breadcrumb project switcher ---------- */
.breadcrumb-switcher { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; box-shadow: none; padding: 0; margin-left: -2px; }
.breadcrumb-switcher:hover { background: var(--gold-glow); color: var(--gold-dim); opacity: 1; box-shadow: none; }
.breadcrumb-switcher svg { width: 13px; height: 13px; }

/* ---------- Topbar dropdown panels ---------- */
.topbar-dropdown { position: relative; }
.topbar-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 300px; max-height: 380px; overflow-y: auto;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid rgba(255,255,255,0.95); border-radius: var(--radius-lg);
  box-shadow: 0 20px 80px rgba(100,120,180,0.2), 0 0 0 1px rgba(201,168,76,0.1);
  z-index: 90; display: none; padding: 8px;
}
.topbar-panel.open { display: block; animation: modal-in 0.15s ease; }
.topbar-panel-title { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 8px 10px 6px; }
.topbar-panel-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-md); color: var(--text-primary); font-size: var(--text-base); cursor: pointer; font-weight: 500; }
.topbar-panel-item:hover { background: var(--gold-glow); }
.topbar-panel-item svg { width: 16px; height: 16px; color: var(--gold-dim); flex-shrink: 0; }
.topbar-panel-empty { padding: 24px 10px; text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
.topbar-panel-foot { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: var(--radius-md); }
.notif-item:hover { background: var(--bg-surface); }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.notif-dot.paid { background: var(--success); }
.notif-dot.partial { background: var(--warning); }
.notif-dot.pending { background: var(--text-muted); }
.notif-body { min-width: 0; }
.notif-title { font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.notif-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }
.bell-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); border: 1.5px solid var(--bg-elevated); }

/* ---------- Attention list (overdue / upcoming) ---------- */
.attention-list { display: flex; flex-direction: column; }
.attention-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.attention-item:last-child { border-bottom: none; }
.attention-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.attention-icon svg { width: 15px; height: 15px; }
.attention-icon.overdue { background: var(--danger-bg); color: var(--danger); }
.attention-icon.upcoming { background: var(--warning-bg); color: var(--warning); }
.attention-body { min-width: 0; flex: 1; }
.attention-title { font-family: var(--font-sans); font-size: var(--text-base); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attention-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }
.attention-right { text-align: right; flex-shrink: 0; }
.attention-amount { font-size: var(--text-base); font-weight: 700; color: var(--text-primary); }
.attention-days { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 700; margin-top: 1px; }
.attention-days.overdue { color: var(--danger); }
.attention-days.upcoming { color: var(--warning); }

/* ---------- File vault ---------- */
.file-list { display: flex; flex-direction: column; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.file-item:last-child { border-bottom: none; }
.file-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--gold-glow-lg); color: var(--gold-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-icon svg { width: 15px; height: 15px; }
.file-body { min-width: 0; flex: 1; }
.file-name { font-family: var(--font-sans); font-size: var(--text-base); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.file-actions form { margin: 0; }

/* ---------- Notes / comments log ---------- */
.note-list { display: flex; flex-direction: column; gap: 12px; }
.note-item { padding: 12px 14px; border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border); }
.note-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.note-author { font-size: var(--text-sm); font-weight: 700; color: var(--text-primary); }
.note-time { font-family: var(--font-sans); font-size: var(--text-xs); color: var(--text-muted); flex-shrink: 0; }
.note-body { font-size: var(--text-base); color: var(--text-secondary); white-space: pre-wrap; line-height: 1.5; }
.note-item form { margin-top: 8px; }
.note-item .btn-sm { padding: 3px 9px; font-size: var(--text-xs); }

/* ---------- Risk / status indicator grid ---------- */
.risk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.risk-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-surface); }
.risk-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.risk-dot.good { background: var(--success); }
.risk-dot.warn { background: var(--warning); }
.risk-dot.info { background: var(--info); }
.risk-dot.bad { background: var(--danger); }
.risk-body { min-width: 0; }
.risk-body .risk-title { font-size: var(--text-sm); font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.risk-body .risk-sub { font-size: var(--text-xs); color: var(--text-muted); }

/* ---------- Cover banner (gradient placeholder, card-bleed) ---------- */
.cover-card { position: relative; height: 100px; margin: -22px -24px 14px; overflow: hidden; border-radius: var(--radius-lg) var(--radius-lg) 0 0; display: flex; align-items: flex-start; justify-content: space-between; padding: 12px 14px; }
.cover-card .cover-badge { position: relative; z-index: 1; }
.cover-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.35)); }

/* ---------- Stat strip (list-page KPI row) ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }

/* ---------- Financial health bars ---------- */
.health-bar-list { display: flex; flex-direction: column; gap: 15px; }
.health-bar-row .hb-top { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-sm); margin-bottom: 6px; gap: 10px; }
.health-bar-row .hb-label { font-weight: 600; color: var(--text-primary); font-family: var(--font-sans); }
.health-bar-row .hb-pct { font-family: var(--font-mono); font-weight: 700; color: var(--text-primary); flex-shrink: 0; }
.health-track { height: 8px; border-radius: 20px; background: var(--border); overflow: hidden; }
.health-fill { height: 100%; border-radius: 20px; transition: width 0.4s ease; }
.health-fill.c-gold { background: linear-gradient(90deg, var(--gold-bright), var(--gold)); }
.health-fill.c-success { background: linear-gradient(90deg, #4ade80, var(--success)); }
.health-fill.c-info { background: linear-gradient(90deg, #60a5fa, var(--info)); }

/* ---------- Quick actions ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.quick-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px 10px; border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary); font-size: var(--text-sm); font-weight: 600; text-align: center; transition: var(--transition); cursor: pointer; }
.quick-action:hover { transform: translateY(-2px); border-color: var(--border-active); background: var(--gold-glow); color: var(--text-primary); }
.quick-action svg { width: 19px; height: 19px; color: var(--gold-dim); }

/* ---------- Page hero (glass, gold-tinted) ---------- */
.page-hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.75), rgba(248,250,255,0.6));
  backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.8);
  padding: 28px 30px; margin-bottom: 24px; position: relative; overflow: hidden;
}
.page-hero::before { content: ''; position: absolute; top: -60px; right: -60px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(201,168,76,0.1) 0%, transparent 65%); pointer-events: none; }
.page-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.page-hero-eyebrow { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; margin-bottom: 6px; }
.page-hero h1 { font-size: 25px; margin-bottom: 4px; color: var(--text-primary); }
.page-hero p.muted { color: var(--text-secondary); }
.page-hero .actions .btn { box-shadow: 0 6px 22px rgba(100,120,180,0.15); }
.page-hero-stats {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 18px 38px; margin-top: 26px; padding-top: 22px;
  border-top: 1px solid var(--border); position: relative; z-index: 1;
}
/* Hairline between figures so adjacent amounts don't read as one number */
.page-hero-stat { position: relative; padding-right: 38px; }
.page-hero-stat + .page-hero-stat::before {
  content: ''; position: absolute; left: -19px; top: 4px; bottom: 4px;
  width: 1px; background: var(--border-2);
}
.page-hero-stat:last-child { padding-right: 0; }
.page-hero-stat .value {
  font-family: var(--font-mono); font-size: clamp(18px, 1.1vw + 8px, 22px); font-weight: 700;
  color: var(--text-primary); letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  white-space: nowrap; line-height: 1.2;
}
.page-hero-stat .label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 5px; font-weight: 700; white-space: nowrap; }
.page-hero-stat.accent .value { color: var(--gold-dim); }
@media (max-width: 880px) {
  .page-hero-stats { gap: 16px 24px; }
  .page-hero-stat { padding-right: 24px; }
  .page-hero-stat + .page-hero-stat::before { left: -12px; }
}

/* ---------- Tabs ---------- */
.tabs-nav { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 22px; -ms-overflow-style: none; scrollbar-width: none; }
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn { padding: 10px 14px; font-size: var(--text-base); font-weight: 600; color: var(--text-secondary); background: transparent; border: none; box-shadow: none; border-radius: 0; white-space: nowrap; position: relative; cursor: pointer; display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.tab-btn:hover { color: var(--text-primary); background: var(--bg-surface); opacity: 1; box-shadow: none; }
.tab-btn.active { color: var(--gold-dim); }
.tab-btn.active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--gold); border-radius: 2px 2px 0 0; }
.tab-btn .tab-count { font-size: var(--text-xs); font-weight: 700; background: var(--bg-surface); color: var(--text-muted); border-radius: 20px; padding: 1px 6px; }
.tab-btn.active .tab-count { background: var(--gold-glow-lg); color: var(--gold-dim); }
.tab-panel { display: none; animation: fadeIn 0.25s ease; }
.tab-panel.active { display: block; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .sidebar-scrim, .topbar, .toast-container, .cmdk-overlay,
  .filter-bar, .quick-actions, .tabs-nav, .danger-zone, .page-hero .actions,
  form button, form .btn, details > summary, .icon-btn, .breadcrumb-switcher,
  .topbar-panel, .checklist-card, .file-actions, td:last-child form,
  .partner-card-actions, .logout-row {
    display: none !important;
  }
  .main-area { margin-left: 0 !important; }
  .container { max-width: 100% !important; padding: 0 !important; }
  body { background: #fff !important; }
  .tab-panel { display: block !important; margin-bottom: 24px; }
  .card, .chart-card, .kpi-card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; backdrop-filter: none !important; background: #fff !important; }
  .page-hero { background: none !important; border: 1px solid #ccc; backdrop-filter: none !important; }
  a { text-decoration: none; color: inherit; }
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .sidebar, :root.sidebar-collapsed .sidebar { transform: translateX(-100%); width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
  .sidebar.open, :root.sidebar-collapsed .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(26,32,64,0.4); z-index: 55; }
  .sidebar-scrim.open { display: block; }
  .main-area, :root.sidebar-collapsed .main-area { margin-left: 0; }
  :root.sidebar-collapsed .nav-label, :root.sidebar-collapsed .sidebar-search span,
  :root.sidebar-collapsed .sidebar-search kbd, :root.sidebar-collapsed .sidebar-brand > div,
  :root.sidebar-collapsed .user-meta { display: revert; }
  :root.sidebar-collapsed .sidebar-brand, :root.sidebar-collapsed .sidebar-search,
  :root.sidebar-collapsed .nav-item, :root.sidebar-collapsed .user-chip { justify-content: revert; padding: revert; }
  .sidebar-collapse-btn { display: none; }
  .menu-btn { display: flex; }
  .container { padding: 22px 16px 50px; }
  .kpi-grid, .stat-strip { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 8px; }
  .breadcrumbs { font-size: 12px; }
  [data-print-page] { display: none; }
  .topbar-panel { width: min(300px, calc(100vw - 24px)); right: -8px; }
  .checklist-head { flex-wrap: wrap; }
  .quick-actions, .type-picker { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}
