/* =====================================================================
   Noah's Accounting — Premium Fintech Dashboard v3
   Design: Mercury + Stripe + Ramp + Pilot + Brex + Bench
   Font: Inter (UI) + JetBrains Mono (numbers)
   Palette: Zinc dark + violet accent + semantic
   ===================================================================== */

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

:root {
  /* ── Surfaces ── */
  --bg:              #09090b;
  --bg-elevated:     #0f0f12;
  --surface-50:      #18181b;
  --surface-100:     #1c1c20;
  --surface-200:     #27272a;
  --surface-300:     #3f3f46;
  --card-bg:         #0f0f12;
  --card-border:     rgba(255, 255, 255, 0.06);

  /* ── Brand ── */
  --violet:          #8b5cf6;
  --violet-hover:    #7c3aed;
  --violet-light:    rgba(139, 92, 246, 0.10);
  --violet-lighter:  rgba(139, 92, 246, 0.05);
  --violet-ring:     rgba(139, 92, 246, 0.25);
  --violet-text:     #a78bfa;
  --orange:          #f97316;

  /* ── Semantic ── */
  --success:         #22c55e;
  --success-light:   rgba(34, 197, 94, 0.10);
  --success-border:  rgba(34, 197, 94, 0.20);
  --warning:         #f59e0b;
  --warning-light:   rgba(245, 158, 11, 0.10);
  --warning-border:  rgba(245, 158, 11, 0.20);
  --danger:          #ef4444;
  --danger-light:    rgba(239, 68, 68, 0.10);
  --danger-border:   rgba(239, 68, 68, 0.20);

  /* ── Text ── */
  --text:            #fafafa;
  --text-2:          #a1a1aa;
  --text-3:          #71717a;
  --text-4:          #52525b;

  /* ── Lines ── */
  --border:          rgba(255, 255, 255, 0.06);
  --border-strong:   rgba(255, 255, 255, 0.10);

  /* ── Radius ── */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* ── Shadows ── */
  --shadow-card: 0 0 0 1px var(--card-border), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.5);

  /* ── Motion ── */
  --ease:   cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 0.12s var(--ease);
  --t:      0.2s var(--ease);
  --t-slow: 0.35s var(--ease);
}

html { background: var(--bg); scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =====================================================================
   AUTH SCREEN — Split-screen (Bench style)
   ===================================================================== */
.auth-screen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
  overflow: hidden;
  padding: 20px;
}
.auth-screen.hidden { display: none; }

/* Animated gradient orbs */
.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  pointer-events: none;
}
.auth-bg-orb--1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.3), transparent 70%);
  top: -10%; left: -5%;
  animation: orbFloat1 12s ease-in-out infinite;
}
.auth-bg-orb--2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.25), transparent 70%);
  bottom: -10%; right: -5%;
  animation: orbFloat2 15s ease-in-out infinite;
}
.auth-bg-orb--3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.2), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat3 10s ease-in-out infinite;
}
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, 30px) scale(1.05); }
  66% { transform: translate(-20px, -15px) scale(0.95); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, -20px) scale(1.08); }
  66% { transform: translate(25px, 15px) scale(0.92); }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -52%) scale(1.1); }
}

/* Auth card — glassmorphism */
.auth-card {
  position: relative;
  background: rgba(14, 14, 26, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 30px 80px -20px rgba(0, 0, 0, 0.6), 0 0 80px -10px rgba(99, 102, 241, 0.08);
  animation: authCardIn 0.6s var(--ease) both;
  z-index: 1;
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  justify-content: center;
}
.auth-card__logo-icon {
  width: 42px; height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--violet), #6366f1);
  border-radius: 12px;
  color: white;
  box-shadow: 0 4px 14px -3px rgba(129, 140, 248, 0.4);
}
.auth-card__logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}

.auth-card h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  color: var(--text);
  margin-bottom: 6px;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--text-3);
  text-align: center;
  margin-bottom: 28px;
}

.auth-field { margin-bottom: 18px; }
.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-2);
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-3);
  pointer-events: none;
  transition: color var(--t-fast);
}
.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--violet);
}

.auth-field input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-50);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.auth-field input::placeholder { color: var(--text-3); }
.auth-field input:focus {
  outline: none;
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.08);
  background: var(--bg-elevated);
}

.auth-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--violet), #6366f1);
  color: #06060c;
  border: none;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px -3px rgba(129, 140, 248, 0.4);
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
}
.auth-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 30px -6px rgba(129, 140, 248, 0.4); }
.auth-btn:hover::before { opacity: 1; }
.auth-btn:active { transform: translateY(0); }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-switch {
  text-align: center;
  margin-top: 22px;
  font-size: 13px;
  color: var(--text-3);
}
.auth-switch a {
  color: var(--violet);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--t-fast);
}
.auth-switch a:hover { color: #c4b5fd; text-decoration: underline; }

.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
}
.auth-error.show { display: block; }

.app.hidden { display: none; }

/* =====================================================================
   TOP NAVBAR — Mercury/Stripe style
   ===================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 24px;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 24px;
}
.topbar-logo {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--violet);
  border-radius: 6px;
  color: white;
}
.topbar-brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.topbar-client {
  font-size: 12px;
  color: var(--text-3);
  padding-left: 10px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  position: relative;
}
.topbar-btn svg { flex-shrink: 0; }
.topbar-btn:hover {
  color: var(--text-2);
  background: var(--surface-50);
}
.topbar-btn.active {
  color: var(--text);
  background: var(--surface-100);
  font-weight: 600;
}
.topbar-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 8px; right: 8px;
  height: 2px;
  background: var(--violet);
  border-radius: 2px 2px 0 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.topbar-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t-fast);
}
.topbar-logout:hover {
  border-color: var(--danger-border);
  color: #fca5a5;
  background: var(--danger-light);
}

/* =====================================================================
   MAIN CONTENT
   ===================================================================== */
.main {
  padding: 24px 32px 48px;
  max-width: 1240px;
  margin: 0 auto;
  min-height: calc(100vh - 52px);
}

.tab-content {
  display: none;
  animation: tabIn 0.3s var(--ease);
}
.tab-content.active { display: block; }
@keyframes tabIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section head */
.section-head {
  margin-bottom: 20px;
}
.section-head h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.section-head p {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

/* =====================================================================
   PENDING BANNER
   ===================================================================== */
.pending-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--warning);
  margin-bottom: 20px;
}
.pending-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--warning);
}
.pending-banner strong { font-weight: 800; }

/* =====================================================================
   HERO CARDS — Pilot style (large numbers + left accent bar)
   ===================================================================== */
.hero-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.hero-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  display: flex;
  overflow: hidden;
  transition: border-color var(--t);
}
.hero-card:hover { border-color: var(--border-strong); }

.hero-card__bar {
  width: 4px;
  flex-shrink: 0;
}
.hero-card__bar--income { background: var(--violet); }
.hero-card__bar--expense { background: var(--danger); }
.hero-card__bar--receivable { background: var(--warning); }
.hero-card__bar--cash { background: var(--success); }
.hero-card__bar--runway { background: #3b82f6; }
.hero-card__bar--health { background: var(--violet); }
.hero-card__bar--recurring { background: var(--orange); }

.hero-cards--4 {
  grid-template-columns: repeat(4, 1fr);
}
.hero-cards--3 {
  grid-template-columns: repeat(3, 1fr);
}
.hero-cards--2 {
  grid-template-columns: repeat(2, 1fr);
}
.hero-cards--1 {
  grid-template-columns: 1fr;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 4px;
}

.concentration-warning {
  font-size: 11px;
  font-weight: 700;
  color: var(--warning);
  background: var(--warning-light);
  padding: 2px 8px;
  border-radius: var(--r-xs);
  margin-left: auto;
}

.hero-card__body {
  padding: 20px 22px;
  flex: 1;
}

.hero-card__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.hero-card__value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.hero-card__formula {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 6px;
  line-height: 1.4;
  font-family: 'JetBrains Mono', monospace;
}
.hero-card__formula strong { color: var(--violet-text); }

.hero-card__delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 20px;
}
.hero-card__delta.up {
  color: var(--success);
  background: var(--success-light);
}
.hero-card__delta.down {
  color: var(--danger);
  background: var(--danger-light);
}

.hero-card__sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}

/* =====================================================================
   CARDS
   ===================================================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  margin-bottom: 16px;
}

.card-header {
  padding: 16px 20px 0;
}
.card-header h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 16px 20px 20px;
}

/* =====================================================================
   CHART GRID (2-column)
   ===================================================================== */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.chart-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}
.card--tall .card-body { min-height: 380px; }

.chart-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.chart-indicator--expense { background: var(--danger); }
.chart-indicator--revenue { background: var(--violet); }

.chart-pie-wrap {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
.chart-pie-wrap canvas { max-height: 220px !important; }

/* =====================================================================
   FILTER BAR — Ramp compact style
   ===================================================================== */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  flex-wrap: wrap;
}
.filter-bar label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.filter-group { display: flex; flex-direction: column; }
.filter-group--search { flex: 1; min-width: 160px; }
.filter-group--search .input { width: 100%; }

.filter-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-sep {
  color: var(--text-4);
  font-size: 12px;
}

.input, .filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-50);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--violet-ring);
  box-shadow: 0 0 0 2px var(--violet-lighter);
}
.filter-select {
  cursor: pointer;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* =====================================================================
   TABLES — Stripe style (clean, subtle hover)
   ===================================================================== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  background: var(--surface-50);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background var(--t-fast);
}
.data-table tbody tr:hover td {
  background: var(--violet-lighter);
  cursor: pointer;
}

/* =====================================================================
   BADGES — Stripe dot + pill
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-pending {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}
.badge-approved {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.badge-voided {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.ar-ok { color: var(--success); font-weight: 700; }
.ar-warn { color: var(--warning); font-weight: 700; }
.ar-danger { color: var(--danger); font-weight: 700; }

/* =====================================================================
   SLIDE PANEL — Stripe drawer style
   ===================================================================== */
.slide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
}
.slide-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.slide-panel {
  position: fixed;
  top: 0; right: -480px;
  width: 460px;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 100;
  transition: right 0.3s var(--ease);
  display: flex;
  flex-direction: column;
}
.slide-panel.open { right: 0; }

.slide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.slide-header h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.close-btn {
  width: 28px; height: 28px;
  background: var(--surface-50);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.close-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.slide-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
}
.detail-value {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* =====================================================================
   SUB TABS
   ===================================================================== */
.sub-tabs {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 16px;
  padding: 3px;
  background: var(--surface-50);
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
}
.sub-tab {
  padding: 7px 16px;
  border: none;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t-fast);
}
.sub-tab:hover { color: var(--text-2); }
.sub-tab.active {
  background: var(--surface-200);
  color: var(--text);
}

.sub-content { display: none; }
.sub-content.active { display: block; animation: tabIn 0.2s var(--ease); }

/* =====================================================================
   SECTION TOOLBAR (for financials)
   ===================================================================== */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-toolbar h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.toolbar-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-4);
}
.section-toolbar__actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.filter-inline {
  display: flex;
  flex-direction: column;
}
.filter-inline label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* =====================================================================
   FINANCIAL TABLE — Pilot/Bench style
   ===================================================================== */
.financial-table {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  padding: 20px 24px;
}
.fin-section { margin-bottom: 24px; }
.fin-section:last-child { margin-bottom: 0; }
.fin-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 0 10px;
  border-bottom: 2px solid var(--violet);
  margin-bottom: 4px;
  color: var(--text);
}
.fin-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: var(--r-xs);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  transition: background var(--t-fast);
}
.fin-row:hover { background: var(--violet-lighter); }
.fin-row.subtotal {
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border-strong);
  margin-top: 4px;
  padding-top: 10px;
}
.fin-row.highlight {
  font-size: 13px;
  font-weight: 800;
  color: var(--violet-text);
  background: var(--violet-light);
  border-radius: var(--r-xs);
  margin-top: 6px;
  padding: 10px 12px;
}

.fin-account { display: flex; align-items: center; gap: 5px; }
.term-hint {
  font-size: 12px;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity var(--t-fast);
}
.term-hint:hover { opacity: 1; }

/* =====================================================================
   IFRS FORMULA
   ===================================================================== */
.ifrs-formula {
  background: var(--violet-lighter);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: var(--r-sm);
  padding: 14px 18px;
  margin: 8px 0;
}
.formula-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.formula-result {
  border-top: 2px solid var(--violet);
  margin-top: 8px;
  padding-top: 10px;
  font-weight: 800;
  font-size: 13px;
  color: var(--violet-text);
}

/* =====================================================================
   STAT MINI ROW (Receivables)
   ===================================================================== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-mini {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  padding: 14px 18px;
}
.stat-mini__label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.stat-mini__value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* =====================================================================
   REPORT
   ===================================================================== */
.report-body { margin-top: 8px; }

.ai-advice {
  background: var(--violet-lighter);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: var(--r);
  padding: 18px 22px;
  margin-top: 16px;
}
.ai-advice__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--violet);
}
.ai-advice__header h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.ai-advice p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
}

/* =====================================================================
   LOADING PLACEHOLDER
   ===================================================================== */
.loading-placeholder {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-4);
  font-size: 13px;
}
.loading-placeholder p { margin: 0; }

/* ─── Health Score ─── */
.health-scores { display: flex; flex-direction: column; gap: 10px; }
.health-row { display: flex; align-items: center; gap: 10px; }
.health-row__label { width: 80px; font-size: 12px; color: var(--text-2); font-weight: 600; flex-shrink: 0; }
.health-row__bar { flex: 1; height: 6px; background: var(--surface-50); border-radius: 3px; overflow: hidden; }
.health-row__fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.health-row__score { width: 36px; text-align: right; font-family: var(--mono); font-size: 11px; color: var(--text-2); font-weight: 700; }
.health-recs { margin-top: 16px; padding: 12px 14px; background: var(--violet-light); border: 1px solid rgba(139,92,246,0.12); border-radius: var(--r-md); }
.health-recs__title { font-size: 12px; font-weight: 700; color: var(--violet-text); margin-bottom: 6px; }
.health-rec { font-size: 12px; color: var(--text-2); line-height: 1.6; padding: 2px 0; }

/* ─── AI Advice ─── */
.ai-advice-card { background: linear-gradient(135deg, rgba(139,92,246,0.06) 0%, rgba(139,92,246,0.02) 100%); border-color: rgba(139,92,246,0.12); }
.ai-advice-card:hover { border-color: rgba(139,92,246,0.2); }
.advice-insight { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.advice-insight:last-child { border-bottom: none; }
.advice-insight__emoji { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.advice-insight__content { flex: 1; }
.advice-insight__title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.advice-insight__detail { font-size: 12px; color: var(--text-2); line-height: 1.6; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ─── Runway Gauge ─── */
.runway-gauge { padding: 8px 0; }
.runway-gauge__track { height: 32px; background: var(--surface-50); border-radius: 16px; position: relative; overflow: hidden; margin-bottom: 8px; }
.runway-gauge__fill { height: 100%; border-radius: 16px; transition: width 0.8s cubic-bezier(0.16,1,0.3,1); }
.runway-gauge__marker { position: absolute; top: -8px; transform: translateX(-50%); transition: left 0.8s cubic-bezier(0.16,1,0.3,1); }
.runway-gauge__marker span { background: var(--text); color: var(--bg); font-family: var(--mono); font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 6px; white-space: nowrap; }
.runway-gauge__labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); margin-bottom: 6px; }
.runway-gauge__zones { display: flex; border-radius: 6px; overflow: hidden; margin-top: 4px; }
.runway-gauge__zone { text-align: center; font-size: 10px; font-weight: 700; padding: 4px 0; }
.runway-gauge__zone--danger { background: rgba(239,68,68,0.2); color: #ef4444; }
.runway-gauge__zone--warn { background: rgba(245,158,11,0.2); color: #f59e0b; }
.runway-gauge__zone--ok { background: rgba(34,197,94,0.15); color: #22c55e; }
.runway-gauge__zone--good { background: rgba(59,130,246,0.15); color: #3b82f6; }

/* =====================================================================
   MODAL
   ===================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  width: 460px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: modalIn 0.2s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 14px;
  font-weight: 700;
}
.modal-body {
  padding: 20px 22px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-2);
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1024px) {
  .chart-grid { grid-template-columns: 1fr; }
  .hero-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .auth-left { display: none; }
  .auth-right { padding: 32px 24px; }

  .topbar {
    padding: 0 12px;
    gap: 0;
  }
  .topbar-brand { display: none; }
  .topbar-client { display: none; }
  .topbar-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-btn { padding: 7px 10px; font-size: 11px; }
  .topbar-btn span { display: none; }

  .main {
    padding: 16px 12px 40px;
  }

  .hero-cards { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }

  .slide-panel { width: 100%; right: -100%; }

  .filter-bar, .report-controls { flex-direction: column; align-items: stretch; }
  .filter-group { width: 100%; }
  .filter-date-range { width: 100%; }
  .filter-date-range .input { flex: 1; }

  .section-toolbar { flex-direction: column; align-items: flex-start; }
  .section-toolbar__actions { width: 100%; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .hero-card__value { font-size: 24px; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 11px; }
}
