*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  /* ── LEGACY (kept for backwards-compat with existing rules) ── */
  --bg:#F8FAFC;--surface:#fff;--border:#E2E8F0;--text:#0F172A;--muted:#64748B;
  --primary:#2563EB;--primary-h:#1D4ED8;--primary-light:#EFF6FF;
  --success:#16A34A;--warn:#D97706;--danger:#DC2626;
  --radius:10px;--shadow:0 1px 3px rgba(0,0,0,.07),0 1px 2px rgba(0,0,0,.04);
  --shadow-lg:0 10px 30px rgba(0,0,0,.1);

  /* ═══ DESIGN TOKENS (v1) ════════════════════════════════════════
     World-class apps standardize: typescale, spacing, radius, colors.
     New code MUST use these. Old inline styles will migrate over time. */

  /* ── Color palette: 5-step intent ramps ── */
  --c-neutral-50:#f8fafc;  --c-neutral-100:#f1f5f9; --c-neutral-200:#e2e8f0;
  --c-neutral-300:#cbd5e1; --c-neutral-400:#94a3b8; --c-neutral-500:#64748b;
  --c-neutral-600:#475569; --c-neutral-700:#334155; --c-neutral-800:#1e293b;
  --c-neutral-900:#0f172a;

  --c-brand-50:#eff6ff;  --c-brand-100:#dbeafe; --c-brand-500:#3b82f6;
  --c-brand-600:#2563eb; --c-brand-700:#1d4ed8;

  --c-success-50:#f0fdf4;  --c-success-100:#dcfce7; --c-success-500:#22c55e;
  --c-success-600:#16a34a; --c-success-700:#15803d;

  --c-warning-50:#fffbeb;  --c-warning-100:#fef3c7; --c-warning-500:#f59e0b;
  --c-warning-600:#d97706; --c-warning-700:#b45309;

  --c-danger-50:#fef2f2;   --c-danger-100:#fee2e2;  --c-danger-200:#fecaca;
  --c-danger-500:#ef4444;  --c-danger-600:#dc2626;  --c-danger-700:#b91c1c;

  --c-info-50:#eff6ff;     --c-info-100:#dbeafe;    --c-info-500:#3b82f6;
  --c-info-600:#2563eb;    --c-info-700:#1d4ed8;

  --c-accent-50:#eef2ff;   --c-accent-100:#e0e7ff;  --c-accent-500:#6366f1;
  --c-accent-600:#4f46e5;  --c-accent-700:#4338ca;

  /* ── Semantic surface / text ── */
  --bg-canvas:var(--c-neutral-50);
  --bg-surface:#ffffff;
  --bg-subtle:var(--c-neutral-100);
  --fg-default:var(--c-neutral-900);
  --fg-muted:var(--c-neutral-500);
  --fg-subtle:var(--c-neutral-400);
  --border-default:var(--c-neutral-200);
  --border-strong:var(--c-neutral-300);

  /* ── Spacing: 4-pt grid ── */
  --space-1:4px;  --space-2:8px;  --space-3:12px; --space-4:16px;
  --space-5:20px; --space-6:24px; --space-8:32px; --space-10:40px;

  /* ── Border radius (3 sizes only) ── */
  --radius-sm:6px;
  --radius-md:8px;
  --radius-lg:12px;
  --radius-full:9999px;

  /* ── Typography scale ── */
  --text-xs:11px;  /* meta / labels */
  --text-sm:12px;  /* secondary body */
  --text-base:13px; /* primary body */
  --text-md:14px;  /* default UI */
  --text-lg:16px;  /* small headings */
  --text-xl:20px;  /* section heading */
  --text-2xl:28px; /* page heading */
  --font-mono:'DM Mono','SF Mono',ui-monospace,Menlo,Consolas,monospace;

  /* ── Elevation ── */
  --elev-1:0 1px 2px rgba(15,23,42,0.05);
  --elev-2:0 2px 8px rgba(15,23,42,0.08);
  --elev-3:0 8px 24px rgba(15,23,42,0.10);
  --elev-popover:0 12px 40px rgba(15,23,42,0.16);

  /* ── Motion ── */
  --duration-fast:120ms;
  --duration:180ms;
  --easing:cubic-bezier(.16,1,.3,1);
}

@media (prefers-reduced-motion:reduce){
  :root{ --duration-fast:0ms; --duration:0ms; }
  *{ animation-duration:0ms !important; transition-duration:0ms !important; }
}

/* ── Utility: focus ring (a11y) ── */
.focus-ring:focus-visible,
button:focus-visible,
[role=button]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline:2px solid var(--c-brand-500);
  outline-offset:2px;
  border-radius:var(--radius-sm);
}

/* ── Status pills (semantic, replaces ad-hoc inline styles) ── */
.pill{
  display:inline-flex;align-items:center;gap:4px;
  padding:2px 8px;border-radius:var(--radius-full);
  font-size:var(--text-xs);font-weight:600;line-height:1.6;
  border:1px solid transparent;white-space:nowrap;
}
.pill-success{background:var(--c-success-50);color:var(--c-success-700);border-color:var(--c-success-100)}
.pill-warning{background:var(--c-warning-50);color:var(--c-warning-700);border-color:var(--c-warning-100)}
.pill-danger {background:var(--c-danger-50); color:var(--c-danger-700); border-color:var(--c-danger-200)}
.pill-info   {background:var(--c-info-50);   color:var(--c-info-700);   border-color:var(--c-info-100)}
.pill-neutral{background:var(--c-neutral-100);color:var(--c-neutral-700);border-color:var(--c-neutral-200)}
.pill-accent {background:var(--c-accent-50); color:var(--c-accent-700); border-color:var(--c-accent-100)}
.pill-dot::before{
  content:'';width:6px;height:6px;border-radius:var(--radius-full);
  background:currentColor;opacity:.7;
}

/* ── Count badge on filter tabs / nav items ── */
.count-badge{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:18px;height:18px;padding:0 5px;
  border-radius:var(--radius-full);
  background:var(--c-neutral-200);color:var(--c-neutral-700);
  font-size:10px;font-weight:700;line-height:1;
  margin-left:6px;
}
.btn-primary .count-badge{background:rgba(255,255,255,0.25);color:#fff}
.count-badge.is-danger{background:var(--c-danger-100);color:var(--c-danger-700)}
.count-badge.is-warning{background:var(--c-warning-100);color:var(--c-warning-700)}
.count-badge.is-success{background:var(--c-success-100);color:var(--c-success-700)}
.count-badge.is-info{background:var(--c-info-100);color:var(--c-info-700)}

/* ── Filter tabs: segmented control style ── */
.filter-tabs-v2{
  display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px;
  padding:4px;background:var(--c-neutral-100);border-radius:var(--radius-lg);
  margin-bottom:var(--space-3);
}
.filter-tabs-v2 .seg{
  display:inline-flex;align-items:center;gap:6px;
  padding:6px 12px;border:none;background:transparent;
  border-radius:var(--radius-md);
  font-size:var(--text-base);font-weight:500;color:var(--c-neutral-600);
  cursor:pointer;transition:all var(--duration-fast) var(--easing);
  font-family:inherit;
}
.filter-tabs-v2 .seg:hover{color:var(--c-neutral-900);background:rgba(255,255,255,0.6)}
.filter-tabs-v2 .seg.is-active{
  background:#ffffff;color:var(--c-neutral-900);font-weight:600;
  box-shadow:var(--elev-1);
}

/* ── Action menu (overflow dropdown) ── */
.action-menu-wrap{position:relative;display:inline-block}
.action-menu-trigger{
  display:inline-flex;align-items:center;justify-content:center;
  width:30px;height:30px;border-radius:var(--radius-md);
  border:1px solid var(--border-default);background:#fff;
  color:var(--c-neutral-600);cursor:pointer;
  transition:all var(--duration-fast) var(--easing);
}
.action-menu-trigger:hover{background:var(--c-neutral-100);border-color:var(--border-strong);color:var(--c-neutral-900)}
.action-menu-trigger.is-open{background:var(--c-neutral-100);border-color:var(--border-strong)}
.action-menu{
  /* Positioning set inline by ActionMenu._position() — uses position:fixed
     so the menu escapes overflow:hidden containers and can auto-flip up. */
  min-width:220px;background:#fff;border:1px solid var(--border-default);
  border-radius:var(--radius-md);box-shadow:var(--elev-popover);
  padding:6px;z-index:10000;
  animation:menu-fade-in var(--duration) var(--easing);
}
/* Caret pointing UP to the trigger when menu opens below */
.action-menu[data-placement="below"]::before,
.action-menu[data-placement="below"]::after{
  content:'';position:absolute;left:var(--caret-x,16px);
  width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;
  transform:translateX(-7px);
}
.action-menu[data-placement="below"]::before{
  top:-7px;border-bottom:7px solid var(--border-default);
}
.action-menu[data-placement="below"]::after{
  top:-6px;border-bottom:7px solid #fff;
}
/* Caret pointing DOWN to the trigger when menu flipped above */
.action-menu[data-placement="above"]::before,
.action-menu[data-placement="above"]::after{
  content:'';position:absolute;left:var(--caret-x,16px);
  width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;
  transform:translateX(-7px);
}
.action-menu[data-placement="above"]::before{
  bottom:-7px;border-top:7px solid var(--border-default);
}
.action-menu[data-placement="above"]::after{
  bottom:-6px;border-top:7px solid #fff;
}
@keyframes menu-fade-in{
  from{opacity:0;transform:translateY(-4px) scale(0.98)}
  to  {opacity:1;transform:translateY(0)    scale(1)}
}
.action-menu-item{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:8px 10px;border:none;background:transparent;
  border-radius:var(--radius-sm);
  font-size:var(--text-md);color:var(--c-neutral-800);
  cursor:pointer;text-align:left;font-family:inherit;
  transition:background var(--duration-fast) var(--easing);
}
.action-menu-item:hover{background:var(--c-neutral-100)}
.action-menu-item.is-danger{color:var(--c-danger-700)}
.action-menu-item.is-danger:hover{background:var(--c-danger-50)}
.action-menu-item svg{flex-shrink:0;width:14px;height:14px;opacity:0.8}
.action-menu-divider{height:1px;background:var(--border-default);margin:4px 2px}

/* ── Bulk action toolbar ── */
.bulk-toolbar{
  position:sticky;top:60px;z-index:60;
  display:flex;align-items:center;gap:var(--space-3);
  padding:10px 16px;margin:0 0 var(--space-3);
  background:var(--c-neutral-900);color:#fff;border-radius:var(--radius-lg);
  box-shadow:var(--elev-3);
  animation:bulk-slide-down var(--duration) var(--easing);
}
@keyframes bulk-slide-down{
  from{opacity:0;transform:translateY(-8px)}
  to  {opacity:1;transform:translateY(0)}
}
.bulk-toolbar-count{
  font-weight:700;font-size:var(--text-md);
  padding:3px 10px;background:rgba(255,255,255,0.15);
  border-radius:var(--radius-full);
}
.bulk-toolbar-spacer{flex:1}
.bulk-toolbar .btn{
  background:rgba(255,255,255,0.1);color:#fff;border:1px solid rgba(255,255,255,0.15);
  font-weight:500;
}
.bulk-toolbar .btn:hover{background:rgba(255,255,255,0.2)}
.bulk-toolbar .btn.is-danger{background:var(--c-danger-600);border-color:transparent}
.bulk-toolbar .btn.is-danger:hover{background:var(--c-danger-700)}

/* Checkbox column on tables */
.bulk-check{width:18px;height:18px;cursor:pointer;accent-color:var(--c-brand-600)}
.party-table th.bulk-col,.party-table td.bulk-col{width:36px;text-align:center;padding-left:14px}
.party-table tr.is-selected td{background:var(--c-brand-50) !important}

body {
  font-family: 'Inter', 'DM Sans', sans-serif;
  background-color: #f8fafc;
  background-image: radial-gradient(circle at top right, rgba(239, 246, 255, 0.4) 0%, transparent 40%),
                    radial-gradient(circle at bottom left, rgba(236, 253, 245, 0.3) 0%, transparent 40%),
                    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#app{display:flex;min-height:100vh}

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar{width:240px;background:rgba(255,255,255,0.8);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-right:1px solid rgba(226,232,240,0.8);display:flex;flex-direction:column;padding:16px 0 20px;flex-shrink:0;overflow-y:auto;transition:all .3s ease}
.logo{display:flex;align-items:center;gap:10px;padding:0 20px 24px;font-weight:700;font-size:16px;letter-spacing:-.2px;color:#0f172a}
.sidebar nav{display:flex;flex-direction:column;gap:4px;padding:0 12px;flex:1}
.sidebar nav a{position:relative;display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:10px;text-decoration:none;color:#475569;font-weight:500;font-size:13.5px;transition:all .2s cubic-bezier(.16,1,.3,1)}
.sidebar nav a:hover{background:rgba(241,245,249,0.8);color:#0f172a;transform:translateX(4px)}
.sidebar nav a.active{background:var(--primary-light);color:var(--primary);font-weight:600}
.sidebar nav a.active::before{content:'';position:absolute;left:0;top:50%;transform:translateY(-50%);height:60%;width:3px;background:var(--primary);border-radius:4px}
.nav-section{font-size:11px;font-weight:600;letter-spacing:0.08em;color:#94a3b8;padding:20px 14px 6px;text-transform:uppercase}
.icon{display:flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;opacity:0.8;transition:opacity .2s, transform .2s}
.icon svg{width:100%;height:100%}
.sidebar nav a:hover .icon{opacity:1;transform:scale(1.1)}
.sidebar nav a.active .icon{opacity:1;color:var(--primary)}

/* ── SIDEBAR USER PROFILE ── */
.sidebar-user { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.sidebar-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-h)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--muted); }

/* ── CONTENT ─────────────────────────────────── */
.content{flex:1;overflow-y:auto;min-width:0}
.page{display:none;padding:28px 32px}
.page.active{display:block;animation:dash-fade-up 300ms cubic-bezier(.16,1,.3,1) forwards}

/* ── PAGE HEADER ─────────────────────────────── */
.page-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px;gap:12px}
.page-header h1{font-size:22px;font-weight:600;letter-spacing:-.35px}

/* ── BUTTONS ─────────────────────────────────── */
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border-radius:8px;border:none;cursor:pointer;font-size:13px;font-weight:500;font-family:inherit;transition:all .12s;white-space:nowrap}
.btn-primary{background:var(--primary);color:#fff}.btn-primary:hover{background:var(--primary-h)}
.btn-secondary{background:var(--surface);color:var(--text);border:1px solid var(--border)}.btn-secondary:hover{background:var(--bg)}
.btn-success{background:var(--success);color:#fff}.btn-success:hover{filter:brightness(.92)}
.btn-danger{background:var(--danger);color:#fff}.btn-danger:hover{filter:brightness(.92)}
.btn-sm{padding:5px 10px;font-size:12px;border-radius:6px}
.btn-icon{background:none;border:none;cursor:pointer;padding:4px 6px;font-size:17px;color:var(--muted);line-height:1;border-radius:4px}
.btn-icon:hover{background:var(--bg)}
.actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}

/* ── CARDS ───────────────────────────────────── */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);transition:box-shadow .15s,transform .15s}
.card:hover{box-shadow:var(--shadow-lg);transform:translateY(-1px)}
.stat-card{transition:box-shadow .15s,transform .15s}
.stat-card:hover{box-shadow:var(--shadow-lg);transform:translateY(-1px)}
.settings-grid{display:flex;flex-direction:column;gap:20px;max-width:700px}
.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:24px}
.stat-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);position:relative;overflow:hidden}
.stat-card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:4px}
.stat-card.green::before{background:var(--success)}.stat-card.green .value{color:var(--success)}
.stat-card.amber::before{background:var(--warn)}.stat-card.amber .value{color:var(--warn)}
.stat-card.red::before{background:var(--danger)}.stat-card.red .value{color:var(--danger)}
.stat-card.blue::before{background:var(--primary)}.stat-card.blue .value{color:var(--primary)}
.stat-card .label{font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
.stat-card .value{font-size:26px;font-weight:700;margin-top:6px;font-family:'DM Mono',monospace;letter-spacing:-.5px}
.stat-card .sub{font-size:12px;color:var(--muted);margin-top:4px}

/* ── TABLE ───────────────────────────────────── */
.table-wrap{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:auto;box-shadow:var(--shadow);-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse}
th{background:#F8FAFC;padding:10px 14px;text-align:left;font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;border-bottom:1px solid var(--border);position:sticky;top:0;z-index:1}
td{padding:11px 14px;border-bottom:1px solid #F1F5F9;vertical-align:middle;font-size:13.5px}
tr:last-child td{border-bottom:none}
tr:hover td{background:#FAFBFC}

/* Form validation */
input:invalid:not(:placeholder-shown), select:invalid:not(:placeholder-shown){border-color:#fca5a5}
input:invalid:not(:placeholder-shown):focus, select:invalid:not(:placeholder-shown):focus{box-shadow:0 0 0 3px rgba(220,38,38,.08)}
.field-error{font-size:12px;color:#dc2626;margin-top:4px}

/* ── BADGES ──────────────────────────────────── */
.badge{display:inline-flex;align-items:center;padding:3px 9px;border-radius:20px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.badge-paid{background:#DCFCE7;color:#15803D}
.badge-unpaid{background:#FEF3C7;color:#92400E}
.badge-overdue{background:#FEE2E2;color:#991B1B}
.badge-converted{background:#E0E7FF;color:#3730A3}
.badge-pending{background:#F1F5F9;color:var(--muted)}
.badge-received{background:#DCFCE7;color:#15803D}
.badge-active{background:#DCFCE7;color:#15803D}
.badge-inactive{background:#FEE2E2;color:#991B1B}
.badge-draft{background:#F1F5F9;color:#475569}
.badge-sent{background:#E0E7FF;color:#3730A3}
.badge-partial{background:#FEF3C7;color:#92400E}
.badge-void{background:#FEE2E2;color:#991B1B}
.badge-cancelled{background:#F1F5F9;color:#64748B}
.badge-archived{background:#F1F5F9;color:#64748B}
.badge-discontinued{background:#F1F5F9;color:#64748B}
.badge-approved{background:#DCFCE7;color:#15803D}
.badge-expired{background:#FEE2E2;color:#991B1B}

/* ── VOID & FADED ROWS ───────────────────────── */
tr.row-void td{opacity:.55}
tr.row-void:hover td{background:transparent}
.void-watermark{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-30deg);font-size:96px;font-weight:900;color:rgba(220,38,38,.15);pointer-events:none;z-index:10;letter-spacing:8px;text-transform:uppercase;user-select:none}

/* ── FORMS ───────────────────────────────────── */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.form-group{display:flex;flex-direction:column;gap:5px}
.form-group.full{grid-column:1/-1}
label{font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
input,select,textarea{padding:8px 11px;border:1px solid var(--border);border-radius:7px;font-family:inherit;font-size:13.5px;color:var(--text);background:var(--surface);width:100%;outline:none;transition:border .12s}
input:focus,select:focus,textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(37,99,235,.1)}
textarea{resize:vertical;min-height:72px}
.input-action{display:flex;gap:6px;align-items:center}
.input-action input{flex:1}
.field-help{font-size:11px;color:var(--muted);margin-top:3px}

/* ── ITEMS TABLE ─────────────────────────────── */
.items-section{margin-top:22px}
.items-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;flex-wrap:wrap;gap:8px}
.items-header h4{font-size:12px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin:0}
.gst-toggle{display:flex;gap:18px}
.gst-toggle label{text-transform:none;font-size:13px;font-weight:400;display:flex;align-items:center;gap:6px;cursor:pointer;color:var(--text)}
.table-scroll{overflow-x:auto}
.items-table{width:100%;border-collapse:collapse;margin-bottom:8px;min-width:960px;table-layout:fixed}
.items-table th{background:#F8FAFC;padding:8px 8px;font-size:11px;text-align:left;border:1px solid var(--border);color:var(--muted);font-weight:700;text-transform:uppercase;white-space:nowrap}
.items-table td{padding:5px 6px;border:1px solid var(--border);vertical-align:middle}
.items-table input,.items-table select{border:none;background:transparent;padding:7px 8px;font-size:13px;border-radius:4px}
.items-table input:focus,.items-table select:focus{background:#EFF6FF;outline:none;box-shadow:inset 0 0 0 1px var(--primary)}
.discount-field{display:grid;grid-template-columns:minmax(0,1fr) 46px;align-items:center;gap:6px;width:100%}
.discount-field input,.discount-field select{width:100%;min-width:0}
.discount-field input{min-width:0;padding:7px 8px;font-size:13px}
.discount-field .discount-type{font-weight:700;text-align:center;cursor:pointer;padding:7px 4px}
.items-table .line-serial{text-align:center;color:var(--muted);font-family:'DM Mono',monospace;font-size:12px}
.items-table th:nth-child(1),.items-table td:nth-child(1){text-align:center}
.items-table th:nth-child(5),.items-table td:nth-child(5),
.items-table th:nth-child(6),.items-table td:nth-child(6),
.items-table th:nth-child(7),.items-table td:nth-child(7),
.items-table th:nth-child(8),.items-table td:nth-child(8),
.items-table th:nth-child(10),.items-table td:nth-child(10){text-align:right}
.totals-box{display:flex;justify-content:flex-end;margin-top:12px}
.totals-inner{min-width:260px;background:#F8FAFC;border:1px solid var(--border);border-radius:8px;overflow:hidden}
.totals-inner .row{display:flex;justify-content:space-between;padding:8px 14px;border-bottom:1px solid var(--border);font-size:13px}
.totals-inner .row:last-child{border-bottom:none;font-weight:700;font-size:15px;background:var(--primary-light);color:var(--primary)}

/* ── AUTOCOMPLETE ────────────────────────────── */
.ac-drop{position:absolute;top:100%;left:0;right:0;background:#fff;border:1px solid var(--border);border-radius:8px;box-shadow:var(--shadow-lg);z-index:200;max-height:240px;overflow-y:auto}
.ac-item{padding:9px 12px;cursor:pointer;border-bottom:1px solid #F1F5F9}
.ac-item:last-child{border-bottom:none}
.ac-item:hover{background:var(--primary-light)}
.ac-name{font-size:13px;font-weight:600;color:var(--text)}
.ac-sub{font-size:11px;color:var(--muted);margin-top:2px}

/* ── MODAL ───────────────────────────────────── */
#modal-overlay{
  position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:100;
  display:flex;align-items:center;justify-content:center;padding:20px;
  opacity:0;visibility:hidden;transition:opacity .2s ease,visibility .2s ease;
  backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);
}
#modal-overlay.hidden{opacity:0;visibility:hidden}
#modal-overlay:not(.hidden){opacity:1;visibility:visible}
.modal{
  background:var(--surface);border-radius:16px;width:100%;max-width:860px;max-height:92vh;
  overflow-y:auto;box-shadow:0 25px 80px rgba(0,0,0,.15);
  transform:scale(.96) translateY(10px);transition:transform .25s cubic-bezier(.16,1,.3,1);
}
.modal.visible{transform:scale(1) translateY(0)}
.modal-header{display:flex;justify-content:space-between;align-items:center;padding:18px 24px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--surface);z-index:1}
.modal-header h3{font-size:17px;font-weight:700}
#modal-body{padding:24px}
.modal-footer{display:flex;justify-content:flex-end;gap:10px;padding:16px 0 0;border-top:1px solid var(--border);margin-top:16px}

/* ── SAVE SUCCESS ────────────────────────────── */
.save-success{display:flex;align-items:center;gap:16px;padding:16px 0}
.save-icon{width:52px;height:52px;background:#DCFCE7;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:24px;color:var(--success);flex-shrink:0}
.save-success h3{font-size:16px;font-weight:600;margin-bottom:4px}
.save-success p{font-size:13px;color:var(--muted)}

/* ── SETTINGS ────────────────────────────────── */
.logo-settings{display:flex;align-items:flex-start;gap:20px;padding:16px 0}
.logo-preview{width:90px;height:70px;border:2px dashed var(--border);border-radius:8px;display:flex;align-items:center;justify-content:center;background:var(--bg);color:var(--muted);font-size:11px;flex-shrink:0;overflow:hidden}
.logo-preview img{max-width:100%;max-height:100%;object-fit:contain}

/* ── PRINT / INVOICE DOC ─────────────────────── */
#print-area{display:none}

.invoice-doc{position:relative;max-width:880px;margin:0 auto;padding:42px 46px;background:#fff;color:#0F172A;font-family:'Inter','Roboto','DM Sans',Arial,sans-serif;font-size:12.5px;line-height:1.5;border-radius:12px;box-shadow:0 18px 48px rgba(15,23,42,.14)}
.invoice-doc .inv-header{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:34px;align-items:start;padding-bottom:22px;margin-bottom:20px;border-bottom:3px solid var(--primary)}
.invoice-doc .brand-block{display:flex;align-items:center;gap:16px;min-width:0}
.invoice-doc .invoice-logo{display:block;height:75px;max-height:80px;max-width:210px;width:auto;object-fit:contain;object-position:left center;padding:3px 0;flex-shrink:0}
.invoice-doc .logo-fallback{max-width:220px;padding:14px 18px;background:var(--primary);color:#fff;border-radius:10px;font-size:18px;font-weight:800;line-height:1.2}
.invoice-doc .company-block{min-width:0}
.invoice-doc .company-name{font-size:22px;font-weight:800;color:var(--primary);line-height:1.18}
.invoice-doc .company-details{max-width:430px;margin-top:8px;color:#475569;font-size:11.5px;line-height:1.65}
.invoice-doc .inv-meta{text-align:right;min-width:230px}
.invoice-doc .doc-label{display:inline-block;margin-bottom:8px;padding:6px 11px;border-radius:999px;background:var(--primary-light);color:var(--primary);font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.invoice-doc .inv-no{font-family:'DM Mono',monospace;font-size:25px;font-weight:800;color:#1D4ED8;line-height:1.2}
.invoice-doc .hero-total{margin:12px 0 10px;padding:13px 15px;border-radius:10px;background:linear-gradient(135deg,#2563EB,#1E40AF);color:#fff;box-shadow:0 10px 22px rgba(37,99,235,.22)}
.invoice-doc .hero-total span{display:block;margin-bottom:2px;font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;opacity:.85}
.invoice-doc .hero-total strong{display:block;font-family:'DM Mono',monospace;font-size:20px;font-weight:800;line-height:1.25}
.invoice-doc .meta-grid{display:grid;grid-template-columns:auto auto;gap:4px 12px;justify-content:end;margin-top:8px;color:#64748B;font-size:11.5px}
.invoice-doc .meta-grid strong{color:#0F172A;font-weight:700}
.invoice-doc .invoice-badges{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:20px}
.invoice-doc .invoice-badges span{display:inline-flex;gap:8px;align-items:center;padding:8px 12px;background:#fff;border:1px solid #E5E7EB;border-radius:999px;color:#334155;font-size:11.5px;box-shadow:0 4px 12px rgba(15,23,42,.04)}
.invoice-doc .invoice-badges strong{color:#64748B;font-size:10px;text-transform:uppercase;letter-spacing:.05em}
.invoice-doc .parties{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px}
.invoice-doc .party-box{padding:16px 18px;background:#fff;border:1px solid #E5E7EB;border-radius:10px;min-height:118px;box-shadow:0 7px 18px rgba(15,23,42,.05)}
.invoice-doc .party-box h4{margin-bottom:8px;color:#64748B;font-size:10px;font-weight:800;letter-spacing:.08em}
.invoice-doc .party-box strong{display:block;margin-bottom:4px;color:#0F172A;font-size:14px;font-weight:800}
.invoice-doc .party-box span{display:block;color:#475569;font-size:11.5px;line-height:1.7}
.invoice-doc .inv-table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:20px;border:1px solid #000;table-layout:fixed}
.invoice-doc .inv-table th{padding:10px;background:var(--primary);color:#fff;border:1px solid #000;font-size:10px;font-weight:800;text-align:left;text-transform:uppercase;letter-spacing:.05em;white-space:nowrap}
.invoice-doc .inv-table td{padding:10px;border:1px solid #000;color:#1F2937;font-size:12px;vertical-align:top}
.invoice-doc .inv-table tr:nth-child(even) td{background:#FAFBFC}
.invoice-doc .item-desc{min-width:210px;font-weight:600;color:#111827}
.invoice-doc .text-right{text-align:right}
.invoice-doc .text-center{text-align:center}
.invoice-doc .invoice-bottom{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:24px;align-items:start;margin-bottom:24px}
.invoice-doc .invoice-notes{color:#475569;font-size:12px}
.invoice-doc .amount-words,.invoice-doc .bank-box,.invoice-doc .notes-block{margin-bottom:12px;padding:16px 18px;background:#fff;border:1px solid #E5E7EB;border-radius:10px;box-shadow:0 7px 18px rgba(15,23,42,.05)}
.invoice-doc .amount-words strong,.invoice-doc .bank-box strong{display:block;margin-bottom:4px;color:#0F172A;font-size:11px;text-transform:uppercase;letter-spacing:.05em}
.invoice-doc .amount-words span,.invoice-doc .bank-box span{display:block}
.invoice-doc .inv-summary{overflow:hidden;background:#fff;border:1px solid #E5E7EB;border-radius:10px;box-shadow:0 8px 22px rgba(15,23,42,.07)}
.invoice-doc .summary-row{display:flex;justify-content:space-between;gap:14px;padding:11px 16px;border-bottom:1px solid #E5E7EB;font-size:12.5px}
.invoice-doc .summary-row span{color:#64748B}
.invoice-doc .summary-row strong{font-family:'DM Mono',monospace;color:#0F172A}
.invoice-doc .summary-total{display:flex;justify-content:space-between;gap:14px;padding:15px 16px;background:linear-gradient(135deg,#2563EB,#1E40AF);color:#fff;font-size:18px;font-weight:800}
.invoice-doc .summary-total strong{font-family:'DM Mono',monospace;color:#fff}
.invoice-doc .signature-row{display:flex;justify-content:space-between;align-items:flex-end;margin:18px 0 16px;padding-top:6px}
.invoice-doc .signature-box{min-width:210px;text-align:center;color:#475569;font-size:12px}
.invoice-doc .sig-line{width:170px;margin:42px auto 7px;border-top:1px solid #94A3B8}
.invoice-doc .footer-note{padding-top:14px;border-top:1px solid #E2E8F0;text-align:center;color:#94A3B8;font-size:11px}
.invoice-doc .status-stamp{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-30deg);font-size:72px;font-weight:900;opacity:.06;pointer-events:none;color:#16A34A;white-space:nowrap;letter-spacing:.1em}

@page{size:A4;margin:20mm}
@media print {
  html,body{background:#fff!important}
  body > *{display:none!important}
  #print-area{display:block!important}
  #print-area .invoice-doc{display:block!important}
  .no-print,.modal,.modal-footer,#modal-overlay{display:none!important}
  .invoice-doc{max-width:none;width:100%;margin:0;padding:0;border-radius:0;box-shadow:none;print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .invoice-doc .inv-table tr,.invoice-doc .party-box,.invoice-doc .inv-summary,.invoice-doc .amount-words,.invoice-doc .bank-box,.invoice-doc .signature-row{break-inside:avoid;page-break-inside:avoid}
  .invoice-doc .inv-table thead{display:table-header-group}
  .invoice-doc .inv-table tfoot{display:table-footer-group}
}

/* GST Invoice — shared base + multi-template */
#modal-body > div[style]:has(.gst-invoice){padding:0!important;background:#fff!important;border-radius:0!important;overflow:auto!important}
.modal:has(.gst-invoice){max-width:960px;border-radius:8px}
.modal:has(.gst-invoice) .modal-header{padding:12px 16px}
.modal:has(.gst-invoice) .modal-header h3{font-size:13px}
.modal:has(.gst-invoice) #modal-body{padding:12px 24px 14px}
.modal:has(.gst-invoice) .modal-footer{padding:12px 0 0;margin-top:16px}
.invoice-doc.gst-invoice{
  width:100%;max-width:100%;margin:0 auto;padding:0;
  background:#fff;color:#1e293b;
  font-family:'Inter',Arial,Helvetica,sans-serif;
  font-size:11px;line-height:1.4;
  border:1px solid #cbd5e1;border-radius:0;
  box-shadow:none;overflow:hidden;
}
.invoice-doc.gst-invoice,.invoice-doc.gst-invoice *{box-shadow:none;text-shadow:none}

/* ── Header (shared across all templates) ── */
.gst-invoice .invoice-header{display:flex;justify-content:space-between;align-items:center;width:100%;min-height:142px;border-bottom:1px solid #e2e8f0;padding:14px 18px;gap:0;page-break-inside:avoid;break-inside:avoid}
.gst-invoice .header-left,.gst-invoice .header-center,.gst-invoice .header-right{display:flex;align-items:center;min-height:120px;min-width:0;overflow:hidden}
.gst-invoice .header-left,.gst-invoice .header-right{width:20%;justify-content:center;text-align:center}
.gst-invoice .header-right{flex-direction:column;gap:4px}
.gst-invoice .header-center{width:60%;justify-content:center;text-align:center;flex-direction:column;padding:0 12px;word-wrap:break-word;overflow-wrap:anywhere}
.gst-invoice .gst-logo{display:block;width:auto;max-width:100%;height:auto;max-height:118px;object-fit:contain;object-position:center;margin:0 auto}
.gst-invoice .gst-logo-fallback{width:120px;height:86px;border:1px solid #e2e8f0;border-radius:8px;display:flex;align-items:center;justify-content:center;margin:0 auto;font-size:18px;font-weight:700;color:#334155}
.gst-invoice .gst-title{font-size:11px;font-weight:700;text-transform:uppercase;margin:0 0 8px;color:#64748b;letter-spacing:.08em}
.gst-invoice .gst-company-name{max-width:100%;font-size:20px;font-weight:800;text-transform:uppercase;line-height:1.1;margin:0 0 6px;overflow-wrap:anywhere;color:#0f172a}
.gst-invoice .header-center p{margin:2px 0;font-size:12px;line-height:1.25;color:#334155}
.gst-invoice .qr-code{position:relative;width:96px;height:96px;max-width:100%;margin:0 auto;display:flex;align-items:center;justify-content:center}
.gst-invoice .qr-code img,.gst-invoice .qr-code canvas{display:block;width:96px;max-width:100%;height:auto;aspect-ratio:1/1}

/* ── Shared helpers ── */
.gst-invoice .center{text-align:center}
.gst-invoice .right{text-align:right}
.gst-invoice strong{font-weight:700}
.gst-invoice .inv-section{padding:0 20px;margin-bottom:0;page-break-inside:avoid;break-inside:avoid}
.gst-invoice .inv-section-head{font-size:9.5px;font-weight:800;text-transform:uppercase;letter-spacing:.1em;color:#2563eb;margin:0 0 8px;padding-bottom:5px;border-bottom:2px solid #2563eb;display:inline-block}
.gst-invoice .inv-party-name{font-size:13px;font-weight:800;color:#0f172a;margin-bottom:4px;letter-spacing:-.01em}
.gst-invoice .inv-party-detail{font-size:10.5px;color:#475569;line-height:1.5;margin-bottom:2px}
.gst-invoice .inv-label{font-weight:700;color:#64748b}
.gst-invoice .inv-info-row{display:flex;justify-content:space-between;align-items:baseline;padding:3px 0;font-size:10.5px}
.gst-invoice .inv-info-row .inv-label{font-weight:700;color:#94a3b8;text-transform:uppercase;font-size:9px;letter-spacing:.06em}
.gst-invoice .inv-info-row .inv-value{font-weight:700;color:#0f172a}
.gst-invoice .inv-total-row{display:flex;justify-content:space-between;align-items:baseline;padding:4px 0;font-size:10.5px;color:#475569}
.gst-invoice .inv-total-row span:last-child{font-weight:700;font-family:'DM Mono','Inter Mono',monospace;color:#1e293b}
.gst-invoice .inv-sign-label{font-size:10px;font-weight:800;color:#1e293b}
.gst-invoice .inv-sign-space{height:42px}
.gst-invoice .gst-note{text-align:center;border-top:1px solid #e2e8f0;padding:6px;font-size:8px;color:#94a3b8;letter-spacing:.04em;text-transform:uppercase}
.gst-invoice .inv-notes{margin-top:10px;font-size:10px;color:#475569}

/* ── Items table (shared base, templates override) ── */
.gst-invoice .gst-items-table{width:100%;border-collapse:collapse;border-spacing:0;table-layout:fixed}
.gst-invoice .gst-items-table th{text-align:center;font-weight:700;text-transform:uppercase;padding:9px 6px}
.gst-invoice .gst-items-table td{font-size:10px;padding:7px 6px;color:#1e293b;vertical-align:middle}

/* ================================================================
   MODERN TEMPLATE
   ================================================================ */
.gst-invoice.tpl-modern .inv-accent-bar{height:4px;background:linear-gradient(90deg,#2563eb,#7c3aed,#2563eb);background-size:200% 100%}
.gst-invoice.tpl-modern .inv-parties{display:flex;gap:0;padding:16px 20px;background:#f8fafc;border-bottom:1px solid #e2e8f0}
.gst-invoice.tpl-modern .inv-party-card{flex:1;padding:0 16px 0 0}
.gst-invoice.tpl-modern .inv-party-card + .inv-party-card{padding:0 16px;border-left:1px solid #e2e8f0}
.gst-invoice.tpl-modern .inv-info-card{flex:0 0 210px;padding-left:16px;border-left:1px solid #e2e8f0}
.gst-invoice.tpl-modern .inv-info-number{font-size:18px;font-weight:900;color:#2563eb;letter-spacing:-.02em;margin-bottom:8px;font-family:'DM Mono','Inter Mono',monospace}
.gst-invoice.tpl-modern .inv-items-wrap{padding:16px 20px}
.gst-invoice.tpl-modern .gst-items-table{border:1px solid #e2e8f0;border-radius:8px;overflow:hidden}
.gst-invoice.tpl-modern .gst-items-table th{background:#1e293b;font-size:8.5px;color:#fff;letter-spacing:.06em;border-right:1px solid #334155}
.gst-invoice.tpl-modern .gst-items-table th:last-child{border-right:0}
.gst-invoice.tpl-modern .gst-items-table td{border-bottom:1px solid #f1f5f9;border-right:1px solid #f1f5f9}
.gst-invoice.tpl-modern .gst-items-table td:last-child{border-right:0}
.gst-invoice.tpl-modern .gst-items-table tbody tr:nth-child(even){background:#f8fafc}
.gst-invoice.tpl-modern .gst-items-table tr:last-child td{border-bottom:0}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(1){width:5%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(2){width:24%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(3){width:9%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(4){width:7%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(5){width:6%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(6){width:10%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(7){width:10%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(8){width:12%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(9){width:7%}
.gst-invoice.tpl-modern .gst-items-table th:nth-child(10){width:10%}
.gst-invoice.tpl-modern .inv-summary{display:flex;gap:0;border-top:1px solid #e2e8f0;padding:16px 20px}
.gst-invoice.tpl-modern .inv-words{flex:1;padding-right:20px}
.gst-invoice.tpl-modern .inv-words-text{font-size:10.5px;color:#334155;font-weight:600;margin-top:2px}
.gst-invoice.tpl-modern .inv-totals{flex:0 0 240px;border-left:1px solid #e2e8f0;padding-left:20px}
.gst-invoice.tpl-modern .inv-grand-row{margin-top:6px;padding:8px 10px;background:#1e293b;border-radius:6px;font-size:12px;font-weight:900;color:#fff}
.gst-invoice.tpl-modern .inv-grand-row span{color:#fff!important}
.gst-invoice.tpl-modern .inv-grand-row span:last-child{font-size:15px}
.gst-invoice.tpl-modern .inv-footer{display:flex;gap:0;border-top:1px solid #e2e8f0;padding:16px 20px;background:#f8fafc}
.gst-invoice.tpl-modern .inv-footer-col{flex:1}
.gst-invoice.tpl-modern .inv-footer-center{text-align:center;padding:0 16px;border-left:1px solid #e2e8f0;border-right:1px solid #e2e8f0}
.gst-invoice.tpl-modern .inv-footer-right{text-align:center;display:flex;flex-direction:column;justify-content:flex-end;align-items:center}

/* ================================================================
   CLASSIC TEMPLATE
   ================================================================ */
.gst-invoice.tpl-classic{color:#000;font-family:Arial,'Times New Roman',serif;border:1px solid #000}
.gst-invoice.tpl-classic .invoice-header{border-bottom:1px solid #000}
.gst-invoice.tpl-classic .gst-logo-fallback{border:1px solid #000;border-radius:0}
.gst-invoice.tpl-classic .section-head{font-size:10px;font-weight:700;text-transform:uppercase;margin:0 0 4px;text-decoration:underline;color:#000}
.gst-invoice.tpl-classic table{width:100%;border-collapse:collapse;border-spacing:0;table-layout:fixed;border:1px solid #000;border-top:0}
.gst-invoice.tpl-classic th,.gst-invoice.tpl-classic td{border:1px solid #000;padding:4px 5px;color:#000;vertical-align:middle;background:#fff}
.gst-invoice.tpl-classic th{font-weight:700;text-align:left}
.gst-invoice.tpl-classic .gst-party-table{border-top:1px solid #000}
.gst-invoice.tpl-classic .gst-party-table + table,.gst-invoice.tpl-classic .gst-items-table + table,.gst-invoice.tpl-classic .gst-total-table + table{margin-top:-1px}
.gst-invoice.tpl-classic .gst-party-table .party-col{width:32%;height:170px}
.gst-invoice.tpl-classic .gst-party-table .terms-col{width:35%;height:170px}
.gst-invoice.tpl-classic .gst-party-table .invoice-info-col{padding:0}
.gst-invoice.tpl-classic .header-invoice-meta{height:100%;font-size:11px;table-layout:fixed}
.gst-invoice.tpl-classic .header-invoice-meta th,.gst-invoice.tpl-classic .header-invoice-meta td{font-size:11px;padding:4px 8px;line-height:1.1;vertical-align:middle}
.gst-invoice.tpl-classic .header-invoice-meta th{width:52%;background:#fff;text-transform:uppercase}
.gst-invoice.tpl-classic .gst-items-table{border:1px solid #000}
.gst-invoice.tpl-classic .gst-items-table th{background:#fff;text-align:center;font-size:9px;line-height:1.12;color:#000}
.gst-invoice.tpl-classic .gst-items-table td{font-size:9.5px;height:22px}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(1){width:6%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(2){width:25%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(3){width:10%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(4){width:8%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(5){width:6%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(6){width:10%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(7){width:9%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(8){width:12%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(9){width:6%}
.gst-invoice.tpl-classic .gst-items-table th:nth-child(10){width:8%}
.gst-invoice.tpl-classic .gst-total-table .words-cell{width:66%;font-weight:600;height:100px}
.gst-invoice.tpl-classic .gst-total-table .totals-cell{width:35%;padding:0}
.gst-invoice.tpl-classic .gst-total-table .totals-cell table{height:100%}
.gst-invoice.tpl-classic .gst-total-table .totals-cell table td:first-child{width:48%}
.gst-invoice.tpl-classic .gst-total-table .totals-cell table td:last-child{width:52%}
.gst-invoice.tpl-classic .gst-total-table .totals-cell table td{padding:4px 7px;vertical-align:middle}
.gst-invoice.tpl-classic .grand-row td{background:#fff;font-size:11px;font-weight:700}
.gst-invoice.tpl-classic .notes-line{margin-top:7px;font-weight:400}
.gst-invoice.tpl-classic .gst-footer-table td{width:37%;height:86px}
.gst-invoice.tpl-classic .sign-cell{text-align:center;vertical-align:bottom;padding-top:10px}
.gst-invoice.tpl-classic .sign-space{height:38px}
.gst-invoice.tpl-classic .gst-note{border-top:1px solid #000;color:#000;font-size:8px;text-transform:none;letter-spacing:0}
.gst-invoice.tpl-classic table table{border:0}
.gst-invoice.tpl-classic table table th,.gst-invoice.tpl-classic table table td{border:1px solid #000}
.gst-invoice.tpl-classic table table tr:first-child > th,.gst-invoice.tpl-classic table table tr:first-child > td{border-top:0}
.gst-invoice.tpl-classic table table tr:last-child > th,.gst-invoice.tpl-classic table table tr:last-child > td{border-bottom:0}
.gst-invoice.tpl-classic table table th:first-child,.gst-invoice.tpl-classic table table td:first-child{border-left:0}
.gst-invoice.tpl-classic table table th:last-child,.gst-invoice.tpl-classic table table td:last-child{border-right:0}

/* ================================================================
   MINIMAL TEMPLATE
   ================================================================ */
.gst-invoice.tpl-minimal .inv-section-head{color:#64748b;border-bottom:1px solid #e2e8f0;font-size:9px;letter-spacing:.08em}
.gst-invoice.tpl-minimal .inv-parties-min{display:flex;gap:0;padding:14px 20px;border-bottom:1px solid #e2e8f0}
.gst-invoice.tpl-minimal .inv-party-min{flex:1;padding-right:16px}
.gst-invoice.tpl-minimal .inv-party-min + .inv-party-min{padding:0 16px;border-left:1px solid #e2e8f0}
.gst-invoice.tpl-minimal .inv-info-min{flex:0 0 160px;padding-left:16px;border-left:1px solid #e2e8f0}
.gst-invoice.tpl-minimal .inv-items-wrap{padding:12px 20px}
.gst-invoice.tpl-minimal .gst-items-table{border:0}
.gst-invoice.tpl-minimal .gst-items-table th{background:transparent;font-size:8px;color:#94a3b8;letter-spacing:.08em;padding:6px 4px;border-bottom:1px solid #e2e8f0;font-weight:600}
.gst-invoice.tpl-minimal .gst-items-table td{border-bottom:1px solid #f1f5f9;padding:6px 4px;font-size:10px;color:#334155}
.gst-invoice.tpl-minimal .gst-items-table tr:last-child td{border-bottom:0}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(1){width:4%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(2){width:24%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(3){width:8%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(4){width:7%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(5){width:6%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(6){width:9%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(7){width:9%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(8){width:11%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(9){width:7%}
.gst-invoice.tpl-minimal .gst-items-table th:nth-child(10){width:15%}
.gst-invoice.tpl-minimal .inv-summary-min{display:flex;gap:0;border-top:1px solid #e2e8f0;padding:14px 20px}
.gst-invoice.tpl-minimal .inv-words-min{flex:1;padding-right:20px;font-size:10px;color:#64748b;font-style:italic}
.gst-invoice.tpl-minimal .inv-totals-min{flex:0 0 200px;border-left:1px solid #e2e8f0;padding-left:20px}
.gst-invoice.tpl-minimal .inv-grand-row{border-top:2px solid #0f172a;margin-top:4px;padding-top:6px;font-size:13px;font-weight:900;color:#0f172a}
.gst-invoice.tpl-minimal .inv-grand-row span:last-child{font-size:14px}
.gst-invoice.tpl-minimal .inv-footer-min{display:flex;justify-content:space-between;align-items:flex-end;border-top:1px solid #e2e8f0;padding:14px 20px}
.gst-invoice.tpl-minimal .inv-footer-min-left{font-size:9px;color:#94a3b8}
.gst-invoice.tpl-minimal .inv-footer-min-right{text-align:center}
.gst-invoice.tpl-minimal .gst-note{color:#cbd5e1}

/* ================================================================
   SPECIAL TEMPLATE
   ================================================================ */
.gst-invoice.tpl-special{background:#fff;border:1px solid #e2e8f0}
.gst-invoice.tpl-special .inv-accent-bar{height:6px;background:linear-gradient(90deg,#0f172a,#334155,#0f172a)}
.gst-invoice.tpl-special .inv-parties{display:flex;gap:0;padding:18px 22px;border-bottom:1px solid #e2e8f0;background:#f8fafc}
.gst-invoice.tpl-special .inv-party-card{flex:1;padding-right:18px}
.gst-invoice.tpl-special .inv-party-card + .inv-party-card{padding:0 18px;border-left:1px solid #cbd5e1}
.gst-invoice.tpl-special .inv-info-card{flex:0 0 220px;padding-left:18px;border-left:1px solid #cbd5e1}
.gst-invoice.tpl-special .inv-info-number{font-size:20px;font-weight:900;color:#0f172a;letter-spacing:-.02em;margin-bottom:10px;font-family:'DM Mono','Inter Mono',monospace}
.gst-invoice.tpl-special .inv-items-wrap{padding:16px 22px}
.gst-invoice.tpl-special .gst-items-table{border:1px solid #e2e8f0;border-radius:8px;overflow:hidden}
.gst-invoice.tpl-special .gst-items-table th{background:#0f172a;font-size:8.5px;color:#fff;letter-spacing:.06em;border-right:1px solid #334155;padding:10px 6px}
.gst-invoice.tpl-special .gst-items-table th:last-child{border-right:0}
.gst-invoice.tpl-special .gst-items-table td{border-bottom:1px solid #f1f5f9;border-right:1px solid #f1f5f9;padding:8px 6px;font-size:10.5px;color:#1e293b;vertical-align:middle}
.gst-invoice.tpl-special .gst-items-table td:last-child{border-right:0}
.gst-invoice.tpl-special .gst-items-table tbody tr:nth-child(even){background:#f8fafc}
.gst-invoice.tpl-special .gst-items-table tr:last-child td{border-bottom:0}
.gst-invoice.tpl-special .gst-items-table th:nth-child(1){width:5%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(2){width:24%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(3){width:9%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(4){width:7%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(5){width:6%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(6){width:10%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(7){width:10%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(8){width:12%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(9){width:7%}
.gst-invoice.tpl-special .gst-items-table th:nth-child(10){width:10%}
.gst-invoice.tpl-special .inv-summary{display:flex;gap:0;border-top:1px solid #e2e8f0;padding:18px 22px;background:#f8fafc}
.gst-invoice.tpl-special .inv-words{flex:1;padding-right:20px}
.gst-invoice.tpl-special .inv-words-text{font-size:11px;color:#334155;font-weight:600;margin-top:2px;line-height:1.5}
.gst-invoice.tpl-special .inv-totals{flex:0 0 240px}
.gst-invoice.tpl-special .inv-total-row{display:flex;justify-content:space-between;padding:3px 0;font-size:11px;color:#475569}
.gst-invoice.tpl-special .inv-grand-row{border-top:2px solid #0f172a;margin-top:6px;padding-top:8px;font-size:14px;font-weight:900;color:#0f172a}
.gst-invoice.tpl-special .inv-grand-row span:last-child{font-size:15px;font-family:'DM Mono','Inter Mono',monospace}
.gst-invoice.tpl-special .inv-footer{display:flex;gap:0;border-top:1px solid #e2e8f0;padding:18px 22px}
.gst-invoice.tpl-special .inv-footer-col{flex:1;padding-right:16px}
.gst-invoice.tpl-special .inv-footer-col + .inv-footer-col{padding:0 16px;border-left:1px solid #e2e8f0}
.gst-invoice.tpl-special .inv-footer-right{text-align:right;display:flex;flex-direction:column;align-items:flex-end;justify-content:flex-end}
.gst-invoice.tpl-special .inv-sign-space{height:40px;border-bottom:1px solid #94a3b8;margin-bottom:4px;width:140px}
.gst-invoice.tpl-special .gst-note{color:#94a3b8;border-top:1px solid #e2e8f0;padding:8px 22px;font-size:9px;text-align:center;letter-spacing:.02em;background:#f8fafc}

/* ── Print (shared + template-specific) ── */
@page{size:A4;margin:12mm}
@media print {
  html,body,#print-area{transform:none!important;zoom:1!important}
  .invoice-doc.gst-invoice{width:100%;max-width:none;font-size:11px}
  button,.btn,.btn-icon,.no-print{display:none!important}
  .invoice-doc.gst-invoice,.invoice-doc.gst-invoice *{box-shadow:none!important;text-shadow:none!important}
  .gst-invoice .invoice-header{display:flex!important;justify-content:space-between!important;align-items:center!important;min-height:130px;padding:10px 14px!important;page-break-inside:avoid!important;break-inside:avoid!important}
  .gst-invoice .header-left{width:20%!important}
  .gst-invoice .header-center{width:60%!important}
  .gst-invoice .header-right{width:20%!important}
  .gst-invoice .header-left,.gst-invoice .header-center,.gst-invoice .header-right{min-height:112px}
  .gst-invoice .gst-company-name{font-size:18px;white-space:normal}
  .gst-invoice .gst-logo{max-width:100%;max-height:108px;height:auto}
  .gst-invoice .qr-code,.gst-invoice .qr-code img,.gst-invoice .qr-code canvas{width:82px;height:82px;overflow:visible}
  .gst-invoice .inv-section,.gst-invoice .inv-parties,.gst-invoice .inv-summary,.gst-invoice .inv-footer,
  .gst-invoice .inv-parties-min,.gst-invoice .inv-summary-min,.gst-invoice .inv-footer-min{break-inside:avoid;page-break-inside:avoid}
  .gst-invoice .gst-items-table thead{display:table-header-group}
  .gst-invoice .gst-items-table tr{break-inside:avoid;page-break-inside:avoid}
  /* Modern print */
  .gst-invoice.tpl-modern{border:1px solid #cbd5e1!important}
  .gst-invoice.tpl-modern .inv-accent-bar{background:#2563eb!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .gst-invoice.tpl-modern .gst-items-table th{background:#1e293b!important;color:#fff!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .gst-invoice.tpl-modern .gst-items-table th,.gst-invoice.tpl-modern .gst-items-table td{border-color:#e2e8f0!important}
  .gst-invoice.tpl-modern .inv-grand-row{background:#1e293b!important;color:#fff!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  /* Classic print */
  .gst-invoice.tpl-classic{border:1px solid #000!important}
  .gst-invoice.tpl-classic th,.gst-invoice.tpl-classic td{border-color:#000!important;border-style:solid!important;border-width:1px!important}
  .gst-invoice.tpl-classic .gst-items-table th{background:#fff!important;color:#000!important}
  .gst-invoice.tpl-classic table{border-color:#000!important}
  /* Minimal print */
  .gst-invoice.tpl-minimal{border:1px solid #e2e8f0!important}
  .gst-invoice.tpl-minimal .gst-items-table th{background:transparent!important;color:#94a3b8!important}
  /* Special print */
  .gst-invoice.tpl-special{border:1px solid #cbd5e1!important}
  .gst-invoice.tpl-special .inv-accent-bar{background:linear-gradient(90deg,#0f172a,#334155,#0f172a)!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .gst-invoice.tpl-special .gst-items-table th{background:#0f172a!important;color:#fff!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .gst-invoice.tpl-special .gst-items-table th,.gst-invoice.tpl-special .gst-items-table td{border-color:#e2e8f0!important}
  .gst-invoice.tpl-special .inv-grand-row{border-top-color:#0f172a!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  /* Preserve background colors for inline-styled templates */
  .gst-invoice div[style*="background:#"]{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .gst-invoice div[style*="background:#000"],.gst-invoice div[style*="background:#0f172a"],.gst-invoice div[style*="background:#059669"]{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}

/* ── PDF capture mode (used by downloadInvoicePdf / email-attach PDF) ──
   Mirrors @media print so the html2canvas capture renders the SAME visual
   the user sees in the on-screen preview modal. html2canvas does NOT apply
   @media print rules, so we duplicate the key ones here via a class hook. */
.pdf-render-mode{
  width:794px;background:#fff;color:#1e293b;
  font-family:'Inter',Arial,Helvetica,sans-serif;
  /* Make sure nothing inside is hidden by the app's screen-only chrome rules */
  transform:none!important;zoom:1!important;
}
.pdf-render-mode .invoice-doc.gst-invoice{
  width:100%;max-width:100%;margin:0;font-size:11px;
  box-shadow:none!important;text-shadow:none!important;
}
.pdf-render-mode .invoice-doc.gst-invoice *{box-shadow:none!important;text-shadow:none!important}
.pdf-render-mode .no-print,.pdf-render-mode button,.pdf-render-mode .btn,.pdf-render-mode .btn-icon{display:none!important}
/* Preserve coloured backgrounds inside the captured image (jpeg honours these) */
.pdf-render-mode .gst-invoice [style*="background:#"]{-webkit-print-color-adjust:exact;print-color-adjust:exact}
.pdf-render-mode .gst-invoice .inv-grand-row,
.pdf-render-mode .gst-invoice .gst-items-table th,
.pdf-render-mode .gst-invoice .inv-accent-bar{-webkit-print-color-adjust:exact;print-color-adjust:exact}
/* Keep rows / sections from being cut in half across PDF pages */
.pdf-render-mode .gst-invoice .invoice-header,
.pdf-render-mode .gst-invoice .inv-parties,
.pdf-render-mode .gst-invoice .inv-summary,
.pdf-render-mode .gst-invoice .inv-footer,
.pdf-render-mode .gst-invoice .inv-section,
.pdf-render-mode .gst-invoice .gst-items-table tr{
  page-break-inside:avoid;break-inside:avoid;
}
.pdf-render-mode .gst-invoice .gst-items-table thead{display:table-header-group}

/* Template preview cards */
.template-card:hover{border-color:#2563eb!important;transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.08)}
.template-card.selected{border-color:#2563eb!important;box-shadow:0 0 0 2px #2563eb33}

/* Public shared invoice / quotation page */
.public-share-page{min-height:100vh;background:#eef2f7;padding:24px;color:#0f172a}
.public-share-toolbar{max-width:960px;margin:0 auto 18px;display:flex;align-items:center;justify-content:space-between;gap:16px}
.public-share-brand{font-size:18px;font-weight:800;letter-spacing:0;color:#0f172a}
.public-share-subtitle{font-size:13px;color:#64748b;margin-top:2px}
.public-share-shell{max-width:960px;margin:0 auto;background:#fff;border:1px solid #cbd5e1;box-shadow:0 18px 45px rgba(15,23,42,.12)}
.public-share-shell .invoice-doc.gst-invoice{border:0}
.public-share-loading,.public-share-error{padding:56px 24px;text-align:center;color:#64748b}
.public-share-error h1{font-size:22px;margin:0 0 8px;color:#0f172a}
.public-share-error p{margin:0}

@media (max-width: 760px){
  .public-share-page{padding:12px;background:#fff}
  .public-share-toolbar{align-items:flex-start;margin-bottom:12px}
  .public-share-shell{max-width:none;border:0;box-shadow:none;overflow-x:auto}
  .public-share-shell .invoice-doc.gst-invoice{min-width:760px}
}

/* Retail POS */
.pos-app{display:flex;flex-direction:column;gap:14px;color:#0f172a}
.pos-topbar{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 16px;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 8px rgba(15,23,42,.04)}
.pos-title h2{margin:0;font-size:20px;letter-spacing:0;color:#0f172a}
.pos-title span,.pos-sync{font-size:12px;color:#64748b}
.pos-sync{padding:6px 10px;border-radius:999px;background:#ecfdf5;color:#047857;font-weight:700}
.pos-customer{position:relative;display:grid;grid-template-columns:140px minmax(180px,1.3fr) 120px 140px 120px;gap:8px;flex:1;max-width:1060px}
.pos-customer input,.pos-customer select,.pos-search input,.pos-split input,.pos-category-search input{height:38px;border:1px solid #dbe3ef;border-radius:8px;padding:0 10px;background:#fff;color:#0f172a}
.pos-actions{display:flex;gap:8px;flex-wrap:wrap}
.pos-grid{display:grid;grid-template-columns:minmax(0,1fr) 390px;gap:14px;align-items:start}
.pos-products-panel,.pos-cart-panel,.pos-report-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 2px 12px rgba(15,23,42,.04)}
.pos-products-panel{padding:14px;min-height:620px}
.pos-mode-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
.pos-mode-tabs button{border:1px solid #dbe3ef;background:#fff;border-radius:8px;padding:10px;font-weight:800;color:#334155;cursor:pointer}
.pos-mode-tabs button.active{background:#0f172a;color:#fff;border-color:#0f172a}
.pos-search{display:flex;gap:8px;margin-bottom:12px}
.pos-search input{flex:1;height:44px;font-size:15px}
.pos-category-search{position:relative;margin-bottom:10px}
.pos-category-search input{width:100%}
.pos-suggest{position:absolute;z-index:30;background:#fff;border:1px solid #dbe3ef;border-radius:8px;box-shadow:0 12px 26px rgba(15,23,42,.14);max-height:240px;overflow:auto}
.pos-suggest:empty{display:none}
.pos-suggest button{display:block;width:100%;border:0;background:#fff;text-align:left;padding:9px 11px;color:#0f172a;cursor:pointer}
.pos-suggest button:hover{background:#eff6ff}
.pos-suggest strong,.pos-suggest span{display:block}
.pos-suggest span{font-size:11px;color:#64748b;margin-top:2px}
.pos-suggest-empty{padding:9px 11px;color:#64748b;font-size:12px}
#pos-customer-results{left:148px;top:42px;width:320px}
#pos-city-results{left:148px;top:88px;width:300px}
.pos-customer-summary{grid-column:2/-1;min-height:0;font-size:11px;color:#047857}
.pos-customer-summary strong{margin-right:8px;color:#065f46}
.pos-customer-summary span{color:#64748b}
#pos-category-suggest,#pos-quick-category-suggest,#rp-category-suggest{position:relative;width:100%;margin-top:4px}
.pos-quick-mode{border:1px solid #e2e8f0;border-radius:8px;padding:14px;background:#f8fafc}
.pos-quick-grid{display:grid;grid-template-columns:2fr 1fr 1fr 1fr;gap:10px}
.pos-quick-grid input,.pos-quick-grid select{height:42px;border:1px solid #dbe3ef;border-radius:8px;padding:0 10px;background:#fff;color:#0f172a}
.pos-save-inventory{display:flex;align-items:center;gap:8px;font-size:13px;color:#334155;font-weight:700}
.pos-add-quick{margin-top:12px;width:100%;height:44px;border:0;border-radius:8px;background:#2563eb;color:#fff;font-weight:900;cursor:pointer}
.pos-quick-help{font-size:12px;color:#64748b;margin-top:8px;text-align:center}
.pos-categories{display:flex;gap:8px;overflow:auto;padding-bottom:10px;margin-bottom:10px}
.pos-categories button{border:1px solid #dbe3ef;background:#fff;border-radius:999px;padding:8px 12px;white-space:nowrap;cursor:pointer;color:#334155;font-weight:600}
.pos-categories button.active{background:#0f172a;color:#fff;border-color:#0f172a}
.pos-categories span{opacity:.7;margin-left:4px}
.pos-products{display:flex;flex-direction:column;gap:0;border:1px solid #e2e8f0;border-radius:8px;overflow:auto;background:#fff}
.pos-product-row{display:grid;grid-template-columns:minmax(170px,1.5fr) minmax(90px,.8fr) minmax(80px,.7fr) minmax(110px,.9fr) 70px 90px 54px 74px;gap:10px;align-items:center;min-width:820px}
.pos-product-head{position:sticky;top:0;z-index:1;padding:9px 10px;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#64748b;font-size:11px;font-weight:800;text-transform:uppercase}
.pos-product{text-align:left;border:0;border-bottom:1px solid #eef2f7;background:#fff;border-radius:0;padding:9px 10px;min-height:54px;cursor:default;transition:background .12s,border-color .12s,box-shadow .12s}
.pos-product:hover{transform:translateY(-1px);border-color:#2563eb;box-shadow:0 8px 20px rgba(37,99,235,.09)}
.pos-product:focus{outline:2px solid #93c5fd;outline-offset:1px}
.pos-product.is-out{opacity:.5;cursor:not-allowed}
.pos-product-main{min-width:0}
.pos-product-main strong,.pos-product-row>span,.pos-product-row>strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-product-main strong{display:block;font-size:13px;color:#0f172a}
.pos-product-main small{display:block;color:#64748b;font-size:10px;margin-top:2px}
.pos-product-row .low{color:#dc2626;font-weight:800}
.pos-product-row .pos-product-meta{display:none}
.pos-product-name{font-size:13px;font-weight:800;color:#0f172a;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-product-category{font-size:10px;color:#475569;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-product-meta{font-size:10px;color:#64748b;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-product-bottom{display:flex;flex-direction:column;align-items:flex-end;gap:3px}
.pos-product-bottom strong{font-family:'DM Mono',monospace;font-size:13px}
.pos-product-bottom span{font-size:11px;color:#64748b}
.pos-product-bottom span.low{color:#dc2626;font-weight:800}
.pos-product-add{height:34px;border:0;border-radius:8px;background:#0f172a;color:#fff;font-weight:900;cursor:pointer}
.pos-product-add:disabled{background:#cbd5e1;cursor:not-allowed}
.pos-cart-panel{position:sticky;top:74px;overflow:hidden}
.pos-cart-head{display:flex;align-items:center;justify-content:space-between;padding:14px;border-bottom:1px solid #e2e8f0}
.pos-cart-head h3{margin:0;font-size:15px}
.pos-cart-head span{font-size:12px;color:#64748b}
.pos-cart{max-height:310px;overflow:auto;padding:10px}
.pos-cart-item{display:grid;grid-template-columns:minmax(0,1fr) 104px 62px 78px 58px;gap:8px;align-items:center;padding:10px 0;border-bottom:1px solid #f1f5f9}
.pos-cart-main strong{display:block;font-size:13px;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-cart-main span{font-size:11px;color:#64748b}
.pos-qty{display:grid;grid-template-columns:28px 1fr 28px;border:1px solid #dbe3ef;border-radius:8px;overflow:hidden}
.pos-qty button{border:0;background:#f8fafc;cursor:pointer;font-weight:800}
.pos-qty input,.pos-line-discount{border:0;text-align:center;min-width:0}
.pos-line-discount{height:34px;border:1px solid #dbe3ef;border-radius:8px}
.pos-line-total{font-family:'DM Mono',monospace;font-size:12px;text-align:right}
.pos-remove-item{height:32px;border:1px solid #fecaca;border-radius:8px;background:#fff1f2;color:#be123c;font-size:11px;font-weight:800;cursor:pointer}
.pos-payment{padding:14px;border-top:1px solid #e2e8f0;background:#f8fafc}
.pos-totals{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.pos-totals div,.pos-receipt-totals div{display:flex;justify-content:space-between;gap:12px}
.pos-totals span{color:#64748b}
.pos-totals .grand{padding-top:8px;border-top:1px solid #cbd5e1;font-size:18px;color:#0f172a}
.pos-pay-modes{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin:8px 0 10px}
.pos-pay-modes button{border:1px solid #dbe3ef;background:#fff;border-radius:8px;padding:10px;cursor:pointer;font-weight:700;color:#334155}
.pos-pay-modes button.active{border-color:#2563eb;background:#eff6ff;color:#1d4ed8}
.pos-split{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:10px}
.pos-notes{width:100%;min-height:54px;border:1px solid #dbe3ef;border-radius:8px;padding:9px 10px;margin:0 0 10px;background:#fff;resize:vertical}
.pos-checkout{width:100%;height:48px;border:0;border-radius:8px;background:#0f172a;color:#fff;font-weight:900;font-size:15px;cursor:pointer}
.pos-print-buttons{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-top:10px}
.pos-print-buttons .btn-wa{grid-column:1/-1}
.pos-report-panel{padding:14px}
.pos-report-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.pos-report-filters{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.pos-report-filters button,.pos-report-filters input{height:32px;border:1px solid #dbe3ef;border-radius:8px;background:#fff;color:#334155;padding:0 9px;font-size:12px;font-weight:700}
.pos-report-filters button.active{background:#0f172a;color:#fff;border-color:#0f172a}
.pos-reports{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.pos-report-card,.pos-report-list{border:1px solid #e2e8f0;border-radius:8px;padding:12px;background:#fff}
.pos-report-card span,.pos-report-card small{display:block;color:#64748b;font-size:12px}
.pos-report-card strong{display:block;font-size:18px;margin:4px 0;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-report-list h4{margin:0 0 8px;font-size:13px}
.pos-report-list div{display:flex;justify-content:space-between;gap:10px;padding:5px 0;border-top:1px solid #f1f5f9;font-size:12px}
.pos-product-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.pos-product-form input,.pos-product-form select{height:42px;border:1px solid #dbe3ef;border-radius:8px;padding:0 10px;background:#fff;color:#0f172a}
.pos-history-wrap{max-height:70vh;overflow:auto}
.pos-history-table{width:100%;border-collapse:collapse;font-size:13px}
.pos-history-table th,.pos-history-table td{padding:10px;border-bottom:1px solid #e2e8f0;text-align:left;vertical-align:middle}
.pos-history-table small{display:block;color:#64748b;margin-top:2px}
.pos-refund-form{display:flex;flex-direction:column;gap:10px}
.pos-refund-form input{height:38px;border:1px solid #dbe3ef;border-radius:8px;padding:0 10px;background:#fff;color:#0f172a}
.pos-refund-qty{max-width:90px}
.pos-chart{border:1px solid #e2e8f0;border-radius:8px;padding:12px;background:#fff;min-height:150px}
.pos-chart h4{margin:0 0 10px;font-size:13px}
.pos-bars{height:112px;display:flex;align-items:end;gap:7px}
.pos-bars>div{flex:1;min-width:18px;height:100%;display:flex;flex-direction:column;justify-content:flex-end;gap:4px;text-align:center}
.pos-bars span{display:block;border-radius:6px 6px 0 0;background:#2563eb;min-height:4px}
.pos-bars small{font-size:10px;color:#64748b;white-space:nowrap}
.pos-pie-list{display:flex;flex-direction:column;gap:7px}
.pos-pie-list div{display:flex;align-items:center;gap:8px;font-size:12px}
.pos-pie-list strong{margin-left:auto}
.swatch{width:10px;height:10px;border-radius:999px;background:#2563eb}
.swatch-1{background:#16a34a}.swatch-2{background:#f59e0b}.swatch-3{background:#dc2626}.swatch-4{background:#7c3aed}.swatch-5{background:#0891b2}
.pos-heatmap{display:grid;grid-template-columns:repeat(8,1fr);gap:5px}
.pos-heatmap span{display:grid;place-items:center;height:24px;border-radius:6px;background:#f1f5f9;color:#64748b;font-size:10px}
.pos-heatmap .heat-1{background:#dbeafe;color:#1d4ed8}.pos-heatmap .heat-2{background:#93c5fd;color:#1e3a8a}.pos-heatmap .heat-3{background:#3b82f6;color:#fff}.pos-heatmap .heat-4{background:#1d4ed8;color:#fff}
.pos-empty{padding:28px 12px;text-align:center;color:#64748b}
.hidden{display:none!important}
.pos-print-thermal,.pos-print-a4{background:#fff;color:#000;margin:0 auto;font-family:Arial,Helvetica,sans-serif}
.pos-print-thermal{padding:4mm;font-size:10px}
.pos-print-58{width:48mm}
.pos-print-80{width:72mm}
.pos-print-a4{width:190mm;padding:12mm;font-size:12px}
.pos-receipt-head{text-align:center;border-bottom:1px dashed #000;padding-bottom:6px;margin-bottom:6px}
.pos-receipt-head strong,.pos-receipt-head span{display:block}
.pos-receipt-logo{display:block;max-width:34mm;max-height:16mm;object-fit:contain;margin:0 auto 4px}
.pos-receipt-customer{border-bottom:1px dashed #000;padding-bottom:6px;margin-bottom:6px}
.pos-print-thermal table,.pos-print-a4 table{width:100%;border-collapse:collapse}
.pos-print-thermal th,.pos-print-thermal td{font-size:9px;padding:3px 0;border-bottom:1px dotted #999;text-align:right}
.pos-print-thermal th:first-child,.pos-print-thermal td:first-child{text-align:left;width:42%}
.pos-print-thermal td span{font-size:8px;color:#333}
.pos-print-a4 th,.pos-print-a4 td{font-size:12px;padding:8px;border:1px solid #ddd;text-align:right}
.pos-print-a4 th:first-child,.pos-print-a4 td:first-child{text-align:left}
.pos-receipt-totals{margin-top:8px}
.pos-receipt-totals .grand{font-size:13px;border-top:1px solid #000;padding-top:5px;margin-top:4px}
.pos-receipt-qr{display:flex;flex-direction:column;align-items:center;gap:3px;margin-top:8px}
.pos-receipt-qr .qr-code{width:72px;height:72px}
.pos-receipt-qr .qr-code canvas,.pos-receipt-qr .qr-code img{width:72px!important;height:72px!important}
.pos-receipt-qr span{font-size:9px}
.pos-receipt-qr small{font-size:8px}
.pos-receipt-foot{text-align:center;border-top:1px dashed #000;margin-top:8px;padding-top:8px}

@media(max-width:1100px){
  .pos-topbar{align-items:flex-start;flex-direction:column}
  .pos-customer{grid-template-columns:repeat(2,minmax(0,1fr));max-width:none;width:100%}
  .pos-grid{grid-template-columns:1fr}
  .pos-cart-panel{position:static}
  .pos-reports{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:640px){
  .pos-customer,.pos-pay-modes,.pos-print-buttons,.pos-reports{grid-template-columns:1fr}
  .pos-quick-grid,.pos-mode-tabs{grid-template-columns:1fr}
  .pos-product-form{grid-template-columns:1fr}
  .pos-products{border-radius:8px}
  .pos-product-row{grid-template-columns:minmax(150px,1fr) 70px 72px;min-width:0}
  .pos-product-row>span:nth-child(2),.pos-product-row>span:nth-child(3),.pos-product-row>span:nth-child(4),.pos-product-row>span:nth-child(7),
  .pos-product-head span:nth-child(2),.pos-product-head span:nth-child(3),.pos-product-head span:nth-child(4),.pos-product-head span:nth-child(7){display:none}
  .pos-product-add{height:40px}
  .pos-checkout{position:sticky;bottom:8px;z-index:5;box-shadow:0 8px 20px rgba(15,23,42,.18)}
  .pos-cart-item{grid-template-columns:1fr;align-items:stretch}
  .pos-line-total{text-align:left}
}

@media print{
  #print-area .pos-print-thermal,#print-area .pos-print-a4{display:block!important;color:#000!important;box-shadow:none!important}
  #print-area .pos-print-thermal *{font-family:Arial,Helvetica,sans-serif!important}
  #print-area .pos-print-58{width:48mm!important;max-width:48mm!important}
  #print-area .pos-print-80{width:72mm!important;max-width:72mm!important}
  #print-area .pos-print-a4{width:190mm!important;max-width:190mm!important}
}

/* ── MISC ────────────────────────────────────── */
.empty{text-align:center;padding:60px 20px;color:var(--muted)}
.empty .icon{font-size:44px;margin-bottom:14px;display:block}
.actions{display:flex;gap:5px;flex-wrap:wrap}
.section-title{font-size:13px;font-weight:700;margin-bottom:14px;padding-bottom:8px;border-bottom:1px solid var(--border);color:var(--text)}

/* ── RESPONSIVE ──────────────────────────────── */
@media(max-width:900px){
  .sidebar{width:56px}
  .nav-label,.logo span,.nav-section{display:none}
  .page{padding:20px 16px}
  .form-grid{grid-template-columns:1fr}
  .stats-grid{grid-template-columns:1fr 1fr}
}
@media(max-width:600px){
  .stats-grid{grid-template-columns:1fr}
  .parties{grid-template-columns:1fr!important}
  .invoice-doc{padding:20px}
}

/* ── SECTION / CARD TITLES ──────────────────── */
.section-title{font-size:13px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin-bottom:16px}
.card-title{font-size:15px;font-weight:700;color:var(--text);margin-bottom:14px}

/* Data Migration */
.page-subtitle{color:var(--muted);font-size:13px;margin-top:4px}
.dm-trust-strip{display:flex;gap:8px;flex-wrap:wrap}
.dm-trust-strip span{font-size:12px;font-weight:700;color:#166534;background:#dcfce7;border:1px solid #bbf7d0;border-radius:999px;padding:7px 10px}
.dm-tabs{display:flex;gap:8px;margin-bottom:16px;overflow:auto}
.dm-tab{border:1px solid var(--border);background:#fff;color:#475569;border-radius:8px;padding:10px 14px;font-weight:700;font-size:13px;white-space:nowrap;cursor:pointer}
.dm-tab.active{background:#0f172a;color:#fff;border-color:#0f172a}
.dm-wizard{display:grid;gap:16px}
.dm-steps{display:flex;gap:8px;overflow:auto;padding-bottom:2px}
.dm-steps span{flex:0 0 auto;border:1px solid #e2e8f0;background:#fff;color:#64748b;border-radius:999px;padding:7px 10px;font-size:11px;font-weight:800;text-transform:uppercase}
.dm-steps span.active{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
.dm-grid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(280px,.85fr);gap:16px}
.dm-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:18px;box-shadow:0 8px 24px rgba(15,23,42,.04)}
.dm-panel-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px}
.dm-panel-head h3{font-size:15px;margin:0;color:#0f172a}
.dm-panel-head span{font-size:12px;color:#64748b}
.dm-drop{display:flex;min-height:148px;border:1.5px dashed #94a3b8;border-radius:8px;background:#f8fafc;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:22px;cursor:pointer;transition:.15s}
.dm-drop:hover,.dm-drop.drag{border-color:#2563eb;background:#eff6ff}
.dm-drop strong{font-size:15px;color:#0f172a}
.dm-drop small{max-width:480px;color:#64748b;margin-top:6px}
.dm-controls,.dm-export-grid{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px;align-items:center}
.dm-controls select,.dm-controls input,.dm-export-grid select,.dm-export-grid input,.dm-map-grid select,.dm-search{border:1px solid #cbd5e1;border-radius:8px;padding:9px 10px;background:#fff;min-height:38px;font-size:13px}
.dm-export-grid label{display:grid;gap:5px;min-width:180px}
.dm-export-grid span,.dm-map-grid span{font-size:12px;font-weight:700;color:#475569}
.dm-map-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}
.dm-map-grid label{display:grid;gap:6px;border:1px solid #e2e8f0;background:#fbfdff;border-radius:8px;padding:10px}
.dm-map-grid label.required-missing{border-color:#fecaca;background:#fff7f7}
.dm-map-grid b{font-size:10px;color:#dc2626;margin-left:6px}
.dm-preview-table{overflow:auto;border:1px solid #e2e8f0;border-radius:8px;margin-top:14px}
.dm-preview-table table{min-width:760px}
.dm-preview-table th{background:#f8fafc;color:#64748b;font-size:11px;text-transform:uppercase;padding:10px;border-bottom:1px solid #e2e8f0;text-align:left}
.dm-preview-table td{padding:10px;border-bottom:1px solid #f1f5f9;font-size:12px;color:#334155}
.dm-preview-table tr:last-child td{border-bottom:0}
.dm-row-bad td{background:#fef2f2;color:#991b1b}
.dm-row-warn td{background:#fffbeb;color:#92400e}
.dm-kpis,.dm-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px}
.dm-kpis div,.dm-stats div{border:1px solid #e2e8f0;background:#f8fafc;border-radius:8px;padding:12px}
.dm-kpis strong,.dm-stats strong{display:block;font-size:20px;color:#0f172a;text-transform:capitalize}
.dm-kpis span,.dm-stats span{font-size:11px;color:#64748b;font-weight:700;text-transform:uppercase}
.dm-stats .ok{background:#ecfdf5;border-color:#bbf7d0}.dm-stats .bad{background:#fef2f2;border-color:#fecaca}.dm-stats .warn{background:#fffbeb;border-color:#fde68a}
.dm-stats.compact{margin-bottom:10px}
.dm-sheet-list{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.dm-sheet-list span{font-size:12px;background:#f1f5f9;border-radius:999px;padding:7px 10px;color:#475569}
.dm-empty{display:grid;place-items:center;min-height:140px;text-align:center;color:#64748b}
.dm-empty strong{color:#0f172a}.dm-empty small{margin-top:5px}
.dm-progress{height:12px;background:#e2e8f0;border-radius:999px;overflow:hidden}
.dm-progress span{display:block;height:100%;background:linear-gradient(90deg,#2563eb,#16a34a);transition:width .25s}
.dm-job-report{margin-top:12px}
.dm-badge{display:inline-flex;border-radius:999px;padding:5px 9px;font-size:11px;font-weight:800;background:#f1f5f9;color:#475569}
.dm-badge.completed{background:#dcfce7;color:#166534}.dm-badge.failed{background:#fee2e2;color:#991b1b}.dm-badge.completed_with_errors{background:#fffbeb;color:#92400e}

/* GST Intelligence */
.gst-badge{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:3px 8px;font-size:11px;font-weight:800;line-height:1;border:1px solid transparent;vertical-align:middle}
.gst-badge.verified{background:#dcfce7;color:#166534;border-color:#bbf7d0}
.gst-badge.fetching{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe;position:relative;overflow:hidden}
.gst-badge.fetching:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);animation:gstShimmer 1.1s infinite}
.gst-badge.warning{background:#fffbeb;color:#92400e;border-color:#fde68a}
.gst-badge.invalid{background:#fef2f2;color:#991b1b;border-color:#fecaca}
.gst-autofilled{animation:gstAutofill .9s ease;border-color:#16a34a!important;box-shadow:0 0 0 3px rgba(22,163,74,.12)!important}
.gst-inline-hint{margin-top:6px;color:#475569;font-size:12px}
.hsn-intel-drop{position:fixed;z-index:10000;display:none;background:#fff;border:1px solid #cbd5e1;border-radius:8px;box-shadow:0 16px 42px rgba(15,23,42,.18);overflow:hidden;max-height:280px;overflow-y:auto}
.hsn-intel-drop button{width:100%;display:block;text-align:left;background:#fff;border:0;border-bottom:1px solid #f1f5f9;padding:10px 12px;cursor:pointer}
.hsn-intel-drop button:hover{background:#eff6ff}
.hsn-intel-drop strong{display:block;font-size:12px;color:#0f172a}
.hsn-intel-drop span{display:block;margin-top:3px;font-size:11px;color:#64748b}
@keyframes gstAutofill{0%{background:#ecfdf5}100%{background:transparent}}
@keyframes gstShimmer{100%{transform:translateX(100%)}}

@media (max-width: 900px){
  .dm-grid{grid-template-columns:1fr}
  .dm-panel-head{align-items:flex-start;flex-direction:column}
}

/* ── PREMIUM SAAS DASHBOARD ────────────────────────── */
.dashboard-grid { display: flex; flex-direction: column; gap: 32px; margin-bottom: 40px; }

/* ── Hero / Welcome Section ── */
.dash-hero-section {
  display: flex; justify-content: space-between; align-items: flex-end;
  background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
  padding: 0 0 24px; margin-bottom: 16px; border-bottom: 1px solid rgba(226,232,240,0.6);
  flex-wrap: wrap; gap: 20px;
}
.dash-hero-title { font-size: 28px; font-weight: 700; color: #0f172a; margin: 0 0 6px; letter-spacing: -0.8px; display: flex; align-items: center; gap: 8px; }
.wave { display: inline-block; animation: wave-animation 2.5s infinite; transform-origin: 70% 70%; }
@keyframes wave-animation {
  0% { transform: rotate(0.0deg) }
  10% { transform: rotate(14.0deg) }
  20% { transform: rotate(-8.0deg) }
  30% { transform: rotate(14.0deg) }
  40% { transform: rotate(-4.0deg) }
  50% { transform: rotate(10.0deg) }
  60% { transform: rotate(0.0deg) }
  100% { transform: rotate(0.0deg) }
}
.dash-hero-subtitle { font-size: 14px; color: #64748b; margin: 0 0 16px; font-weight: 400; }
.dash-hero-ai-insight {
  display: inline-flex; align-items: center; gap: 8px; background: linear-gradient(135deg, rgba(239,246,255,0.7), rgba(219,234,254,0.4));
  border: 1px solid rgba(191,219,254,0.6); padding: 8px 14px; border-radius: 8px;
  font-size: 13px; color: #1e40af; font-weight: 500; box-shadow: 0 2px 8px rgba(37,99,235,0.04);
}
.ai-sparkle { font-size: 14px; animation: sparkle-pulse 2s infinite alternate; }
@keyframes sparkle-pulse { 0% { opacity: 0.6; transform: scale(0.9); } 100% { opacity: 1; transform: scale(1.1); } }

.dash-hero-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-glass-chip {
  display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(226,232,240,0.8); padding: 6px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600; color: #475569;
  box-shadow: 0 2px 10px rgba(15,23,42,0.02); transition: all 0.2s ease;
}
.dash-glass-chip:hover { background: #fff; box-shadow: 0 4px 12px rgba(15,23,42,0.05); transform: translateY(-1px); }
.dash-glass-chip.trend-up { color: #059669; background: rgba(236,253,245,0.7); border-color: rgba(167,243,208,0.5); }
.dash-glass-chip.trend-down { color: #dc2626; background: rgba(254,242,242,0.7); border-color: rgba(254,202,202,0.5); }
.dash-glass-chip.health-good { color: #059669; }
.dash-glass-chip.health-warning { color: #d97706; }
.dash-glass-chip.health-danger { color: #dc2626; }

/* ── Premium Feedback Button ── */
.dash-feedback-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(59, 130, 246, 0.04));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  font-family: inherit;
  white-space: nowrap;
}

.dash-feedback-btn:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.08));
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

.dash-feedback-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.feedback-icon {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
}

.feedback-label {
  display: inline;
}

/* Mobile: hide label on small screens */
@media (max-width: 640px) {
  .feedback-label {
    display: none;
  }
  .dash-feedback-btn {
    padding: 6px 10px;
  }
}

/* ── AI Predictions ── */
.dash-predictions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.dash-prediction-card { background: var(--surface); border: 1px solid var(--border); padding: 20px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; transition: transform 0.2s ease; }
.dash-prediction-card:hover { transform: translateY(-2px); border-color: rgba(37, 99, 235, 0.2); }
.dash-prediction-icon-wrap { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--primary); background: var(--primary-light); margin-bottom: 4px; }
.dash-prediction-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.dash-prediction-value { font-size: 28px; font-weight: 600; color: var(--text); font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.dash-prediction-sub { font-size: 12px; color: var(--muted); }
.live-indicator-dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; box-shadow: 0 0 8px #10b981; animation: live-pulse 2s infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); } 70% { box-shadow: 0 0 0 6px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }

/* ── Section Headers ── */
.dash-section { margin-bottom: 32px; animation: dash-fade-up 0.4s ease forwards; opacity: 0; }
.dash-section-header { margin-bottom: 16px; display: flex; justify-content: space-between; align-items: flex-end; }
.dash-section-title { font-size: 16px; font-weight: 700; color: #0f172a; letter-spacing: -0.3px; margin: 0; }

/* ── Smart Action Cards ── */
.dash-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.dash-action-card {
  display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 14px 18px; cursor: pointer; position: relative; overflow: hidden;
  box-shadow: 0 1px 3px rgba(15,23,42,0.02); transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
}
.dash-action-card:hover {
  border-color: rgba(37,99,235,0.3); box-shadow: 0 8px 24px -6px rgba(37,99,235,0.12), 0 4px 12px -4px rgba(15,23,42,0.04);
  transform: translateY(-2px);
}
.dash-action-icon-wrap {
  width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
  transition: all 0.3s; box-shadow: inset 0 2px 4px rgba(255,255,255,0.5);
}
.dash-action-card:hover .dash-action-icon-wrap {
  background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #2563eb; transform: scale(1.08) rotate(-5deg);
}
.dash-action-content { flex: 1; min-width: 0; }
.dash-action-label { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 2px; }
.dash-action-tooltip { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-action-kbd {
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 600; color: #94a3b8;
  background: #f1f5f9; padding: 3px 6px; border-radius: 4px; border: 1px solid #e2e8f0;
  transition: all 0.2s;
}
.dash-action-card:hover .dash-action-kbd { background: #e2e8f0; color: #64748b; }

/* ── KPI Cards ── */
.dash-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.dash-kpi-card {
  background: #fff; border: 1px solid rgba(226,232,240,0.8); border-radius: 16px;
  position: relative; overflow: hidden; padding: 22px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.02), 0 1px 3px rgba(15,23,42,0.01);
  transition: all 0.3s cubic-bezier(0.16,1,0.3,1); display: flex; flex-direction: column;
}
.dash-kpi-card:hover {
  transform: translateY(-4px); box-shadow: 0 12px 32px rgba(15,23,42,0.06), 0 4px 12px rgba(15,23,42,0.03);
  border-color: rgba(226,232,240,1);
}
.dash-kpi-top-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; opacity: 0.8; }
.dash-kpi-card.blue .dash-kpi-top-bar { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.dash-kpi-card.amber .dash-kpi-top-bar { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.dash-kpi-card.red .dash-kpi-top-bar { background: linear-gradient(90deg, #ef4444, #f87171); }
.dash-kpi-card.green .dash-kpi-top-bar { background: linear-gradient(90deg, #10b981, #34d399); }
.dash-kpi-card.purple .dash-kpi-top-bar { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.dash-kpi-card.pink .dash-kpi-top-bar { background: linear-gradient(90deg, #ec4899, #f472b6); }
.dash-kpi-card.teal .dash-kpi-top-bar { background: linear-gradient(90deg, #14b8a6, #2dd4bf); }
.dash-kpi-card.gray .dash-kpi-top-bar { background: linear-gradient(90deg, #64748b, #94a3b8); }

.dash-kpi-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.dash-kpi-icon-wrap {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.6);
}
.dash-kpi-card.blue .dash-kpi-icon-wrap { background: #eff6ff; color: #2563eb; }
.dash-kpi-card.amber .dash-kpi-icon-wrap { background: #fffbeb; color: #d97706; }
.dash-kpi-card.red .dash-kpi-icon-wrap { background: #fef2f2; color: #dc2626; }
.dash-kpi-card.green .dash-kpi-icon-wrap { background: #ecfdf5; color: #059669; }
.dash-kpi-card.purple .dash-kpi-icon-wrap { background: #f5f3ff; color: #7c3aed; }
.dash-kpi-card.pink .dash-kpi-icon-wrap { background: #fdf2f8; color: #db2777; }
.dash-kpi-card.teal .dash-kpi-icon-wrap { background: #f0fdfa; color: #0d9488; }
.dash-kpi-card.gray .dash-kpi-icon-wrap { background: #f8fafc; color: #475569; }

.dash-kpi-body { flex: 1; }
.dash-kpi-title { font-size: 13px; font-weight: 600; color: #64748b; margin-bottom: 4px; }
.dash-kpi-value { font-size: 28px; font-weight: 700; color: #0f172a; font-family: 'DM Mono', monospace; letter-spacing: -0.5px; line-height: 1.1; margin-bottom: 8px; }
.dash-kpi-trend { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; margin-bottom: 8px; }
.dash-kpi-trend.up { background: #ecfdf5; color: #059669; }
.dash-kpi-trend.down { background: #fef2f2; color: #dc2626; }
.dash-kpi-trend.neutral { background: #f1f5f9; color: #64748b; }
.dash-kpi-micro-insight { font-size: 12px; color: #94a3b8; font-weight: 500; }
.dash-kpi-sparkline-wrap { margin-top: 16px; height: 36px; width: 100%; opacity: 0.8; }

/* ── Smart Empty States ── */
.dash-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center; background: rgba(255,255,255,0.6);
  border: 1px dashed rgba(203,213,225,0.8); border-radius: 16px; backdrop-filter: blur(4px);
}
.dash-empty-state.small { padding: 32px 24px; }
.dash-empty-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.8; }
.dash-empty-title { font-size: 15px; font-weight: 600; color: #1e293b; margin-bottom: 6px; }
.dash-empty-desc { font-size: 13px; color: #64748b; max-width: 300px; margin: 0 auto 16px; line-height: 1.5; }

/* ── Analytics & Trends (Charts) ── */
.dash-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }
.dash-chart-card {
  background: #fff; border: 1px solid rgba(226,232,240,0.8); border-radius: 16px;
  padding: 20px; box-shadow: 0 4px 12px rgba(15,23,42,0.02); transition: all 0.3s;
}
.dash-chart-card:hover { box-shadow: 0 8px 24px rgba(15,23,42,0.04); transform: translateY(-2px); }
.dash-chart-title { font-size: 14px; font-weight: 600; color: #0f172a; margin-bottom: 16px; }

/* ── Smart Overviews (Tables) ── */
.dash-table-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); gap: 24px; }
.dash-table-card { background: #fff; border: 1px solid rgba(226,232,240,0.8); border-radius: 16px; overflow: hidden; box-shadow: 0 4px 12px rgba(15,23,42,0.02); }
.dash-table-card .dash-table-title { padding: 16px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-size: 14px; font-weight: 600; color: #0f172a; }

/* ── AI Insights Cards ── */
.dash-insights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.dash-insight-card {
  background: linear-gradient(145deg, #ffffff, #f8fafc); border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.02); position: relative; overflow: hidden; transition: all 0.25s;
}
.dash-insight-card:hover { box-shadow: 0 8px 20px rgba(15,23,42,0.05); transform: translateY(-3px); }
.dash-insight-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.dash-insight-card.success::before { background: #10b981; }
.dash-insight-card.warning::before { background: #f59e0b; }
.dash-insight-card.danger::before { background: #ef4444; }
.dash-insight-card.info::before { background: #3b82f6; }
.dash-insight-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.dash-insight-title { font-size: 14px; font-weight: 600; color: #0f172a; }
.dash-insight-metric { font-size: 12px; font-weight: 600; color: #475569; padding: 2px 8px; background: #f1f5f9; border-radius: 6px; }
.dash-insight-message { font-size: 13px; color: #475569; line-height: 1.5; margin-bottom: 14px; }
.dash-insight-action { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #2563eb; cursor: pointer; transition: color 0.2s; }
.dash-insight-action:hover { color: #1d4ed8; }
.dash-insight-action svg { transition: transform 0.2s; }
.dash-insight-action:hover svg { transform: translateX(3px); }

/* ── Financial Health ── */
.dash-health-card {
  display: flex; align-items: center; gap: 24px; background: linear-gradient(145deg, #ffffff, #f8fafc);
  border: 1px solid rgba(226,232,240,0.8); border-radius: 16px; padding: 24px 32px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.02);
}
.dash-health-content { flex: 1; }
.dash-health-title { font-size: 18px; font-weight: 600; color: #0f172a; margin-bottom: 6px; letter-spacing: -0.2px; }
.dash-health-desc { font-size: 13px; color: #64748b; margin-bottom: 16px; }
.dash-health-progress-wrap { height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.dash-health-progress { height: 100%; border-radius: 4px; transition: width 1s cubic-bezier(0.16,1,0.3,1); }

@media(max-width:900px){
  .dash-chart-grid { grid-template-columns: 1fr; }
  .dash-table-grid { grid-template-columns: 1fr; }
}
@media(max-width:600px){
  .dash-hero-section { flex-direction: column; align-items: flex-start; }
  .dash-kpi-grid { grid-template-columns: 1fr; }
  .dash-actions-grid { grid-template-columns: 1fr; }
  .dash-health-card { flex-direction: column; align-items: flex-start; text-align: left; gap: 16px; padding: 20px; }
}

/* ── SIDEBAR TRANSITIONS ───────────────────────── */
.sidebar {
  transition: width .25s ease, transform .3s cubic-bezier(.4,0,.2,1);
}

/* ── SIDEBAR TOGGLE ───────────────────────────── */
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
  border-radius: 6px;
  transition: background .15s;
}
.sidebar-toggle:hover {
  background: var(--bg);
}

/* ── SIDEBAR OVERLAY ───────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 40;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
  display: block;
}

/* ── FLOATING TOGGLE ───────────────────────────── */
.sidebar-toggle-floating {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 55;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: background .15s, box-shadow .15s;
}
.sidebar-toggle-floating:hover {
  background: var(--bg);
  box-shadow: var(--shadow-lg);
}
.sidebar-toggle-floating.visible {
  display: flex;
}

/* ── DESKTOP COLLAPSED (ICON-ONLY) ───────────── */
@media (min-width: 769px) {
  .sidebar {
    transition: width .25s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.collapsed {
    width: 72px;
    padding-left: 0;
    padding-right: 0;
  }
  .sidebar.collapsed .logo {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
  }
  .sidebar.collapsed .logo .sidebar-toggle {
    margin: 0;
    padding: 6px;
  }
  .sidebar.collapsed .logo span,
  .sidebar.collapsed .nav-section,
  .sidebar.collapsed .nav-label {
    display: none;
  }
  .sidebar.collapsed nav a {
    justify-content: center;
    padding: 10px 0;
    margin: 0 10px;
    border-radius: 10px;
  }
  .sidebar.collapsed nav a .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    margin: 0;
  }
  .sidebar.collapsed nav a.active {
    position: relative;
  }
  .sidebar.collapsed nav a.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
  }
  /* Tooltip */
  .sidebar.collapsed nav a {
    position: relative;
  }
  .sidebar.collapsed nav a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s, visibility .18s, transform .18s;
    pointer-events: none;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
  }
  .sidebar.collapsed nav a:hover::after {
    opacity: 1;
    visibility: visible;
  }
}

/* ── MOBILE SIDEBAR DRAWER ─────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    width: 260px;
    box-shadow: none;
    border-right: none;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
  }
  .sidebar.mobile-open .nav-label,
  .sidebar.mobile-open .logo span,
  .sidebar.mobile-open .nav-section {
    display: block;
  }
  .sidebar.mobile-open nav a {
    justify-content: flex-start;
  }
  .sidebar-overlay.active {
    display: block;
  }
  body.drawer-open {
    overflow: hidden;
  }
}

/* ── TEAM MANAGEMENT ─────────────────────────── */

/* Header */
.tm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.tm-header-text h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: #0f172a;
  margin: 0 0 4px;
}
.tm-header-text p {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

/* Stats */
.tm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.tm-stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: box-shadow .2s, transform .2s;
}
.tm-stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
.tm-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.tm-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  font-family: 'DM Mono', monospace;
}
.tm-stat-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}

/* Card */
.tm-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  overflow: hidden;
}

/* Action bar */
.tm-actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
  flex-wrap: wrap;
}
.tm-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}
.tm-search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  color: #0f172a;
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.tm-search-wrap input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.tm-search-wrap input::placeholder {
  color: #94a3b8;
}
.tm-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}
.tm-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tm-filters select {
  padding: 8px 28px 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #334155;
  background: #fff;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  min-width: 130px;
}
.tm-filters select:focus {
  border-color: #2563eb;
}

/* Table */
.tm-table-wrap {
  overflow-x: auto;
}
.tm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tm-table thead th {
  text-align: left;
  padding: 12px 20px;
  color: #64748b;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  white-space: nowrap;
}
.tm-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid #f8fafc;
  vertical-align: middle;
}
.tm-table tbody tr {
  transition: background .15s;
}
.tm-table tbody tr:hover {
  background: #fafbfc;
}
.tm-table tbody tr:last-child td {
  border-bottom: none;
}

/* User cell */
.tm-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: .5px;
}
.tm-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tm-user-name {
  font-weight: 600;
  color: #0f172a;
  font-size: 14px;
}
.tm-user-email {
  font-size: 12.5px;
  color: #64748b;
}

/* Role badges */
.tm-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: .02em;
}
.tm-role-admin {
  background: #dbeafe;
  color: #1e40af;
}
.tm-role-accountant {
  background: #d1fae5;
  color: #065f46;
}
.tm-role-sales {
  background: #fce7f3;
  color: #9d174d;
}
.tm-role-viewer {
  background: #f3f4f6;
  color: #4b5563;
}
.tm-role-default {
  background: #e2e8f0;
  color: #334155;
}

/* Status */
.tm-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.tm-status.active {
  background: #f0fdf4;
  color: #15803d;
}
.tm-status.inactive {
  background: #fef2f2;
  color: #b91c1c;
}
.tm-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.tm-status.active .tm-status-dot {
  box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.tm-status.inactive .tm-status-dot {
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}

/* Department / Phone / Last Login */
.tm-dept, .tm-phone, .tm-last-login {
  font-size: 13px;
  color: #475569;
}
.tm-last-login {
  color: #64748b;
  font-size: 12.5px;
}

/* Actions dropdown */
.tm-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
}
.tm-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.tm-action-btn:hover {
  background: #f1f5f9;
  color: #475569;
}
.tm-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,.1);
  padding: 6px;
  min-width: 160px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(.97);
  transition: opacity .15s, visibility .15s, transform .15s;
  pointer-events: none;
}
.tm-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.tm-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #334155;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background .1s;
}
.tm-dropdown button:hover {
  background: #f8fafc;
}
.tm-dropdown button.danger {
  color: #dc2626;
}
.tm-dropdown button.danger:hover {
  background: #fef2f2;
}
.tm-dropdown button.success {
  color: #16a34a;
}
.tm-dropdown button.success:hover {
  background: #f0fdf4;
}

/* Empty state */
.tm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
}
.tm-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: .5;
}
.tm-empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 6px;
}
.tm-empty p {
  font-size: 13.5px;
  color: #94a3b8;
  margin: 0 0 18px;
}

/* ── MODAL ───────────────────────────────────── */
.tm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15,23,42,.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.tm-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}
.tm-modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 30px 100px rgba(0,0,0,.18);
  transform: scale(.95) translateY(12px);
  transition: transform .28s cubic-bezier(.16,1,.3,1);
  position: relative;
  display: flex;
  flex-direction: column;
}
.tm-modal-overlay.visible .tm-modal {
  transform: scale(1) translateY(0);
}
.tm-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 28px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
  background: #fff;
}
.tm-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}
.tm-modal-subtitle {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.4;
}
.tm-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  margin-top: 2px;
}
.tm-modal-close:hover {
  background: #f1f5f9;
  color: #475569;
}
#tm-modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Two-column modal body */
.tm-modal-body-two-col {
  display: flex;
  gap: 0;
  min-height: 0;
}
.tm-modal-left {
  width: 340px;
  flex-shrink: 0;
  padding: 24px 28px;
  border-right: 1px solid #f1f5f9;
}
.tm-modal-right {
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
  overflow-y: auto;
  max-height: 52vh;
}
.tm-panel-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 16px;
}
.tm-field {
  margin-bottom: 16px;
}
.tm-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: 0;
}
.tm-field .form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  color: #0f172a;
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.tm-field .form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.tm-field .form-control:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}
.tm-field select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.tm-hint {
  font-size: 12px;
  color: #94a3b8;
  margin: 5px 0 0;
  line-height: 1.4;
}
.tm-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
  flex-shrink: 0;
}

/* Temp password */
.tm-temp-password {
  text-align: center;
  padding: 40px 24px;
}
.tm-temp-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.tm-temp-password h3 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
}
.tm-temp-password p {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 20px;
  line-height: 1.5;
}
.tm-password-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px 28px;
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  letter-spacing: 2px;
  margin-bottom: 20px;
  display: inline-block;
}
.tm-temp-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── PERMISSION ACCORDION ────────────────────── */
.tm-perm-accordion {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tm-perm-group {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.tm-perm-group.open {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.tm-perm-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: #fafbfc;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  text-align: left;
  transition: background .12s;
}
.tm-perm-group-header:hover {
  background: #f1f5f9;
}
.tm-perm-chevron {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: transform .2s, color .15s;
  flex-shrink: 0;
}
.tm-perm-group.open .tm-perm-chevron {
  transform: rotate(90deg);
  color: #475569;
}
.tm-perm-group-name {
  flex: 1;
  min-width: 0;
}
.tm-perm-group-count {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}
.tm-perm-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px 0;
}
.tm-perm-group-toggle input {
  width: 15px;
  height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}
.tm-perm-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s cubic-bezier(.4,0,.2,1), padding .25s;
}
.tm-perm-group.open .tm-perm-group-body {
  max-height: 500px;
  padding: 0 14px 14px;
}
.tm-perm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}
.tm-perm-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  user-select: none;
  transition: background .1s, border-color .1s;
}
.tm-perm-action:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.tm-perm-action input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── EMPTY (legacy pages) ────────────────────── */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty .icon {
  font-size: 48px;
  margin-bottom: 18px;
  opacity: .45;
  display: block;
  transition: opacity .3s, transform .3s;
}
.empty:hover .icon {
  opacity: .6;
  transform: scale(1.05);
}
.empty p {
  font-size: 14px;
  margin: 0 0 18px;
  line-height: 1.6;
  color: var(--muted);
  font-weight: 400;
}
.empty small {
  font-size: 12px;
  color: #94a3b8;
}

/* ── EMPTY STATES ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--muted);
}
.empty-state-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 22px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.05);
  transition: transform .3s, box-shadow .3s;
}
.empty-state:hover .empty-state-icon {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(15,23,42,0.08);
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
  letter-spacing: -0.1px;
}
.empty-state p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 22px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
  font-weight: 400;
}

/* ── SKELETON LOADERS ────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { margin-bottom: 0; }
.skeleton-title { height: 18px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.skeleton-table-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}
.skeleton-table-row:last-child { border-bottom: none; }

/* ── RESPONSIVE TABLES ───────────────────────── */
@media (max-width: 768px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 720px; }
  .page { padding: 20px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header h1, .page-header h2 { font-size: 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .btn { padding: 7px 14px; font-size: 12.5px; }
  .actions { flex-wrap: wrap; }
  .modal { max-width: 100%; border-radius: 14px 14px 0 0; margin-top: auto; max-height: 85vh; }
  #modal-overlay { align-items: flex-end; padding: 0; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .sidebar { width: 260px; }
  .page { padding: 16px; }
  .page-header { margin-bottom: 16px; }
  .table-wrap { border-radius: 8px; }
  th, td { padding: 8px 10px; font-size: 12.5px; }
}

/* ── RESPONSIVE TEAM ─────────────────────────── */
@media (max-width: 1024px) {
  .tm-stats { grid-template-columns: repeat(2, 1fr); }
  .tm-modal { max-width: 720px; }
  .tm-modal-right { max-height: 45vh; }
}
@media (max-width: 768px) {
  .tm-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tm-stat-card { padding: 14px; gap: 10px; }
  .tm-stat-icon { width: 36px; height: 36px; font-size: 16px; }
  .tm-stat-value { font-size: 18px; }
  .tm-header { flex-direction: column; align-items: flex-start; }
  .tm-actionbar { flex-direction: column; align-items: stretch; }
  .tm-search-wrap { max-width: none; }
  .tm-filters { width: 100%; }
  .tm-filters select { flex: 1; }
  .tm-table thead th:nth-child(5),
  .tm-table tbody td:nth-child(5) { display: none; } /* hide phone */

  /* Modal: stacked layout on tablet */
  .tm-modal { max-width: 100%; border-radius: 14px 14px 0 0; margin-top: auto; max-height: 90vh; }
  .tm-modal-overlay { align-items: flex-end; padding: 0; }
  .tm-modal-body-two-col { flex-direction: column; }
  .tm-modal-left { width: 100%; border-right: none; border-bottom: 1px solid #f1f5f9; padding: 20px 24px; }
  .tm-modal-right { padding: 20px 24px; max-height: 35vh; }
  .tm-modal-header { padding: 18px 24px; }
  .tm-modal-footer { padding: 14px 24px; }
}
@media (max-width: 480px) {
  .tm-stats { grid-template-columns: 1fr 1fr; }
  .tm-table thead th:nth-child(3),
  .tm-table tbody td:nth-child(3) { display: none; } /* hide dept */
  .tm-table thead th:nth-child(7),
  .tm-table tbody td:nth-child(7) { display: none; } /* hide last active */
  .tm-form-grid { grid-template-columns: 1fr; }
  .tm-modal-left, .tm-modal-right { padding: 16px 20px; }
  .tm-modal-header { padding: 16px 20px; }
  .tm-modal-footer { padding: 12px 20px; }
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green {
  background: #d1fae5;
  color: #065f46;
}
.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

/* ── PAGE ERROR BOUNDARY ─────────────────────── */
.page-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  max-width: 480px;
  margin: 0 auto;
  animation: fade-in-up 300ms ease;
}
.page-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
  line-height: 1;
}
.page-error h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}
.page-error p {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 20px;
  line-height: 1.5;
}
.page-error-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.page-error-hint {
  margin-top: 12px;
  font-size: 12px;
  color: #94a3b8;
}

/* ── FADE TRANSITIONS ──────────────────────────── */
.page {
  transition: opacity 220ms ease, transform 220ms ease;
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── SPINNER ─────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  display: inline-block;
  animation: spin 1s linear infinite;
}

/* ════════════════════════════════════════════════════════════
   PREMIUM COMMAND CENTER DASHBOARD
   ════════════════════════════════════════════════════════════ */

:root {
  --dash-bg: #f6f8fc;
  --dash-surface: rgba(255,255,255,0.88);
  --dash-surface-solid: #ffffff;
  --dash-border: rgba(226,232,240,0.65);
  --dash-text: #0f172a;
  --dash-text-secondary: #334155;
  --dash-muted: #64748b;
  --dash-muted-light: #94a3b8;
  --dash-primary: #2563eb;
  --dash-primary-light: #eff6ff;
  --dash-success: #10b981;
  --dash-warn: #f59e0b;
  --dash-danger: #ef4444;
  --dash-purple: #8b5cf6;
  --dash-pink: #ec4899;
  --dash-teal: #14b8a6;
  --dash-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.02);
  --dash-shadow-sm: 0 2px 8px rgba(15,23,42,0.04);
  --dash-shadow-md: 0 4px 20px rgba(15,23,42,0.06);
  --dash-shadow-lg: 0 8px 32px rgba(15,23,42,0.08);
  --dash-shadow-xl: 0 20px 60px rgba(15,23,42,0.10);
  --dash-glow-primary: 0 0 0 3px rgba(37,99,235,0.08);
  --dash-radius: 18px;
  --dash-radius-sm: 14px;
  --dash-radius-xs: 10px;
}

@keyframes dash-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dash-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dash-scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes dash-pulse-soft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.15); }
  50%      { box-shadow: 0 0 0 6px rgba(37,99,235,0); }
}

/* ── Top Business Summary Bar ──────────────────────────────── */
.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  padding: 16px 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 60%, #f1f5f9 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  box-shadow: var(--dash-shadow-sm);
  animation: dash-fade-up 500ms cubic-bezier(.16,1,.3,1) forwards;
}
.dash-topbar-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.dash-topbar-date {
  font-size: 11px; font-weight: 500; color: var(--dash-muted-light);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 5px 12px; background: #f1f5f9; border-radius: 20px;
}
.dash-topbar-company {
  font-size: 17px; font-weight: 600; color: var(--dash-text);
  letter-spacing: -0.25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-topbar-health {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 20px;
  transition: transform .15s;
}
.dash-topbar-health.good { background: linear-gradient(135deg, #d1fae5, #ecfdf5); color: #065f46; }
.dash-topbar-health.warning { background: linear-gradient(135deg, #fef3c7, #fffbeb); color: #92400e; }
.dash-topbar-health.danger { background: linear-gradient(135deg, #fee2e2, #fef2f2); color: #991b1b; }
.dash-topbar-right { display: flex; align-items: center; gap: 10px; }
.dash-topbar-team {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dash-muted); font-weight: 500;
}
.dash-topbar-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--dash-primary), #6366f1);
  color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(37,99,235,0.18);
  transition: transform .2s;
}
.dash-topbar-avatar:hover { transform: scale(1.1); }
.dash-search {
  position: relative;
}
.dash-search input {
  padding: 9px 14px 9px 36px; border: 1px solid var(--dash-border); border-radius: var(--dash-radius-xs);
  font-size: 13px; background: #f8fafc; width: 200px; transition: all .25s cubic-bezier(.4,0,.2,1);
  color: var(--dash-text);
}
.dash-search input:focus { width: 260px; background: #fff; border-color: var(--dash-primary); outline: none; box-shadow: var(--dash-glow-primary); }
.dash-search input::placeholder { color: var(--dash-muted-light); }
.dash-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--dash-muted-light); pointer-events: none;
}
.dash-icon-btn {
  width: 38px; height: 38px; border-radius: var(--dash-radius-xs); border: 1px solid var(--dash-border);
  background: #fff; color: var(--dash-muted); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: all .2s cubic-bezier(.4,0,.2,1); position: relative;
}
.dash-icon-btn:hover { background: var(--dash-primary-light); color: var(--dash-primary); border-color: #bfdbfe; transform: translateY(-2px); box-shadow: var(--dash-shadow-md); }
.dash-icon-btn:active { transform: translateY(0) scale(0.96); }
.dash-icon-btn .badge-dot {
  position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--dash-danger); border: 2px solid #fff;
}

/* ── Quick Action Center ─────────────────────────────────── */
.dash-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.dash-action-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 12px; background: var(--dash-surface-solid);
  border: 1px solid var(--dash-border); border-radius: var(--dash-radius-sm);
  cursor: pointer; transition: all .25s cubic-bezier(.4,0,.2,1);
  text-decoration: none; color: var(--dash-text); position: relative;
  animation: dash-fade-up 400ms cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.dash-action-card:hover {
  transform: translateY(-4px); box-shadow: var(--dash-shadow-lg);
  border-color: rgba(37,99,235,0.18); background: #fff;
}
.dash-action-card:active { transform: translateY(-1px) scale(0.97); }
.dash-action-icon {
  width: 44px; height: 44px; border-radius: var(--dash-radius-xs);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; background: linear-gradient(135deg, #eff6ff, #dbeafe);
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
  transition: transform .25s, box-shadow .25s;
}
.dash-action-card:hover .dash-action-icon {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(37,99,235,0.14);
}
.dash-action-label { font-size: 12px; font-weight: 500; color: var(--dash-text-secondary); text-align: center; letter-spacing: -0.1px; }
.dash-action-shortcut {
  font-size: 10px; color: var(--dash-muted-light); background: #f1f5f9;
  padding: 3px 7px; border-radius: 5px; font-family: 'DM Mono', monospace; font-weight: 500;
}

/* ── KPI Cards ───────────────────────────────────────────── */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px; margin-bottom: 28px;
}
.dash-kpi-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--dash-shadow-sm);
  animation: dash-fade-up 450ms cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--i, 0) * 50ms);
}
.dash-kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--dash-primary), #6366f1); opacity: 0.7;
  transition: opacity .3s;
}
.dash-kpi-card:hover { transform: translateY(-4px); box-shadow: var(--dash-shadow-lg); border-color: rgba(37,99,235,0.18); }
.dash-kpi-card:hover::before { opacity: 1; }
.dash-kpi-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.dash-kpi-icon {
  width: 42px; height: 42px; border-radius: var(--dash-radius-xs);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  transition: transform .3s, box-shadow .3s;
}
.dash-kpi-card:hover .dash-kpi-icon { transform: scale(1.08); }
.dash-kpi-icon.blue { background: linear-gradient(135deg, #dbeafe, #eff6ff); box-shadow: 0 2px 8px rgba(37,99,235,0.10); }
.dash-kpi-icon.green { background: linear-gradient(135deg, #d1fae5, #ecfdf5); box-shadow: 0 2px 8px rgba(16,185,129,0.10); }
.dash-kpi-icon.amber { background: linear-gradient(135deg, #fef3c7, #fffbeb); box-shadow: 0 2px 8px rgba(245,158,11,0.10); }
.dash-kpi-icon.red { background: linear-gradient(135deg, #fee2e2, #fef2f2); box-shadow: 0 2px 8px rgba(239,68,68,0.10); }
.dash-kpi-icon.purple { background: linear-gradient(135deg, #ede9fe, #f5f3ff); box-shadow: 0 2px 8px rgba(139,92,246,0.10); }
.dash-kpi-icon.teal { background: linear-gradient(135deg, #ccfbf1, #f0fdfa); box-shadow: 0 2px 8px rgba(20,184,166,0.10); }
.dash-kpi-icon.pink { background: linear-gradient(135deg, #fce7f3, #fdf2f8); box-shadow: 0 2px 8px rgba(236,72,153,0.10); }
.dash-kpi-icon.gray { background: linear-gradient(135deg, #f1f5f9, #f8fafc); box-shadow: 0 2px 8px rgba(100,116,139,0.08); }
.dash-kpi-badge {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; gap: 3px;
}
.dash-kpi-badge.up { background: linear-gradient(135deg, #d1fae5, #ecfdf5); color: #065f46; }
.dash-kpi-badge.down { background: linear-gradient(135deg, #fee2e2, #fef2f2); color: #991b1b; }
.dash-kpi-badge.neutral { background: linear-gradient(135deg, #f1f5f9, #f8fafc); color: #475569; }
.dash-kpi-label { font-size: 11px; font-weight: 500; color: var(--dash-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.dash-kpi-value {
  font-size: 24px; font-weight: 600; color: var(--dash-text); margin-top: 8px;
  font-family: 'DM Mono', monospace; letter-spacing: -0.6px;
}
.dash-kpi-sub { font-size: 12px; color: var(--dash-muted-light); margin-top: 5px; font-weight: 400; }
.dash-kpi-sparkline {
  margin-top: 14px; height: 40px; display: flex; align-items: flex-end; gap: 2px;
}
.dash-kpi-sparkline svg { width: 100%; height: 100%; }

/* ── Section Containers ────────────────────────────────── */
.dash-section { margin-bottom: 32px; }
.dash-section-title {
  font-size: 13px; font-weight: 600; color: var(--dash-text);
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.15px;
  animation: dash-fade-up 400ms cubic-bezier(.16,1,.3,1) forwards;
}
.dash-section-title .section-icon {
  width: 30px; height: 30px; border-radius: var(--dash-radius-xs);
  background: linear-gradient(135deg, var(--dash-primary-light), #dbeafe);
  color: var(--dash-primary); display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
}

/* ── AI Insights ─────────────────────────────────────────── */
.dash-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.dash-insight-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  padding: 20px;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--dash-shadow-sm);
  position: relative; overflow: hidden;
  animation: dash-fade-up 450ms cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.dash-insight-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.dash-insight-card.alert::before { background: linear-gradient(180deg, var(--dash-danger), #f87171); }
.dash-insight-card.warning::before { background: linear-gradient(180deg, var(--dash-warn), #fbbf24); }
.dash-insight-card.info::before { background: linear-gradient(180deg, var(--dash-primary), #60a5fa); }
.dash-insight-card.success::before { background: linear-gradient(180deg, var(--dash-success), #34d399); }
.dash-insight-card:hover { transform: translateY(-3px); box-shadow: var(--dash-shadow-lg); border-color: rgba(37,99,235,0.15); }
.dash-insight-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.dash-insight-title { font-size: 13px; font-weight: 600; color: var(--dash-text); letter-spacing: -0.1px; }
.dash-insight-metric {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: #f1f5f9; color: var(--dash-muted);
}
.dash-insight-message { font-size: 13px; color: var(--dash-text-secondary); line-height: 1.6; margin-bottom: 12px; font-weight: 400; }
.dash-insight-action {
  font-size: 12px; color: var(--dash-primary); font-weight: 500; background: var(--dash-primary-light);
  padding: 6px 12px; border-radius: 8px; display: inline-block;
  transition: all .15s;
}
.dash-insight-action:hover { background: #dbeafe; }

/* ── Health Score Ring ───────────────────────────────────── */
.dash-health-ring {
  display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
}
.dash-health-ring svg { transform: rotate(-90deg); }
.dash-health-ring .score-label { font-size: 11px; font-weight: 600; color: var(--dash-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dash-health-ring .score-value { font-size: 20px; font-weight: 700; font-family: 'DM Mono', monospace; }

/* ── Charts ──────────────────────────────────────────────── */
.dash-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 18px; margin-bottom: 28px;
}
.dash-chart-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  padding: 22px;
  box-shadow: var(--dash-shadow-sm);
  transition: all .3s cubic-bezier(.4,0,.2,1);
  animation: dash-fade-up 450ms cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.dash-chart-card:hover { box-shadow: var(--dash-shadow-lg); border-color: rgba(37,99,235,0.15); transform: translateY(-2px); }
.dash-chart-title { font-size: 13px; font-weight: 600; color: var(--dash-text); margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; letter-spacing: -0.1px; }
.dash-chart-container { position: relative; height: 260px; }
.dash-chart-container.small { height: 200px; }

/* ── Smart Tables ────────────────────────────────────────── */
.dash-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 18px; margin-bottom: 28px;
}
.dash-table-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  padding: 0;
  box-shadow: var(--dash-shadow-sm);
  overflow: hidden;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  animation: dash-fade-up 450ms cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.dash-table-card:hover { box-shadow: var(--dash-shadow-lg); border-color: rgba(37,99,235,0.12); }
.dash-table-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--dash-border);
  background: linear-gradient(135deg, #ffffff, #f8fafc);
}
.dash-table-header h4 { font-size: 13px; font-weight: 600; color: var(--dash-text); margin: 0; letter-spacing: -0.1px; }
.dash-table-header .table-actions { display: flex; gap: 8px; }
.dash-table-header .table-actions button {
  font-size: 11px; font-weight: 500; padding: 5px 11px; border-radius: 8px;
  border: 1px solid var(--dash-border); background: #fff; color: var(--dash-muted); cursor: pointer;
  transition: all .15s;
}
.dash-table-header .table-actions button:hover { background: var(--dash-primary-light); color: var(--dash-primary); border-color: #bfdbfe; transform: translateY(-1px); }
.dash-table-body { padding: 0; max-height: 320px; overflow: auto; }
.dash-table-body table { width: 100%; border-collapse: collapse; }
.dash-table-body th {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9); padding: 11px 16px; text-align: left; font-size: 10px;
  font-weight: 600; color: var(--dash-muted); text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--dash-border); position: sticky; top: 0; z-index: 1;
}
.dash-table-body td { padding: 11px 16px; border-bottom: 1px solid #f1f5f9; font-size: 13px; color: var(--dash-text-secondary); vertical-align: middle; transition: background .12s; }
.dash-table-body tr { transition: background .12s; }
.dash-table-body tr:hover td { background: #f8fafc; }
.dash-table-body tr:last-child td { border-bottom: none; }
.dash-table-body .cell-amount { font-family: 'DM Mono', monospace; font-weight: 600; color: var(--dash-text); letter-spacing: -0.3px; }
.dash-table-body .cell-client { font-weight: 500; color: var(--dash-text); }
.dash-table-body .cell-muted { color: var(--dash-muted); font-size: 12px; }
.dash-table-body .cell-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
}
.dash-table-body .cell-badge.paid { background: linear-gradient(135deg, #d1fae5, #ecfdf5); color: #065f46; }
.dash-table-body .cell-badge.unpaid { background: linear-gradient(135deg, #fef3c7, #fffbeb); color: #92400e; }
.dash-table-body .cell-badge.overdue { background: linear-gradient(135deg, #fee2e2, #fef2f2); color: #991b1b; }
.dash-table-body .cell-badge.pending { background: linear-gradient(135deg, #f1f5f9, #f8fafc); color: #475569; }

/* ── Alert Center ──────────────────────────────────────────── */
.dash-alerts-list {
  display: flex; flex-direction: column; gap: 12px;
}
.dash-alert-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px; background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--dash-border); border-radius: var(--dash-radius-sm);
  box-shadow: var(--dash-shadow-sm); transition: all .25s cubic-bezier(.4,0,.2,1);
  animation: dash-fade-up 400ms cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.dash-alert-item:hover { transform: translateX(6px); box-shadow: var(--dash-shadow-md); border-color: rgba(37,99,235,0.12); }
.dash-alert-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.dash-alert-content { flex: 1; min-width: 0; }
.dash-alert-title { font-size: 13px; font-weight: 600; color: var(--dash-text); margin-bottom: 3px; letter-spacing: -0.1px; }
.dash-alert-message { font-size: 12px; color: var(--dash-text-secondary); line-height: 1.5; font-weight: 400; }
.dash-alert-priority {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 3px 9px; border-radius: 20px; flex-shrink: 0;
}
.dash-alert-priority.high { background: linear-gradient(135deg, #fee2e2, #fef2f2); color: #991b1b; }
.dash-alert-priority.medium { background: linear-gradient(135deg, #fef3c7, #fffbeb); color: #92400e; }
.dash-alert-priority.low { background: linear-gradient(135deg, #e0e7ff, #eef2ff); color: #3730a3; }

/* ── AI Assistant Panel ──────────────────────────────────── */
.dash-ai-float {
  position: fixed; bottom: 24px; right: 24px; z-index: 90;
}
.dash-ai-toggle {
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--dash-primary), #6366f1);
  color: #fff; font-size: 22px; cursor: pointer; box-shadow: 0 6px 22px rgba(37,99,235,0.30);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .3s cubic-bezier(.4,0,.2,1); animation: dash-pulse-soft 3s infinite;
}
.dash-ai-toggle:hover { transform: scale(1.1); box-shadow: 0 10px 32px rgba(37,99,235,0.40); }
.dash-ai-panel {
  position: absolute; bottom: 68px; right: 0; width: 360px; max-height: 500px;
  background: var(--dash-surface-solid); border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius); box-shadow: var(--dash-shadow-xl);
  display: none; flex-direction: column; overflow: hidden;
  animation: dash-scale-in 250ms cubic-bezier(.16,1,.3,1) forwards;
}
.dash-ai-panel.open { display: flex; }
.dash-ai-header {
  padding: 16px 20px; border-bottom: 1px solid var(--dash-border);
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, var(--dash-primary-light), #dbeafe);
}
.dash-ai-header h4 { font-size: 14px; font-weight: 600; color: var(--dash-primary); margin: 0; letter-spacing: -0.1px; }
.dash-ai-close { background: none; border: none; color: var(--dash-muted); cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 6px; transition: all .15s; }
.dash-ai-close:hover { background: rgba(37,99,235,0.08); color: var(--dash-primary); }
.dash-ai-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.dash-ai-message {
  padding: 11px 15px; border-radius: 14px; font-size: 13px; line-height: 1.55; max-width: 90%; font-weight: 400;
  animation: dash-fade-up 200ms ease forwards;
}
.dash-ai-message.bot { background: #f8fafc; color: var(--dash-text-secondary); align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(15,23,42,0.04); }
.dash-ai-message.user { background: linear-gradient(135deg, var(--dash-primary), #6366f1); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; box-shadow: 0 4px 12px rgba(37,99,235,0.20); }
.dash-ai-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.dash-ai-suggestion {
  font-size: 11px; font-weight: 500; padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--dash-border); background: #fff; color: var(--dash-primary); cursor: pointer;
  transition: all .15s;
}
.dash-ai-suggestion:hover { background: var(--dash-primary-light); border-color: #bfdbfe; transform: translateY(-1px); }
.dash-ai-input-row {
  display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--dash-border); background: #f8fafc;
}
.dash-ai-input-row input {
  flex: 1; padding: 9px 14px; border: 1px solid var(--dash-border); border-radius: var(--dash-radius-xs); font-size: 13px; background: #fff; color: var(--dash-text);
  transition: all .2s;
}
.dash-ai-input-row input:focus { border-color: var(--dash-primary); outline: none; box-shadow: var(--dash-glow-primary); }
.dash-ai-input-row button {
  padding: 9px 16px; border: none; border-radius: var(--dash-radius-xs); background: var(--dash-primary); color: #fff;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s;
}
.dash-ai-input-row button:hover { background: var(--dash-primary-h, #1d4ed8); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.20); }

/* ── Predictions Panel ───────────────────────────────────── */
.dash-predictions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.dash-prediction-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--dash-border); border-radius: var(--dash-radius-sm);
  padding: 20px; text-align: center; box-shadow: var(--dash-shadow-sm);
  transition: all .3s cubic-bezier(.4,0,.2,1);
  animation: dash-fade-up 450ms cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.dash-prediction-card:hover { transform: translateY(-3px); box-shadow: var(--dash-shadow-lg); border-color: rgba(37,99,235,0.15); }
.dash-prediction-icon { font-size: 26px; margin-bottom: 10px; transition: transform .3s; }
.dash-prediction-card:hover .dash-prediction-icon { transform: scale(1.1); }
.dash-prediction-label { font-size: 11px; font-weight: 500; color: var(--dash-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.dash-prediction-value { font-size: 19px; font-weight: 600; color: var(--dash-text); margin-top: 6px; font-family: 'DM Mono', monospace; letter-spacing: -0.4px; }
.dash-prediction-sub { font-size: 11px; color: var(--dash-muted-light); margin-top: 5px; font-weight: 400; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .dash-chart-grid { grid-template-columns: 1fr; }
  .dash-table-grid { grid-template-columns: 1fr; }
  .dash-insights-grid { grid-template-columns: 1fr; }
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-actions { grid-template-columns: repeat(3, 1fr); }
  .dash-ai-panel { width: 320px; right: -20px; }
}

/* ── CLIENT FILTER TOOLBAR ───────────────────── */
.filter-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 20px;margin-bottom:20px;box-shadow:var(--shadow)}
.filter-toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.filter-search{position:relative;flex:1;min-width:260px}
.filter-search-icon{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--muted);pointer-events:none}
.filter-search-input{width:100%;padding:8px 12px 8px 34px;border:1px solid var(--border);border-radius:8px;font-size:13px;outline:none;transition:border .12s,box-shadow .12s;background:var(--surface)}
.filter-search-input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.filter-group{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.filter-select{padding:8px 28px 8px 10px;border:1px solid var(--border);border-radius:8px;font-size:13px;outline:none;transition:border .12s,box-shadow .12s;background:var(--surface);cursor:pointer;appearance:none;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='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center}
.filter-select:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.filter-clear{display:inline-flex;align-items:center;gap:4px}
.filter-meta{font-size:12px;color:var(--muted);margin-top:10px;padding-top:10px;border-top:1px solid #F1F5F9}
.city-autocomplete{position:relative}
.city-suggest{position:absolute;left:0;right:0;top:100%;z-index:1200;margin-top:4px;max-height:230px;overflow:auto;background:#fff;border:1px solid #dbe3ef;border-radius:8px;box-shadow:0 14px 34px rgba(15,23,42,.16)}
.city-suggest:empty{display:none}
.city-suggest button{display:block;width:100%;border:0;background:#fff;text-align:left;padding:9px 11px;color:#0f172a;cursor:pointer}
.city-suggest button:hover,.city-suggest button.active{background:#eff6ff}
.city-suggest strong,.city-suggest span{display:block}
.city-suggest span{font-size:11px;color:#64748b;margin-top:2px}

/* ── CLIENT TYPE BADGES ──────────────────────── */
.badge-client-retail{background:#E0F2FE;color:#0369A1}
.badge-client-wholesale{background:#F3E8FF;color:#7E22CE}
.badge-client-distributor{background:#FEF3C7;color:#92400E}
.badge-client-corporate{background:#DCFCE7;color:#15803D}
.badge-client-government{background:#FEE2E2;color:#991B1B}
.badge-client-export{background:#E0E7FF;color:#3730A3}
.badge-client-service{background:#F1F5F9;color:#475569}

/* ── PARTY TABLE ───────────────────────────────── */
.party-name-wrap{display:flex;flex-direction:column;gap:4px;align-items:flex-start}
.party-name{font-size:13.5px}
.party-location{color:var(--muted);font-size:12.5px}
.party-actions .btn-icon{color:var(--muted);padding:6px;border-radius:6px;transition:all .12s}
.party-actions .btn-icon:hover{background:var(--primary-light);color:var(--primary)}
.party-table tbody tr{transition:background .12s}
.party-table tbody tr:hover td{background:#F1F5F9}

/* ── PAGINATION ────────────────────────────────── */
.pagination-bar{display:flex;justify-content:center;align-items:center;gap:12px;margin-top:16px;padding:12px 0}
.pagination-info{font-size:12px;color:var(--muted);font-weight:500}
.pagination-bar .btn:disabled{opacity:.45;cursor:not-allowed}

@media (max-width: 768px) {
  .dash-topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .dash-topbar-right { justify-content: space-between; }
  .dash-kpi-grid { grid-template-columns: 1fr; }
  .dash-actions { grid-template-columns: repeat(2, 1fr); }
  .dash-chart-grid { grid-template-columns: 1fr; }
  .dash-table-grid { grid-template-columns: 1fr; }
  .dash-predictions-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-ai-panel { width: calc(100vw - 48px); right: 0; max-height: 60vh; }
  .dash-ai-float { right: 16px; bottom: 16px; }
  .filter-toolbar { flex-direction: column; align-items: stretch; }
  .filter-search { min-width: 100%; }
  .filter-group { width: 100%; }
  .filter-select { flex: 1; min-width: 0; }
}
/* ── WHATSAPP SHARE ────────────────────────────── */
.btn-wa{background:#25D366;color:#fff;border:none;transition:all .12s}
.btn-wa:hover{background:#128C7E;transform:scale(1.05)}
.actions{position:relative}

@media (max-width: 480px) {
  .dash-actions { grid-template-columns: repeat(2, 1fr); }
  .dash-kpi-grid { grid-template-columns: 1fr; }
  .dash-predictions-grid { grid-template-columns: 1fr; }
  .dash-search input { width: 140px; }
  .dash-search input:focus { width: 180px; }
}

/* ════════════════════════════════════════════════════════════
   PREMIUM EXPENSES PAGE Redesign
   ════════════════════════════════════════════════════════════ */

/* Header & Title */
.expense-header-wrap {
  display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.expense-title-group h2 { font-size: 24px; font-weight: 700; color: #0f172a; margin: 0 0 4px; letter-spacing: -0.5px; }
.expense-subtitle { font-size: 13px; color: #64748b; margin: 0; font-weight: 400; }
.expense-header-actions { display: flex; gap: 10px; align-items: center; }

/* Premium KPI Cards */
.expense-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 28px; }
.expense-kpi-card {
  background: linear-gradient(145deg, #ffffff, #fafafa);
  border: 1px solid #e2e8f0; border-radius: 16px; padding: 22px 20px;
  position: relative; overflow: hidden; box-shadow: 0 2px 10px rgba(15,23,42,0.03);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.expense-kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; opacity: 0.85; transition: opacity 0.3s;
}
.expense-kpi-card.kpi-total::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.expense-kpi-card.kpi-paid::before { background: linear-gradient(90deg, #10b981, #34d399); }
.expense-kpi-card.kpi-pending::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.expense-kpi-card.kpi-recurring::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.expense-kpi-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(15,23,42,0.06); border-color: rgba(37,99,235,0.15); }

.expense-kpi-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.expense-kpi-label { font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.expense-kpi-icon {
  width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: transform 0.3s;
}
.expense-kpi-card:hover .expense-kpi-icon { transform: scale(1.1) rotate(5deg); }
.kpi-total .expense-kpi-icon { background: #eff6ff; color: #2563eb; box-shadow: 0 0 15px rgba(37,99,235,0.15); }
.kpi-paid .expense-kpi-icon { background: #ecfdf5; color: #059669; box-shadow: 0 0 15px rgba(16,185,129,0.15); }
.kpi-pending .expense-kpi-icon { background: #fffbeb; color: #d97706; box-shadow: 0 0 15px rgba(245,158,11,0.15); }
.kpi-recurring .expense-kpi-icon { background: #f5f3ff; color: #7c3aed; box-shadow: 0 0 15px rgba(139,92,246,0.15); }

.expense-kpi-value { font-size: 26px; font-weight: 700; color: #0f172a; font-family: 'DM Mono', monospace; letter-spacing: -0.5px; line-height: 1.1; margin-bottom: 6px; }
.expense-kpi-trend { font-size:12px; font-weight:500; display:inline-flex; align-items:center; gap:4px; }
.trend-up { color:#059669; } .trend-down { color:#dc2626; } .trend-neutral { color:#64748b; }

.expense-filter-toolbar {
  display:flex; gap:12px; flex-wrap:wrap; align-items:center;
  padding:14px 18px; background:rgba(255,255,255,.85); backdrop-filter:blur(8px);
  border:1px solid #e2e8f0; border-radius:14px; margin-bottom:24px;
  box-shadow:0 2px 8px rgba(15,23,42,.02); position:sticky; top:10px; z-index:10;
}
.expense-filter-group { display:flex; align-items:center; position:relative; }
.expense-search-input { padding:9px 14px 9px 36px; border:1px solid #cbd5e1; border-radius:8px; font-size:13px; min-width:240px; background:#fff; transition:all .2s; }
.expense-search-input:focus { border-color:#2563eb; outline:none; box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.expense-search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:#94a3b8; pointer-events:none; }
.expense-select,.expense-date { padding:9px 28px 9px 12px; border:1px solid #cbd5e1; border-radius:8px; font-size:13px; background:#fff; color:#334155; transition:all .2s; outline:none; cursor:pointer; height:38px; }
.expense-select { appearance:none; 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='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; }
.expense-select:focus,.expense-date:focus { border-color:#2563eb; box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.expense-filter-toolbar .btn-ghost { height:38px; display:inline-flex; align-items:center; justify-content:center; padding:0 14px; font-size:13px; font-weight:500; color:#64748b; background:transparent; border:1px solid transparent; border-radius:8px; transition:all .2s; cursor:pointer; }
.expense-filter-toolbar .btn-ghost:hover { background:#f1f5f9; color:#0f172a; border-color:#e2e8f0; }

.expense-table-wrap { background:#fff; border:1px solid #e2e8f0; border-radius:16px; overflow:hidden; box-shadow:0 4px 12px rgba(15,23,42,.03); }
.expense-table { width:100%; border-collapse:separate; border-spacing:0; }
.expense-table th { background:#f8fafc; padding:14px 18px; text-align:left; font-size:11px; font-weight:600; color:#64748b; text-transform:uppercase; letter-spacing:.05em; border-bottom:1px solid #e2e8f0; position:sticky; top:0; z-index:5; }
.expense-table th.right,.expense-table td.right { text-align:right; }
.expense-table td { padding:14px 18px; font-size:13px; color:#334155; border-bottom:1px solid #f1f5f9; transition:background .2s; vertical-align:middle; }
.expense-table tr:nth-child(even) td { background:#fafafc; }
.expense-table tr:hover td { background:#f1f5f9; }
.expense-table tr:last-child td { border-bottom:none; }
.expense-id-cell { font-family:'DM Mono',monospace; font-weight:600; color:#0f172a; font-size:12px; }
.expense-vendor-cell { font-weight:500; color:#0f172a; }
.expense-amount-cell { font-family:'DM Mono',monospace; font-weight:700; color:#0f172a; font-size:14px; letter-spacing:-.3px; }
.badge-expense { display:inline-flex; align-items:center; padding:4px 10px; border-radius:20px; font-size:11px; font-weight:600; letter-spacing:.02em; }
.badge-expense.paid { background:#ecfdf5; color:#059669; border:1px solid #a7f3d0; }
.badge-expense.pending { background:#fffbeb; color:#d97706; border:1px solid #fde68a; }
.badge-expense.partial { background:#eff6ff; color:#2563eb; border:1px solid #bfdbfe; }
.badge-expense.overdue { background:#fef2f2; color:#dc2626; border:1px solid #fecaca; }
.badge-expense.cancelled { background:#f1f5f9; color:#64748b; border:1px solid #cbd5e1; }
.badge-expense.low { background:#f8fafc; color:#475569; }
.badge-expense.medium { background:#eff6ff; color:#3b82f6; }
.badge-expense.high { background:#fffbeb; color:#f59e0b; }
.badge-expense.critical { background:#fef2f2; color:#ef4444; }
.expense-action-btn { width:32px; height:32px; border-radius:8px; border:1px solid transparent; background:transparent; color:#64748b; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; transition:all .2s; }
.expense-action-btn:hover { background:#f1f5f9; color:#2563eb; border-color:#cbd5e1; }
.expense-action-btn.danger:hover { background:#fef2f2; color:#dc2626; border-color:#fecaca; }
.expense-action-btn svg { width:14px; height:14px; }
.expense-empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:80px 24px; text-align:center; background:#fff; border-radius:16px; border:1px dashed #cbd5e1; }
.expense-empty-illustration { width:80px; height:80px; background:linear-gradient(135deg,#eff6ff,#dbeafe); border-radius:24px; display:flex; align-items:center; justify-content:center; font-size:36px; margin-bottom:24px; box-shadow:0 8px 16px rgba(37,99,235,.1); }
.expense-empty-title { font-size:18px; font-weight:700; color:#0f172a; margin:0 0 8px; }
.expense-empty-desc { font-size:14px; color:#64748b; max-width:340px; margin:0 0 24px; line-height:1.6; }
@media (max-width:768px) {
  .expense-header-wrap { flex-direction:column; align-items:stretch; }
  .expense-kpi-grid { grid-template-columns:1fr 1fr; }
  .expense-filter-toolbar { flex-direction:column; align-items:stretch; }
  .expense-table-wrap { overflow-x:auto; }
}
@media (max-width:480px) { .expense-kpi-grid { grid-template-columns:1fr; } }

/* ═══ GLOBAL TOPBAR ═══ */
.global-topbar { position:sticky; top:0; z-index:100; display:flex; align-items:center; justify-content:space-between; padding:0 28px; height:56px; background:rgba(255,255,255,.82); backdrop-filter:blur(16px) saturate(1.8); -webkit-backdrop-filter:blur(16px) saturate(1.8); border-bottom:1px solid rgba(226,232,240,.55); margin:-28px -32px 28px; }
.topbar-left { display:flex; align-items:center; gap:14px; flex:1; }
.topbar-center { display:flex; align-items:center; justify-content:center; flex:2; }
.topbar-right { display:flex; align-items:center; gap:6px; flex:1; justify-content:flex-end; }
.topbar-divider { width:1px; height:24px; background:#e2e8f0; margin:0 6px; }
.topbar-search-wrap { position:relative; display:flex; align-items:center; gap:10px; background:rgba(241,245,249,0.7); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); border:1px solid rgba(226,232,240,0.8); border-radius:12px; padding:8px 16px; width:100%; max-width:320px; transition:all .3s cubic-bezier(.16,1,.3,1); box-shadow:inset 0 1px 3px rgba(255,255,255,0.6); }
.topbar-search-wrap:focus-within { max-width:480px; background:#fff; border-color:rgba(37,99,235,0.4); box-shadow:0 8px 24px rgba(37,99,235,0.1), 0 0 0 4px rgba(37,99,235,0.05); transform:translateY(-1px); }
.topbar-search-wrap input { border:none!important; background:transparent!important; outline:none; padding:0!important; font-size:14px; font-weight:500; color:#0f172a; width:100%; box-shadow:none!important; transition:all .2s; }
.topbar-search-wrap input::placeholder { color:#94a3b8; font-weight:400; }
.topbar-search-wrap svg { color:#64748b; transition:color .2s; }
.topbar-search-wrap:focus-within svg { color:#2563eb; }
.topbar-kbd { font-family:'DM Mono',monospace; font-size:11px; font-weight:600; color:#64748b; background:#e2e8f0; padding:3px 6px; border-radius:6px; line-height:1; border:1px solid rgba(255,255,255,0.5); box-shadow:0 1px 2px rgba(15,23,42,0.05); transition:all .2s; }
.topbar-search-wrap:focus-within .topbar-kbd { opacity:0; transform:scale(0.8); pointer-events:none; }
.global-search-results{position:absolute;top:calc(100% + 10px);left:50%;transform:translateX(-50%) translateY(-6px);width:min(680px,calc(100vw - 28px));max-height:min(620px,70vh);overflow:auto;background:rgba(255,255,255,.98);border:1px solid rgba(226,232,240,.9);border-radius:12px;box-shadow:0 22px 60px rgba(15,23,42,.18);padding:8px;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .16s,visibility .16s,transform .16s;z-index:1200}
.global-search-results.open{opacity:1;visibility:visible;pointer-events:auto;transform:translateX(-50%) translateY(0)}
.global-search-section + .global-search-section{border-top:1px solid #eef2f7;margin-top:6px;padding-top:6px}
.global-search-label{font-size:10px;font-weight:800;color:#64748b;text-transform:uppercase;letter-spacing:.06em;padding:7px 8px 5px}
.global-search-item,.global-search-recent{width:100%;border:0;background:#fff;color:#0f172a;text-align:left;border-radius:8px;cursor:pointer}
.global-search-item{display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:10px;align-items:center;padding:9px 10px}
.global-search-item:hover,.global-search-item.active,.global-search-recent:hover{background:#eff6ff}
.global-search-icon{display:grid;place-items:center;width:30px;height:30px;border-radius:8px;background:#e0f2fe;color:#0369a1;font-size:10px;font-weight:900}
.global-search-main{min-width:0}
.global-search-main strong,.global-search-main small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.global-search-main strong{font-size:13px}
.global-search-main small{font-size:11px;color:#64748b;margin-top:2px}
.global-search-main mark{background:#fef08a;color:inherit;border-radius:3px;padding:0 1px}
.global-search-page{font-size:11px;color:#64748b;font-weight:700}
.global-search-empty{padding:20px 14px;color:#64748b;font-size:13px;text-align:center}
.global-search-recent{padding:9px 10px;font-size:13px}
.topbar-icon-btn { width:38px; height:38px; border-radius:10px; border:1px solid transparent; background:transparent; color:#64748b; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; transition:all .2s ease; position:relative; }
.topbar-icon-btn:hover { background:#f1f5f9; color:#0f172a; transform:translateY(-1px); box-shadow:0 4px 12px rgba(15,23,42,0.05); }

/* ═══ PREMIUM AI BUTTON ═══ */
.ai-assistant-btn { position:relative; width:40px; height:40px; border-radius:12px; border:1px solid rgba(139,92,246,.3); background:linear-gradient(145deg,#ffffff,#f5f3ff); color:#7c3aed; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; transition:all .3s cubic-bezier(.16,1,.3,1); overflow:hidden; box-shadow:0 4px 12px rgba(124,58,237,.1), inset 0 2px 4px rgba(255,255,255,0.8); }
.ai-assistant-btn::before { content:''; position:absolute; inset:0; background:linear-gradient(135deg,rgba(139,92,246,.25),rgba(59,130,246,.25)); opacity:0; transition:opacity .3s; z-index:0; }
.ai-assistant-btn:hover { transform:translateY(-3px); box-shadow:0 12px 24px -4px rgba(124,58,237,.2), 0 4px 8px -2px rgba(124,58,237,.1); border-color:rgba(139,92,246,.5); }
.ai-assistant-btn:hover::before { opacity:1; }
.ai-icon-svg { position:relative; z-index:2; transition:transform .3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.ai-assistant-btn:hover .ai-icon-svg { transform:scale(1.15) rotate(-5deg); }
.ai-orb { position:absolute; width:18px; height:18px; background:radial-gradient(circle at 30% 30%,#a78bfa,#6d28d9); border-radius:50%; top:50%; left:50%; transform:translate(-50%,-50%); filter:blur(5px); opacity:.4; z-index:1; animation:ai-pulse 2s ease-in-out infinite alternate; }
.ai-orb.small { position:relative; top:auto; left:auto; transform:none; filter:blur(1.5px); width:14px; height:14px; opacity:1; background:radial-gradient(circle at 30% 30%,#a78bfa,#4f46e5); box-shadow:0 0 8px rgba(124,58,237,.5); margin-right:6px; }
@keyframes ai-pulse { 0% { transform:translate(-50%,-50%) scale(0.9); opacity:.3; filter:blur(4px); } 100% { transform:translate(-50%,-50%) scale(1.6); opacity:.6; filter:blur(8px); } }

/* ═══ PROFILE ═══ */
.profile-menu-wrap { position:relative; }
.profile-trigger { display:flex; align-items:center; gap:8px; background:transparent; border:none; cursor:pointer; padding:3px 6px 3px 3px; border-radius:24px; transition:all .2s ease; }
.profile-trigger:hover { background:rgba(241,245,249,.8); }
.profile-avatar { width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg,#3b82f6,#6366f1); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; font-size:13px; font-family:'DM Mono',monospace; overflow:hidden; box-shadow:0 2px 4px rgba(0,0,0,.08); border:1px solid rgba(255,255,255,.5); }
.profile-avatar.has-image { background:transparent; border:1px solid #e2e8f0; }
.profile-avatar img { width:100%; height:100%; object-fit:cover; }
.profile-dropdown { position:absolute; top:calc(100% + 12px); right:0; width:260px; background:rgba(255,255,255,.95); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); border:1px solid rgba(226,232,240,.8); border-radius:16px; box-shadow:0 10px 40px -8px rgba(15,23,42,.15),0 4px 12px -4px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,1); padding:0; opacity:0; visibility:hidden; pointer-events:none; transform:translateY(-10px) scale(.98); transition:all .22s cubic-bezier(.16,1,.3,1); z-index:1000; overflow:hidden; }
.profile-dropdown.open { opacity:1; visibility:visible; pointer-events:auto; transform:translateY(0) scale(1); }
.profile-dropdown-header { display:flex; align-items:center; gap:14px; padding:18px 20px 16px; background:linear-gradient(180deg,rgba(248,250,252,.6),rgba(255,255,255,0)); border-bottom:1px solid #f1f5f9; }
.profile-avatar-wrapper { position:relative; display:inline-block; border-radius:50%; cursor:pointer; }
.profile-avatar-large { width:44px; height:44px; border-radius:50%; background:linear-gradient(135deg,#3b82f6,#6366f1); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:16px; font-family:'DM Mono',monospace; overflow:hidden; box-shadow:0 4px 10px rgba(59,130,246,.2); border:2px solid #fff; flex-shrink:0; transition:all .2s ease; }
.profile-avatar-wrapper:hover .profile-avatar-large { filter:brightness(0.85); box-shadow:0 6px 14px rgba(59,130,246,.3); }
.profile-avatar-overlay { position:absolute; inset:0; border-radius:50%; background:rgba(15,23,42,.6); display:flex; align-items:center; justify-content:center; color:#fff; opacity:0; transition:opacity .2s ease; pointer-events:none; }
.profile-avatar-wrapper:hover .profile-avatar-overlay { opacity:1; }
.profile-avatar-large.has-image { background:transparent; border:1px solid #e2e8f0; }
.profile-avatar-large img { width:100%; height:100%; object-fit:cover; }
.profile-header-info { display:flex; flex-direction:column; justify-content:center; min-width:0; }
.profile-dropdown-name { font-weight:700; color:#0f172a; font-size:14px; letter-spacing:-.01em; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.profile-dropdown-company { font-size:12px; font-weight:500; color:#475569; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.profile-dropdown-email { color:#94a3b8; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.profile-dropdown-body { padding:6px 8px; }
.profile-dropdown-item { display:flex; align-items:center; gap:12px; padding:8px 12px; color:#334155; font-size:13px; font-weight:500; background:transparent; border:none; width:100%; text-align:left; cursor:pointer; transition:all .15s ease; text-decoration:none; border-radius:8px; margin-bottom:2px; }
.profile-dropdown-item:last-child { margin-bottom:0; }
.profile-dropdown-item svg { color:#64748b; flex-shrink:0; transition:color .15s ease; }
.profile-dropdown-item:hover { background:rgba(241,245,249,.8); color:#0f172a; }
.profile-dropdown-item:hover svg { color:#0f172a; }
.profile-dropdown-item.danger { color:#dc2626; }
.profile-dropdown-item.danger svg { color:#dc2626; }
.profile-dropdown-item.danger:hover { background:#fef2f2; color:#b91c1c; }
.profile-dropdown-item.danger:hover svg { color:#b91c1c; }
.profile-dropdown-divider { height:1px; background:#e2e8f0; margin:4px 0; }

/* ═══ AI PANEL ═══ */
.topbar-ai-wrap { position:relative; }
.ai-panel { position:absolute; top:calc(100% + 10px); right:-20px; width:360px; height:440px; max-height:calc(100vh - 80px); background:#fff; border:1px solid #e2e8f0; border-radius:14px; box-shadow:0 16px 40px -8px rgba(15,23,42,.12),0 4px 12px -4px rgba(15,23,42,.06); display:flex; flex-direction:column; opacity:0; visibility:hidden; pointer-events:none; transform:translateY(-8px) scale(.97); transition:all .2s cubic-bezier(.16,1,.3,1); z-index:999; }
.ai-panel.open { opacity:1; visibility:visible; pointer-events:auto; transform:translateY(0) scale(1); }
.ai-panel-header { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid #f1f5f9; }
.ai-panel-close { background:none; border:none; cursor:pointer; color:#94a3b8; font-size:16px; padding:2px 6px; border-radius:6px; transition:all .12s; }
.ai-panel-close:hover { background:#f1f5f9; color:#0f172a; }
.ai-panel-body { flex:1; overflow-y:auto; padding:14px 16px; display:flex; flex-direction:column; gap:10px; }
.ai-msg { padding:10px 14px; border-radius:12px; font-size:13px; line-height:1.55; max-width:90%; animation:dash-fade-up .3s ease forwards; }
.ai-msg.bot { background:#f8fafc; color:#334155; align-self:flex-start; border:1px solid #e2e8f0; }
.ai-msg.user { background:linear-gradient(135deg,#2563eb,#3b82f6); color:#fff; align-self:flex-end; }
.ai-suggestions { display:flex; flex-wrap:wrap; gap:6px; margin-top:4px; }
.ai-suggestions button { background:#f1f5f9; border:1px solid #e2e8f0; border-radius:20px; padding:5px 12px; font-size:12px; color:#475569; cursor:pointer; transition:all .12s; font-family:inherit; }
.ai-suggestions button:hover { background:#eff6ff; border-color:#bfdbfe; color:#2563eb; }
.ai-panel-input { display:flex; align-items:center; gap:8px; padding:10px 14px; border-top:1px solid #f1f5f9; }
.ai-panel-input input { flex:1; border:1px solid #e2e8f0; border-radius:8px; padding:8px 12px; font-size:13px; outline:none; font-family:inherit; transition:border .12s; }
.ai-panel-input input:focus { border-color:#2563eb; }
.ai-panel-input button { width:34px; height:34px; border-radius:8px; border:none; background:#2563eb; color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .12s; flex-shrink:0; }
.ai-panel-input button:hover { background:#1d4ed8; }

/* ═══ SHORTCUT TOAST ═══ */
.shortcut-toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(16px); background:rgba(15,23,42,.92); backdrop-filter:blur(8px); color:#fff; padding:10px 20px; border-radius:28px; font-size:13px; font-weight:500; display:flex; align-items:center; gap:8px; box-shadow:0 8px 20px rgba(15,23,42,.2); opacity:0; visibility:hidden; transition:all .25s cubic-bezier(.16,1,.3,1); z-index:9999; }
.shortcut-toast.show { opacity:1; visibility:visible; transform:translateX(-50%) translateY(0); }
.kbd-tag { background:rgba(255,255,255,.15); padding:2px 7px; border-radius:4px; font-family:'DM Mono',monospace; font-size:11px; font-weight:600; }

/* ═══ SIDEBAR REFINEMENTS ═══ */
.sidebar { border-right-color:rgba(226,232,240,.7); }
.sidebar nav a { position:relative; transition:all .15s ease; margin:1px 10px; padding:9px 12px; border-radius:8px; }
.sidebar nav a:hover { background:rgba(37,99,235,.04); color:#2563eb; transform:translateX(2px); }
.sidebar nav a.active { background:rgba(37,99,235,.08); color:#2563eb; font-weight:600; }
.sidebar nav a.active::before { content:''; position:absolute; left:-10px; top:50%; transform:translateY(-50%); height:18px; width:3px; background:linear-gradient(180deg,#2563eb,#3b82f6); border-radius:0 3px 3px 0; }
.nav-section { font-size:9.5px; letter-spacing:.1em; color:#cbd5e1; padding:14px 12px 5px; }
@media (max-width:768px) {
  .global-topbar { padding:0 16px; height:52px; margin:-28px -16px 20px; }
  .topbar-search-wrap { width:160px; }
  .global-search-results{left:0;right:0;transform:translateY(-6px);width:calc(100vw - 24px)}
  .global-search-results.open{transform:translateY(0)}
  .global-search-item{grid-template-columns:30px minmax(0,1fr)}
  .global-search-page{display:none}
  .topbar-kbd { display:none; }
  .ai-panel { width:calc(100vw - 32px); right:-60px; }
  .profile-dropdown { right:-8px; }
}

/* ════════════════════════════════════════════════════════════
   PREMIUM CLIENTS / VENDORS PAGE
   ════════════════════════════════════════════════════════════ */

/* ── Page Header ── */
.page-header { margin-bottom:20px; }
.page-header h1 { font-size:24px; font-weight:700; letter-spacing:-.5px; color:#0f172a; margin-bottom:1px; }
.page-subtitle { font-size:13px; color:#94a3b8; font-weight:400; margin:0; line-height:1.4; }
.page-header-actions { display:flex; gap:8px; align-items:center; }
.page-header .btn-primary {
  background:linear-gradient(135deg,#2563eb,#3b82f6); border:none;
  padding:9px 20px; font-weight:600; font-size:13px; border-radius:10px;
  box-shadow:0 2px 8px rgba(37,99,235,.18); transition:all .18s ease;
}
.page-header .btn-primary:hover {
  background:linear-gradient(135deg,#1d4ed8,#2563eb);
  box-shadow:0 4px 16px rgba(37,99,235,.28); transform:translateY(-1px);
}
.page-header .btn-secondary {
  padding:9px 16px; border-radius:10px; font-weight:500; font-size:13px;
  border:1px solid #e2e8f0; color:#475569; transition:all .15s;
}
.page-header .btn-secondary:hover { background:#f8fafc; border-color:#cbd5e1; }

/* ── Filter Card ── */
.filter-card {
  background:rgba(255,255,255,.92); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
  border:1px solid rgba(226,232,240,.55); border-radius:14px;
  padding:12px 16px 8px; margin-bottom:16px;
  box-shadow:0 1px 3px rgba(15,23,42,.03), 0 4px 14px rgba(15,23,42,.02);
}
.client-filter-card {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:12px 16px; margin-bottom:16px;
  box-shadow:var(--shadow);
}
.client-filter-card .filter-search { position:relative; }
.client-filter-card .filter-search-input {
  width:100%; padding:8px 11px 8px 36px !important;
}
.client-filter-card .filter-select {
  width:100%; padding:8px 30px 8px 11px !important; height:auto;
  min-width:auto; max-width:none;
}
.filter-toolbar {
  display:flex; gap:8px; align-items:center;
}
.filter-search { position:relative; flex:1.8; min-width:180px; }
.filter-search-icon {
  position:absolute; left:11px; top:50%; transform:translateY(-50%);
  color:#94a3b8; pointer-events:none; z-index:1;
}
.filter-search-input {
  width:100%; padding:7px 12px 7px 34px !important; height:36px;
  border:1px solid #e2e8f0 !important; border-radius:9px !important;
  font-size:13px; background:#f8fafc !important; color:#0f172a;
  transition:all .18s; font-family:inherit;
}
.filter-search-input::placeholder { color:#a0aec0; font-weight:400; }
.filter-search-input:focus {
  background:#fff !important; border-color:#2563eb !important;
  box-shadow:0 0 0 3px rgba(37,99,235,.08) !important; outline:none;
}
.filter-select {
  padding:7px 28px 7px 11px !important; height:36px;
  border:1px solid #e2e8f0 !important; border-radius:9px !important;
  font-size:12.5px; color:#334155; background:#f8fafc !important;
  cursor:pointer; min-width:80px; flex-shrink:0;
  appearance:none; font-family:inherit;
  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='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat:no-repeat !important; background-position:right 9px center !important;
  transition:all .15s;
}
.filter-select:hover { border-color:#cbd5e1 !important; background:#fff !important; }
.filter-select:focus {
  border-color:#2563eb !important; background:#fff !important;
  box-shadow:0 0 0 3px rgba(37,99,235,.08) !important; outline:none;
}
.filter-clear-btn {
  display:inline-flex; align-items:center; gap:4px; height:36px;
  padding:0 12px; border-radius:9px; border:1px solid #e2e8f0;
  background:#fff; color:#64748b; font-size:12px; font-weight:500;
  cursor:pointer; white-space:nowrap; transition:all .15s; font-family:inherit;
  flex-shrink:0;
}
.filter-clear-btn:hover { background:#fef2f2; border-color:#fecaca; color:#dc2626; }
.filter-clear-btn svg { transition:transform .2s; }
.filter-clear-btn:hover svg { transform:rotate(90deg); }
.filter-meta {
  font-size:11.5px; color:#94a3b8; font-weight:500; margin-top:8px;
  padding-top:7px; border-top:1px solid rgba(241,245,249,.7);
}
.filter-count { font-weight:700; color:#475569; font-family:'DM Mono',monospace; font-size:12px; }

/* ── Table ── */
.table-wrap { border-radius:14px; box-shadow:0 1px 3px rgba(15,23,42,.03), 0 4px 14px rgba(15,23,42,.02); overflow:hidden; }
.party-table { width:100%; border-collapse:separate; border-spacing:0; }
.party-table th {
  background:#f8fafc; padding:11px 16px; text-align:left;
  font-size:10px; font-weight:700; color:#94a3b8; text-transform:uppercase;
  letter-spacing:.07em; border-bottom:1px solid #e2e8f0;
  position:sticky; top:0; z-index:2; white-space:nowrap;
}
.party-table td {
  padding:12px 16px; font-size:13px; color:#334155;
  border-bottom:1px solid #f1f5f9; vertical-align:middle;
  transition:background .12s ease;
}
.party-table tr:last-child td { border-bottom:none; }
.party-table tbody tr { transition:background .12s ease; }
.party-table tbody tr:hover td { background:rgba(248,250,252,.9); }
.party-table tbody tr.party-row-inactive td {
  background:#f8fafc;
  color:#64748b;
}
.party-table tbody tr.party-row-inactive:hover td { background:#f1f5f9; }
.party-row-inactive .party-name,
.party-row-inactive .party-gstin,
.party-row-inactive .party-location,
.party-row-inactive .party-email {
  opacity:.68;
}

/* ── Party Name ── */
.party-name-wrap { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.party-name { font-weight:600; color:#0f172a; font-size:13.5px; letter-spacing:-.01em; }

/* ── GSTIN ── */
.party-gstin {
  font-family:'DM Mono',monospace; font-size:11.5px; color:#64748b;
  background:#f8fafc; padding:3px 8px; border-radius:6px;
  border:1px solid #f1f5f9; letter-spacing:.02em; white-space:nowrap;
}

/* ── Location ── */
.party-location {
  color:#64748b; font-size:12.5px; display:inline-flex; align-items:center; gap:4px;
}
.party-location svg { color:#94a3b8; flex-shrink:0; opacity:.7; }

/* ── Email ── */
.party-email { color:#64748b; font-size:12.5px; }

/* ── Client Type Badges ── */
[class*="badge-client-"] {
  font-size:9.5px; padding:2px 8px; border-radius:20px; font-weight:600;
  text-transform:uppercase; letter-spacing:.04em; white-space:nowrap;
}
.badge-client-retail { background:#eff6ff; color:#2563eb; border:1px solid #bfdbfe; }
.badge-client-wholesale { background:#f0fdf4; color:#16a34a; border:1px solid #bbf7d0; }
.badge-client-distributor { background:#faf5ff; color:#7c3aed; border:1px solid #ddd6fe; }
.badge-client-corporate { background:#fefce8; color:#ca8a04; border:1px solid #fef08a; }
.badge-client-government { background:#fff1f2; color:#e11d48; border:1px solid #fecdd3; }
.badge-client-export { background:#ecfdf5; color:#059669; border:1px solid #a7f3d0; }
.badge-client-service { background:#f0f9ff; color:#0284c7; border:1px solid #bae6fd; }

/* ── Status Badges ── */
.status-pill {
  display:inline-flex; align-items:center; gap:5px;
  padding:4px 9px; border-radius:999px;
  font-size:10.5px; font-weight:700; letter-spacing:.04em;
  text-transform:uppercase; white-space:nowrap;
}
.badge.active { background:#ecfdf5; color:#059669; border:1px solid #a7f3d0; }
.badge.inactive { background:#f8fafc; color:#64748b; border:1px solid #cbd5e1; }

/* ── Action Buttons (icon-only, refined v2) ── */
.party-actions { gap:5px !important; flex-wrap:nowrap !important; }
.btn-action {
  width:30px; height:30px; border-radius:var(--radius-md); border:1px solid var(--border-default);
  background:#fff; display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all var(--duration-fast) var(--easing); padding:0;
  color:var(--c-neutral-600); position:relative; flex-shrink:0;
}
.btn-action:hover {
  background:var(--c-neutral-100); border-color:var(--border-strong);
  color:var(--c-neutral-900); transform:translateY(-1px);
}
.btn-action-wa { color:#16a34a; }
.btn-action-wa:hover {
  background:#dcfce7; border-color:#bbf7d0; color:#15803d;
  box-shadow:0 2px 8px rgba(22,163,74,.12);
}
.btn-action-edit:hover {
  background:#eff6ff; border-color:#bfdbfe; color:#2563eb;
  box-shadow:0 2px 8px rgba(37,99,235,.1);
}
.btn-action-deactivate:hover {
  background:#fef2f2; border-color:#fecaca; color:#dc2626;
  box-shadow:0 2px 8px rgba(220,38,38,.1);
}
.btn-status-toggle {
  height:32px; min-width:92px; padding:0 10px;
  border-radius:8px; border:1px solid transparent;
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  background:#fff; font-size:12px; font-weight:600;
  cursor:pointer; transition:all .18s ease; font-family:inherit;
  white-space:nowrap; flex-shrink:0;
}
.btn-status-toggle:hover { transform:translateY(-1px); }
.btn-status-toggle.deactivate {
  color:#dc2626; border-color:#fecaca; background:#fffafa;
}
.btn-status-toggle.deactivate:hover {
  background:#fef2f2; box-shadow:0 2px 8px rgba(220,38,38,.1);
}
.btn-status-toggle.activate {
  color:#059669; border-color:#a7f3d0; background:#f6fef9;
}
.btn-status-toggle.activate:hover {
  background:#ecfdf5; box-shadow:0 2px 8px rgba(5,150,105,.12);
}
/* Tooltip */
.btn-action[title] { position:relative; }
.btn-action[title]::after {
  content:attr(title); position:absolute; bottom:calc(100% + 6px); left:50%;
  transform:translateX(-50%) translateY(4px); background:#1e293b; color:#fff;
  padding:4px 10px; border-radius:6px; font-size:11px; font-weight:500;
  white-space:nowrap; opacity:0; visibility:hidden; pointer-events:none;
  transition:all .15s ease; z-index:50; box-shadow:0 4px 12px rgba(0,0,0,.15);
}
.btn-action[title]:hover::after { opacity:1; visibility:visible; transform:translateX(-50%) translateY(0); }

/* ── Pagination ── */
.pagination-bar {
  display:flex; align-items:center; justify-content:center;
  gap:12px; padding:16px 0 4px; margin-top:12px;
}
.pagination-info { font-size:13px; color:#64748b; font-weight:500; }
.pagination-bar .btn {
  border-radius:10px !important; padding:8px 18px !important;
  font-weight:500; transition:all .15s; font-size:13px;
}
.pagination-bar .btn:disabled { opacity:.35; cursor:not-allowed; }

/* ── Empty State ── */
.empty {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:64px 24px; text-align:center;
}
.empty .icon { font-size:44px; margin-bottom:14px; opacity:.65; }
.empty p { color:#64748b; font-size:14px; margin-bottom:20px; max-width:320px; line-height:1.6; }

/* ── Responsive ── */
@media (max-width:1024px) {
  .filter-toolbar { flex-wrap:wrap; }
  .filter-search { min-width:100%; flex:1 1 100%; }
  .filter-select { flex:1; min-width:0; }
}
@media (max-width:768px) {
  .filter-toolbar { flex-direction:column; align-items:stretch; gap:6px; }
  .filter-search { min-width:100%; }
  .filter-select { width:100%; max-width:none; }
  .filter-clear-btn { width:100%; justify-content:center; }
  .page-header { flex-direction:column; align-items:flex-start; gap:12px; }
  .page-header-actions { width:100%; }
  .party-table th, .party-table td { padding:10px 12px; font-size:12px; }
  .party-actions { gap:4px !important; }
  .btn-action { width:28px; height:28px; }
  .btn-status-toggle { min-width:82px; height:28px; padding:0 8px; font-size:11px; }
}
/* Branch Management */
.branch-console { display: grid; gap: 16px; }
.branch-console-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.branch-console-head h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: 0; color: var(--text); }
.branch-console-head p { margin: 0; color: var(--muted); font-size: 13px; }
.branch-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 2px; }
.branch-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.branch-kpi { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.branch-kpi span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.branch-kpi strong { color: var(--text); font-size: 20px; letter-spacing: 0; }
.branch-form-card { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.muted { color: var(--muted); font-size: 12px; margin-top: 2px; }
.branch-context-switcher,.branch-context-static{display:flex;align-items:center;gap:10px;min-width:0;font-size:12px;color:#64748b;white-space:nowrap}
.branch-context-switcher span,.branch-context-static span{overflow:hidden;text-overflow:ellipsis;max-width:180px}
.branch-context-static strong{font-size:12px;color:#0f172a;font-weight:700}
.branch-context-switcher label{display:flex;align-items:center;gap:6px;color:#334155;font-weight:600}
.branch-context-switcher select{height:32px;border:1px solid #dbe3ef;border-radius:8px;background:#fff;color:#0f172a;font-size:12px;font-weight:700;padding:0 30px 0 10px;max-width:180px}
.tm-branch-chip{display:inline-flex;align-items:center;max-width:150px;padding:4px 9px;border-radius:999px;background:#eef6ff;color:#1d4ed8;font-size:11px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tm-protected-note{font-size:10px;color:#b45309;margin-top:4px;font-weight:700}
.tm-dropdown-note{padding:9px 12px;color:#92400e;font-size:12px;font-weight:700;white-space:nowrap}
.tm-branch-assignment{margin-top:14px;padding-top:14px;border-top:1px solid #eef2f7}
.tm-radio-row{display:flex;flex-wrap:wrap;gap:12px;margin:8px 0 10px}
.tm-radio-row label{display:flex;align-items:center;gap:7px;font-size:13px;font-weight:700;color:#334155}
.tm-branch-search{margin-bottom:8px}
.tm-branch-list{display:grid;gap:6px;max-height:170px;overflow:auto;padding-right:2px}
.tm-branch-option{display:flex;align-items:flex-start;gap:9px;padding:9px;border:1px solid #e2e8f0;border-radius:8px;background:#fff;cursor:pointer}
.tm-branch-option:hover{background:#f8fafc;border-color:#bfdbfe}
.tm-branch-option span{display:grid;gap:2px;min-width:0}
.tm-branch-option strong{font-size:13px;color:#0f172a}
.tm-branch-option small{font-size:11px;color:#64748b}
.tm-protected-box{display:grid;gap:3px;border:1px solid #fde68a;background:#fffbeb;color:#92400e;border-radius:8px;padding:10px 12px;font-size:12px}
.tm-protected-box strong{font-size:13px;color:#78350f}
.tm-empty-inline{padding:10px;color:#64748b;font-size:12px;border:1px dashed #cbd5e1;border-radius:8px;text-align:center}
.branch-console .table-wrap{overflow:auto}
.branch-console table{min-width:760px;table-layout:auto}
.branch-console th{position:sticky;top:0;background:#fff;z-index:1}
.branch-console td,.branch-console th{vertical-align:middle}
.branch-pane-wrap{min-height:180px}
.branch-pane[hidden]{display:none!important}
.branch-light-loader{display:grid;gap:12px;padding:16px;border:1px solid var(--border);border-radius:8px;background:#fff;box-shadow:var(--shadow-sm)}
@media (max-width: 720px) {
  .branch-console-head { display: block; }
  .branch-tabs .btn { flex: 1 1 calc(50% - 8px); }
  .branch-form-card .input-action { flex-direction: column; align-items: stretch; }
  .branch-context-switcher span,.branch-context-static span{display:none}
  .branch-context-switcher select{max-width:132px}
  .tm-branch-list{max-height:130px}
  .tm-table{min-width:760px}
}

/* ════════════════════════════════════════════════════════════════════════
   PREMIUM CLIENT MODULE — Industry-standard styling (Tally/Zoho-grade)
   ════════════════════════════════════════════════════════════════════════ */

/* ── Summary cards row above client list ───────────────────────────── */
.client-summary-area { margin: 0 0 16px; }
.client-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.client-summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  transition: box-shadow .15s ease, transform .15s ease;
}
.client-summary-card:hover {
  box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
  transform: translateY(-1px);
}
.client-summary-card .summary-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.client-summary-card .summary-value {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
}
.client-summary-card .summary-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

/* ── Sectioned form (Basic / GST / Contact / Address / Business / Notes) ── */
.party-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.form-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 4px;
  border-bottom: 1px solid #e2e8f0;
  margin: 6px 0 -4px;
}
.form-section-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 16px;
}
.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -.01em;
}
.form-section-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 1px;
}
.required-mark {
  color: #dc2626;
  font-weight: 700;
  margin-left: 2px;
}

/* ── Right-align headers (for Outstanding / Sales / Actions cols) ── */
.party-table th.right,
.party-table td.right { text-align: right; }

/* ── Party name as clickable link (client list) ──────────────────────── */
.party-name-link {
  cursor: pointer;
  transition: color .12s ease;
}
.party-name-link:hover { color: #1d4ed8 !important; }

/* ── Better action button states (replaces old btn-status-toggle) ───── */
.party-actions .btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s ease, background .12s ease;
}
.party-actions .btn-action:hover { transform: translateY(-1px); }

/* ── Client 360° modal — make it wider on desktop ────────────────────── */
#modal-overlay .modal:has(.client-360-modal) {
  max-width: 1040px !important;
}

/* ── Responsive: collapse summary cards & table on mobile ────────────── */
@media (max-width: 720px) {
  .client-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .client-summary-card {
    padding: 10px 12px;
  }
  .client-summary-card .summary-value {
    font-size: 16px;
  }
  .party-table { min-width: 760px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ════════════════════════════════════════════════════════════════════════
   COLLAPSIBLE FORM SECTIONS — Progressive Disclosure (Zoho/Tally-style)
   ════════════════════════════════════════════════════════════════════════ */
.form-collapsible {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-collapsible:hover { border-color: #cbd5e1; }
.form-collapsible.expanded { box-shadow: 0 1px 3px rgba(15,23,42,.04); }

.form-collapsible-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .15s ease;
}
.form-collapsible-trigger:hover {
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}
.form-collapsible-chevron {
  color: #64748b;
  transition: transform .25s ease;
  flex-shrink: 0;
}
.form-collapsible.expanded .form-collapsible-chevron {
  transform: rotate(180deg);
}
.form-collapsible-body {
  display: none;
  padding: 16px;
  border-top: 1px solid #f1f5f9;
}
.form-collapsible.expanded .form-collapsible-body {
  display: block;
  animation: collapsible-fade-in .25s ease;
}
@keyframes collapsible-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Subsection dividers inside a collapsible body */
.form-subsection-divider {
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  letter-spacing: -.005em;
}
.form-subsection-divider:first-child { margin-top: 0; }

/* Checkboxes in advanced settings */
.form-collapsible-body input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}

/* Slightly tighter spacing in modals so 3-layer form fits well */
#modal-body .party-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ════════════════════════════════════════════════════════════════════════
   ROUND 4 POLISH — Mobile, accessibility, premium touches
   ════════════════════════════════════════════════════════════════════════ */

/* Help text inside form fields */
.field-help {
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.4;
}

/* Custom inputs (Payment Terms, TDS, Industry, Source) — visual nest */
.form-group input[type="text"][id$="_custom"] {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}
.form-group input[type="text"][id$="_custom"]:focus {
  background: #fff;
  border-style: solid;
  border-color: #2563eb;
}

/* Better empty state */
.empty {
  padding: 40px 24px;
  text-align: center;
}
.empty .icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.6;
}

/* Disabled input visual (for WhatsApp same-as-phone) */
input:disabled {
  cursor: not-allowed;
  color: #475569;
}

/* Mobile / tablet improvements */
@media (max-width: 768px) {
  /* GST Verify button: stack on small screens so it doesn't crowd */
  .input-action {
    flex-wrap: wrap;
  }
  .input-action input { min-width: 100%; }
  .input-action button { width: 100%; margin-top: 4px; }

  /* Form sections — tighter padding on mobile */
  .form-collapsible-trigger { padding: 12px 12px; }
  .form-collapsible-body { padding: 12px; }
  .form-section-header { padding: 4px 0; }
  .form-section-title { font-size: 13px; }
  .form-section-sub { font-size: 11px; }

  /* Modal — full screen on mobile for forms */
  #modal { max-width: 100vw !important; max-height: 100vh !important; margin: 0 !important; border-radius: 0 !important; }
  #modal-body { max-height: calc(100vh - 110px); overflow-y: auto; }
}

@media (max-width: 480px) {
  /* Summary cards — single column on phones */
  .client-summary-grid { grid-template-columns: 1fr; }
  .client-summary-card .summary-value { font-size: 17px; }
  .client-summary-card .summary-sub { font-size: 11px; }

  /* Action buttons in table — slightly tighter */
  .party-actions .btn-action { padding: 5px 6px !important; }
}

/* Keyboard shortcut hint in footer (subtle) */
.modal-footer::before {
  content: 'Tip: Ctrl+Enter to save · ESC to cancel';
  font-size: 11px;
  color: #94a3b8;
  flex: 1;
  display: flex;
  align-items: center;
}
@media (max-width: 600px) {
  .modal-footer::before { display: none; }
}

/* ════════════════════════════════════════════════════════════════════════
   SMART LOGO SYSTEM — Auto-adjusts for any company logo
   Detects aspect ratio (wide / square / portrait) via JS adjustLogoLayout()
   ════════════════════════════════════════════════════════════════════════ */

/* Wrapper that adapts to logo aspect */
.gst-invoice .gst-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 120px;
  min-width: 80px;
  min-height: 60px;
  overflow: hidden;
  border-radius: 6px;
}

/* The image itself — always contain, never crop */
.gst-invoice .gst-logo-smart {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  object-position: center;
  display: block;
}

/* Wide banner-style logos (>2.5:1 aspect) → take more horizontal space */
.gst-invoice .gst-logo-wrap.logo-wide {
  max-width: 280px;
  max-height: 90px;
}
.gst-invoice .gst-logo-wrap.logo-wide .gst-logo-smart {
  max-height: 80px;
  max-width: 100%;
}

/* Portrait / tall logos (<0.7:1) → narrower but taller */
.gst-invoice .gst-logo-wrap.logo-portrait {
  max-width: 100px;
  max-height: 140px;
}
.gst-invoice .gst-logo-wrap.logo-portrait .gst-logo-smart {
  max-height: 130px;
}

/* Square logos (default) — balanced */
.gst-invoice .gst-logo-wrap.logo-square {
  max-width: 160px;
  max-height: 120px;
}

/* Tiny icon-style logos (<80px wide) — keep them small, don't upscale */
.gst-invoice .gst-logo-wrap.logo-mini .gst-logo-smart {
  max-height: 60px;
  max-width: 60px;
}

/* Broken image fallback — when logo URL fails to load */
.gst-invoice .gst-logo-wrap.logo-broken {
  display: none;
}

/* Text fallback box (no logo case) — colored badge with initials */
.gst-invoice .gst-logo-fallback {
  width: 100px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary, #2563eb) 0%, #1d4ed8 100%);
  color: #fff;
  border-radius: 10px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
}

/* Print-specific: ensure logo prints sharp + handle page breaks */
@media print {
  .gst-invoice .gst-logo-smart {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Prevent logo from being split across pages */
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .gst-invoice .invoice-header {
    page-break-after: avoid;
    break-after: avoid;
  }
  .gst-invoice .inv-section {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .gst-invoice .inv-grand-row,
  .gst-invoice .inv-eway-strip,
  .gst-invoice .inv-footer {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  /* Make sure colors print correctly */
  .gst-invoice {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Mobile: stack header smoothly */
@media (max-width: 720px) {
  .gst-invoice .gst-logo-wrap {
    max-width: 120px;
    max-height: 80px;
  }
  .gst-invoice .gst-logo-wrap.logo-wide {
    max-width: 100%;
    max-height: 70px;
  }
}

/* E-way bill strip styling */
.gst-invoice .inv-eway-strip {
  font-family: inherit;
}

/* ════════════════════════════════════════════════════════════════════════
   PREVIEW-BEFORE-SAVE MODAL — wider for full invoice preview
   ════════════════════════════════════════════════════════════════════════ */
#modal-overlay .modal:has(#preview-template-select) {
  max-width: 1100px !important;
  width: 92vw;
}
#preview-area .gst-invoice {
  background: #fff;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .08);
  border-radius: 8px;
  margin: 0 auto;
  max-width: 920px;
}
#preview-template-select option {
  padding: 6px 8px;
}

/* ════════════════════════════════════════════════════════════════════════
   PREVIEW MODAL — Frozen template bar + scrollable preview
   ════════════════════════════════════════════════════════════════════════ */
.preview-modal-content {
  display: flex;
  flex-direction: column;
  /* Take full available height in modal body so the inner scroll area can grow */
  height: 70vh;
  max-height: 720px;
  min-height: 480px;
}

/* The frozen header bar at the top of the preview modal */
.preview-template-bar {
  flex: 0 0 auto;
  background: #fff;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
  position: relative;
  z-index: 2;
}

/* The scrolling preview body */
.preview-scroll-area {
  flex: 1 1 auto;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  /* Smooth scroll on touch devices */
  -webkit-overflow-scrolling: touch;
}

/* On mobile, reduce height to leave room for modal chrome */
@media (max-width: 720px) {
  .preview-modal-content {
    height: 60vh;
  }
  .preview-template-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  .preview-template-bar select {
    flex: 1 1 100% !important;
    order: 2;
  }
}

/* Quotation-specific row states */
.row-expired td {
  background: #fffbeb !important;
}
.row-expired:hover td {
  background: #fef3c7 !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   DASHBOARD v2 — WORLD-CLASS UI/UX OVERRIDES
   Industry standard: Stripe / Freshbooks / Linear design language.
   These rules override the legacy dash-* block above.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Page container max-width for large screens ── */
#page-dashboard { max-width: 1600px; margin: 0 auto; }

/* ── Hero Section v2 ──────────────────────────────────────────────── */
.dash-hero-v2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px;
  margin-bottom: 24px;
  background: #ffffff;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.03);
  animation: dash-fade-up 350ms cubic-bezier(.16,1,.3,1) forwards;
}
.dash-hero-v2-left { flex: 1; min-width: 0; }
.dash-hero-greeting { margin-bottom: 10px; }
.dash-hero-v2-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.6px;
  margin: 0 0 4px;
  line-height: 1.25;
}
.dash-wave { font-style: normal; }
.dash-hero-v2-sub {
  font-size: 13px;
  color: #64748b;
  margin: 0;
  font-weight: 400;
}
.dash-hero-v2-insight {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 12.5px;
  color: #1d4ed8;
  font-weight: 500;
  line-height: 1.4;
}
.dash-hero-v2-insight svg { flex-shrink: 0; color: #3b82f6; }
.dash-hero-v2-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.dash-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
  transition: all 0.15s;
}
.dash-hero-chip.health-good    { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.dash-hero-chip.health-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.dash-hero-chip.health-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.dash-period-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.dash-period-filter span {
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dash-period-filter select {
  width: auto;
  min-width: 118px;
  padding: 2px 22px 2px 2px;
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}
.dash-period-filter select:focus {
  box-shadow: none;
}
.dash-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #10b981; flex-shrink: 0;
  animation: dash-live-pulse 2.2s ease-in-out infinite;
}
@keyframes dash-live-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}
/* Override legacy feedback button for hero v2 */
.dash-hero-v2 .dash-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.dash-hero-v2 .dash-feedback-btn:hover {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

/* ── Section Headers — consistent size everywhere ─────────────────── */
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.dash-section-header .dash-section-title,
.dash-section .dash-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: -0.2px;
  margin: 0;
}
.dash-section-header .dash-section-title svg { color: #64748b; flex-shrink: 0; }
.dash-section-period {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  background: #f8fafc;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* ── KPI Cards v2 — SVG icons, refined typography ─────────────────── */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 0;
}
.dash-kpi-card {
  background: #ffffff;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
  animation: dash-fade-up 400ms cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  cursor: default;
}
.dash-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(15,23,42,0.08);
  border-color: rgba(37,99,235,0.2);
}
/* Color accent bar */
.dash-kpi-top-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.dash-kpi-card.blue   .dash-kpi-top-bar { background: linear-gradient(90deg,#3b82f6,#60a5fa); }
.dash-kpi-card.amber  .dash-kpi-top-bar { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.dash-kpi-card.red    .dash-kpi-top-bar { background: linear-gradient(90deg,#ef4444,#f87171); }
.dash-kpi-card.green  .dash-kpi-top-bar { background: linear-gradient(90deg,#10b981,#34d399); }
.dash-kpi-card.purple .dash-kpi-top-bar { background: linear-gradient(90deg,#8b5cf6,#a78bfa); }
.dash-kpi-card.pink   .dash-kpi-top-bar { background: linear-gradient(90deg,#ec4899,#f472b6); }
.dash-kpi-card.teal   .dash-kpi-top-bar { background: linear-gradient(90deg,#14b8a6,#2dd4bf); }
.dash-kpi-card.gray   .dash-kpi-top-bar { background: linear-gradient(90deg,#64748b,#94a3b8); }

/* KPI header: label left, icon right */
.dash-kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.dash-kpi-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.4;
  flex: 1;
  padding-right: 8px;
}
/* SVG icon wrapper — replaces emoji span */
.dash-kpi-icon-wrap {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.dash-kpi-card:hover .dash-kpi-icon-wrap { transform: scale(1.1); }
.dash-kpi-icon-wrap.blue   { background: #eff6ff; color: #2563eb; }
.dash-kpi-icon-wrap.amber  { background: #fffbeb; color: #d97706; }
.dash-kpi-icon-wrap.red    { background: #fef2f2; color: #dc2626; }
.dash-kpi-icon-wrap.green  { background: #f0fdf4; color: #16a34a; }
.dash-kpi-icon-wrap.purple { background: #f5f3ff; color: #7c3aed; }
.dash-kpi-icon-wrap.pink   { background: #fdf2f8; color: #db2777; }
.dash-kpi-icon-wrap.teal   { background: #f0fdfa; color: #0d9488; }
.dash-kpi-icon-wrap.gray   { background: #f8fafc; color: #475569; }
.dash-kpi-icon-wrap svg { width: 18px; height: 18px; }

/* KPI body */
.dash-kpi-body { }
.dash-kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.8px;
  line-height: 1.15;
  margin-bottom: 8px;
}
.dash-kpi-trend-row { margin-bottom: 6px; }
.dash-kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}
.dash-kpi-trend.up      { background: #f0fdf4; color: #15803d; }
.dash-kpi-trend.down    { background: #fef2f2; color: #dc2626; }
.dash-kpi-trend.neutral { background: #f1f5f9; color: #64748b; }
.dash-kpi-trend svg { flex-shrink: 0; }
.dash-kpi-sub {
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 400;
  margin-top: 4px;
}
.dash-kpi-sparkline-wrap { margin-top: 14px; height: 34px; width: 100%; }

/* ── Quick Actions — horizontal compact pill bar ─────────────────── */
.dash-quick-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  margin-bottom: 24px;
  background: #ffffff;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
  animation: dash-fade-up 380ms cubic-bezier(.16,1,.3,1) both;
}
.dash-qa-prefix {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  margin-right: 4px;
}
.dash-qa-divider {
  width: 1px; height: 20px;
  background: #e2e8f0;
  flex-shrink: 0;
  margin-right: 4px;
}
.dash-qa-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: #334155;
  transition: all 0.14s ease;
  white-space: nowrap;
  line-height: 1;
}
.dash-qa-btn:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,0.1);
}
.dash-qa-btn:active { transform: translateY(0) scale(0.98); }
.dash-qa-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-qa-icon svg { width: 14px; height: 14px; }
.dash-qa-label { font-size: 12.5px; }
.dash-qa-kbd {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #94a3b8;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 2px;
  line-height: 1.4;
}
.dash-qa-btn:hover .dash-qa-kbd { background: #dbeafe; border-color: #bfdbfe; color: #3b82f6; }

/* ── Charts — period selector + wide primary chart ───────────────── */
.dash-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.dash-chart-wide { grid-column: 1 / -1; }
.dash-chart-card {
  background: #ffffff;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  animation: dash-fade-up 420ms cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.dash-chart-card:hover {
  box-shadow: 0 6px 20px rgba(15,23,42,0.07);
  transform: translateY(-2px);
}
.dash-chart-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 18px;
  letter-spacing: -0.15px;
}
.dash-chart-container { position: relative; height: 260px; }
.dash-chart-container.small { height: 200px; }

/* Period tabs inside chart header */
.dash-period-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
}
.dash-period-tab {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.14s;
  font-family: inherit;
  line-height: 1;
}
.dash-period-tab:hover { color: #0f172a; }
.dash-period-tab.active {
  background: #fff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

/* ── Smart Tables v2 ──────────────────────────────────────────────── */
.dash-table-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.dash-table-card {
  background: #ffffff;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
  transition: box-shadow 0.2s ease;
  animation: dash-fade-up 430ms cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.dash-table-card:hover { box-shadow: 0 6px 20px rgba(15,23,42,0.06); }
.dash-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafafa;
}
.dash-table-header-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.1px;
}
.dash-table-dot {
  width: 7px; height: 7px;
  border-radius: 50%; flex-shrink: 0;
}
.dash-table-header-title svg { color: #64748b; flex-shrink: 0; }
.dash-table-count {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 1px 7px;
  margin-left: 2px;
}
/* View all link */
.dash-view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #2563eb;
  padding: 5px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s;
  white-space: nowrap;
}
.dash-view-all-link:hover {
  background: #eff6ff;
  color: #1d4ed8;
}
.dash-table-body { max-height: 300px; overflow-y: auto; }
.dash-table-body table { width: 100%; border-collapse: collapse; }
.dash-table-body th {
  padding: 9px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #fafafa;
  border-bottom: 1px solid #f1f5f9;
  position: sticky; top: 0; z-index: 1;
}
.dash-table-body th.cell-amount-th { text-align: right; }
.dash-table-body td {
  padding: 10px 14px;
  border-bottom: 1px solid #f8fafc;
  font-size: 12.5px;
  color: #334155;
  vertical-align: middle;
}
.dash-table-body tr:last-child td { border-bottom: none; }
.dash-table-body tr:hover td { background: #fafbff; }
.dash-table-row-link { cursor: pointer; }
.dash-table-mono {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}
.dash-table-body .cell-client { font-weight: 500; color: #0f172a; }
.dash-table-body .cell-amount { font-family: 'DM Mono',monospace; font-weight: 600; color: #0f172a; text-align: right; }
.dash-table-body .cell-muted  { font-size: 12px; color: #64748b; }
.dash-table-body .cell-badge  {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.dash-table-body .cell-badge.paid     { background: #f0fdf4; color: #15803d; }
.dash-table-body .cell-badge.unpaid   { background: #fffbeb; color: #92400e; }
.dash-table-body .cell-badge.overdue  { background: #fef2f2; color: #991b1b; }
.dash-table-body .cell-badge.pending  { background: #f8fafc; color: #475569; }
.dash-table-body .cell-badge.draft    { background: #f8fafc; color: #64748b; }
/* Empty row inside tables */
.dash-table-empty-row {
  text-align: center;
  padding: 32px 24px !important;
  color: #94a3b8;
  font-size: 13px;
}
.dash-table-empty-row svg { display: block; margin: 0 auto 10px; }
.dash-table-empty-row span { display: block; }

/* ── Alerts v2 — left border severity ────────────────────────────── */
.dash-alert-clear {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #15803d;
}
.dash-alert-badge-count {
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 20px;
  padding: 2px 9px;
}
.dash-alerts-list { display: flex; flex-direction: column; gap: 10px; }
.dash-alert-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #94a3b8;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: dash-fade-up 400ms cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
.dash-alert-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}
.dash-alert-content { flex: 1; min-width: 0; }
.dash-alert-side {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.dash-alert-title {
  font-size: 13px; font-weight: 600; color: #0f172a;
  margin-bottom: 3px; letter-spacing: -0.1px;
}
.dash-alert-message { font-size: 12px; color: #475569; line-height: 1.5; }
.dash-alert-priority {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 20px; flex-shrink: 0;
  margin-top: 2px;
}
.dash-alert-priority.high   { background: #fef2f2; color: #dc2626; }
.dash-alert-priority.medium { background: #fffbeb; color: #d97706; }
.dash-alert-priority.low    { background: #eff6ff; color: #2563eb; }
.dash-alert-priority.info   { background: #f0f9ff; color: #0369a1; }
.dash-alert-action {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 7px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.dash-alert-action:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

/* ── Financial Health v2 ──────────────────────────────────────────── */
.dash-health-card-v2 {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}
.dash-health-ring-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px; flex-shrink: 0;
}
/* Rotate the ring so it starts from top */
.dash-health-ring-wrap svg { transform: rotate(-90deg); }
.dash-health-ring-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.dash-health-details { flex: 1; min-width: 0; }
.dash-health-score-line {
  display: flex; align-items: baseline; gap: 4px;
  margin-bottom: 0;
}
.dash-health-progress-wrap {
  height: 6px; background: #f1f5f9; border-radius: 4px; overflow: hidden;
}
.dash-health-progress {
  height: 100%; border-radius: 4px;
  transition: width 1.2s cubic-bezier(.16,1,.3,1);
}
.dash-health-factors { display: flex; flex-direction: column; gap: 9px; }
.dash-health-factor {
  display: flex; align-items: center; gap: 10px;
}
.dash-health-factor-icon {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  background: #f8fafc; border-radius: 6px; border: 1px solid #e2e8f0;
  color: #64748b; flex-shrink: 0;
}
.dash-health-factor-icon svg { width: 13px; height: 13px; }
.dash-health-factor-name {
  font-size: 12px; font-weight: 500; color: #475569;
  white-space: nowrap; min-width: 110px;
}
.dash-health-factor-bar-wrap {
  flex: 1; height: 5px; background: #f1f5f9; border-radius: 3px; overflow: hidden;
}
.dash-health-factor-bar {
  height: 100%; border-radius: 3px;
  transition: width 1s cubic-bezier(.16,1,.3,1);
}
.dash-health-factor-val {
  font-size: 11px; font-weight: 700; color: #334155;
  font-family: 'DM Mono', monospace; min-width: 30px; text-align: right;
}
.dash-health-desc {
  font-size: 11.5px; color: #94a3b8; margin-top: 16px; line-height: 1.5;
}

/* ── AI Insights / Predictions — tighter section titles ──────────── */
.dash-section-header .dash-section-title svg { opacity: 0.7; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .dash-kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1024px) {
  .dash-kpi-grid    { grid-template-columns: repeat(2, 1fr); }
  .dash-chart-grid  { grid-template-columns: 1fr; }
  .dash-chart-wide  { grid-column: auto; }
  .dash-table-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dash-hero-v2 {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
    border-radius: 14px;
  }
  .dash-hero-greeting { margin-bottom: 7px; }
  .dash-hero-v2-title { font-size: 20px; letter-spacing: -0.3px; }
  .dash-hero-v2-sub { font-size: 12px; }
  .dash-hero-v2-insight {
    padding: 6px 10px;
    font-size: 12px;
    max-width: 100%;
  }
  .dash-hero-v2-right {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(148px,1fr) auto auto;
    gap: 8px;
    align-items: center;
  }
  .dash-period-filter { min-width: 0; }
  .dash-period-filter select {
    min-width: 96px;
    max-width: 100%;
  }
  .dash-hero-v2 .dash-feedback-btn span { display: none; }
  .dash-hero-v2 .dash-feedback-btn { justify-content: center; padding: 7px 9px; }
  .dash-kpi-grid    { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .dash-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    padding: 12px;
    gap: 8px;
    margin-bottom: 20px;
  }
  .dash-qa-prefix, .dash-qa-divider { display: none; }
  .dash-qa-btn {
    min-width: 0;
    justify-content: center;
    padding: 9px 10px;
  }
  .dash-qa-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .dash-qa-kbd { display: none; }
  .dash-health-card-v2 { flex-direction: column; }
  .dash-alert-item { flex-direction: column; }
  .dash-alert-side { align-items: flex-start; flex-direction: row; }
}
@media (max-width: 480px) {
  .dash-kpi-grid { grid-template-columns: 1fr; }
  .dash-kpi-value { font-size: 20px; }
  .dash-hero-v2 { padding: 14px; }
  .dash-hero-v2-right { grid-template-columns: 1fr 1fr; }
  .dash-hero-chip,
  .dash-period-filter,
  .dash-hero-v2 .dash-feedback-btn {
    width: 100%;
    justify-content: center;
  }
  .dash-period-filter select { flex: 1; }
  .dash-quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Section entrance stagger (--si set by JS) ────────────────────── */
#dash-content .dash-section {
  animation: dash-fade-up 420ms cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--si, 0) * 70ms);
  opacity: 0; /* reset — animation fills forwards */
}

/* ── Chart tooltip font override (Chart.js injects inline) ─────────── */
.dash-chart-container canvas { display: block; }

/* ── Quick-actions bar — don't stagger the prefix/divider spans ────── */
.dash-quick-actions .dash-qa-prefix,
.dash-quick-actions .dash-qa-divider { animation: none; opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════
   EXPENSE MODULE v2 — Industry-grade table, filters, form, details
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Header Add button (replaces inline styles) ──────────────────── */
.exp-add-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(37,99,235,0.22);
  font-weight: 600;
}
.exp-add-btn:hover { box-shadow: 0 6px 18px rgba(37,99,235,0.3); transform: translateY(-1px); }

/* Inline kbd hint */
.exp-kbd {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 1px 5px;
  margin: 0 1px;
  vertical-align: 1px;
}

/* ── KPI icon — switch to SVG wrapper sizing (overrides legacy emoji) ── */
.expense-kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.expense-kpi-card.kpi-total     .expense-kpi-icon { background: #eff6ff; color: #2563eb; }
.expense-kpi-card.kpi-paid      .expense-kpi-icon { background: #f0fdf4; color: #16a34a; }
.expense-kpi-card.kpi-pending   .expense-kpi-icon { background: #fffbeb; color: #d97706; }
.expense-kpi-card.kpi-recurring .expense-kpi-icon { background: #f5f3ff; color: #7c3aed; }
.expense-kpi-card:hover .expense-kpi-icon { transform: scale(1.08) rotate(-3deg); }

/* ── Date range preset chips ─────────────────────────────────────── */
.exp-date-preset-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 14px;
  margin-top: -8px;
  margin-bottom: 8px;
}
.exp-date-preset-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}
.exp-date-preset {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s ease;
  white-space: nowrap;
}
.exp-date-preset:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.exp-date-preset.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}

/* ── Bulk action floating bar ───────────────────────────────────── */
.exp-bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  margin-top: 16px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.18);
  color: #f8fafc;
  position: sticky;
  bottom: 16px;
  z-index: 10;
  animation: exp-bulk-rise 0.25s cubic-bezier(.16,1,.3,1);
}
@keyframes exp-bulk-rise {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.exp-bulk-count {
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
}
.exp-bulk-count strong {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: rgba(255,255,255,0.12);
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 4px;
}
.btn-bulk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #f8fafc;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s ease;
}
.btn-bulk:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.2); }
.btn-bulk.success { background: rgba(16,185,129,0.18); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.btn-bulk.success:hover { background: rgba(16,185,129,0.28); color: #a7f3d0; }
.btn-bulk.danger  { background: rgba(239,68,68,0.18);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.btn-bulk.danger:hover  { background: rgba(239,68,68,0.28); color: #fecaca; }

/* ── Table — checkbox column, sortable headers, row states ───────── */
.exp-checkbox-cell {
  width: 36px;
  padding: 0 4px 0 14px !important;
  text-align: center;
}
.exp-check {
  width: 15px; height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
  vertical-align: middle;
}
.exp-sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
}
.exp-sortable:hover { background: #eff6ff !important; color: #2563eb !important; }
.exp-sortable > span { margin-right: 4px; }
.exp-sort-icon { vertical-align: middle; color: #94a3b8; }
.exp-sort-icon.active { color: #2563eb; }

.expense-table .exp-row.is-selected td  { background: #eff6ff !important; }
.expense-table .exp-row.is-overdue td   { background: #fef9f9 !important; }
.expense-table .exp-row.is-overdue:hover td { background: #fef2f2 !important; }
.expense-table .exp-row.is-cancelled td { opacity: 0.55; }
.expense-table .exp-row.is-cancelled .expense-vendor-cell,
.expense-table .exp-row.is-cancelled .expense-id-cell { text-decoration: line-through; }
.expense-table .exp-row.is-paid .badge-expense.paid { box-shadow: 0 0 0 1px #a7f3d0; }
.exp-recurring-pill {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: #7c3aed;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 10px;
  width: 18px;
  height: 18px;
  line-height: 15px;
  text-align: center;
  font-weight: 700;
}
.exp-method-cell { font-size: 12px; color: #64748b; }
.exp-totals-row td {
  background: #fafbff !important;
  font-size: 12.5px;
  padding: 12px 18px !important;
  border-top: 2px solid #e2e8f0;
}
.exp-actions-cell { width: 1px; white-space: nowrap; }
.exp-row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.exp-row:hover .exp-row-actions { opacity: 1; }
.expense-action-btn.success:hover { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }

/* ── Skeleton ───────────────────────────────────────────────────── */
.exp-skel {
  height: 14px;
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: exp-skel-shimmer 1.3s linear infinite;
}
@keyframes exp-skel-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.expense-table tbody td:has(.exp-skel) { padding: 18px 14px; border-bottom: 1px solid #f8fafc; }

/* ── Empty state — SVG illustration ─────────────────────────────── */
.exp-empty-svg {
  width: 96px; height: 96px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: 28px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
  box-shadow: 0 12px 24px rgba(37,99,235,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* ── Smart pagination ───────────────────────────────────────────── */
.exp-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 4px 20px;
}
.exp-page-info {
  font-size: 12.5px;
  color: #64748b;
}
.exp-page-info strong { color: #0f172a; font-weight: 600; }
.exp-page-controls { display: flex; align-items: center; gap: 4px; }
.exp-page-btn {
  min-width: 32px; height: 32px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.exp-page-btn:hover:not(.disabled):not(.active) { background: #f1f5f9; border-color: #cbd5e1; color: #0f172a; }
.exp-page-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
  font-weight: 600;
}
.exp-page-btn.disabled { color: #cbd5e1; background: #fafafa; cursor: not-allowed; }
.exp-page-ellipsis { color: #94a3b8; padding: 0 4px; font-size: 13px; }

/* ── Form: grouped sections ─────────────────────────────────────── */
.exp-form-grid { display: flex; flex-direction: column; gap: 18px; }
.exp-form-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
.exp-form-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  background: #fafbff;
  padding: 10px 18px;
  border-bottom: 1px solid #e2e8f0;
}
.exp-form-section-body { padding: 18px; }

/* ── Live GST preview card ──────────────────────────────────────── */
.exp-gst-preview {
  margin-top: 10px;
  background: linear-gradient(135deg, #f8fafc, #eff6ff);
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 14px 16px;
}
.exp-gst-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: #64748b;
  padding: 4px 0;
}
.exp-gst-row strong {
  font-family: 'DM Mono', monospace;
  color: #0f172a;
  font-weight: 600;
}
.exp-gst-row.total {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
  font-size: 13.5px;
  color: #0f172a;
  font-weight: 600;
}
.exp-gst-row.total strong { font-size: 16px; color: #2563eb; }

/* Current attachment chip */
.exp-current-attachment {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #475569;
  padding: 5px 10px;
  background: #f1f5f9;
  border-radius: 6px;
}
.exp-current-attachment a { color: #2563eb; font-weight: 500; text-decoration: none; }
.exp-current-attachment a:hover { text-decoration: underline; }

/* ── View Details panel ─────────────────────────────────────────── */
.exp-view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.exp-view-col.full { grid-column: 1 / -1; }
.exp-view-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 10px;
}
.exp-view-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed #f1f5f9;
  font-size: 13px;
}
.exp-view-row:last-child { border-bottom: none; }
.exp-view-label { color: #64748b; font-weight: 500; }
.exp-view-val   { color: #0f172a; text-align: right; }
.exp-view-total {
  margin-top: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}
.exp-view-total strong { font-family: 'DM Mono', monospace; font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.exp-view-notes {
  padding: 12px 14px;
  background: #fafbff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
  white-space: pre-wrap;
}
.exp-view-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1d4ed8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.exp-view-attachment:hover { background: #dbeafe; transform: translateY(-1px); }

/* ── btn-success utility (used in view footer) ──────────────────── */
.btn-success {
  background: #10b981;
  color: #ffffff;
  border: 1px solid #10b981;
}
.btn-success:hover { background: #059669; border-color: #059669; }

/* ─── Phase 1: Indian GST compliance — vendor autocomplete + tax rows ─── */

/* Vendor autocomplete dropdown */
.exp-vendor-autocomplete { position: relative; }
.exp-vendor-input { width: 100%; }
.exp-vendor-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,0.12);
  padding: 4px;
}
.exp-vendor-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
}
.exp-vendor-item:hover { background: #eff6ff; }
.exp-vendor-item-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.exp-vendor-item-main strong { color: #0f172a; font-weight: 600; }
.exp-vendor-gstin {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #475569;
  background: #f1f5f9;
  border-radius: 4px;
  padding: 1px 6px;
}
.exp-vendor-item-meta {
  font-size: 11.5px;
  color: #94a3b8;
}
.exp-vendor-empty {
  padding: 12px 14px;
  font-size: 12.5px;
  color: #94a3b8;
  font-style: italic;
}

/* Form helper hint below POS selector */
.exp-form-hint {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  color: #64748b;
}
.exp-form-hint strong { color: #2563eb; font-weight: 600; }

/* GST split rows in preview — slightly indented to indicate breakdown */
.exp-gst-preview .exp-gst-row[id^="ef_gst_split_"] {
  padding-left: 14px;
  font-size: 12px;
  color: #475569;
}
.exp-gst-preview .exp-gst-row[id^="ef_gst_split_"] strong { color: #2563eb; }

/* GST type badges in view-details */
.badge-expense.cgstsgst { background:#eff6ff; color:#1d4ed8; border:1px solid #bfdbfe; }
.badge-expense.igst     { background:#f5f3ff; color:#6d28d9; border:1px solid #ddd6fe; }
.badge-expense.nogst    { background:#f8fafc; color:#64748b; border:1px solid #cbd5e1; }
.badge-expense.auto     { background:#fffbeb; color:#92400e; border:1px solid #fde68a; }

/* ═══════════════ Phase 2: Payment tracking styles ═══════════════ */

/* Account autocomplete — same shape as vendor autocomplete */
.exp-account-autocomplete { position: relative; }
.exp-account-input { width: 100%; }
.exp-account-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,0.12);
  padding: 4px;
}
.exp-account-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
}
.exp-account-type.type-bank   { background: #eff6ff; color: #1d4ed8; }
.exp-account-type.type-cash   { background: #f0fdf4; color: #15803d; }
.exp-account-type.type-wallet { background: #f5f3ff; color: #6d28d9; }

/* Multi-attachment dropzone + list */
.exp-attach-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px 16px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  background: #fafbff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.18s ease;
}
.exp-attach-dropzone:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.exp-attach-dropzone.drag  { border-color: #2563eb; background: #dbeafe; color: #1d4ed8; transform: scale(1.01); }
.exp-attach-dropzone svg { flex-shrink: 0; }
.exp-attach-dz-text { font-size: 13px; }
.exp-attach-dz-text strong { color: #0f172a; font-weight: 600; }
.exp-attach-dz-text a { color: #2563eb; font-weight: 500; text-decoration: none; }
.exp-attach-dz-text a:hover { text-decoration: underline; }

.exp-attach-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.exp-attach-empty {
  padding: 10px 12px;
  font-size: 12.5px;
  color: #94a3b8;
  font-style: italic;
  text-align: center;
}
.exp-attach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.15s;
}
.exp-attach-item:hover { border-color: #cbd5e1; background: #fafbff; }
.exp-attach-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9;
  color: #64748b;
  flex-shrink: 0;
}
.exp-attach-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.exp-attach-link { font-size: 13px; color: #0f172a; font-weight: 500; text-decoration: none; }
a.exp-attach-link:hover { color: #2563eb; text-decoration: underline; }
.exp-attach-info small { font-size: 11px; color: #94a3b8; }
.exp-attach-new {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
}
.exp-attach-remove {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.exp-attach-remove:hover { background: #fef2f2; border-color: #fecaca; color: #dc2626; }

/* View-details attachments grid */
.exp-view-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exp-view-attachments .exp-view-attachment {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.exp-view-attachments .exp-view-attachment span { flex: 1; }
.exp-view-attachments .exp-view-attachment small { color: #94a3b8; font-size: 11px; }

/* ═══════════════ Phase 3: Workflow + Activity + Comments ═══════════════ */

/* Workflow badges (table + view-details) */
.exp-wf-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.exp-wf-badge.wf-draft     { background: #f8fafc; color: #64748b; border: 1px solid #cbd5e1; }
.exp-wf-badge.wf-submitted { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.exp-wf-badge.wf-approved  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.exp-wf-badge.wf-rejected  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.exp-wf-badge.wf-paid      { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.exp-wf-badge.wf-cancelled { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; opacity: 0.7; text-decoration: line-through; }

/* Workflow banner at top of view-details */
.exp-view-wf-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 0 0 16px;
  background: #fafbff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.exp-view-wf-banner.submitted { background: #eff6ff; border-color: #bfdbfe; }
.exp-view-wf-banner.approved  { background: #f0fdf4; border-color: #bbf7d0; }
.exp-view-wf-banner.rejected  { background: #fef2f2; border-color: #fecaca; }
.exp-view-wf-banner.paid      { background: #ecfdf5; border-color: #a7f3d0; }
.exp-view-wf-banner.cancelled { background: #f8fafc; border-color: #cbd5e1; }
.exp-view-wf-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: #334155;
}
.exp-view-wf-info strong { color: #0f172a; font-weight: 600; }
.exp-view-wf-info small { color: #64748b; font-size: 12px; }

/* Activity timeline */
.exp-activity-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 0;
}
.exp-activity-empty,
.exp-comments-empty {
  padding: 16px;
  text-align: center;
  color: #94a3b8;
  font-style: italic;
  font-size: 13px;
}
.exp-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.exp-activity-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: -8px;
  width: 1px;
  background: #e2e8f0;
}
.exp-activity-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
}
.exp-activity-item.action-submitted .exp-activity-icon { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.exp-activity-item.action-approved  .exp-activity-icon { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.exp-activity-item.action-rejected  .exp-activity-icon { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.exp-activity-item.action-commented .exp-activity-icon { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.exp-activity-item.action-created   .exp-activity-icon { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.exp-activity-item.action-auto_created .exp-activity-icon,
.exp-activity-item.action-auto_generated_child .exp-activity-icon { background: #ecfeff; color: #0891b2; border-color: #a5f3fc; }
.exp-activity-body { flex: 1; min-width: 0; padding-top: 3px; }
.exp-activity-text { font-size: 13px; color: #334155; line-height: 1.5; }
.exp-activity-text strong { color: #0f172a; font-weight: 600; }
.exp-activity-text em { color: #64748b; font-style: italic; }
.exp-activity-time { font-size: 11.5px; color: #94a3b8; margin-top: 2px; }

/* Comments thread */
.exp-comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.exp-comment-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.exp-comment-item.is-internal {
  background: #fffbeb;
  border-color: #fde68a;
}
.exp-comment-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.exp-comment-body { flex: 1; min-width: 0; }
.exp-comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.exp-comment-header strong { font-size: 13px; color: #0f172a; font-weight: 600; }
.exp-comment-internal-pill {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
}
.exp-comment-time { font-size: 11px; color: #94a3b8; margin-left: auto; }
.exp-comment-message {
  font-size: 13px;
  color: #334155;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.exp-comment-compose {
  background: #fafbff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}
.exp-comment-compose textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 50px;
  outline: none;
  transition: border-color 0.15s;
  background: #ffffff;
}
.exp-comment-compose textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.exp-comment-compose-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.exp-comment-internal-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.exp-comment-internal-toggle input { accent-color: #d97706; }

/* Recurring preview */
.exp-recurring-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f5f3ff, #ecfeff);
  border: 1px solid #ddd6fe;
  border-radius: 10px;
}
.exp-recurring-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
  padding: 4px 0;
}
.exp-recurring-item.next { color: #0f172a; font-weight: 500; }
.exp-recurring-item strong { color: #7c3aed; font-weight: 600; }
.exp-recurring-item svg { color: #94a3b8; flex-shrink: 0; }

/* ═══════════════ Phase 4: Projects, billable, tags, CSV import ═══════════════ */

/* Project/customer/tag autocomplete reuses the vendor styles, plus its own dropdown wrapper */
.exp-project-autocomplete,
.exp-customer-autocomplete {
  position: relative;
}
.exp-project-input,
.exp-customer-input { width: 100%; }
.exp-project-dropdown,
.exp-customer-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,0.12);
  padding: 4px;
}

/* Tag chip input */
.exp-tag-input-wrap {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.exp-tag-input-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.exp-tag-chips { display: contents; }
.exp-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  font-size: 12px;
  color: #1d4ed8;
  font-weight: 500;
  text-transform: lowercase;
}
.exp-tag-chip button {
  background: none;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.exp-tag-chip button:hover { color: #1d4ed8; }
.exp-tag-input {
  flex: 1;
  min-width: 100px;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  padding: 4px;
  background: transparent;
}
.exp-tag-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,0.12);
  padding: 4px;
}
.exp-tag-suggest {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: #475569;
}
.exp-tag-suggest:hover { background: #eff6ff; color: #1d4ed8; }
.exp-tag-suggest small { color: #94a3b8; font-size: 11px; }

/* Tag pill in view-details */
.exp-tag-pill {
  display: inline-block;
  padding: 2px 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 11px;
  color: #475569;
  margin-right: 4px;
  text-transform: lowercase;
}

/* Billable preview card */
.exp-billable-preview {
  margin-top: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
}

/* Import CSV button styling */
.exp-import-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-weight: 500;
  transition: all 0.15s;
}
.exp-import-btn:hover { background: #f1f5f9; border-color: #94a3b8; }

/* CSV import modal */
.exp-csv-import {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.exp-csv-info p { margin: 0 0 6px; font-size: 13px; color: #475569; }
.exp-csv-cols {
  display: block;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11.5px;
  color: #334155;
  line-height: 1.5;
  word-break: break-word;
}
.exp-csv-dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 18px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  background: #fafbff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.18s ease;
}
.exp-csv-dropzone:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.exp-csv-dropzone.drag  { border-color: #2563eb; background: #dbeafe; color: #1d4ed8; }
.exp-csv-dropzone div { font-size: 13px; }
.exp-csv-dropzone strong { color: #0f172a; }
.exp-csv-dropzone a { color: #2563eb; font-weight: 500; text-decoration: none; }
.exp-csv-summary {
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 12.5px;
  color: #15803d;
  margin-bottom: 10px;
}
.exp-csv-summary strong { color: #14532d; }
.exp-csv-table-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.exp-csv-table {
  width: 100%;
  border-collapse: collapse;
}
.exp-csv-table th {
  background: #fafbff;
  padding: 8px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0;
}
.exp-csv-table td {
  padding: 7px 12px;
  font-size: 12px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exp-csv-errors {
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 12px;
  color: #991b1b;
}
.exp-csv-errors strong { color: #7f1d1d; }
.exp-csv-errors ul { margin: 6px 0 0; padding-left: 18px; }

/* ═══════════════ Phase 5: Reports & Analytics ═══════════════ */

/* Large modal variant for reports/ledger */
.modal.modal-xl { max-width: 1280px !important; width: 96vw !important; }
.modal.modal-xl #modal-body { max-height: 80vh; overflow-y: auto; }

.exp-reports-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Filter bar */
.exp-reports-filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  background: #fafbff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.exp-rf-group { display: flex; flex-direction: column; gap: 4px; }
.exp-rf-group label { font-size: 10.5px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.exp-rf-group input, .exp-rf-group select {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 12.5px;
  font-family: inherit;
  background: #fff;
  min-width: 130px;
}
.exp-reports-filters .btn-sm {
  height: 32px;
  padding: 0 12px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}

/* Tabs */
.exp-reports-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 10px;
}
.exp-rep-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: transparent;
  border: none;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s;
}
.exp-rep-tab:hover { color: #0f172a; background: rgba(255,255,255,0.5); }
.exp-rep-tab.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}
.exp-rep-tab svg { color: currentColor; flex-shrink: 0; }

/* Body */
.exp-reports-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.exp-rep-loading {
  padding: 64px 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

/* KPI cards */
.exp-rep-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.exp-rep-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.exp-rep-kpi:hover { box-shadow: 0 4px 12px rgba(15,23,42,0.06); transform: translateY(-1px); }
.exp-rep-kpi span:first-child {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}
.exp-rep-kpi strong {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.5px;
}
.exp-rep-kpi small { font-size: 11px; color: #94a3b8; line-height: 1.4; }
.exp-rep-kpi.paid    { background: linear-gradient(135deg,#f0fdf4,#dcfce7); border-color: #bbf7d0; }
.exp-rep-kpi.paid strong { color: #15803d; }
.exp-rep-kpi.unpaid  { background: linear-gradient(135deg,#fef2f2,#fee2e2); border-color: #fecaca; }
.exp-rep-kpi.unpaid strong { color: #b91c1c; }
.exp-rep-kpi.billable { background: linear-gradient(135deg,#fffbeb,#fef3c7); border-color: #fde68a; }
.exp-rep-kpi.billable strong { color: #92400e; }
.exp-rep-kpi.net     { background: linear-gradient(135deg,#eff6ff,#dbeafe); border-color: #bfdbfe; }
.exp-rep-kpi.net strong { color: #1d4ed8; }

/* Report card (chart or table wrapper) */
.exp-rep-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
}
.exp-rep-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 12px;
  letter-spacing: -0.1px;
}

.exp-rep-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 900px) { .exp-rep-grid-2 { grid-template-columns: 1fr; } }

/* Report tables */
.exp-rep-table-wrap {
  overflow-x: auto;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
}
.exp-rep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.exp-rep-table th {
  background: #fafbff;
  padding: 8px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0;
  z-index: 1;
}
.exp-rep-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f8fafc;
  color: #334155;
  vertical-align: middle;
}
.exp-rep-table tr:hover td { background: #fafbff; }
.exp-rep-table .r { text-align: right; }
.exp-rep-table .mono { font-family: 'DM Mono', monospace; font-weight: 600; color: #0f172a; }
.exp-rep-table .small { font-size: 11px; color: #64748b; }

/* Utilization bar (project budget vs spent) */
.exp-util-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
  max-width: 130px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.exp-util-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(.16,1,.3,1);
}
.exp-util-bar .fill.ok    { background: #10b981; }
.exp-util-bar .fill.warn  { background: #f59e0b; }
.exp-util-bar .fill.over  { background: #ef4444; }
.exp-rep-table small.ok   { color: #15803d; font-weight: 600; }
.exp-rep-table small.warn { color: #d97706; font-weight: 600; }
.exp-rep-table small.over { color: #dc2626; font-weight: 700; }

/* Aging summary buckets */
.exp-rep-aging-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
}
.exp-rep-aging-bucket {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #94a3b8;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.exp-rep-aging-bucket .label { font-size: 11px; color: #64748b; font-weight: 500; }
.exp-rep-aging-bucket .amt {
  font-family: 'DM Mono', monospace;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}
.exp-rep-aging-bucket small { font-size: 11px; color: #94a3b8; }

.exp-rep-days {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
}
.exp-rep-days.ok     { background: #f0fdf4; color: #15803d; }
.exp-rep-days.notice { background: #fffbeb; color: #d97706; }
.exp-rep-days.warn   { background: #fff7ed; color: #ea580c; }
.exp-rep-days.danger { background: #fef2f2; color: #b91c1c; }

.exp-rep-bucket-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}

/* Vendor ledger header */
.exp-rep-vendor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
}
.exp-rep-vendor-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.3px;
}
.exp-rep-vendor-header small { font-size: 11.5px; color: #64748b; }
.exp-rep-vendor-balance {
  text-align: right;
}
.exp-rep-vendor-balance span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.exp-rep-vendor-balance strong {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: #b91c1c;
  letter-spacing: -0.5px;
}

/* Generic link button */
.btn-link {
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 0;
}
.btn-link:hover { color: #1d4ed8; text-decoration: underline; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .exp-view-grid { grid-template-columns: 1fr; }
  .expense-table th:nth-child(7), .expense-table td:nth-child(7),
  .expense-table th:nth-child(10), .expense-table td:nth-child(10) { display: none; }
}
@media (max-width: 768px) {
  .expense-filter-toolbar { flex-wrap: wrap; }
  .exp-date-preset-row { flex-wrap: wrap; }
  .exp-pagination { flex-direction: column; align-items: stretch; }
  .exp-page-controls { justify-content: center; }
  .expense-table th:nth-child(8), .expense-table td:nth-child(8),
  .expense-table th:nth-child(9), .expense-table td:nth-child(9) { display: none; }
}
