/* FinanceIQ — Black & White Theme with Animations */
:root {
  --bg-primary:    #0a0a0a;
  --bg-secondary:  #111111;
  --bg-card:       #161616;
  --bg-hover:      #1e1e1e;
  --border:        #2a2a2a;
  --border-light:  #333333;
  --text-primary:  #f0f0f0;
  --text-secondary:#a0a0a0;
  --text-muted:    #606060;
  --white:         #ffffff;
  --black:         #000000;
  --accent:        #ffffff;
  --accent-dim:    rgba(255,255,255,0.08);
  --accent-hover:  rgba(255,255,255,0.14);
  --success:       #4ade80;
  --success-dim:   rgba(74,222,128,0.1);
  --danger:        #f87171;
  --danger-dim:    rgba(248,113,113,0.1);
  --warning:       #fbbf24;
  --warning-dim:   rgba(251,191,36,0.1);
  --info:          #60a5fa;
  --info-dim:      rgba(96,165,250,0.1);
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --shadow:        0 4px 24px rgba(0,0,0,0.6);
  --shadow-lg:     0 8px 48px rgba(0,0,0,0.8);
  --transition:    all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ─── Typography ──────────────────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
p  { color: var(--text-secondary); }
a  { color: var(--text-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--white); }
small { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.app-wrapper   { display: flex; min-height: 100vh; }
.sidebar       { width: 260px; background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: var(--transition); overflow: hidden; }
.sidebar-nav   { flex: 1; overflow-y: auto; overflow-x: hidden; }
.main-content  { flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; min-width: 0; }
.top-bar       { background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.page-content  { flex: 1; padding: 20px 24px; }

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar-logo  { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sidebar-logo .logo-icon { width: 32px; height: 32px; background: var(--white); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.sidebar-logo .logo-icon svg { width: 18px; height: 18px; color: var(--black); }
.sidebar-logo .logo-text { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.5px; }

.sidebar-section { padding: 16px 12px 4px; }
.sidebar-section-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); padding: 0 12px 8px; }

.nav-item      { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: var(--transition); position: relative; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--white); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: var(--white); border-radius: 0 3px 3px 0; }
.nav-item svg  { width: 16px; height: 16px; flex-shrink: 0; }
.nav-badge     { margin-left: auto; background: var(--white); color: var(--black); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; line-height: 1; }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* ─── Top Bar ─────────────────────────────────────────────────────────────── */
.page-title    { font-size: 1.05rem; font-weight: 600; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }

/* Business Switcher */
.business-switcher { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; font-size: 13px; color: var(--text-primary); cursor: pointer; display: flex; align-items: center; gap: 8px; transition: var(--transition); }
.business-switcher:hover { border-color: var(--border-light); background: var(--bg-hover); }
.business-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

/* Icon Btn */
.icon-btn      { width: 36px; height: 36px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); color: var(--text-secondary); position: relative; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.icon-btn svg  { width: 16px; height: 16px; }
.icon-btn .badge { position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; background: var(--white); color: var(--black); font-size: 9px; font-weight: 700; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* Avatar */
.avatar        { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-hover); border: 1px solid var(--border-light); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; cursor: pointer; overflow: hidden; }
.avatar img    { width: 100%; height: 100%; object-fit: cover; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card          { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: var(--transition); }
.card:hover    { border-color: var(--border-light); }
.card-header   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title    { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.card-value    { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.card-sub      { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* KPI Cards */
.kpi-grid      { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi-card      { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; overflow: hidden; transition: var(--transition); }
.kpi-card:hover{ border-color: var(--border-light); transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.015) 0%, transparent 60%); pointer-events: none; }
.kpi-icon      { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.kpi-icon svg  { width: 18px; height: 18px; }
.kpi-label     { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 6px; }
.kpi-value     { font-size: 1.6rem; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.kpi-change    { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; font-weight: 500; }
.kpi-change.up   { color: var(--success); }
.kpi-change.down { color: var(--danger); }
.kpi-change svg  { width: 12px; height: 12px; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn           { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: var(--transition); text-decoration: none; white-space: nowrap; }
.btn:focus     { outline: 2px solid var(--border-light); outline-offset: 2px; }
.btn-primary   { background: var(--white); color: var(--black); }
.btn-primary:hover { background: #e0e0e0; color: var(--black); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-danger    { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }
.btn-danger:hover { background: rgba(248,113,113,0.2); }
.btn-success   { background: var(--success-dim); color: var(--success); border: 1px solid rgba(74,222,128,0.2); }
.btn-ghost     { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm        { padding: 5px 10px; font-size: 12px; }
.btn-lg        { padding: 11px 22px; font-size: 14px; }
.btn-icon      { padding: 8px; }
.btn svg       { width: 14px; height: 14px; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group    { margin-bottom: 18px; }
.form-label    { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-control  { width: 100%; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px; color: var(--text-primary); transition: var(--transition); outline: none; }
.form-control:focus { border-color: var(--border-light); background: var(--bg-hover); box-shadow: 0 0 0 3px rgba(255,255,255,0.04); }
.form-control::placeholder { color: var(--text-muted); }
.form-control option { background: var(--bg-secondary); }
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: 11.5px; color: var(--danger); margin-top: 4px; display: none; }
.is-invalid ~ .invalid-feedback { display: block; }
textarea.form-control { min-height: 90px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-check    { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--white); cursor: pointer; }
.input-group   { position: relative; display: flex; }
.input-group .input-prefix { background: var(--bg-hover); border: 1px solid var(--border); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: 9px 12px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.input-group .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-row      { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.table         { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th      { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg-secondary); white-space: nowrap; }
.table td      { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-primary); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--bg-hover); }
.table-striped tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination-wrapper { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; border-top: 1px solid var(--border); }
.pagination-info  { font-size: 12px; color: var(--text-muted); }
.pagination       { display: flex; align-items: center; gap: 4px; }
.pagination-btn   { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 30px; padding: 0 8px; font-size: 12px; font-weight: 500; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; transition: var(--transition); }
.pagination-btn:hover:not(.disabled):not(.active) { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.pagination-btn.active { background: var(--white); color: var(--bg-primary); font-weight: 600; border-color: var(--white); }
.pagination-btn.disabled { opacity: 0.35; cursor: default; }
.pagination-ellipsis { font-size: 12px; color: var(--text-muted); padding: 0 4px; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge         { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 100px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; }
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger  { background: var(--danger-dim); color: var(--danger); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info    { background: var(--info-dim); color: var(--info); }
.badge-gray    { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.badge-white   { background: rgba(255,255,255,0.1); color: var(--white); }

/* ─── Progress ────────────────────────────────────────────────────────────── */
.progress      { height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.progress-bar  { height: 100%; background: var(--white); border-radius: 3px; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-bar.danger { background: var(--danger); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.success { background: var(--success); }

/* ─── Alerts ──────────────────────────────────────────────────────────────── */
.alert         { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; border: 1px solid; animation: slideDown 0.3s ease; }
.alert svg     { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-dim); border-color: rgba(74,222,128,0.2); color: var(--success); }
.alert-danger  { background: var(--danger-dim);  border-color: rgba(248,113,113,0.2); color: var(--danger); }
.alert-warning { background: var(--warning-dim); border-color: rgba(251,191,36,0.2); color: var(--warning); }
.alert-info    { background: var(--info-dim);    border-color: rgba(96,165,250,0.2); color: var(--info); }
.alert-close   { margin-left: auto; cursor: pointer; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* ─── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 0.2s ease; }
.modal         { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; animation: scaleIn 0.2s ease; }
.modal-lg      { max-width: 720px; }
.modal-header  { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-title   { font-size: 1.05rem; font-weight: 600; }
.modal-close   { width: 28px; height: 28px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); transition: var(--transition); }
.modal-close:hover { color: var(--text-primary); background: var(--bg-secondary); }
.modal-body    { padding: 20px 24px; }
.modal-footer  { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Dropdowns ───────────────────────────────────────────────────────────── */
.dropdown      { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius); min-width: 180px; z-index: 150; box-shadow: var(--shadow-lg); animation: slideDown 0.15s ease; overflow: hidden; display: none; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item svg { width: 14px; height: 14px; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.company-filter-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--white); cursor: pointer; flex-shrink: 0; }

/* ─── Tabs ────────────────────────────────────────────────────────────────── */
.tabs          { display: flex; gap: 2px; background: var(--bg-secondary); border-radius: var(--radius-sm); padding: 3px; border: 1px solid var(--border); width: fit-content; }
.tab           { padding: 6px 14px; border-radius: 6px; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--text-muted); transition: var(--transition); }
.tab.active    { background: var(--bg-card); color: var(--text-primary); box-shadow: 0 1px 4px rgba(0,0,0,0.4); }

/* ─── Page Header ─────────────────────────────────────────────────────────── */
.page-header   { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.page-header-left h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 2px; }
.page-header-left p  { font-size: 13px; color: var(--text-muted); }
.page-header-right   { display: flex; gap: 8px; flex-shrink: 0; }

/* ─── Stat Row ────────────────────────────────────────────────────────────── */
.stat-row      { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-label    { font-size: 13px; color: var(--text-secondary); }
.stat-value    { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ─── Auth Layout ─────────────────────────────────────────────────────────── */
.auth-wrapper  { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-primary); padding: 20px; position: relative; overflow: hidden; }
.auth-card     { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 420px; position: relative; z-index: 1; animation: scaleIn 0.3s ease; }
.auth-logo     { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-mark { width: 44px; height: 44px; background: var(--white); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.auth-logo .logo-mark svg { width: 24px; height: 24px; color: var(--black); }
.auth-logo h1  { font-size: 1.25rem; }
.auth-logo p   { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.auth-divider  { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-footer   { text-align: center; margin-top: 24px; font-size: 13px; color: var(--text-muted); }
.auth-footer a { color: var(--text-secondary); font-weight: 500; }
.auth-footer a:hover { color: var(--white); }

/* Background grid for auth */
.auth-bg-grid  { position: absolute; inset: 0; opacity: 0.04; background-image: linear-gradient(var(--white) 1px, transparent 1px), linear-gradient(90deg, var(--white) 1px, transparent 1px); background-size: 40px 40px; }
.auth-bg-glow  { position: absolute; width: 400px; height: 400px; background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%); top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }

/* ─── Legal Pages ─────────────────────────────────────────────────────────── */
.legal-content { text-align: left; max-height: 60vh; overflow-y: auto; padding-right: 8px; }
.legal-content h3 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 24px 0 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.legal-content h3:first-child { margin-top: 0; }
.legal-content p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 8px; }
.legal-content ul { list-style: disc; padding-left: 20px; margin-bottom: 8px; }
.legal-content ul li { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 4px; }
.legal-content a { color: var(--info); text-decoration: underline; }
.legal-content a:hover { color: var(--white); }
.legal-content strong { color: var(--text-primary); }

/* ─── Charts ──────────────────────────────────────────────────────────────── */
.chart-container { position: relative; }
.chart-placeholder { display: flex; align-items: center; justify-content: center; height: 200px; color: var(--text-muted); font-size: 13px; }

/* ─── Empty State ─────────────────────────────────────────────────────────── */
.empty-state   { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3  { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p   { font-size: 13px; }

/* ─── Loading ─────────────────────────────────────────────────────────────── */
.spinner       { width: 20px; height: 20px; border: 2px solid var(--border-light); border-top-color: var(--white); border-radius: 50%; animation: spin 0.6s linear infinite; }
.spinner-sm    { width: 14px; height: 14px; }
.skeleton      { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }

/* ─── Search ──────────────────────────────────────────────────────────────── */
.search-box    { position: relative; }
.search-box input { padding-left: 34px; }
.search-box svg   { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }

/* ─── Filter Bar ──────────────────────────────────────────────────────────── */
.filter-bar    { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 0; }
.filter-bar .form-control { width: auto; min-width: 130px; }

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.pagination    { display: flex; gap: 4px; align-items: center; justify-content: center; padding-top: 16px; }
.page-link     { min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.page-link:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.page-link.active { background: var(--white); color: var(--black); border-color: var(--white); }
.page-link.disabled { opacity: 0.4; cursor: default; }

/* ─── File Upload ─────────────────────────────────────────────────────────── */
.file-drop     { border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; transition: var(--transition); }
.file-drop:hover, .file-drop.drag-over { border-color: var(--border-light); background: var(--accent-dim); }
.file-drop svg { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 8px; }
.file-drop p   { font-size: 13px; }

/* ─── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(8px); }  to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn   { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes shimmer   { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulse     { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes countUp   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes barGrow   { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.fade-in       { animation: fadeIn 0.3s ease; }
.slide-up      { animation: slideUp 0.3s ease; }
.page-enter    { animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1); }

/* ─── Utility ─────────────────────────────────────────────────────────────── */
.text-success  { color: var(--success) !important; }
.text-danger   { color: var(--danger)  !important; }
.text-warning  { color: var(--warning) !important; }
.text-info     { color: var(--info)    !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }
.mono          { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.92em; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16{ margin-top: 16px; }
.mt-24{ margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16{ margin-bottom: 16px; }
.mb-24{ margin-bottom: 16px; }
.w-full{ width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.separator { height: 1px; background: var(--border); margin: 20px 0; }

/* Color dots */
.color-dot     { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
/* Layout-level responsiveness handled by Tailwind utility classes in views.  */
/* Below: component-level behavior that CSS must handle.                      */

.sidebar-overlay { display: none; }

@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; }
}

@media (max-width: 768px) {
  /* Sidebar slide + overlay */
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar.open ~ .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }
  .main-content { margin-left: 0; width: 100vw; max-width: 100vw; }
  .page-content { padding: 10px 10px; overflow-x: hidden; }

  /* Top bar compact */
  .top-bar { height: 52px; padding: 0 12px; }
  .top-bar-right { gap: 6px; }

  /* Tables — compact cells */
  .table th, .table td { padding: 8px 6px; font-size: 12px; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Tabs — scroll */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; gap: 0; width: 100%; }
  .tab { flex-shrink: 0; font-size: 12px; padding: 6px 10px; white-space: nowrap; }

  /* Dropdown constrain */
  .dropdown-menu { max-width: calc(100vw - 24px); }

  /* Charts */
  .chart-container { height: 160px !important; }
  .doughnut-wrapper { height: 130px; }
  .doughnut-center .dc-value { font-size: 13px; }
  .doughnut-layout { grid-template-columns: 1fr !important; gap: 8px !important; }
  .doughnut-layout .doughnut-wrapper { height: 140px; }
  .dash-chart-card { padding: 10px; }
  .dash-chart-card .card-header { flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }

  /* Recent tx / top cats */
  .recent-tx-title { max-width: 140px; }
  .top-cat-header { flex-direction: column; gap: 2px; }

  /* Toast */
  .toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: 100%; }

  /* Form rows */
  .form-row { grid-template-columns: 1fr; }

  /* Reduce spacing on mobile */
  .mb-24 { margin-bottom: 8px; }
  .mb-16 { margin-bottom: 6px; }
  .mb-4 { margin-bottom: 8px; }
  .page-header { margin-bottom: 8px; gap: 6px; }
  .page-header-left h1 { font-size: 1.15rem; }
  .kpi-grid { gap: 6px; }
  .kpi-card { padding: 10px; }
  .kpi-icon { width: 28px; height: 28px; margin-bottom: 6px; }
  .kpi-icon svg { width: 14px; height: 14px; }
  .kpi-value { font-size: 1.2rem; }
  .kpi-label { font-size: 10px; margin-bottom: 3px; }
  .kpi-change { font-size: 10px; margin-top: 3px; }
  .quick-stats { gap: 4px; padding: 8px 10px; }
  .quick-stat-value { font-size: 14px; }
  .quick-stat-label { font-size: 9px; }
  .card { padding: 10px; }
  .card-header { margin-bottom: 6px; }
  .grid-2, .grid-3, .grid-4 { gap: 6px; }
  .separator { margin: 8px 0; }
  .form-group { margin-bottom: 8px; }
  .alert { margin-bottom: 6px; }
  .empty-state { padding: 20px 12px; }
  .empty-state svg { width: 32px; height: 32px; margin-bottom: 6px; }
  .top-cat-item { gap: 8px; margin-bottom: 6px; }
  .cat-legend-item { padding: 3px 4px; }
  .recent-tx { gap: 8px; padding: 6px 0; }
  .recent-tx-icon { width: 28px; height: 28px; }
  h1 { font-size: 1.2rem; }
  h2 { font-size: 1.1rem; }
  h3 { font-size: 0.95rem; }
}

@media (max-width: 480px) {
  .auth-card { padding: 20px 16px; }
  .page-content { padding: 8px 8px; }
  .dash-chart-card { padding: 8px; }
  .chart-container { height: 140px !important; }
  .doughnut-wrapper { height: 120px; }
  .doughnut-layout .doughnut-wrapper { height: 120px; }
  .kpi-card { padding: 8px; }
  .kpi-icon { width: 24px; height: 24px; margin-bottom: 4px; }
  .kpi-icon svg { width: 12px; height: 12px; }
  .kpi-value { font-size: 1rem; }
  .recent-tx-title { font-size: 11px; max-width: 100px; }
  .recent-tx-meta { font-size: 9px; }
  .btn-icon { width: 26px; height: 26px; min-width: 26px; }
  #bulk-bar { flex-direction: column; gap: 6px !important; text-align: center; }
}

/* ─── Notification Toast ──────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast         { pointer-events: all; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 12px 16px; min-width: 280px; max-width: 360px; box-shadow: var(--shadow-lg); display: flex; align-items: flex-start; gap: 10px; animation: slideUp 0.25s ease; }
.toast.removing { animation: slideDown 0.2s ease reverse; }
.toast-icon    { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-body    { flex: 1; }
.toast-title   { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.toast-message { font-size: 12px; color: var(--text-muted); }
.toast-close   { cursor: pointer; color: var(--text-muted); flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }

/* ─── Page Grid (single-column uniform spacing) ──────────────────────────── */
.page-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (max-width: 768px) { .page-grid { gap: 8px; } }
@media (max-width: 480px) { .page-grid { gap: 6px; } }

/* ─── Dashboard Grid ──────────────────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 768px) { .dash-grid { grid-template-columns: 1fr; gap: 8px; } }
@media (max-width: 480px) { .dash-grid { gap: 6px; } }

/* ─── Dashboard Enhancements ──────────────────────────────────────────────── */
/* KPI cards with colored top border accent */
.kpi-card.kpi-income   { border-top: 2px solid var(--success); }
.kpi-card.kpi-expense  { border-top: 2px solid var(--danger); }
.kpi-card.kpi-profit   { border-top: 2px solid var(--info); }
.kpi-card.kpi-margin   { border-top: 2px solid var(--warning); }
.kpi-card.kpi-ar       { border-top: 2px solid #c084fc; }
.kpi-card.kpi-ap       { border-top: 2px solid #fb923c; }
.kpi-card.kpi-runway   { border-top: 2px solid #22d3ee; }

/* Dashboard chart card styling */
.dash-chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: var(--transition); }
.dash-chart-card:hover { border-color: var(--border-light); }
.dash-chart-card .card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dash-chart-card .card-header .card-icon { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; margin-right: 8px; }
.dash-chart-card .card-header .card-icon svg { width: 14px; height: 14px; }
.dash-title-row { display: flex; align-items: center; }

/* Doughnut center label */
.doughnut-wrapper { position: relative; height: 160px; }
.doughnut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.doughnut-center .dc-value { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.doughnut-center .dc-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }

/* Category legend styling */
.cat-legend { display: flex; flex-direction: column; gap: 2px; }
.cat-legend-item { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; border-radius: 6px; transition: var(--transition); }
.cat-legend-item:hover { background: var(--bg-hover); }
.cat-legend-name { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.cat-legend-val { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.cat-legend-pct { font-size: 11px; color: var(--text-muted); margin-left: 6px; }

/* Quick stats bar */
.quick-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.quick-stat { text-align: center; padding: 0 8px; border-right: 1px solid var(--border); }
.quick-stat:last-child { border-right: none; }
.quick-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 4px; }
.quick-stat-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Top categories enhanced */
.top-cat-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.top-cat-rank { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-hover); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.top-cat-info { flex: 1; min-width: 0; }
.top-cat-header { display: flex; justify-content: space-between; margin-bottom: 5px; }
.top-cat-name { font-size: 12.5px; color: var(--text-secondary); }
.top-cat-amount { font-size: 12px; font-weight: 600; }

/* Recent transactions enhanced */
.recent-tx { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.recent-tx:last-child { border-bottom: none; }
.recent-tx-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.recent-tx-icon svg { width: 14px; height: 14px; }
.recent-tx-info { flex: 1; min-width: 0; }
.recent-tx-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-tx-meta { font-size: 11px; color: var(--text-muted); }
.recent-tx-amount { text-align: right; flex-shrink: 0; }

@media (max-width: 768px) {
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
  .quick-stat { border-right: none; padding: 6px 0; border-bottom: 1px solid var(--border); }
  .quick-stat:nth-last-child(-n+2) { border-bottom: none; }
}

/* ─── Flatpickr overrides ────────────────────────────────────────────────── */
.flatpickr-calendar          { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-family: 'Inter', sans-serif; }
.flatpickr-months             { background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0; }
.flatpickr-month              { color: var(--text-primary); }
.flatpickr-current-month      { color: var(--text-primary); font-weight: 600; }
.flatpickr-current-month input.cur-year { color: var(--text-primary); }
.flatpickr-monthDropdown-months { background: var(--bg-secondary); color: var(--text-primary); }
.flatpickr-weekdays           { background: var(--bg-card); }
.flatpickr-weekday            { color: var(--text-muted); font-weight: 500; }
.flatpickr-day                { color: var(--text-primary); border-radius: 6px; }
.flatpickr-day:hover          { background: var(--bg-hover); border-color: var(--border-light); }
.flatpickr-day.today          { border-color: var(--text-muted); }
.flatpickr-day.today:hover    { background: var(--bg-hover); }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { background: var(--white); color: var(--black); border-color: var(--white); font-weight: 600; }
.flatpickr-day.selected:hover, .flatpickr-day.startRange:hover, .flatpickr-day.endRange:hover { background: var(--text-secondary); border-color: var(--text-secondary); }
.flatpickr-day.inRange        { background: rgba(255,255,255,0.12); border-color: transparent; box-shadow: -5px 0 0 rgba(255,255,255,0.12), 5px 0 0 rgba(255,255,255,0.12); }
.flatpickr-day.flatpickr-disabled { color: var(--text-muted); opacity: 0.3; }
.flatpickr-prev-month, .flatpickr-next-month { color: var(--text-secondary); fill: var(--text-secondary); }
.flatpickr-prev-month:hover, .flatpickr-next-month:hover { color: var(--text-primary); fill: var(--text-primary); }
.flatpickr-innerContainer     { border-bottom: 1px solid var(--border); }
.flatpickr-rContainer         { background: var(--bg-card); }
.daterange-input              { cursor: pointer; background: var(--bg-primary); }
.daterange-input::placeholder { color: var(--text-muted); }
