/* ==========================================================================
   Blazenly Pay — design system
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg: #05080f;
  --bg-2: #0a0f1d;
  --surface: rgba(20, 28, 52, .55);
  --surface-2: rgba(255, 255, 255, .045);
  --surface-3: rgba(255, 255, 255, .08);
  --surface-solid: #0d1324;
  --border: rgba(140, 160, 255, .12);
  --border-strong: rgba(140, 160, 255, .24);
  --text: #e8ebf7;
  --text-2: #a4abc8;
  --text-3: #6b7396;
  --accent: #22d3ee;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(34, 211, 238, .12);
  --grad: linear-gradient(135deg, #22d3ee 0%, #6366f1 55%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(34, 211, 238, .16), rgba(168, 85, 247, .16));
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --muted: #94a3b8;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
  --ring: 0 0 0 3px rgba(34, 211, 238, .25);
  --grid-line: rgba(120, 140, 255, .05);
  --orb-a: rgba(34, 211, 238, .18);
  --orb-b: rgba(139, 92, 246, .2);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f5fb;
  --bg-2: #e9edf7;
  --surface: rgba(255, 255, 255, .78);
  --surface-2: rgba(15, 23, 60, .035);
  --surface-3: rgba(15, 23, 60, .07);
  --surface-solid: #ffffff;
  --border: rgba(30, 41, 90, .1);
  --border-strong: rgba(30, 41, 90, .2);
  --text: #0e1530;
  --text-2: #4a5272;
  --text-3: #8890ab;
  --accent: #0891b2;
  --accent-2: #7c3aed;
  --accent-soft: rgba(8, 145, 178, .1);
  --ok: #059669;
  --warn: #b45309;
  --bad: #dc2626;
  --info: #2563eb;
  --muted: #64748b;
  --shadow: 0 16px 40px -20px rgba(15, 23, 42, .25);
  --ring: 0 0 0 3px rgba(8, 145, 178, .2);
  --grid-line: rgba(30, 41, 90, .045);
  --orb-a: rgba(34, 211, 238, .16);
  --orb-b: rgba(139, 92, 246, .12);
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: "Space Grotesk", "Inter", sans-serif; letter-spacing: -.01em; margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--text-3); }
code, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.ico { flex-shrink: 0; vertical-align: middle; }

/* ── Background effects ─────────────────────────────────── */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
}
.orb { position: absolute; border-radius: 50%; filter: blur(90px); }
.orb-a { width: 520px; height: 520px; background: var(--orb-a); top: -180px; right: -120px; }
.orb-b { width: 460px; height: 460px; background: var(--orb-b); bottom: -200px; left: 10%; }

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

.sidebar {
  position: sticky; top: 0; height: 100vh; width: 264px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 16px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 24px -8px rgba(99, 102, 241, .8), inset 0 1px 0 rgba(255,255,255,.3);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: "Space Grotesk", sans-serif; font-size: 1.08rem; }
.brand-text small { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 6px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--grad-soft); color: var(--text); }
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--grad); box-shadow: 0 0 12px var(--accent);
}
.nav-item.active .ico { color: var(--accent); }
.nav-badge {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: .72rem; font-weight: 600; text-align: center;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(34, 211, 238, .3);
}

.partner-card {
  display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.partner-card small { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.partner-card strong { font-size: .8rem; line-height: 1.3; display: block; }
.partner-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 2px 0 0; color: var(--text-3); font-size: .85rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.dot-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: .66rem; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
}
[data-theme="dark"] .theme-light, [data-theme="light"] .theme-dark { display: none; }
.theme-dark, .theme-light { display: grid; }

.menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font: inherit;
}
.user-chip-text { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-chip-text strong { font-size: .84rem; }
.user-chip-text small { font-size: .72rem; }
.menu-pop {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; padding: 6px;
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow);
}
.menu.open .menu-pop { display: block; }
.menu-pop a, .menu-pop button {
  display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 12px; border-radius: 9px;
  color: var(--text-2); background: none; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.content { flex: 1; padding: 26px 28px 40px; display: flex; flex-direction: column; gap: 22px; max-width: 1440px; width: 100%; }
.app-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 28px; border-top: 1px solid var(--border); color: var(--text-3); font-size: .78rem;
}

.avatar {
  --h: 200;
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: .74rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 80% 55%), hsl(calc(var(--h) + 50) 75% 50%));
}
.avatar.lg { width: 52px; height: 52px; font-size: 1rem; }
.avatar.sm { width: 26px; height: 26px; font-size: .64rem; }

/* ── Cards & layout ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 9px; }
.card-head h2 .ico { color: var(--accent); }
.card-head p { margin: 2px 0 0; color: var(--text-3); font-size: .84rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 20px 22px 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }

/* ── KPI tiles ──────────────────────────────────────────── */
.kpi { position: relative; overflow: hidden; padding: 20px; }
.kpi::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--kpi-c, var(--grad)); opacity: .9;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-label { color: var(--text-2); font-size: .82rem; font-weight: 500; }
.kpi-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--kpi-ic, var(--accent)); }
.kpi-value { font-family: "Space Grotesk", sans-serif; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi-value small { font-size: .85rem; font-weight: 500; color: var(--text-3); margin-right: 4px; }
.kpi-foot { margin-top: 8px; color: var(--text-3); font-size: .8rem; }
.kpi.ok { --kpi-c: var(--ok); --kpi-ic: var(--ok); }
.kpi.warn { --kpi-c: var(--warn); --kpi-ic: var(--warn); }
.kpi.info { --kpi-c: var(--info); --kpi-ic: var(--info); }
.kpi.bad { --kpi-c: var(--bad); --kpi-ic: var(--bad); }

.hero {
  position: relative; overflow: hidden; padding: 26px 28px;
  background: var(--grad-soft), var(--surface);
  border-color: var(--border-strong);
}
.hero::before {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, .25), transparent 70%);
}
.hero h2 { font-size: 1.5rem; margin-bottom: 6px; }
.hero p { color: var(--text-2); max-width: 640px; margin: 0; }
.hero .row { margin-top: 16px; position: relative; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; font: 600 .88rem/1.1 "Inter", sans-serif;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 22px -10px rgba(99, 102, 241, .9); }
.btn-primary:hover { box-shadow: 0 10px 28px -8px rgba(99, 102, 241, 1); border-color: transparent; }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-color: transparent; }
.btn-danger { background: rgba(248, 113, 113, .12); color: var(--bad); border-color: rgba(248, 113, 113, .35); }
.btn-danger:hover { border-color: var(--bad); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: .8rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.badge-pending { --c: var(--warn); }
.badge-approved { --c: var(--info); }
.badge-disbursed { --c: var(--ok); }
.badge-rejected { --c: var(--bad); }
.badge-cancelled { --c: var(--muted); }
.badge-r-awaiting { --c: var(--warn); }
.badge-r-confirmed { --c: var(--ok); }
.badge-r-disputed { --c: var(--bad); }
.badge-r-resolved { --c: var(--info); }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 7px; font-size: .74rem; font-weight: 500;
  background: var(--surface-3); color: var(--text-2);
}
.tag-wage { color: var(--accent); background: var(--accent-soft); }
.tag-expense { color: #c4b5fd; background: rgba(139, 92, 246, .14); }
[data-theme="light"] .tag-expense { color: #6d28d9; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
  text-align: left; font-weight: 600; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
  padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { padding: 13px 16px; font-weight: 700; border-top: 1px solid var(--border-strong); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr[data-href] { cursor: pointer; }
.cell-main { display: flex; flex-direction: column; gap: 2px; }
.cell-main strong { font-weight: 600; }
.cell-main small { font-size: .78rem; }
.person { display: inline-flex; align-items: center; gap: 9px; }
.vno { font-family: "JetBrains Mono", monospace; font-size: .8rem; color: var(--accent); }

/* ── Forms ──────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: .76rem; color: var(--text-3); }
.req { color: var(--bad); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 13px; border-radius: 11px; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface-3); }
.input::placeholder { color: var(--text-3); }
textarea.input { min-height: 96px; resize: vertical; }
select.input {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238890ab' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
select.input option { background: var(--surface-solid); color: var(--text); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span {
  display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-right: 0;
  border-radius: 11px 0 0 11px; background: var(--surface-3); color: var(--text-2); font-weight: 600; font-size: .82rem;
}
.input-prefix .input { border-radius: 0 11px 11px 0; font-family: "JetBrains Mono", monospace; font-size: 1rem; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--text-2); font-size: .88rem; }
.check input { width: 17px; height: 17px; accent-color: var(--accent-2); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: .86rem; color: var(--text-2); }
.seg input:checked + span { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -8px rgba(99, 102, 241, .9); }
.seg input:focus-visible + span { box-shadow: var(--ring); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; border-radius: 14px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-strong); background: var(--surface-2); color: var(--text-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.dropzone .files { font-size: .8rem; color: var(--accent); }

/* ── Filters / toolbar ──────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { min-width: 150px; flex: 1; }
.toolbar .field.grow { flex: 2; min-width: 220px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: .84rem;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
}
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.tabs a b { font-size: .72rem; padding: 0 7px; border-radius: 999px; background: var(--surface-3); }

/* ── Flash messages ─────────────────────────────────────── */
.flash {
  --c: var(--info);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 13px;
  background: color-mix(in srgb, var(--c) 11%, var(--surface-solid)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); color: var(--text);
  animation: slideIn .3s ease;
}
.flash .ico { color: var(--c); }
.flash span { flex: 1; }
.flash-success { --c: var(--ok); }
.flash-error { --c: var(--bad); }
.flash-warning { --c: var(--warn); }
.flash-x { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 4px; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.callout {
  --c: var(--info);
  display: flex; gap: 12px; padding: 14px 16px; border-radius: 13px; font-size: .88rem;
  background: color-mix(in srgb, var(--c) 9%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); color: var(--text-2);
}
.callout .ico { color: var(--c); margin-top: 1px; }
.callout strong { color: var(--text); }
.callout.warn { --c: var(--warn); }
.callout.bad { --c: var(--bad); }
.callout.ok { --c: var(--ok); }

/* ── Details / definition list ──────────────────────────── */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; margin: 0; }
.dl div { min-width: 0; }
.dl dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 3px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dl .span-2 { grid-column: 1 / -1; }

.amount-hero { font-family: "Space Grotesk", sans-serif; font-size: 2.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.amount-hero small { font-size: 1rem; color: var(--text-3); margin-right: 6px; font-weight: 500; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── Progress / pipeline ────────────────────────────────── */
.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--grad); box-shadow: 0 0 10px rgba(34, 211, 238, .5); }
.progress.over > span { background: var(--bad); box-shadow: none; }

.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 4px 0 2px; }
.pipe-step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; font-size: .78rem; color: var(--text-3); }
.pipe-step::before {
  content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: var(--border-strong); z-index: 0;
}
.pipe-step:first-child::before { display: none; }
.pipe-dot {
  position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-solid); border: 2px solid var(--border-strong); color: var(--text-3);
}
.pipe-step.done { color: var(--text-2); }
.pipe-step.done .pipe-dot { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 0 16px rgba(99, 102, 241, .6); }
.pipe-step.done::before { background: var(--grad); }
.pipe-step.current .pipe-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.pipe-step.failed .pipe-dot { border-color: var(--bad); color: var(--bad); }
.pipe-step strong { color: var(--text); font-size: .8rem; }

/* ── Timeline ───────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.timeline li::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-icon {
  --c: var(--accent);
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.tl-body { flex: 1; min-width: 0; }
.tl-head { font-size: .86rem; }
.tl-head strong { font-weight: 600; }
.tl-time { font-size: .75rem; color: var(--text-3); }
.tl-note {
  margin-top: 6px; padding: 10px 12px; border-radius: 10px; font-size: .86rem; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}

/* ── Lists ──────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .grow small { display: block; }

.file-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.file-item:hover { border-color: var(--accent); text-decoration: none; }
.file-item .ico { color: var(--accent); }
.file-item .grow { flex: 1; min-width: 0; }
.file-item strong { display: block; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item small { font-size: .74rem; }

.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty-icon { width: 60px; height: 60px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; background: var(--grad-soft); color: var(--accent); }
.empty h2 { margin-bottom: 6px; }

.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-weight: 600; font-size: .84rem; }
.pager a.active { background: var(--grad); color: #fff; border-color: transparent; }
.pager a:hover { text-decoration: none; }
.pager-gap { align-self: center; color: var(--text-3); }

.notif { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: var(--accent-soft); }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; flex-shrink: 0; }
.notif.unread .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }

/* ── Dialogs ────────────────────────────────────────────── */
dialog.modal {
  width: min(520px, calc(100vw - 32px)); padding: 0; border-radius: 20px; color: var(--text);
  background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: 0 30px 80px -20px rgba(0,0,0,.7);
}
dialog.modal::backdrop { background: rgba(3, 6, 15, .65); backdrop-filter: blur(6px); }
dialog.modal[open] { animation: pop .2s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 22px 0; }
.modal-body { padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }

/* ── Auth pages ─────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(440px, 100%); padding: 34px 32px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 24px; }
.auth-foot { margin-top: 22px; text-align: center; font-size: .8rem; color: var(--text-3); }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.scanline {
  height: 2px; margin: 0 -32px 26px; background: var(--grad); opacity: .8;
  box-shadow: 0 0 18px rgba(34, 211, 238, .6);
}

/* ── Utilities ──────────────────────────────────────────── */
.only-mobile { display: none; }
.sidebar-scrim { display: none; }
.stat-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-inline div { display: flex; flex-direction: column; }
.stat-inline small { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; }
.stat-inline strong { font-family: "Space Grotesk", sans-serif; font-size: 1.15rem; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; background: var(--surface-solid); }
  body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow); }
  body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(3, 6, 15, .55); }
  .only-mobile { display: grid; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .user-chip-text { display: none; }
  .user-chip { padding: 3px; }
}
@media (max-width: 680px) {
  .content { padding: 18px 16px 32px; gap: 16px; }
  .topbar { padding: 12px 16px; }
  .topbar-title h1 { font-size: 1.1rem; }
  .topbar-title p { display: none; }
  .hide-sm { display: none; }
  .grid-2, .grid-4, .form-grid, .dl { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px; border-radius: 16px; }
  .kpi-value { font-size: 1.4rem; }
  .amount-hero { font-size: 1.8rem; }
  .app-footer { padding: 14px 16px; }
  .pipe-step { font-size: .7rem; }
  .table th, .table td { padding: 11px 12px; }
  .auth-card { padding: 26px 22px; }
  .scanline { margin: 0 -22px 22px; }
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
  :root, [data-theme] {
    --bg: #fff; --surface: #fff; --surface-2: #f6f7fb; --surface-3: #eef0f6; --surface-solid: #fff;
    --text: #0b1020; --text-2: #333a52; --text-3: #6b7185; --border: #d9dce6; --border-strong: #c3c7d4; --shadow: none;
    --accent: #0e7490;
  }
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .app-footer, .bg-fx, .no-print, .flash, .pager { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; backdrop-filter: none; break-inside: avoid; border-radius: 8px; }
  .chart-box { height: 240px; }
  a { color: inherit; }
}
