@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

/* ═══ THEME SYSTEM ═══ */
:root, [data-theme="dark"] {
  --bg: #131518;
  --surface: #1a1d21;
  --surface2: #22262b;
  --surface3: #2a2f36;
  --border: #2f343c;
  --border2: #3d434d;
  --accent: #2a4d7a;
  --accent-hover: #1e3a5f;
  --accent-subtle: rgba(42,77,122,.15);
  --accent2: #3d6898;
  --accent3: #10b981;
  --accent3-hover: #059669;
  --accent3-subtle: rgba(16,185,129,.1);
  --text: #e8eaed;
  --text2: #cdd0d5;
  --muted: #6b7280;
  --muted2: #9ca3af;
  --danger: #ef4444;
  --danger-subtle: rgba(239,68,68,.1);
  --warning: #f59e0b;
  --warning-subtle: rgba(245,158,11,.1);
  --shadow: 0 2px 12px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
  --gradient: linear-gradient(135deg, var(--accent), #0f2440);
  --gradient2: linear-gradient(135deg, var(--accent3), #059669);
  /* Section-specific financial colors */
  --revenue: #10b981;
  --revenue-subtle: rgba(16,185,129,.08);
  --expense: #f59e0b;
  --expense-subtle: rgba(245,158,11,.08);
  --cogs: #e67e22;
  --cogs-subtle: rgba(230,126,34,.08);
  --profit-pos: #10b981;
  --profit-neg: #ef4444;
  --asset: #06b6d4;
  --asset-subtle: rgba(6,182,212,.08);
  --liability: #f59e0b;
  --liability-subtle: rgba(245,158,11,.08);
  --equity: #8b5cf6;
  --equity-subtle: rgba(139,92,246,.08);
  --cashflow-in: #06b6d4;
  --cashflow-out: #f97316;
  --forecast-col: #2a4d7a;
  --pipeline-col: #8b5cf6;
  --actual-col: #10b981;
}

[data-theme="light"] {
  --bg: #f4f3f8;
  --surface: #ffffff;
  --surface2: #eeedf5;
  --surface3: #e4e2f0;
  --border: #d8d5e8;
  --border2: #c5c1da;
  --accent: #2a4d7a;
  --accent-hover: #1e3a5f;
  --accent-subtle: rgba(42,77,122,.12);
  --accent2: #3d6898;
  --accent3: #059669;
  --accent3-hover: #047857;
  --accent3-subtle: rgba(5,150,105,.08);
  --text: #1a1730;
  --text2: #332f50;
  --muted: #8884a8;
  --muted2: #6b6490;
  --danger: #dc2626;
  --danger-subtle: rgba(220,38,38,.08);
  --warning: #d97706;
  --warning-subtle: rgba(217,119,6,.08);
  --shadow: 0 2px 12px rgba(26,23,48,.08);
  --shadow-lg: 0 8px 32px rgba(26,23,48,.12);
  --gradient: linear-gradient(135deg, var(--accent), #0f2440);
  --gradient2: linear-gradient(135deg, var(--accent3), #047857);
  --revenue: #059669;
  --revenue-subtle: rgba(5,150,105,.06);
  --expense: #d97706;
  --expense-subtle: rgba(217,119,6,.06);
  --cogs: #c2410c;
  --cogs-subtle: rgba(194,65,12,.06);
  --profit-pos: #059669;
  --profit-neg: #dc2626;
  --asset: #0891b2;
  --asset-subtle: rgba(8,145,178,.06);
  --liability: #d97706;
  --liability-subtle: rgba(217,119,6,.06);
  --equity: #7c3aed;
  --equity-subtle: rgba(124,58,237,.06);
  --cashflow-in: #0891b2;
  --cashflow-out: #ea580c;
  --forecast-col: #2a4d7a;
  --pipeline-col: #7c3aed;
  --actual-col: #059669;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Ubuntu', sans-serif;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease, background .3s;
}
.logo { padding: 24px 24px 20px; border-bottom: 1px solid var(--border); }
.logo a { text-decoration: none; }
.logo-mark {
  font-family: 'Ubuntu', sans-serif;
  font-weight: 700; font-size: 22px;
  letter-spacing: -0.5px; color: var(--text);
}
.logo-mark span { color: var(--accent); }
.logo-sub {
  font-size: 10px; color: var(--muted); font-weight: 500;
  letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px;
}

.tenant-badge {
  margin: 14px 14px 0;
  background: var(--accent-subtle);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: border-color .2s;
}
.tenant-badge:hover { border-color: var(--accent); }
.tenant-icon {
  width: 32px; height: 32px; background: var(--accent);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; font-family: 'Ubuntu', sans-serif;
}
.tenant-name { font-size: 13px; font-weight: 500; }
.tenant-plan { font-size: 10px; color: var(--accent); letter-spacing: .5px; font-weight: 500; }

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted);
  padding: 0 8px; margin-bottom: 6px; margin-top: 18px;
}
.nav-label:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 400; color: var(--muted2);
  transition: all .15s; margin-bottom: 1px; position: relative;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: var(--accent-subtle); color: var(--accent);
}
.nav-item.active::before {
  content: ''; position: absolute;
  left: -12px; top: 20%; bottom: 20%;
  width: 3px; background: var(--accent);
  border-radius: 0 4px 4px 0;
}
.nav-icon { font-size: 14px; width: 20px; text-align: center; color: inherit; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 6px;
  border-radius: 20px; min-width: 18px; text-align: center;
}
/* Hidden nav items in customize mode */
.nav-item.nav-hidden, .nav-section.nav-hidden { display: none; }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; cursor: pointer; transition: background .15s;
}
.user-row:hover { background: var(--surface2); }
.avatar {
  width: 34px; height: 34px;
  background: var(--gradient);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; font-family: 'Ubuntu', sans-serif;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--muted); }

/* ═══ MAIN ═══ */
.main {
  margin-left: 240px; flex: 1;
  min-height: 100vh; display: flex; flex-direction: column;
  transition: margin-left .25s ease, margin-right .3s ease;
  min-width: 0;
}

/* ═══ TOPBAR ═══ */
.topbar {
  height: 60px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px; gap: 16px;
  background: var(--surface); position: sticky; top: 0; z-index: 50;
  transition: background .3s;
  flex-shrink: 0;
  overflow: visible;
}
.topbar-title {
  font-family: 'Ubuntu', sans-serif; font-size: 16px; font-weight: 700;
  white-space: nowrap;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.search-bar {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 14px; color: var(--text);
  font-size: 13px; width: 200px; outline: none; transition: border-color .2s;
}
.search-bar:focus { border-color: var(--accent); }
.search-bar::placeholder { color: var(--muted); }

.icon-btn {
  width: 36px; height: 36px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all .15s; position: relative; color: var(--muted2);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }
.notif-dot {
  position: absolute; top: 6px; right: 7px;
  width: 7px; height: 7px; background: var(--accent3);
  border-radius: 50%; border: 1.5px solid var(--surface);
}

/* Dark/Light toggle */
.theme-toggle {
  width: 34px; height: 34px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s; color: var(--muted2);
  font-size: 15px; flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle.hidden-toggle { display: none; }

/* Customize toggle */
.customize-toggle {
  width: 34px; height: 34px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s; color: var(--muted2);
  font-size: 15px; flex-shrink: 0;
}
.customize-toggle:hover { border-color: var(--accent); color: var(--accent); }
.customize-toggle.active { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }

/* ═══ CONTENT ═══ */
.content { padding: 28px; flex: 1; animation: fadeIn .25s ease; overflow-x: auto; min-width: 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ═══ FINANCIAL COLOR UTILITIES ═══ */
.clr-revenue{color:var(--revenue) !important;} .bg-revenue{background:var(--revenue-subtle) !important;}
.clr-expense{color:var(--expense) !important;} .bg-expense{background:var(--expense-subtle) !important;}
.clr-cogs{color:var(--cogs) !important;} .bg-cogs{background:var(--cogs-subtle) !important;}
.clr-profit-pos{color:var(--profit-pos) !important;} .clr-profit-neg{color:var(--profit-neg) !important;}
.clr-asset{color:var(--asset) !important;} .bg-asset{background:var(--asset-subtle) !important;}
.clr-liability{color:var(--liability) !important;} .bg-liability{background:var(--liability-subtle) !important;}
.clr-equity{color:var(--equity) !important;} .bg-equity{background:var(--equity-subtle) !important;}
.clr-cashflow-in{color:var(--cashflow-in) !important;} .clr-cashflow-out{color:var(--cashflow-out) !important;}
.clr-forecast{color:var(--forecast-col) !important;} .clr-pipeline{color:var(--pipeline-col) !important;} .clr-actual{color:var(--actual-col) !important;}

/* ═══ CARDS ═══ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  transition: background .3s, border-color .3s;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-family: 'Ubuntu', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.card-action {
  font-size: 12px; color: var(--accent); cursor: pointer;
  font-weight: 500; background: none; border: none; font-family: inherit;
}
.card-action:hover { text-decoration: underline; }

/* ═══ KPI CARDS ═══ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 22px; position: relative;
  overflow: hidden; transition: border-color .2s, transform .2s, background .3s; cursor: pointer;
}
.kpi-card:hover { transform: translateY(-2px); border-color: var(--border2); }
.kpi-card:hover.c1 { border-color: var(--accent); }
.kpi-card:hover.c2 { border-color: var(--accent2); }
.kpi-card:hover.c3 { border-color: var(--accent3); }
.kpi-card:hover.c4 { border-color: var(--accent); }
.kpi-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 80px; height: 80px; border-radius: 50%;
  opacity: .06; transform: translate(20px, -20px);
}
.c1::after { background: var(--accent); }
.c2::after { background: var(--accent2); }
.c3::after { background: var(--accent3); }
.c4::after { background: var(--accent); }
.kpi-label {
  font-size: 11px; color: var(--muted2); text-transform: uppercase;
  letter-spacing: 1px; font-weight: 500;
}
.kpi-value {
  font-family: 'Ubuntu', sans-serif; font-size: 30px;
  font-weight: 700; margin: 6px 0 4px; letter-spacing: -1px;
}
.c1 .kpi-value { color: var(--accent); }
.c2 .kpi-value { color: var(--accent2); }
.c3 .kpi-value { color: var(--accent3); }
.c4 .kpi-value { color: var(--accent); }
.kpi-delta { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--accent3); }
.kpi-delta.down { color: var(--danger); }

/* ═══ STATUS ═══ */
.status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 20px; letter-spacing: .3px;
}
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.status.active { background: var(--accent3-subtle); color: var(--accent3); }
.status.active::before { background: var(--accent3); }
.status.pending { background: var(--accent-subtle); color: var(--accent); }
.status.pending::before { background: var(--accent); }
.status.review { background: var(--accent-subtle); color: var(--accent2); }
.status.review::before { background: var(--accent2); }
.status.complete { background: rgba(148,144,184,.12); color: var(--muted2); }
.status.complete::before { background: var(--muted); }
.status.overdue { background: var(--danger-subtle); color: var(--danger); }
.status.overdue::before { background: var(--danger); }

/* ═══ PROGRESS ═══ */
.prog-bar { height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; }
.prog-fill {
  height: 100%; border-radius: 4px;
  background: var(--gradient);
  transition: width .8s ease;
}
.prog-label { font-size: 11px; color: var(--muted2); margin-bottom: 4px; }

/* ═══ TABLE ═══ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1px; font-weight: 500; padding: 10px 18px;
  text-align: left; border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 18px; font-size: 13.5px;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .15s; cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface2); }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; font-size: 13px;
  font-weight: 500; border: none; transition: all .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-success { background: var(--accent3); color: #fff; }
.btn-success:hover { background: var(--accent3-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* ═══ MODALS ═══ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(10,8,22,.75); z-index: 999;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; width: 540px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto; animation: fadeIn .2s ease;
  box-shadow: var(--shadow-lg);
  position: relative; z-index: 1000;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: 'Ubuntu', sans-serif; font-size: 16px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--muted2); transition: all .15s; cursor: pointer;
}
.modal-close:hover { color: var(--text); border-color: var(--muted); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 16px; }
.form-label {
  font-size: 12px; font-weight: 500; color: var(--muted2);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px; display: block;
}
.form-input, .form-select, .form-textarea, .form-control {
  width: 100%; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; color: var(--text); font-size: 13.5px;
  outline: none; transition: border-color .2s, background .3s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus, .form-control:focus { border-color: var(--accent); }
.form-input::placeholder, .form-control::placeholder { color: var(--muted); }
.form-select option { background: var(--surface2); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ═══ TABS ═══ */
.page-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px; overflow-x: auto;
}
.page-tab {
  font-size: 13px; padding: 10px 16px; cursor: pointer;
  font-weight: 500; color: var(--muted2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all .15s;
  white-space: nowrap; background: none; border-top: none;
  border-left: none; border-right: none; font-family: inherit;
}
.page-tab:hover { color: var(--text); }
.page-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .25s ease; }

/* ═══ TOAST ═══ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent3); border-radius: 10px;
  padding: 12px 18px; font-size: 13px; max-width: 320px;
  animation: slideIn .3s ease; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
}
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(20px); } }

/* ═══ FINANCIALS ═══ */
.fin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fin-table th {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1px; padding: 8px 10px; text-align: right;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface); position: sticky; top: 0;
}
.fin-table th:first-child { text-align: left; }
.fin-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  text-align: right; white-space: nowrap;
}
.fin-table td:first-child { text-align: left; font-weight: 500; color: var(--muted2); }
.fin-table tbody tr:hover { background: var(--surface2); }
.fin-table .total-row td {
  font-weight: 700; color: var(--text);
  border-top: 2px solid var(--border);
  background: var(--accent-subtle);
}
.fin-table .section-header td {
  background: var(--surface2); font-size: 10px;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); padding: 6px 10px; font-weight: 600;
}
.pos { color: var(--accent3); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

.kpi-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.kpi-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px; transition: background .3s, border-color .3s;
}
.kpi-label-sm { font-size: 10px; color: var(--muted2); text-transform: uppercase; letter-spacing: 1px; font-weight: 500; }
.kpi-val-lg { font-family: 'Ubuntu', sans-serif; font-size: 24px; font-weight: 700; margin: 6px 0 3px; letter-spacing: -.5px; }
.kpi-sub { font-size: 11px; }

.chart-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 22px; margin-bottom: 20px;
}
.chart-title { font-family: 'Ubuntu', sans-serif; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.chart-sub-text { font-size: 11px; color: var(--muted2); margin-bottom: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ═══ DRAG & DROP CUSTOMIZATION ═══ */
.draggable { cursor: grab; position: relative; }
.draggable:active { cursor: grabbing; }
.draggable.dragging { opacity: .5; }
.drag-handle {
  position: absolute; top: 8px; left: 8px;
  width: 20px; height: 20px; display: none;
  align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; cursor: grab;
  border-radius: 4px; z-index: 5;
}
.customize-mode .drag-handle { display: flex; }
.customize-mode .draggable { outline: 1px dashed var(--border2); outline-offset: 2px; }
.customize-mode .draggable:hover { outline-color: var(--accent); }
.drag-placeholder {
  border: 2px dashed var(--accent); border-radius: 14px;
  background: var(--accent-subtle); min-height: 60px;
}

/* Customize panel */
.customize-panel {
  position: fixed; top: 60px; right: 0; bottom: 0;
  width: 280px; background: var(--surface); border-left: 1px solid var(--border);
  z-index: 90; transform: translateX(100%); transition: transform .3s ease;
  overflow-y: auto; box-shadow: var(--shadow-lg);
}
.customize-panel.open { transform: translateX(0); }
/* Push main content when panel is open */
body.customize-active .main { margin-right: 280px; transition: margin-right .3s ease; }
/* Global card drag styles in customize mode */
body.customize-active .content > * {
  outline: 1px dashed var(--border); outline-offset: 2px;
}
body.customize-active .card,
body.customize-active .chart-wrap,
body.customize-active .kpi-box,
body.customize-active .kpi-card,
body.customize-active .d-card,
body.customize-active .cf-card,
body.customize-active .sum-card,
body.customize-active .e-card,
body.customize-active .j-card,
body.customize-active .c-card,
body.customize-active .kb-card,
body.customize-active .v-card,
body.customize-active .po-card,
body.customize-active .ar-card,
body.customize-active .ap-card,
body.customize-active .ds-card,
body.customize-active .fm-kpi-card,
body.customize-active .pf-card,
body.customize-active .fva-card,
body.customize-active .rf-card {
  outline: 2px dashed var(--accent) !important; outline-offset: 3px; cursor: grab; user-select: none;
}
body.customize-active .card:hover,
body.customize-active .d-card:hover,
body.customize-active .cf-card:hover,
body.customize-active .sum-card:hover,
body.customize-active .e-card:hover,
body.customize-active .j-card:hover,
body.customize-active .c-card:hover,
body.customize-active .v-card:hover,
body.customize-active .po-card:hover,
body.customize-active .ar-card:hover,
body.customize-active .ap-card:hover,
body.customize-active .rf-card:hover {
  outline-color: var(--accent2) !important;
}
body.customize-active .content > script,
body.customize-active .content > .dash-greet,
body.customize-active .content > .customize-active-banner {
  outline: none !important; cursor: default;
}
/* Disable customize on document pages */
body.customize-disabled .customize-toggle { display: none; }
.customize-panel-hdr {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between;
}
.customize-section { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.customize-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.customize-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; font-size: 13px;
}
.customize-row label { color: var(--text2); cursor: pointer; display: flex; align-items: center; gap: 8px; }

/* Toggle switch */
.toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle-track {
  width: 100%; height: 100%; background: var(--border);
  border-radius: 10px; cursor: pointer; transition: background .2s;
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff;
  border-radius: 50%; transition: left .2s; pointer-events: none;
}
.toggle input:checked ~ .toggle-thumb { left: 18px; }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 16px; }
  .search-bar { display: none; }
}

/* ═══ COLLAPSIBLE NAV SECTIONS ═══ */
.nav-section { margin-bottom: 2px; }
.nav-section-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--muted2);
  cursor: pointer; transition: all .15s; user-select: none;
}
.nav-section-toggle:hover { background: var(--surface2); color: var(--text); }
.nav-section-open > .nav-section-toggle { color: var(--text); }
.nav-section-label { flex: 1; }
.nav-chevron {
  font-size: 14px; transition: transform .2s; color: var(--muted);
  width: 16px; text-align: center;
}
.nav-section-open > .nav-section-toggle .nav-chevron { transform: rotate(90deg); color: var(--accent); }

.nav-section-items {
  max-height: 0; overflow: hidden;
  transition: max-height .25s ease;
}
.nav-section-open > .nav-section-items { max-height: 500px; }

.nav-sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 36px; border-radius: 6px;
  font-size: 12.5px; font-weight: 400; color: var(--muted2);
  transition: all .12s; margin-bottom: 1px;
}
.nav-sub-item:hover { background: var(--surface2); color: var(--text); }
.nav-sub-item.active { color: var(--accent); font-weight: 600; background: var(--accent-subtle); border-radius: 6px; }
.nav-sub-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
  transition: background .15s;
}
.nav-sub-item.active .nav-sub-dot { background: var(--accent); width: 6px; height: 6px; }
.nav-sub-item:hover .nav-sub-dot { background: var(--text); }

.nav-divider {
  height: 1px; background: var(--border);
  margin: 10px 12px;
}

/* Mobile hamburger */
.menu-toggle {
  display: none; background: none; border: none;
  color: var(--text); font-size: 20px; cursor: pointer; padding: 4px;
}
@media (max-width: 768px) {
  .menu-toggle { display: block; }
}
.card:hover .vt-drag-grip, .d-card:hover .vt-drag-grip,
[class*="-card"]:hover > .vt-drag-grip { opacity: 1; }
