*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  /* ── LEGACY token names — now ALIASES onto the v1 ramps below (Phase 5.2).
     Kept so the ~170 existing var(--muted)/var(--primary)/… refs keep working,
     but there is now ONE source of truth (the --c-* ramps + semantic tokens).
     Values are byte-identical to the old literals → no visual change.
     Do NOT add new usages of these legacy names in new code. ── */
  --bg:var(--bg-canvas);--surface:var(--bg-surface);--border:var(--border-default);--text:var(--fg-default);--muted:var(--fg-muted);
  --primary:var(--c-brand-600);--primary-h:var(--c-brand-700);--primary-light:var(--c-brand-50);
  --success:var(--c-success-600);--warn:var(--c-warning-600);--danger:var(--c-danger-600);
  --radius:var(--radius-md);--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;

  /* accent indigo ramp (#6366f1) removed in Phase 1.5 — use brand/info tokens */

  /* ── 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:10px; /* Phase 5.2: 8→10 per design-system memo (buttons/inputs/cards) */
  --radius-lg:14px; /* Phase 5.2: 12→14 per design-system memo (modals/large surfaces) */
  --radius-full:9999px;

  /* ── Typography scale ── */
  --text-xs:12px;  /* Phase 5.2: was 11px — memo type scale starts at 12px (no 11) */
  --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:'Inter',ui-monospace,SFMono-Regular,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);

  /* ── Responsive breakpoints (Phase 5.5) ──
     480px  = wide phone (portrait)
     640px  = tablet-stack / invoice-preview zoom
     768px  = tablet landscape / modal full-screen
     900px  = tablet-to-desktop transition
     1024px = small desktop
     1280px = large desktop / pricing grid
     Keep: 380 (very narrow), 560 (voice/chip), 600 (modal footer)
     Avoid adding new ad-hoc breakpoints — use the values above. */

  /* ── 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) — covers every interactive element so
   keyboard/AT users always get a visible ring (WCAG 2.4.7). brand-600
   (#2563eb ≈ 4.5:1 on white) clears the 3:1 focus-indicator floor. ── */
.focus-ring:focus-visible,
a:focus-visible,
button:focus-visible,
[role=button]:focus-visible,
[role=link]:focus-visible,
[role=menuitem]:focus-visible,
[role=tab]:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline:2px solid var(--c-brand-600);
  outline-offset:2px;
  border-radius:var(--radius-sm);
}

/* ── Utility: visually hidden but exposed to assistive tech (WCAG text alt) ── */
.sr-only{
  position:absolute !important;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}

/* ── 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-recurring{margin-left:6px}
/* Phase 8.1 — E-Invoice IRN pills */
.pill-irn{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe;margin-left:6px;font-weight:600}
.pill-irn-cancelled{background:#fef2f2;color:#991b1b;border-color:#fecaca;margin-left:6px}

/* ════════════════════════════════════════════════════════════════════════
   VOICE INPUT (Phase 9) — Hindi voice → invoice line items
   ════════════════════════════════════════════════════════════════════════ */
.items-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.btn-voice {
  background: #fef9c3;
  color: #92400E;
  border: 1px solid #fcd34d;
  font-weight: 600;
}
.btn-voice:hover {
  background: #fde68a;
  color: #78350F;
  box-shadow: 0 2px 8px -2px rgba(252, 211, 77, 0.5);
}
.btn-voice svg { color: #92400E; }

.voice-overlay {
  position: fixed; inset: 0; z-index: 2000;
  opacity: 0; visibility: hidden;
  transition: opacity 180ms, visibility 180ms;
}
.voice-overlay.is-visible { opacity: 1; visibility: visible; }
.voice-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.voice-card {
  position: relative;
  max-width: 480px;
  width: calc(100% - 24px);
  margin: 48px auto 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.35);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.voice-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.voice-card-title { font-size: 16px; font-weight: 700; color: #0f172a; }
.voice-card-sub  { font-size: 12px; color: #64748b; margin-top: 2px; line-height: 1.4; }
.voice-card-close {
  border: 0; background: transparent;
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 22px; line-height: 1; color: #64748b;
  cursor: pointer;
}
.voice-card-close:hover { background: #F1F5F9; color: #0f172a; }

.voice-mic-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 8px 0 4px;
}
.voice-mic-btn {
  width: 84px; height: 84px;
  border-radius: 9999px;
  background: #DBEAFE;
  color: #2563EB;
  border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 120ms, box-shadow 120ms, background 120ms;
  box-shadow: 0 6px 18px -6px rgba(37, 99, 235, 0.4);
}
.voice-mic-btn:hover { transform: scale(1.04); }
.voice-mic-btn:active { transform: scale(0.97); }
.voice-mic-btn.is-listening {
  background: #DC2626;
  color: #fff;
  animation: voice-mic-pulse 1.4s ease-in-out infinite;
}
@keyframes voice-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45), 0 6px 18px -6px rgba(220, 38, 38, 0.5); }
  50%      { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0),     0 6px 18px -6px rgba(220, 38, 38, 0.5); }
}
.voice-mic-status {
  font-size: 13px; color: #475569; font-weight: 500;
  text-align: center; min-height: 18px;
}

.voice-transcript {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 60px;
  font-size: 14px; line-height: 1.5;
  color: #0f172a;
}
.voice-transcript-final { color: #0f172a; }
.voice-transcript-interim { color: #64748b; font-style: italic; }

.voice-parsed {
  border-top: 1px dashed #E2E8F0;
  padding-top: 12px;
}
.voice-parsed-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b; font-weight: 600; margin-bottom: 8px;
}
.voice-parsed-list { display: flex; flex-direction: column; gap: 8px; }
.voice-parsed-card {
  display: flex; align-items: center; gap: 12px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 10px;
  padding: 10px 12px;
}
.voice-parsed-card-qty {
  font-size: 18px; font-weight: 700; color: #065F46;
  font-feature-settings: 'tnum';
  min-width: 52px;
}
.voice-parsed-card-unit { font-size: 11px; color: #047857; font-weight: 500; }
.voice-parsed-card-body { flex: 1; min-width: 0; }
.voice-parsed-card-desc {
  font-size: 14px; font-weight: 600; color: #0f172a;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.voice-parsed-card-rate {
  font-size: 12px; color: #475569;
  font-feature-settings: 'tnum';
  margin-top: 2px;
}
.voice-parsed-card-remove {
  border: 0; background: transparent;
  width: 28px; height: 28px; border-radius: 6px;
  color: #64748b;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.voice-parsed-card-remove:hover { background: #FECACA; color: #B91C1C; }

.voice-card-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  border-top: 1px solid #E2E8F0;
  padding-top: 12px;
  margin-top: 4px;
}
.voice-card-foot .btn { min-height: 38px; }

.voice-hint {
  font-size: 11px; color: #64748b; text-align: center;
  padding: 4px 8px 0;
}
.voice-hint em { color: #475569; font-style: normal; }

body.voice-modal-open { overflow: hidden; }

@media (max-width: 480px) {
  .voice-card {
    margin-top: 16px;
    max-height: calc(100vh - 32px);
    border-radius: 14px;
  }
  .voice-mic-btn { width: 96px; height: 96px; }
  .voice-mic-btn svg { width: 42px; height: 42px; }
}
.pill-neutral{background:var(--c-neutral-100);color:var(--c-neutral-700);border-color:var(--c-neutral-200)}
.pill-accent {background:var(--c-info-50); color:var(--c-info-700); border-color:var(--c-info-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{
  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 .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 .seg:hover{color:var(--c-neutral-900);background:rgba(255,255,255,0.6)}
.filter-tabs .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', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "cv11", "ss01";
  -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-brand-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-logo{width:28px;height:28px;border-radius:7px;flex-shrink:0;display:none;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--primary),var(--primary-h));color:#fff;font-weight:700;font-size:12px;line-height:1;overflow:hidden}
.brand-logo.show{display:inline-flex}
.brand-logo img{width:100%;height:100%;object-fit:cover;display:block}
.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}
.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:#64748b;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.75;transition:opacity .15s}
.icon svg{width:100%;height:100%}
.sidebar nav a:hover .icon{opacity:1}
.sidebar nav a.active .icon{opacity:1;color:var(--primary)}

/* ── SIDEBAR NAV GROUPS (Phase 3 disclosure) ── */
.nav-group { display: flex; flex-direction: column; }
.nav-group-header {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 14px; margin: 0;
  background: transparent; border: 0; border-radius: 10px;
  color: #475569; font: inherit; font-weight: 500; font-size: 13.5px;
  text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-group-header:hover { background: rgba(241,245,249,0.8); color: #0f172a; }
.nav-group-header:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-group-header .nav-label { flex: 1; }
.nav-group-header .nav-chevron {
  width: 14px; height: 14px; flex-shrink: 0; opacity: 0.55;
  transition: transform .2s cubic-bezier(.16,1,.3,1);
}
.nav-group.is-open > .nav-group-header .nav-chevron { transform: rotate(180deg); }
.nav-group-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 18px;
  padding-top: 0;
  padding-bottom: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s cubic-bezier(.16,1,.3,1),
              padding-top .2s ease,
              padding-bottom .2s ease;
}
.nav-group.is-open > .nav-group-body {
  max-height: 480px; /* generous cap; max group has 6 items × ~36px = 216px */
  padding-top: 4px;
  padding-bottom: 4px;
}
.nav-group-body > a {
  font-size: 13px;
  position: relative;
}
.nav-group-body > a::after {
  /* subtle vertical guide line at the left */
  content: ''; position: absolute; left: -10px; top: 4px; bottom: 4px;
  width: 1px; background: rgba(226,232,240,0.9);
}
.nav-group-body > a.active::after { background: var(--primary); width: 2px; left: -10px; }
.nav-group-body > a.active::before { display: none; } /* parent group's active marker hides the original */

/* ── 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; overflow: hidden; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.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','Inter',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}

/* ── OVERDUE ROW: subtle left-border accent, no full-row tint ── */
tr.is-overdue td:first-child{box-shadow:inset 3px 0 0 var(--c-danger-500)}
tr.is-overdue td{background:rgba(254,242,242,0.35)}
tr.is-overdue:hover td{background:rgba(254,242,242,0.6)}
.void-watermark,.paid-watermark{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-30deg);font-size:96px;font-weight:900;pointer-events:none;z-index:10;letter-spacing:8px;text-transform:uppercase;user-select:none}
.void-watermark{color:rgba(220,38,38,.15)}
.paid-watermark{color:rgba(5,150,105,.15)}

/* ── 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:13px;font-weight:500;color:#334155;text-transform:none;letter-spacing:0;line-height:1.35}
input,select,textarea{padding:9px 12px;border:1px solid var(--border);border-radius:8px;font-family:inherit;font-size:14px;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','Inter',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}

/* No internal padding — the gutter is provided by .invoice-preview-frame
   (on screen) and by the jsPDF page margin (in the PDF). Keeping padding
   here would double up in the preview vs. PDF and break parity.           */
.invoice-doc{position:relative;max-width:880px;margin:0 auto;padding:0;background:#fff;color:#0F172A;font-family:'Inter','Roboto',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','Inter',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','Inter',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','Inter',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','Inter',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:#64748b;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
   A8: each :has() rule is paired with a .modal-has-gst-invoice class rule
   (toggled in showModal) so the invoice preview is still styled on browsers
   that don't support :has() (Firefox < 121). */
#modal-body > div[style]:has(.gst-invoice),
.modal-has-gst-invoice #modal-body > div[style]{padding:0!important;background:#fff!important;border-radius:0!important;overflow:auto!important}
.modal:has(.gst-invoice),
.modal.modal-has-gst-invoice{max-width:960px;border-radius:8px}
.modal:has(.gst-invoice) .modal-header,
.modal.modal-has-gst-invoice .modal-header{padding:12px 16px}
.modal:has(.gst-invoice) .modal-header h3,
.modal.modal-has-gst-invoice .modal-header h3{font-size:13px}
.modal:has(.gst-invoice) #modal-body,
.modal.modal-has-gst-invoice #modal-body{padding:12px 24px 14px}
.modal:has(.gst-invoice) .modal-footer,
.modal.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) ──
   C3: switched from flex with fixed 20% / 60% / 20% columns to a CSS grid
   where the side columns are AUTO-SIZED (so wide logos and big QR images
   can take what they need) and the center column gets the remaining 1fr.
   Side columns are clamped by min/max so they can't bully the company name.
   Baseline min-height removed (A3); kicks in only when there's an actual
   logo or QR (the :has rules below). */
.gst-invoice .invoice-header{
  display:grid;
  grid-template-columns:minmax(96px,auto) minmax(0,1fr) minmax(96px,auto);
  align-items:center;
  width:100%;
  border-bottom:1px solid #e2e8f0;
  padding:14px 18px;
  gap:16px;
  page-break-inside:avoid;break-inside:avoid;
}
.gst-invoice .invoice-header:has(.gst-logo-smart),
.gst-invoice .invoice-header:has(.qr-code canvas),
.gst-invoice .invoice-header:has(.qr-code img),
.gst-invoice .invoice-header.header-has-media{min-height:130px}

/* C4: dropped overflow:hidden on header columns — was silently clipping
   long company names. min-width:0 lets the grid track shrink correctly
   when needed; overflow-wrap:anywhere lets very long unbroken company
   names wrap to a second line instead of overflowing. */
.gst-invoice .header-left,
.gst-invoice .header-center,
.gst-invoice .header-right{
  display:flex;
  align-items:center;
  min-width:0;
  overflow:visible;
  overflow-wrap:anywhere;
}
.gst-invoice .header-left{justify-content:center;max-width:280px;text-align:center}
.gst-invoice .header-right{justify-content:center;max-width:160px;text-align:center;flex-direction:column;gap:4px}
.gst-invoice .header-center{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','Inter',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:9px;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}
/* When columns are hidden (HSN / Unit / Discount missing), neutralize the
   nth-child width rules below — they assume a 10-column layout. The
   <colgroup> emitted by renderItemsTable supplies the new widths. */
.gst-invoice .gst-items-table.cols-filtered th,
.gst-invoice .gst-items-table.cols-filtered td{width:auto!important}
.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','Inter',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:9px;color:#fff;letter-spacing:.04em;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%;min-height:170px;vertical-align:top}
.gst-invoice.tpl-classic .gst-party-table .terms-col{width:35%;min-height:170px;vertical-align:top}
.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;min-height:100px;vertical-align:top}
.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%;min-height:86px;vertical-align:top}
.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:9px;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:9px;color:#94a3b8;letter-spacing:.06em;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}
/* B16: distinct "Executive" identity vs Modern — slate-toned section labels
   (Modern uses brand blue) + a gold hairline under the accent bar so the two
   templates read as clearly different choices. */
.gst-invoice.tpl-special .inv-section-head{color:#0f172a;border-bottom-color:#0f172a}
.gst-invoice.tpl-special .inv-accent-bar{height:6px;background:linear-gradient(90deg,#0f172a,#334155,#0f172a);border-bottom:2px solid #c8a04a}
.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','Inter',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','Inter',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}

/* ════════════════════════════════════════════════════════════════════════
   E3: Per-template CSS for the 8 originally-inline templates.
   Each block declares the template's accent palette as CSS variables and
   exposes utility classes used by the render functions in invoice-form.js.
   Replaced ~200 inline style="…" attributes across the 8 templates.
   ════════════════════════════════════════════════════════════════════════ */

/* ── CORPORATE — navy professional ── */
.gst-invoice.tpl-corporate{--tpl-accent:#1e3a5f;--tpl-text:#0f172a;--tpl-muted:#475569;--tpl-faint:#94a3b8;--tpl-divider:#e2e8f0;--tpl-row-divider:#f1f5f9}
.gst-invoice.tpl-corporate .corp-accent-bar{height:6px;background:var(--tpl-accent)}
.gst-invoice.tpl-corporate .corp-parties{display:flex;padding:18px 22px;border-bottom:2px solid var(--tpl-accent)}
.gst-invoice.tpl-corporate .corp-party{flex:1;padding-right:18px}
.gst-invoice.tpl-corporate .corp-party + .corp-party{padding:0 18px;border-left:1px solid var(--tpl-divider)}
.gst-invoice.tpl-corporate .corp-info{flex:0 1 220px;min-width:180px;padding-left:18px;border-left:1px solid var(--tpl-divider)}
.gst-invoice.tpl-corporate .corp-label{font-size:9px;font-weight:800;text-transform:uppercase;color:var(--tpl-accent);margin-bottom:6px}
.gst-invoice.tpl-corporate .corp-party-name{font-size:13px;font-weight:700;color:var(--tpl-text)}
.gst-invoice.tpl-corporate .corp-party-addr{font-size:10.5px;color:var(--tpl-muted)}
.gst-invoice.tpl-corporate .corp-inv-no{font-size:17px;font-weight:900;color:var(--tpl-accent);font-family:'DM Mono','Inter',monospace;line-height:1.15;overflow-wrap:anywhere;word-break:break-word}
.gst-invoice.tpl-corporate .corp-info-row{display:flex;justify-content:space-between;padding:3px 0;font-size:10px}
.gst-invoice.tpl-corporate .corp-info-label{font-weight:700;color:var(--tpl-faint);text-transform:uppercase}
.gst-invoice.tpl-corporate .corp-table-wrap{padding:16px 22px}
.gst-invoice.tpl-corporate .corp-bottom{display:flex;padding:16px 22px;border-top:1px solid var(--tpl-divider)}
.gst-invoice.tpl-corporate .corp-words{flex:1;padding-right:20px}
.gst-invoice.tpl-corporate .corp-words-text{font-size:10.5px;color:#334155;font-weight:600}
.gst-invoice.tpl-corporate .corp-notes{font-size:10px;color:#64748b;margin-top:6px}
.gst-invoice.tpl-corporate .corp-totals{flex:0 0 240px;border-left:1px solid var(--tpl-divider);padding-left:20px}
.gst-invoice.tpl-corporate .corp-grand{display:flex;justify-content:space-between;padding:6px 0;margin-top:4px;border-top:2px solid var(--tpl-accent);font-size:13px;font-weight:900;color:var(--tpl-accent)}
.gst-invoice.tpl-corporate .corp-footer{display:flex;padding:16px 22px;border-top:1px solid var(--tpl-divider);font-size:10px;color:var(--tpl-muted);gap:16px}
.gst-invoice.tpl-corporate .corp-footer-meta{margin-top:6px}
.gst-invoice.tpl-corporate .corp-for{text-align:center;font-weight:700}

/* ── BOLD — black-and-red high-contrast ── */
.gst-invoice.tpl-bold{--tpl-accent:#000;--tpl-accent-2:#ef4444;--tpl-text:#0f172a;--tpl-muted:#475569;--tpl-faint:#64748b;--tpl-divider:#e2e8f0}
.gst-invoice.tpl-bold .bold-hero{background:var(--tpl-accent);color:#fff;padding:18px 22px;display:flex;justify-content:space-between}
.gst-invoice.tpl-bold .bold-label{font-size:9px;text-transform:uppercase;letter-spacing:.12em;opacity:.7}
.gst-invoice.tpl-bold .bold-inv-no{font-size:22px;font-weight:900;font-family:'DM Mono','Inter',monospace}
.gst-invoice.tpl-bold .bold-meta{font-size:14px;font-weight:700}
.gst-invoice.tpl-bold .bold-meta-sm{font-size:12px;font-weight:700}
.gst-invoice.tpl-bold .bold-parties{display:flex;padding:18px 22px}
.gst-invoice.tpl-bold .bold-party{flex:1;padding-right:18px}
.gst-invoice.tpl-bold .bold-party + .bold-party{padding:0 18px;border-left:1px solid var(--tpl-divider)}
.gst-invoice.tpl-bold .bold-party-label{font-size:9px;text-transform:uppercase;letter-spacing:.1em;font-weight:800;color:var(--tpl-accent-2);margin-bottom:6px}
.gst-invoice.tpl-bold .bold-party-name{font-size:13px;font-weight:800;color:var(--tpl-text)}
.gst-invoice.tpl-bold .bold-party-addr{font-size:10.5px;color:var(--tpl-muted)}
.gst-invoice.tpl-bold .bold-table-wrap{padding:0 22px}
.gst-invoice.tpl-bold .bold-totals-wrap{display:flex;justify-content:flex-end;padding:18px 22px}
.gst-invoice.tpl-bold .bold-totals-card{width:300px}
.gst-invoice.tpl-bold .bold-total-row{display:flex;justify-content:space-between;padding:4px 0;font-size:11px;border-bottom:1px solid var(--tpl-divider)}
.gst-invoice.tpl-bold .bold-grand{display:flex;justify-content:space-between;padding:8px 10px;font-size:16px;font-weight:900;background:var(--tpl-accent);color:#fff;margin-top:4px}
.gst-invoice.tpl-bold .bold-meta-strip{padding:14px 22px;font-size:10px;color:var(--tpl-faint);border-top:1px solid var(--tpl-divider)}
.gst-invoice.tpl-bold .bold-meta-strip > div{margin-bottom:4px}
.gst-invoice.tpl-bold .bold-terms{margin-top:6px;padding-top:6px;border-top:1px dashed var(--tpl-divider)}
.gst-invoice.tpl-bold .bold-for{text-align:center;padding:14px 22px;font-size:10px;color:var(--tpl-faint)}

/* ── PROFESSIONAL — emerald accent ── */
.gst-invoice.tpl-professional{--tpl-accent:#059669;--tpl-accent-strong:#064e3b;--tpl-tint:#f0fdf4;--tpl-text:#064e3b;--tpl-muted:#374151;--tpl-faint:#64748b;--tpl-divider:#e2e8f0}
.gst-invoice.tpl-professional .prof-wrap{padding:22px 26px}
.gst-invoice.tpl-professional .prof-hero{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px;padding-bottom:14px;border-bottom:3px solid var(--tpl-accent)}
.gst-invoice.tpl-professional .prof-label{font-size:10px;text-transform:uppercase;letter-spacing:.1em;color:var(--tpl-accent);font-weight:800}
.gst-invoice.tpl-professional .prof-inv-no{font-size:22px;font-weight:900;color:var(--tpl-accent-strong);font-family:'DM Mono','Inter',monospace}
.gst-invoice.tpl-professional .prof-meta{font-size:14px;font-weight:700;color:var(--tpl-accent-strong)}
.gst-invoice.tpl-professional .prof-meta-sm{font-size:12px;font-weight:700;color:var(--tpl-accent-strong)}
.gst-invoice.tpl-professional .prof-parties{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:22px}
.gst-invoice.tpl-professional .prof-party{background:var(--tpl-tint);border-left:4px solid var(--tpl-accent);padding:14px}
.gst-invoice.tpl-professional .prof-party-label{font-size:9px;text-transform:uppercase;letter-spacing:.1em;color:var(--tpl-accent);font-weight:800;margin-bottom:6px}
.gst-invoice.tpl-professional .prof-party-name{font-size:13px;font-weight:800;color:var(--tpl-text)}
.gst-invoice.tpl-professional .prof-party-addr{font-size:11px;color:var(--tpl-muted);margin-top:4px}
.gst-invoice.tpl-professional .prof-summary{display:flex;justify-content:space-between;align-items:flex-end;padding-top:16px;border-top:1px solid var(--tpl-divider)}
.gst-invoice.tpl-professional .prof-words-col{flex:1;padding-right:20px}
.gst-invoice.tpl-professional .prof-words{font-size:11px;color:var(--tpl-muted);margin-bottom:4px}
.gst-invoice.tpl-professional .prof-bank{font-size:10px;color:var(--tpl-faint);margin-top:4px}
.gst-invoice.tpl-professional .prof-totals{text-align:right}
.gst-invoice.tpl-professional .prof-totals-label{font-size:10px;color:var(--tpl-accent);text-transform:uppercase;letter-spacing:.1em;font-weight:700;margin-top:4px}
.gst-invoice.tpl-professional .prof-totals-value{font-size:13px;font-weight:700;color:var(--tpl-text)}
.gst-invoice.tpl-professional .prof-grand-label{font-size:14px;color:var(--tpl-accent);text-transform:uppercase;letter-spacing:.1em;font-weight:700;margin-top:8px;border-top:2px solid var(--tpl-accent);padding-top:8px}
.gst-invoice.tpl-professional .prof-grand-value{font-size:24px;font-weight:900;color:var(--tpl-text);font-family:'DM Mono','Inter',monospace}
.gst-invoice.tpl-professional .prof-terms{background:var(--tpl-tint);border-left:4px solid var(--tpl-accent);padding:10px 14px;margin-top:12px;font-size:11px;color:var(--tpl-muted)}
.gst-invoice.tpl-professional .prof-terms strong{color:var(--tpl-accent)}
.gst-invoice.tpl-professional .prof-for{text-align:center;padding-top:16px;font-size:10px;color:var(--tpl-faint)}

/* ── DARK — slate with cyan accent ── */
.gst-invoice.tpl-dark{--tpl-accent:#38bdf8;--tpl-text:#f8fafc;--tpl-muted:#94a3b8;--tpl-faint:#64748b;--tpl-divider:#334155;--tpl-bg:#0f172a;--tpl-card-bg:#1e293b;--tpl-row-divider:#334155;--tpl-row-text:#e2e8f0;--tpl-row-soft:#cbd5e1}
.gst-invoice.tpl-dark .dark-wrap{padding:22px 26px;background:var(--tpl-bg);color:var(--tpl-row-text)}
.gst-invoice.tpl-dark .dark-hero{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px;padding-bottom:14px;border-bottom:2px solid var(--tpl-accent)}
.gst-invoice.tpl-dark .dark-label{font-size:10px;text-transform:uppercase;letter-spacing:.1em;color:var(--tpl-accent);font-weight:800}
.gst-invoice.tpl-dark .dark-inv-no{font-size:22px;font-weight:900;color:var(--tpl-text);font-family:'DM Mono','Inter',monospace}
.gst-invoice.tpl-dark .dark-meta{font-size:14px;font-weight:700;color:var(--tpl-text)}
.gst-invoice.tpl-dark .dark-meta-sm{font-size:12px;font-weight:700;color:var(--tpl-text)}
.gst-invoice.tpl-dark .dark-parties{display:flex;gap:22px;margin-bottom:22px}
.gst-invoice.tpl-dark .dark-party{flex:1}
.gst-invoice.tpl-dark .dark-party-label{font-size:9px;text-transform:uppercase;letter-spacing:.1em;color:var(--tpl-accent);font-weight:800;margin-bottom:6px}
.gst-invoice.tpl-dark .dark-party-name{font-size:13px;font-weight:800;color:var(--tpl-text)}
.gst-invoice.tpl-dark .dark-party-addr{font-size:11px;color:var(--tpl-muted);margin-top:4px}
.gst-invoice.tpl-dark .dark-summary{display:flex;justify-content:space-between;align-items:flex-end;padding-top:16px;border-top:2px solid var(--tpl-divider)}
.gst-invoice.tpl-dark .dark-words-col{flex:1;padding-right:20px}
.gst-invoice.tpl-dark .dark-words{font-size:11px;color:var(--tpl-muted);margin-bottom:4px}
.gst-invoice.tpl-dark .dark-bank{font-size:10px;color:var(--tpl-faint);margin-top:4px}
.gst-invoice.tpl-dark .dark-totals{text-align:right}
.gst-invoice.tpl-dark .dark-totals-label{font-size:10px;color:var(--tpl-accent);text-transform:uppercase;letter-spacing:.1em;font-weight:700;margin-top:4px}
.gst-invoice.tpl-dark .dark-totals-value{font-size:13px;font-weight:700;color:var(--tpl-text)}
.gst-invoice.tpl-dark .dark-grand-label{font-size:14px;color:var(--tpl-accent);text-transform:uppercase;letter-spacing:.1em;font-weight:700;margin-top:8px;border-top:2px solid var(--tpl-accent);padding-top:8px}
.gst-invoice.tpl-dark .dark-grand-value{font-size:24px;font-weight:900;color:var(--tpl-text);font-family:'DM Mono','Inter',monospace}
.gst-invoice.tpl-dark .dark-terms{background:var(--tpl-card-bg);border-left:3px solid var(--tpl-accent);padding:10px 14px;margin-top:12px;font-size:11px;color:var(--tpl-row-soft)}
.gst-invoice.tpl-dark .dark-terms strong{color:var(--tpl-accent)}
.gst-invoice.tpl-dark .dark-for{text-align:center;padding-top:16px;font-size:10px;color:var(--tpl-muted)}

/* ── CLEAN — airy slate/minimal ── */
.gst-invoice.tpl-clean{--tpl-ink:#0f172a;--tpl-faint:#94a3b8;--tpl-muted:#475569;--tpl-divider:#f1f5f9;--tpl-divider-2:#e2e8f0}
.gst-invoice.tpl-clean .clean-wrap{padding:22px 26px}
.gst-invoice.tpl-clean .clean-hero{display:flex;justify-content:space-between;margin-bottom:22px}
.gst-invoice.tpl-clean .clean-label{font-size:11px;text-transform:uppercase;letter-spacing:.1em;color:var(--tpl-faint);font-weight:700}
.gst-invoice.tpl-clean .clean-label.sp{margin-top:4px}
.gst-invoice.tpl-clean .clean-inv-no{font-size:18px;font-weight:800;font-family:'DM Mono','Inter',monospace;color:var(--tpl-ink);margin-top:4px}
.gst-invoice.tpl-clean .clean-meta{font-size:14px;font-weight:600;margin-top:4px}
.gst-invoice.tpl-clean .clean-meta-sm{font-size:12px;font-weight:600}
.gst-invoice.tpl-clean .clean-parties{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:22px;padding-bottom:22px;border-bottom:1px solid var(--tpl-divider)}
.gst-invoice.tpl-clean .clean-party-label{font-size:11px;text-transform:uppercase;letter-spacing:.1em;color:var(--tpl-faint);font-weight:700;margin-bottom:6px}
.gst-invoice.tpl-clean .clean-party-name{font-size:13px;font-weight:700}
.gst-invoice.tpl-clean .clean-party-addr{font-size:11px;color:var(--tpl-muted);margin-top:3px}
.gst-invoice.tpl-clean .clean-summary{display:flex;justify-content:space-between;align-items:flex-end;padding-top:16px;border-top:1px solid var(--tpl-divider)}
.gst-invoice.tpl-clean .clean-words-col{flex:1;padding-right:20px}
.gst-invoice.tpl-clean .clean-words{font-size:11px;color:var(--tpl-muted);margin-bottom:4px}
.gst-invoice.tpl-clean .clean-fine{font-size:10px;color:var(--tpl-faint);margin-top:4px}
.gst-invoice.tpl-clean .clean-tot-label{font-size:11px;color:var(--tpl-faint);text-transform:uppercase;letter-spacing:.05em;margin-top:4px}
.gst-invoice.tpl-clean .clean-tot-value{font-size:13px;font-weight:700;color:var(--tpl-ink)}
.gst-invoice.tpl-clean .clean-grand-label{font-size:14px;color:var(--tpl-faint);text-transform:uppercase;letter-spacing:.05em;margin-top:8px;border-top:2px solid var(--tpl-ink);padding-top:8px}
.gst-invoice.tpl-clean .clean-grand-value{font-size:24px;font-weight:800;color:var(--tpl-ink);font-family:'DM Mono','Inter',monospace}
.gst-invoice.tpl-clean .clean-for{text-align:center;padding-top:16px;font-size:10px;color:#64748b;border-top:1px solid var(--tpl-divider)}

/* ── CARD — blue card surfaces ── */
.gst-invoice.tpl-card{--tpl-accent:#2563eb;--tpl-ink:#0f172a;--tpl-faint:#64748b;--tpl-muted:#475569;--tpl-divider:#e2e8f0;--tpl-tint:#f8fafc}
.gst-invoice.tpl-card .card-wrap{padding:18px 22px}
.gst-invoice.tpl-card .card-row{display:flex;gap:12px;margin-bottom:18px}
.gst-invoice.tpl-card .card-row.sm{margin-bottom:12px}
/* B15: softer hairline + faint shadow instead of a hard 1px border on every
   one of ~7 cards — calmer, less "boxed-in" feel. */
.gst-invoice.tpl-card .card-box{flex:1;border:1px solid #eef2f7;border-radius:10px;padding:14px;box-shadow:0 1px 2px rgba(15,23,42,.04)}
.gst-invoice.tpl-card .card-box.tint{background:var(--tpl-tint)}
.gst-invoice.tpl-card .card-box.white{background:#fff}
.gst-invoice.tpl-card .card-box.full{margin-bottom:12px;background:#fff}
.gst-invoice.tpl-card .card-box.totals{flex:0 0 260px;background:#fff}
.gst-invoice.tpl-card .card-label{font-size:9px;text-transform:uppercase;letter-spacing:.08em;color:var(--tpl-faint);font-weight:800;margin-bottom:6px}
.gst-invoice.tpl-card .card-inv-no{font-size:18px;font-weight:900;font-family:'DM Mono','Inter',monospace;color:var(--tpl-accent)}
.gst-invoice.tpl-card .card-meta-sm{font-size:10px;color:var(--tpl-faint);margin-top:4px}
.gst-invoice.tpl-card .card-due{font-size:16px;font-weight:800;color:var(--tpl-ink)}
.gst-invoice.tpl-card .card-party-name{font-size:13px;font-weight:800}
.gst-invoice.tpl-card .card-party-addr{font-size:10.5px;color:var(--tpl-muted);margin-top:3px}
.gst-invoice.tpl-card .card-words{font-size:10.5px;color:var(--tpl-muted)}
.gst-invoice.tpl-card .card-total-row{display:flex;justify-content:space-between;padding:3px 0;font-size:10.5px}
.gst-invoice.tpl-card .card-grand{display:flex;justify-content:space-between;padding:6px 0;margin-top:4px;border-top:2px solid var(--tpl-accent);font-size:13px;font-weight:900;color:var(--tpl-accent)}
.gst-invoice.tpl-card .card-terms{background:var(--tpl-tint);border:1px solid var(--tpl-divider);border-radius:10px;padding:12px;margin-bottom:12px;font-size:10.5px;color:var(--tpl-muted)}
.gst-invoice.tpl-card .card-terms strong{color:var(--tpl-accent)}
.gst-invoice.tpl-card .card-for{text-align:center;font-size:10px;color:var(--tpl-faint)}

/* ── COMPACT — dense, hairline rules ── */
.gst-invoice.tpl-compact{--tpl-ink:#0f172a;--tpl-faint:#64748b;--tpl-divider:#e2e8f0}
.gst-invoice.tpl-compact .cmp-wrap{padding:12px 16px;font-size:11px}
.gst-invoice.tpl-compact .cmp-hero{display:flex;justify-content:space-between;margin-bottom:12px;padding-bottom:12px;border-bottom:1px solid var(--tpl-divider)}
.gst-invoice.tpl-compact .cmp-summary{display:flex;justify-content:space-between;align-items:flex-start;margin-top:12px;padding-top:12px;border-top:1px solid var(--tpl-divider)}
.gst-invoice.tpl-compact .cmp-words{max-width:60%;font-size:10px}
.gst-invoice.tpl-compact .cmp-tot{text-align:right}
.gst-invoice.tpl-compact .cmp-tot-row{font-size:10px}
.gst-invoice.tpl-compact .cmp-grand{font-size:16px;font-weight:900;font-family:'DM Mono','Inter',monospace;margin-top:4px}
.gst-invoice.tpl-compact .cmp-grand-label{font-size:10px;color:var(--tpl-faint)}
.gst-invoice.tpl-compact .cmp-terms{font-size:9.5px;color:var(--tpl-faint);margin-top:6px;padding-top:6px;border-top:1px dashed var(--tpl-divider)}
.gst-invoice.tpl-compact .cmp-for{text-align:center;font-size:10px;color:var(--tpl-faint);margin-top:8px}

/* ── ELEGANT — serif, gold accents ── */
.gst-invoice.tpl-elegant{--tpl-gold:#d4af37;--tpl-brown:#8b7355;--tpl-ink:#3e2723;--tpl-muted:#5d4037;--tpl-cream:#f5f5dc}
.gst-invoice.tpl-elegant .eleg-wrap{padding:22px;font-family:'Lora',Georgia,'Times New Roman',serif;color:var(--tpl-ink)}
.gst-invoice.tpl-elegant .eleg-hero{display:flex;justify-content:space-between;border-bottom:1px solid var(--tpl-gold);padding-bottom:14px;margin-bottom:22px}
.gst-invoice.tpl-elegant .eleg-label{font-size:10px;text-transform:uppercase;letter-spacing:.2em;color:var(--tpl-brown)}
.gst-invoice.tpl-elegant .eleg-label.sp{margin-top:4px}
.gst-invoice.tpl-elegant .eleg-inv-no{font-size:20px;font-weight:700}
.gst-invoice.tpl-elegant .eleg-meta{font-size:14px}
.gst-invoice.tpl-elegant .eleg-meta-sm{font-size:12px}
.gst-invoice.tpl-elegant .eleg-parties{display:flex;gap:22px;margin-bottom:22px}
.gst-invoice.tpl-elegant .eleg-party{flex:1}
.gst-invoice.tpl-elegant .eleg-party-label{font-size:9px;text-transform:uppercase;letter-spacing:.15em;color:var(--tpl-brown);font-weight:700;margin-bottom:6px}
.gst-invoice.tpl-elegant .eleg-party-name{font-size:13px;font-weight:700}
.gst-invoice.tpl-elegant .eleg-party-addr{font-size:11px;color:var(--tpl-muted);margin-top:4px}
.gst-invoice.tpl-elegant .eleg-summary{display:flex;justify-content:space-between;align-items:flex-end;border-top:1px solid var(--tpl-gold);padding-top:16px}
.gst-invoice.tpl-elegant .eleg-words-col{flex:1;padding-right:20px}
.gst-invoice.tpl-elegant .eleg-words{font-size:11px;color:var(--tpl-muted);margin-bottom:4px}
.gst-invoice.tpl-elegant .eleg-bank{font-size:10px;color:var(--tpl-brown);margin-top:4px}
.gst-invoice.tpl-elegant .eleg-tot-label{font-size:10px;color:var(--tpl-brown);text-transform:uppercase;letter-spacing:.15em;margin-top:4px}
.gst-invoice.tpl-elegant .eleg-tot-value{font-size:13px;font-weight:700;color:var(--tpl-ink)}
.gst-invoice.tpl-elegant .eleg-grand-label{font-size:14px;color:var(--tpl-brown);text-transform:uppercase;letter-spacing:.15em;margin-top:8px;border-top:1px solid var(--tpl-gold);padding-top:8px}
.gst-invoice.tpl-elegant .eleg-grand-value{font-size:24px;font-weight:800;color:var(--tpl-ink);font-family:'DM Mono','Inter',monospace}
.gst-invoice.tpl-elegant .eleg-terms{margin-top:10px;padding-top:10px;border-top:1px solid var(--tpl-gold);font-size:10px;color:var(--tpl-muted)}
.gst-invoice.tpl-elegant .eleg-terms strong{color:var(--tpl-brown)}
.gst-invoice.tpl-elegant .eleg-for{text-align:center;padding-top:16px;font-size:10px;color:var(--tpl-brown)}

/* ── Print (shared + template-specific) ── */
@page{size:A4;margin:12mm}
@media print {
  /* F7: zero the body margin so print content isn't double-inset (browser
     default 8px body margin + @page 12mm). @page provides the page gutter. */
  html,body,#print-area{transform:none!important;zoom:1!important;margin:0!important;padding:0!important}
  /* A1: keep the print font size identical to screen/PDF (12.5px base) —
     the old 11px override made printed text reflow differently. */
  .invoice-doc.gst-invoice{width:100%;max-width:none}
  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}
  /* A3/C3/C4: don't force the old fixed-% flex header in print — let the
     screen grid layout (auto-sized side columns, no clipping) carry over. */
  .gst-invoice .invoice-header{padding:10px 14px!important;page-break-inside:avoid!important;break-inside:avoid!important}
  .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;
}
/* Inherit font-size from .invoice-doc base rule (12.5px) so the PDF text
   reflows identically to the on-screen preview. Previously this overrode
   to 11px, which shifted every line, table cell and total in the PDF.    */
.pdf-render-mode .invoice-doc.gst-invoice{
  width:100%;max-width:100%;margin:0;
  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}
/* A6: html2canvas approximates linear-gradients into visible colour bands at
   scale:2. Replace every gradient surface with a solid flat colour for the
   PDF capture so accent bars / total bars render clean. */
.pdf-render-mode .gst-invoice.tpl-modern .inv-accent-bar{background:#2563eb!important}
.pdf-render-mode .gst-invoice.tpl-special .inv-accent-bar{background:#0f172a!important}
.pdf-render-mode .invoice-doc .hero-total,
.pdf-render-mode .invoice-doc .summary-total{background:#1d4ed8!important}
/* 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;transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.08)}
.template-card.selected{border-color:#2563eb;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}

.public-share-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}

/* Phase 9 — Pay-via-UPI CTA on public share page */
.btn-pay-upi,.btn-pay-rzp{
  display:inline-flex;align-items:center;gap:8px;
  padding:10px 18px;border-radius:10px;
  background:#2563EB;color:#fff;text-decoration:none;
  font-weight:600;font-size:14px;font-family:inherit;
  border:1px solid #2563EB;
  box-shadow:0 6px 18px -4px rgba(37,99,235,.45);
  transition:background .12s,transform .08s;
}
.btn-pay-upi:hover,.btn-pay-rzp:hover{background:#1D4ED8;border-color:#1D4ED8}
.btn-pay-upi:active,.btn-pay-rzp:active{transform:scale(0.98)}
.btn-pay-upi svg,.btn-pay-rzp svg{flex-shrink:0}
.btn-pay-link{color:var(--c-brand-600);border-color:var(--c-brand-200);background:var(--c-brand-50)}

@media (max-width: 768px){
  .public-share-page{padding:12px;background:#fff}
  .public-share-toolbar{align-items:flex-start;margin-bottom:12px;flex-direction:column}
  .public-share-actions{width:100%;justify-content:stretch}
  .public-share-actions .btn-pay-upi,.public-share-actions .btn-pay-rzp{flex:1;justify-content:center;padding:12px 16px;font-size:15px}
  .public-share-actions .btn-secondary{flex:0 0 auto}
  .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','Inter',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','Inter',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: 1024px) {
  .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,.logo .brand-logo.show{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}

/* ── DATA MIGRATION — SWITCH FLOW (one-click import) ── */
.dm-mode-switch{display:inline-flex;gap:4px;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:10px;padding:4px;margin-bottom:16px}
.dm-mode{border:0;background:transparent;color:#475569;border-radius:7px;padding:8px 14px;font-size:13px;font-weight:600;cursor:pointer}
.dm-mode.active{background:#fff;color:#2563eb;box-shadow:0 1px 3px rgba(15,23,42,.08)}
.dm-source-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
.dm-source-card{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;border:1.5px solid #e2e8f0;background:#fff;border-radius:14px;padding:18px 14px;cursor:pointer;transition:.15s}
.dm-source-card:hover{border-color:#2563eb;background:#f8fafc;transform:translateY(-1px)}
.dm-source-card.active{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.14)}
.dm-source-logo{display:grid;place-items:center;width:46px;height:46px;border-radius:12px;font-size:13px;font-weight:800;color:#fff;letter-spacing:.3px;background:#64748b}
.dm-src-tally .dm-source-logo{background:#1e88c7}
.dm-src-vyapar .dm-source-logo{background:#e53935}
.dm-src-quickbooks .dm-source-logo{background:#2ca01c}
.dm-src-zoho_books .dm-source-logo{background:#e0992a}
.dm-src-excel .dm-source-logo{background:#2563eb}
.dm-source-name{font-size:14px;font-weight:700;color:#0f172a}
.dm-source-tag{font-size:11px;color:#64748b}
.dm-switch-grid{display:grid;grid-template-columns:1.4fr 1fr;gap:16px;margin-bottom:14px}
.dm-guide{margin:0;padding-left:20px;color:#334155;font-size:13px;line-height:1.7}
.dm-guide li{margin-bottom:4px}
.dm-templates{background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:14px}
.dm-templates strong{display:block;font-size:13px;color:#0f172a;margin-bottom:8px}
.dm-template-links{display:flex;flex-direction:column;gap:6px}
.dm-template-links a{font-size:12.5px;color:#2563eb;text-decoration:none}
.dm-template-links a:hover{text-decoration:underline}
.dm-analysis-head{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px;margin:16px 0 12px}
.dm-analysis-head div{border:1px solid #e2e8f0;background:#f8fafc;border-radius:10px;padding:12px}
.dm-analysis-head strong{display:block;font-size:18px;color:#0f172a;text-transform:capitalize}
.dm-analysis-head span{font-size:11px;color:#64748b;font-weight:700;text-transform:uppercase}
.dm-allsheet-table table{width:100%}
.dm-allsheet-table select{padding:6px 8px;border:1px solid #cbd5e1;border-radius:8px;font-size:13px}
.dm-allsheet-table tr.dm-sheet-skip{opacity:.5}
.dm-confidence{display:inline-flex;border-radius:999px;padding:3px 9px;font-size:11px;font-weight:700}
.dm-confidence.ok{background:#ecfdf5;color:#166534}
.dm-confidence.warn{background:#fffbeb;color:#92400e}
.dm-skip-toggle{display:inline-flex;align-items:center;gap:5px;font-size:12px;color:#64748b;cursor:pointer}
.dm-all-actions{display:flex;align-items:center;gap:10px;margin-top:14px;flex-wrap:wrap}
.dm-all-actions select{padding:9px 12px;border:1px solid #cbd5e1;border-radius:10px;font-size:13px}
.dm-batch-row{display:grid;grid-template-columns:180px 1fr auto;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid #f1f5f9}
.dm-batch-label strong{display:block;font-size:13px;color:#0f172a}
.dm-batch-label span{font-size:11px;color:#64748b}
.dm-progress-fill{display:block;height:100%;background:linear-gradient(90deg,#2563eb,#16a34a);transition:width .25s}
.dm-progress-fill.bad{background:#dc2626}
.dm-batch-meta{display:flex;gap:8px;font-size:11.5px;font-weight:700;white-space:nowrap}
.dm-batch-meta .ok{color:#166534}.dm-batch-meta .warn{color:#92400e}.dm-batch-meta .bad{color:#991b1b}
.dm-auto-created{margin-top:14px;background:#ecfdf5;border:1px solid #bbf7d0;color:#166534;border-radius:10px;padding:10px 14px;font-size:13px;font-weight:600}

/* 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}
  .dm-switch-grid{grid-template-columns:1fr}
  .dm-batch-row{grid-template-columns:1fr;gap:6px}
}

/* ── 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: 'Inter', sans-serif; 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 + KPI styling consolidated below (single source: "KPI Cards v2" / "Section Headers" near L5020). Stale gen-1 duplicates removed. ── */

/* ── Section animation (still used by .dash-section) ── */
.dash-section { margin-bottom: 32px; animation: dash-fade-up 0.4s ease forwards; opacity: 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: #64748b;
  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: see single source "KPI Cards v2" near L5180. Stale gen-1 KPI block removed. ── */

/* ── 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; }

/* ── Charts / Tables / AI-Insight cards: single source defined later (gen-3 "Charts" near L5360, "Smart Tables v2" near L5430) and gen-2 "AI Insights" near L3300. Stale gen-1 duplicates removed. ── */

/* ── 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;
  }

  /* Nav-group collapsed (rail) state — Phase 3 */
  .sidebar.collapsed .nav-group-header {
    justify-content: center;
    padding: 10px 0;
    margin: 0 10px;
    border-radius: 10px;
    position: relative;
  }
  .sidebar.collapsed .nav-group-header .nav-label,
  .sidebar.collapsed .nav-group-header .nav-chevron {
    display: none;
  }
  .sidebar.collapsed .nav-group-header .icon {
    margin: 0;
  }
  /* Hide expanded group bodies entirely when in rail mode */
  .sidebar.collapsed .nav-group-body {
    display: none !important;
  }
  /* Same tooltip pattern for group headers */
  .sidebar.collapsed .nav-group-header::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;
    pointer-events: none;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
  }
  .sidebar.collapsed .nav-group-header: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: #64748b;
}
.tm-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  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: #64748b;
  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: #64748b;
  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: #64748b;
  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: #64748b;
  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: #64748b;
  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: #64748b;
  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: #64748b;
  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: #64748b;
  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: #64748b;
}

/* ── 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-actions {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-state-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.empty-state-link:hover { text-decoration: underline; }
.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 {
  display: inline-flex;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--c-warning-50);
  color: var(--c-warning-700);
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.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: #64748b;
}

/* ── 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: var(--fg-muted);
  --dash-muted-light: var(--fg-muted);
  --dash-primary: var(--c-brand-600);
  --dash-primary-light: var(--c-brand-50);
  --dash-success: var(--c-success-600); /* was #10b981 (stray green) — fixed in 5.6 */
  --dash-warn: var(--c-warning-500);
  --dash-danger: var(--c-danger-500);
  --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), #1d4ed8);
  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;
}
.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 + Section Containers: single source is gen-3 ("KPI Cards v2" / "Section Headers" near L5070). Stale gen-2 duplicates (incl. dropped #6366f1 indigo) removed. ── */

/* ── 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;
}
.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 + Smart Tables: single source is gen-3 ("Charts" / "Smart Tables v2" near L5210). Stale gen-2 duplicates removed (also dropped a higher-specificity `.dash-table-header h4` that was overriding the v2 title). ── */

/* ── Alert Center ──────────────────────────────────────────── */
/* ── Alert list: single source is gen-3 ("Alerts v2" near L5360). Stale gen-2 duplicate removed (also dropped indigo `.low` + translateX hover). ── */

/* ── 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), #1d4ed8);
  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), #1d4ed8); 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);
}
.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:#64748b; 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','Inter',monospace; font-weight:600; color:#0f172a; font-size:12px; }
.expense-vendor-cell { font-weight:500; color:#0f172a; }
.expense-amount-cell { font-family:'DM Mono','Inter',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; background:transparent; outline:none; padding:0; font-size:14px; font-weight:500; color:#0f172a; width:100%; box-shadow:none; transition:all .2s; }
.topbar-search-wrap input::placeholder { color:#64748b; 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','Inter',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,#2563eb); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; font-size:13px; font-family:'DM Mono','Inter',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,#2563eb); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:16px; font-family:'DM Mono','Inter',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:#64748b; 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:#64748b; 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','Inter',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:#64748b; 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;
}
.client-filter-card .filter-select {
  width:100%; padding:8px 30px 8px 11px; 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:#64748b; pointer-events:none; z-index:1;
}
.filter-search-input {
  width:100%; padding:7px 12px 7px 34px; height:36px;
  border:1px solid #e2e8f0; border-radius:9px;
  font-size:13px; background:#f8fafc; color:#0f172a;
  transition:all .18s; font-family:inherit;
}
.filter-search-input::placeholder { color:#a0aec0; font-weight:400; }
.filter-search-input:focus {
  background:#fff; border-color:#2563eb;
  box-shadow:0 0 0 3px rgba(37,99,235,.08); outline:none;
}
.filter-select {
  padding:7px 28px 7px 11px; height:36px;
  border:1px solid #e2e8f0; border-radius:9px;
  font-size:12.5px; color:#334155; background:#f8fafc;
  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");
  background-repeat:no-repeat; background-position:right 9px center;
  transition:all .15s;
}
.filter-select:hover { border-color:#cbd5e1; background:#fff; }
.filter-select:focus {
  border-color:#2563eb; background:#fff;
  box-shadow:0 0 0 3px rgba(37,99,235,.08); 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:#64748b; 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','Inter',monospace; font-size:12px; }

/* ── List page header + sticky filter bar (Phase 4a) ── */
.list-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.list-page-header-text { min-width: 0; }
.list-page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.list-page-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.list-page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.list-page-header-actions .btn-plus {
  margin-right: 6px;
  font-size: 16px;
  line-height: 1;
}
.list-filter-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-canvas, #FAFAFA);
  padding: 8px 0 12px;
  margin: 0 -32px 0 -32px; /* extend to page edge for clean sticky background */
  padding-left: 32px;
  padding-right: 32px;
  border-bottom: 1px solid transparent;
  transition: border-color .15s, box-shadow .15s;
}
.list-filter-bar.is-stuck {
  border-bottom-color: var(--border, #e2e8f0);
  box-shadow: 0 4px 14px rgba(15,23,42,0.04);
}
.list-search-row { margin-bottom: 0; }
.list-search-row + .list-search-row { margin-top: 10px; }
.list-search-input { flex: 1; }
.list-filter-card { margin: 0 0 12px; padding: 12px 16px; }
.list-filter-grid { gap: 10px; }
.list-filter-grid .form-group { margin-bottom: 0; min-width: 120px; }
.list-filter-grid .list-filter-search { flex: 1; min-width: 220px; }
.list-filter-grid .list-filter-search input { width: 100%; }

/* ── Table row tokens (Phase 4a — replace inline styles in row HTML) ── */
.row-link-mono {
  font-family: 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color .15s, border-color .15s;
}
.row-link-mono:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.cell-mono-num {
  font-family: 'Inter', sans-serif;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  color: var(--text);
}
.cell-amount-paid { color: var(--c-success-700, #15803d); }
.cell-amount-paid.is-zero { color: var(--c-neutral-400, #94a3b8); font-weight: 400; }
.cell-amount-due { color: var(--c-danger-700, #b91c1c); }
.cell-amount-due.is-zero { color: var(--c-success-700, #15803d); font-weight: 500; }
.cell-hint { display:block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.cell-hint-mono { font-family: 'Inter', sans-serif; font-variant-numeric: tabular-nums; }
.cell-hint-danger { color: var(--c-danger-700, #b91c1c); font-weight: 600; }
.cell-hint-warning { color: var(--c-warning-700, #b45309); font-weight: 600; }
.cell-hint-success { color: var(--c-success-700, #15803d); font-weight: 500; }
.cell-hint-info    { color: var(--primary); }
.cell-void-reason {
  display:block; font-size:12px; color: var(--muted); margin-top:2px;
  max-width:160px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.row-actions { display:flex; gap:6px; justify-content:flex-end; align-items:center; }
.row-actions.is-tight { gap: 4px; flex-wrap: wrap; }
.row-actions .btn-action-record-payment,
.btn-action.tone-success {
  color: var(--c-success-700, #15803d);
  background: var(--c-success-50, #ecfdf5);
  border: 1px solid var(--c-success-100, #bbf7d0);
}
.btn-action.tone-info {
  color: var(--c-brand-700, #1d4ed8);
  background: var(--c-brand-50, #eff6ff);
  border: 1px solid var(--c-brand-100, #bfdbfe);
}
.btn-action.tone-danger {
  color: var(--c-danger-700, #b91c1c);
  background: var(--c-danger-50, #fef2f2);
  border: 1px solid var(--c-danger-100, #fecaca);
}
.row-actions .btn-action-quote-convert,
.row-actions .btn-action-quote-send {
  width: auto;
  padding: 0 10px;
  font-weight: 600;
  font-size: 12px;
  gap: 4px;
}
.row-actions .btn-action-quote-convert {
  color: var(--c-success-700, #15803d);
  background: var(--c-success-50, #ecfdf5);
  border: 1px solid var(--c-success-100, #d1fae5);
}
.row-actions .btn-action-quote-send {
  color: var(--c-info-700, #1d4ed8);
  background: var(--c-info-50, #eff6ff);
  border: 1px solid var(--c-info-100, #dbeafe);
}
.row-expired td { background: var(--c-warning-50, #fffbeb); }

/* ── 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:#64748b; 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','Inter',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:#64748b; 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; flex-wrap:nowrap; }
.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);
}
/* Tooltips: rely on the native browser tooltip from the button's `title`
   attribute. The native tooltip is OS-rendered, so it is never clipped by the
   table's overflow:auto wrapper or hidden behind the sticky header — and it
   avoids showing two tooltips at once (custom black box + native). */

/* ── 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; padding:8px 18px;
  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; }
  .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: 768px) {
  .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: #64748b;
  margin-top: 4px;
}
/* Tone variants (Phase 4b) — replaces inline border-left + color on summary cards */
.client-summary-card.tone-info    { border-left: 3px solid var(--primary, #2563eb); }
.client-summary-card.tone-success { border-left: 3px solid var(--c-success-600, #059669); }
.client-summary-card.tone-warning { border-left: 3px solid var(--c-warning-600, #d97706); }
.client-summary-card.tone-danger  { border-left: 3px solid var(--c-danger-600, #dc2626); }
.client-summary-card.tone-accent  { border-left: 3px solid #8b5cf6; } /* conversion-rate purple */
.client-summary-card.is-clickable { cursor: pointer; }
.summary-value-success { color: var(--c-success-700, #15803d); }
.summary-value-danger  { color: var(--c-danger-700, #b91c1c); }
.summary-value-warning { color: var(--c-warning-700, #b45309); }
.summary-value-text { font-size: 15px; line-height: 1.2; font-family: 'Inter', sans-serif; }
.summary-sub-danger { color: var(--c-danger-700, #b91c1c); font-weight: 600; }
/* Re-use party-name-link: give it dashed-underline + brand hover (replaces inline mouseover handlers) */
.party-name-link {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color .15s, border-color .15s;
}
.party-name-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
/* Vendor ID mono cell */
.cell-mono-id {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
/* Phase 4b.3 — productList tokens */
.cell-mono-text {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text);
}
.cell-strike {
  text-align: right;
  font-family: 'Inter', sans-serif;
  font-feature-settings: 'tnum';
  color: var(--muted);
  font-size: 12px;
  text-decoration: line-through;
}
.cell-center { text-align: center; }
.cell-em-dash { color: var(--c-neutral-300, #cbd5e1); text-align: right; }
.cell-mono-num.is-sm { font-size: 12px; font-weight: 500; }
.cell-mono-num.margin-good { color: var(--c-success-700, #15803d); font-weight: 600; }
.cell-mono-num.margin-ok   { color: var(--c-neutral-600, #475569); }
.cell-mono-num.margin-low  { color: var(--c-warning-700, #b45309); }
.cell-mono-num.margin-zero { color: var(--c-neutral-400, #94a3b8); font-weight: 400; }
.cell-status { display: inline-block; }
.cell-status.is-danger  { color: var(--c-danger-700, #b91c1c); font-weight: 700; }
.cell-status.is-warning { color: var(--c-warning-700, #b45309); font-weight: 600; }
.cell-status.is-success { color: var(--c-success-700, #15803d); }
.cell-status-tag { font-size: 10px; margin-left: 4px; font-weight: 700; letter-spacing: 0.04em; }
tr.row-danger td { background: var(--c-danger-50, #fef2f2); }
.product-thumb-row { display: flex; align-items: center; gap: 8px; }
.product-thumb {
  width: 32px; height: 32px; border-radius: 6px;
  object-fit: cover; background: var(--c-neutral-100, #f1f5f9);
  flex-shrink: 0;
}

/* ── 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: 0 0 8px;
  border-bottom: 1px solid #e2e8f0;
  margin: 10px 0 -2px;
}
.party-form-wrap > .form-section-header:first-child { margin-top: 0; }
.form-section-icon { color: #475569; }
.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; }

/* ── 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;
}

/* ── Responsive: collapse summary cards & table on mobile ────────────── */
@media (max-width: 768px) {
  .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; max-height: 100vh; margin: 0; border-radius: 0; }
  #modal-body { max-height: calc(100vh - 110px); overflow-y: auto; }
}

/* ════════════════════════════════════════════════════════════════════════
   INVOICE STEPPER (Phase 6b) — mobile-only multi-step wizard
   Desktop hides stepper UI entirely; mobile (<=768px) activates it via the
   .is-stepper-mode class set by InvoiceStepper.init().
   ════════════════════════════════════════════════════════════════════════ */

/* By default (desktop) keep stepper UI fully hidden — desktop renders all
   form sections at once exactly as before. */
.invoice-stepper,
.invoice-stepper-nav,
.invoice-stepper-review-totals { display: none; }

@media (max-width: 768px) {
  /* Stepper pills bar at the top of the modal form */
  .party-form-wrap.is-stepper-mode .invoice-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 4px 14px;
    margin: -6px -4px 6px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface, #fff);
    border-bottom: 1px solid #e2e8f0;
  }
  .invoice-step-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font: inherit;
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
  .invoice-step-dot {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: #e2e8f0;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 120ms, color 120ms;
  }
  .invoice-step-label {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .invoice-step-pill.is-done .invoice-step-dot {
    background: #DCFCE7;
    color: #059669;
  }
  .invoice-step-pill.is-done .invoice-step-label {
    color: #475569;
  }
  .invoice-step-pill.is-active .invoice-step-dot {
    background: #2563EB;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
  }
  .invoice-step-pill.is-active .invoice-step-label {
    color: #0f172a;
    font-weight: 600;
  }
  .invoice-step-sep {
    width: 12px;
    height: 2px;
    background: #e2e8f0;
    border-radius: 2px;
    flex-shrink: 0;
  }

  /* Hide all step bodies; reveal only the active one */
  .party-form-wrap.is-stepper-mode .form-step { display: none; }
  .party-form-wrap.is-stepper-mode .form-step.is-active-step { display: block; }

  /* Bottom nav bar (Back / progress / Next) */
  .party-form-wrap.is-stepper-mode .invoice-stepper-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px -4px -4px;
    padding: 12px;
    background: var(--surface, #fff);
    border-top: 1px solid #e2e8f0;
    position: sticky;
    bottom: 0;
    z-index: 5;
    box-shadow: 0 -6px 14px -10px rgba(15, 23, 42, 0.18);
  }
  .invoice-stepper-nav .btn {
    flex: 1;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    min-height: 44px;
    font-size: 14px;
  }
  .invoice-stepper-nav .btn[disabled] {
    opacity: 0.4;
    pointer-events: none;
  }
  .invoice-stepper-progress {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    padding: 0 4px;
  }

  /* Review-totals card on step 4 */
  .party-form-wrap.is-stepper-mode .invoice-stepper-review-totals { display: block; }
  .stepper-review-card {
    background: linear-gradient(135deg, #EFF6FF, #fff);
    border: 1px solid #DBEAFE;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
  }
  .stepper-review-card-head {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    font-weight: 600;
  }
  .stepper-review-card-amount {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    font-feature-settings: 'tnum';
    margin: 2px 0 6px;
  }
  .stepper-review-card-break {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #475569;
    font-feature-settings: 'tnum';
  }
  .stepper-draft-link {
    display: inline-block;
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #2563EB;
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.35);
    text-underline-offset: 2px;
    cursor: pointer;
  }
  .stepper-draft-link:hover {
    color: #1D4ED8;
    text-decoration-color: #1D4ED8;
  }

  /* When stepper is live, hide the original modal-footer (Cancel/Draft/Preview)
     and let the stepper nav drive the flow. The Preview button is reachable
     from step 4's "Preview & Save" button which forwards the click. */
  body.invoice-stepper-active .modal-footer { display: none; }

  /* Modal body needs slightly more height since footer is gone */
  body.invoice-stepper-active #modal-body { max-height: 100vh; padding-bottom: 0; }
}

@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; }
}

/* Keyboard shortcut hint in footer (subtle) */
.modal-footer::before {
  content: 'Tip: Ctrl+Enter to save · ESC to cancel';
  font-size: 11px;
  color: #64748b;
  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;
}

/* C1: Broken-image handling lives in JS (handleLogoError). The old
   .logo-broken { display:none } rule used to hide the entire logo column
   on a 404, which left the header asymmetric — replaced by an in-place
   initials-badge swap so the layout stays balanced. */

/* 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;
}

/* C6: the Dark template renders on a near-black canvas. A transparent PNG
   logo with dark artwork would vanish into it, so give the logo a white
   rounded card behind it on the Dark template only. */
.gst-invoice.tpl-dark .gst-logo-wrap {
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
}

/* 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-irn-bar,
  .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: 768px) {
  .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;
}

/* Phase 8.1 — IRN compliance bar (shown when e-invoice is generated) */
.gst-invoice .inv-irn-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 8px 22px;
  background: #eff6ff;
  border-top: 1.5px solid #bfdbfe;
  border-bottom: 1.5px solid #bfdbfe;
  font-size: 11px;
  color: #1e40af;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.gst-invoice .inv-irn-label {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: #1d4ed8;
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.gst-invoice .inv-irn-hash {
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  letter-spacing: .02em;
  word-break: break-all;
  flex: 1;
  min-width: 200px;
}

/* Settings — E-invoice card */
.settings-locked { opacity: .5; pointer-events: none; }
.entitlement-lock-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: #92400e;
  margin-bottom: 14px;
}
.entitlement-lock-banner strong { color: #78350f; }
.entitlement-lock-banner .btn { margin-left: auto; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════════════
   PREVIEW-BEFORE-SAVE MODAL — wider for full invoice preview
   ════════════════════════════════════════════════════════════════════════ */
#modal-overlay .modal:has(#preview-template-select) {
  max-width: 1100px;
  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: 768px) {
  .preview-modal-content {
    height: 60vh;
  }
  .preview-template-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  .preview-template-bar select {
    flex: 1 1 100%;
    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 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px;
  margin-bottom: 24px;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--elev-1);
  animation: dash-fade-up 350ms cubic-bezier(.16,1,.3,1) forwards;
}
.dash-hero-left { flex: 1; min-width: 0; }
.dash-hero-greeting { margin-bottom: 10px; }
.dash-hero-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-sub {
  font-size: 13px;
  color: #64748b;
  margin: 0;
  font-weight: 400;
}
.dash-hero-insight {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: #1d4ed8;
  font-weight: 500;
  line-height: 1.4;
}
.dash-hero-insight svg { flex-shrink: 0; color: #3b82f6; }
.dash-hero-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-hero-chip.is-clickable { cursor: pointer; }
.dash-hero-chip.is-clickable:hover { filter: brightness(0.97); }
.dash-hero-chip.is-clickable:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* Phase 4.4: accessible health-score popover — replaces the title="" &#10; hack.
   Shows on pointer hover + keyboard focus-within + touch-focus; the breakdown is
   ALSO exposed to AT via the .sr-only #dash-health-desc + aria-describedby. */
.dash-health-pop-host { position: relative; display: inline-flex; }
.dash-health-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 236px;
  background: #fff; border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  box-shadow: var(--elev-popover); padding: 12px 14px; text-align: left;
  opacity: 0; visibility: hidden; transform: translateY(-4px); pointer-events: none;
  transition: opacity var(--duration-fast) var(--easing), transform var(--duration-fast) var(--easing), visibility var(--duration-fast);
}
.dash-health-pop-host:hover .dash-health-pop,
.dash-health-pop-host:focus-within .dash-health-pop {
  opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto;
}
.dash-health-pop-title { font-size: 12px; font-weight: 700; color: var(--fg-default); margin-bottom: 8px; }
.dash-health-pop-list { display: grid; gap: 6px; margin: 0; }
.dash-health-pop-list > div { display: flex; justify-content: space-between; gap: 20px; font-size: 12px; }
.dash-health-pop-list dt { color: var(--fg-muted); }
.dash-health-pop-list dd { margin: 0; font-weight: 600; color: var(--fg-default); font-variant-numeric: tabular-nums; }
.dash-health-pop-hint { display: block; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-default); font-size: 11px; color: var(--fg-muted); }
@media (max-width: 560px) { .dash-health-pop { right: auto; left: 0; } }
.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: #64748b;
  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 .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 .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;
  font-weight: 700;
  color: #0f172a;
  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: #64748b;
  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 var(--border-default);
  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: var(--elev-1);
  cursor: default;
}
.dash-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--elev-3);
  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: 13px;
  font-weight: 500;
  color: #64748b;
  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: 'Inter', sans-serif;
  font-feature-settings: "tnum";
  letter-spacing: -0.6px;
  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: 12px;
  color: #64748b;
  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: #64748b;
  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: #64748b;
  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 var(--border-default);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--elev-1);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.dash-chart-card:hover {
  box-shadow: var(--elev-2);
  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 var(--border-default);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--elev-1);
  transition: box-shadow 0.2s ease;
}
.dash-table-card:hover { box-shadow: var(--elev-2); }
.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: #64748b;
  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: 13px;
  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','Inter',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: #64748b;
  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;
}
.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 chip ──────────────────────────────────────────── */
.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: #64748b; 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: 1280px) {
  .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 {
    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-title { font-size: 20px; letter-spacing: -0.3px; }
  .dash-hero-sub { font-size: 12px; }
  .dash-hero-insight {
    padding: 6px 10px;
    font-size: 12px;
    max-width: 100%;
  }
  .dash-hero-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 .dash-feedback-btn span { display: none; }
  .dash-hero .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-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 { padding: 14px; }
  .dash-hero-right { grid-template-columns: 1fr 1fr; }
  .dash-hero-chip,
  .dash-period-filter,
  .dash-hero .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)); }
}

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

/* ═══════════════════════════════════════════════════════════════════════
   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: #64748b;
  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 ───────── */
.expense-table .exp-checkbox-cell {
  width: 36px;
  padding: 0 4px 0 14px;
  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; color: #2563eb; }
.exp-sortable > span { margin-right: 4px; }
.exp-sort-icon { vertical-align: middle; color: #64748b; }
.exp-sort-icon.active { color: #2563eb; }

.expense-table .exp-row.is-selected td  { background: #eff6ff; }
.expense-table .exp-row.is-overdue td   { background: #fef9f9; }
.expense-table .exp-row.is-overdue:hover td { background: #fef2f2; }
.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; }
.expense-table tr.exp-totals-row td {
  background: #fafbff;
  font-size: 12.5px;
  padding: 12px 18px;
  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 is unified with the Phase 4c .skeleton token block at end of file. */
.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: #64748b; 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: #64748b;
  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: #64748b;
}
.exp-vendor-empty {
  padding: 12px 14px;
  font-size: 12.5px;
  color: #64748b;
  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: #64748b;
  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: #64748b; }
.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: #64748b;
  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: #64748b; 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: #64748b;
  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: #64748b; 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: #64748b; 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: #64748b; 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: #64748b; 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: #64748b; }

/* 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: #64748b;
  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; width: 96vw; }
.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: #64748b; 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: #64748b;
  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: #64748b; 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: #64748b; }

.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; }
}

/* ═══════════════════════════════════════════════════════════════════
   PHASE 4c — Skeleton tokens, Toast, Drawer, Sticky-bar
   ═══════════════════════════════════════════════════════════════════ */

/* ── Skeleton extras (tabular + line variants) ─────────────────────── */
.skeleton-line { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite; }
.skeleton-line.is-sm { height: 10px; }
.skeleton-line.is-lg { height: 18px; }
.skeleton-line.is-w-25 { width: 25%; }
.skeleton-line.is-w-40 { width: 40%; }
.skeleton-line.is-w-60 { width: 60%; }
.skeleton-line.is-w-80 { width: 80%; }
.skeleton-cell { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite; }

/* Make .exp-skel an alias for the unified token (kept for backwards-compat with expense-table markup). */
.exp-skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite; }

/* ── Toast stack ───────────────────────────────────────────────────── */
.toast-stack { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 9998; pointer-events: none; max-width: min(420px, calc(100vw - 32px)); }
.toast-stack .toast { pointer-events: auto; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #ffffff; border: 1px solid var(--border, #e2e8f0); border-left: 3px solid var(--c-neutral-400, #94a3b8); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.12), 0 2px 6px rgba(15,23,42,.06); font-size: 13.5px; color: #0f172a; min-width: 280px; max-width: 100%; transform: translateX(24px); opacity: 0; transition: transform .22s cubic-bezier(.16,1,.3,1), opacity .22s ease; }
.toast.is-visible { transform: translateX(0); opacity: 1; }
.toast.is-leaving { transform: translateX(24px); opacity: 0; }
.toast.tone-success { border-left-color: #059669; }
.toast.tone-warning { border-left-color: #D97706; }
.toast.tone-danger  { border-left-color: #DC2626; }
.toast.tone-info    { border-left-color: #2563EB; }
.toast-icon { flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.toast.tone-success .toast-icon { color: #059669; }
.toast.tone-warning .toast-icon { color: #D97706; }
.toast.tone-danger  .toast-icon { color: #DC2626; }
.toast.tone-info    .toast-icon { color: #2563EB; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; color: #0f172a; }
.toast-desc { font-size: 12.5px; color: #475569; margin-top: 2px; line-height: 1.4; }
.toast-action { flex-shrink: 0; border: none; background: transparent; color: #2563EB; font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 6px 10px; border-radius: 6px; transition: background .12s; }
.toast-action:hover { background: #EFF6FF; }
.toast-close { flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; border: none; background: transparent; color: #64748b; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s; }
.toast-close:hover { background: #f1f5f9; color: #334155; }

/* ── Right-side drawer ─────────────────────────────────────────────── */
.drawer-root { position: fixed; inset: 0; z-index: 1500; pointer-events: none; }
.drawer-root.is-open { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.42); opacity: 0; transition: opacity .18s ease; }
.drawer-root.is-open .drawer-backdrop { opacity: 1; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 96vw); background: #ffffff; box-shadow: -20px 0 40px rgba(15,23,42,.18); transform: translateX(100%); transition: transform .22s cubic-bezier(.16,1,.3,1); display: flex; flex-direction: column; }
.drawer-root.is-open .drawer-panel { transform: translateX(0); }
.drawer-panel.is-wide { width: min(760px, 96vw); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border, #e2e8f0); flex-shrink: 0; }
.drawer-title { font-size: 16px; font-weight: 600; color: #0f172a; margin: 0; line-height: 1.3; }
.drawer-sub { font-size: 12.5px; color: #64748b; margin-top: 2px; }
.drawer-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; color: #64748b; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s; flex-shrink: 0; }
.drawer-close:hover { background: #f1f5f9; color: #0f172a; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-footer { padding: 14px 20px; border-top: 1px solid var(--border, #e2e8f0); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; background: #fafafa; }
body.drawer-open-right { overflow: hidden; }

/* ── Sticky filter shadow when stuck (.list-filter-bar already has its own rule) ── */
.list-filter-card.is-stuck { box-shadow: 0 6px 14px -8px rgba(15,23,42,.18); }
.sticky-sentinel { display: block; width: 100%; height: 1px; margin: 0; pointer-events: none; }

/* ── Checkbox-row helper (replaces inline label flex styles) ───────── */
.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-row.is-pad-top { padding-top: 24px; }
.checkbox-row.is-pad-top-sm { padding-top: 6px; }

/* ── Generic clickable cursor (used by rows/tds promoted to handlers) ─ */
tr.is-clickable { cursor: pointer; }
td.is-clickable { cursor: pointer; }

/* ── Legacy toast fallback (only shown if window.Toast not yet loaded) ── */
.legacy-toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; padding: 12px 20px; border-radius: 10px; color: #fff; font-weight: 500; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.18); transition: opacity .3s; }
.legacy-toast.tone-success { background: #16A34A; }
.legacy-toast.tone-warning { background: #D97706; }
.legacy-toast.tone-error { background: #DC2626; }
.legacy-toast.tone-info { background: #2563EB; }

/* ── Expense GST cell muted ─────────────────────────────────────────── */
.cell-gst-muted { color: #64748b; }

/* ── Expense error-state tone (replaces inline style) ───────────────── */
.expense-empty-state.is-error { border-color: #fecaca; background: #fffafa; }
.expense-empty-state.is-error .exp-empty-svg { background: linear-gradient(135deg,#fef2f2,#fee2e2); }
.expense-empty-state.is-error .expense-empty-title { color: #991b1b; }

/* ── Expense empty-state actions row ────────────────────────────────── */
.exp-empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Button with leading icon (replaces inline svg margin-right) ───── */
.btn-with-icon { display: inline-flex; align-items: center; gap: 6px; }
.btn-with-icon svg { flex-shrink: 0; }

/* ── Full-width button (used by component lib for stacked layouts) ─── */
.btn-full { display: flex; width: 100%; }

/* ── Form helpers ─────────────────────────────────────────────────── */
/* Small muted inline note inside form labels/options. Phase 5.3 folds in the
   ~59 inline `font-weight:400;color:#64748b;font-size:11/12px` hint spans from
   pages.js; font-size:var(--text-xs)=12px also clears the 11px-reintroduced
   violation (design-system memo: type scale starts at 12px). */
.label-hint { color: var(--fg-muted); font-weight: 400; font-size: var(--text-xs); }
.exp-form-hint-trail { color: var(--fg-muted); margin-left: auto; }
.is-uppercase { text-transform: uppercase; }

/* Checkbox / toggle row label: flex-aligned + clickable. Phase 5.3 folds in the
   pages.js inline `display:flex;align-items:center;gap:8/10px;cursor:pointer`. */
.check-label { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.check-label-inline { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); font-weight: 400; color: var(--fg-muted); cursor: pointer; text-transform: none; }

/* ── Layout / spacing utilities (Phase 5.3) ───────────────────────────
   Small, documented atomic helpers so one-off inline `style=` can migrate to
   classes. Prefer a semantic component class when a cluster repeats; reach for
   these only for genuine one-offs. Keep this set minimal — it is NOT Tailwind. */
.u-flex { display: flex; }
.u-inline-flex { display: inline-flex; }
.u-flex-1 { flex: 1; }
.u-items-center { align-items: center; }
.u-items-end { align-items: flex-end; }
.u-justify-between { justify-content: space-between; }
.u-gap-1 { gap: 4px; }
.u-gap-2 { gap: 8px; }
.u-gap-3 { gap: 12px; }
.u-mb-0 { margin-bottom: 0; }
.u-mt-1 { margin-top: 4px; }
.u-mt-2 { margin-top: 8px; }
.u-mt-12 { margin-top: 12px; }
.u-w-full { width: 100%; }
.u-text-left { text-align: left; }
.u-text-right { text-align: right; }
.u-text-muted { color: var(--fg-muted); }
.module-toggle { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Phase 5.3 — invoice-form.js component classes ─────────────────── */
/* Item table fixed column widths (form view only; print uses inv-table) */
.items-table th:nth-child(1)  { width: 40px; }
.items-table th:nth-child(2)  { min-width: 170px; }
.items-table th:nth-child(3)  { width: 70px; }
.items-table th:nth-child(4)  { width: 70px; }
.items-table th:nth-child(5)  { width: 70px; }
.items-table th:nth-child(6)  { width: 100px; }
.items-table th:nth-child(7)  { width: 135px; }
.items-table th:nth-child(8)  { width: 150px; }
.items-table th:nth-child(9)  { width: 64px; }
.items-table th:nth-child(10) { width: 100px; }
.items-table th:nth-child(11) { width: 34px; }
/* Item section header bar */
.items-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.items-header h4 { margin: 0; }
/* GST mode detection chip */
#gst-mode-indicator { padding: 6px 12px; background: var(--c-neutral-100, #f1f5f9); border-radius: 6px; font-size: var(--text-sm); text-align: right; }
/* Bill/ship summary box */
#bill-ship-summary { background: var(--c-neutral-50, #f8fafc); border-radius: var(--radius-md); padding: 12px; margin-top: -4px; }
/* Address display inside summary */
.addr-section-label { font-size: var(--text-sm); color: var(--fg-muted); font-weight: 500; }
.addr-detail { font-size: 13px; line-height: 1.5; }
/* Checkbox sizing for form checkboxes with margin reset */
.form-checkbox { width: 18px; height: 18px; margin: 0; }
/* Recurring info caption below the checkbox */
.recurring-help { display: block; color: var(--fg-muted); margin-top: 4px; font-size: 11.5px; }
/* Eway bill strip field labels */
.inv-eway-strip .inv-label { color: var(--fg-muted); }
/* Signature/stamp image in print templates */
.inv-sig-img { display: block; max-height: 60px; max-width: 200px; object-fit: contain; margin: 0 auto 4px; }
/* UPI-not-set placeholder in QR cell */
.qr-no-upi { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 9px; color: var(--fg-muted); text-align: center; padding: 4px; }
/* Inline discount-type selector */
.sel-discount-type { width: 60px; }
/* Discount field + type dropdown row */
.discount-row { display: flex; gap: 6px; }
/* Collapsible section label flex with left-align override */
.form-section-label-flex { flex: 1; text-align: left; }
/* PDF generating overlay spinner */
.pdf-gen-spinner { width: 48px; height: 48px; border: 4px solid rgba(255,255,255,0.2); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }

/* Phase 5.3 — dashboard.js component classes */
.sparkline-svg { width: 100%; height: 100%; }
.dash-content-hidden { display: none; }
.dash-section-icon-primary { color: var(--primary); }

/* Totals preview live-render rows */
.row-discount { color: var(--c-danger-600, #dc2626); }
.row-bold     { font-weight: 600; }
.row-muted    { color: var(--fg-muted); font-size: var(--text-xs); }
.row-grand    { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; font-weight: 700; font-size: 15px; }
.row-words    { font-size: 11px; color: var(--fg-muted); font-style: italic; padding: 6px 0 0; line-height: 1.4; }
/* GSTIN monospace display in bill/ship summary */
.gstin-mono { font-family: 'Inter', monospace; font-variant-numeric: tabular-nums; font-size: 12px; }
/* QR label below the QR code */
.qr-label { font-size: 10px; text-align: center; margin-top: 4px; color: var(--fg-muted); font-weight: 600; }
/* E-way strip layout */
.gst-invoice .inv-eway-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 10px; padding: 10px 22px; border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; font-size: 11px; color: #334155; background: #f8fafc; font-family: inherit; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
/* PDF overlay texts */
.pdf-gen-text { margin-top: 16px; font-size: 15px; font-weight: 500; }
/* Item-row inline note (specs/description) */
.item-note-text { font-size: 11px; color: var(--fg-muted); margin-top: 2px; white-space: pre-wrap; line-height: 1.4; }

/* ── Phase 5.3 — payments.js component classes ──────────────────── */
/* Modal table used for invoice allocation, view-payment, outstanding, ledger */
.pay-modal-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pay-modal-table th, .pay-modal-table td { padding: 8px; }
.pay-modal-table th { font-weight: 600; color: #475569; }
.pay-modal-table thead tr { border-bottom: 1px solid #e2e8f0; }
.pay-modal-table thead { background: #f8fafc; position: sticky; top: 0; }
.pay-modal-table tbody tr { border-bottom: 1px solid #f1f5f9; }
/* Form label in payment modals */
.pay-form-label { font-size: 12px; font-weight: 600; color: #475569; }
/* Stat components */
.stat-label     { font-size: 11px; color: var(--fg-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-hint      { font-size: 11px; color: var(--fg-muted); }
.stat-value-xl  { font-size: 22px; font-weight: 700; }
.stat-value-lg  { font-size: 20px; font-weight: 700; color: #0f172a; }
.stat-value-md  { font-size: 18px; font-weight: 700; }
.stat-value-sm  { font-size: 16px; font-weight: 700; color: #0f172a; }
/* Summary cards (top of payments list) */
.pay-summary-cards  { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; margin: 12px 0 18px; }
.pay-summary-card   { border-radius: 10px; padding: 14px; }
.pay-summary-card--green { background: #f0fdf4; border: 1px solid #bbf7d0; }
.pay-summary-card--blue  { background: #eff6ff; border: 1px solid #bfdbfe; }
.pay-summary-card--red   { background: #fef2f2; border: 1px solid #fecaca; }
.pay-summary-card--green .stat-label { color: #15803d; }
.pay-summary-card--blue  .stat-label { color: #1d4ed8; }
.pay-summary-card--red   .stat-label { color: #b91c1c; }
/* KPI bars */
.pay-kpi-bar   { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; padding: 12px; background: #f1f5f9; border-radius: 8px; }
.pay-kpi-bar-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; padding: 12px; background: #f1f5f9; border-radius: 8px; }
/* Form grids in payment modals */
.pay-form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
/* Invoice allocation box */
.pay-invoice-box { border: 1px solid #e2e8f0; border-radius: 8px; max-height: 280px; overflow: auto; background: #f8fafc; }
/* Allocation header row */
.pay-alloc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pay-alloc-title  { font-size: 13px; font-weight: 600; color: #0f172a; }
/* Notes / warning block */
.pay-notes-block { padding: 10px; background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 4px; font-size: 13px; white-space: pre-wrap; }
/* Detail view */
.pay-detail-grid   { display: flex; flex-direction: column; gap: 14px; }
.pay-detail-meta-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
/* Ledger / outstanding view */
.pay-ledger-bal        { padding: 12px; background: #f1f5f9; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.pay-ledger-bal-note   { font-size: 12px; color: var(--fg-muted); }
.pay-ledger-scroll     { max-height: 480px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.pay-outstanding-grid  { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.pay-outstanding-card  { padding: 12px; border-radius: 8px; }
.pay-outstanding-card--red    { background: #fef2f2; }
.pay-outstanding-card--blue   { background: #eff6ff; }
.pay-outstanding-card--yellow { background: #fffbeb; }
.pay-aging-grid        { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.pay-aging-bucket      { padding: 10px; border-radius: 8px; text-align: center; }
/* Empty / loading state messages */
.pay-list-empty  { padding: 32px; text-align: center; color: var(--fg-muted); }
.pay-modal-empty { padding: 24px; text-align: center; color: var(--fg-muted); font-size: 13px; }
.pay-advance-tag { padding: 16px; text-align: center; color: #1d4ed8; background: #eff6ff; border-radius: 8px; }
/* Dynamic state classes (replaces inline conditional style) */
.row-bounced         { background: #fef2f2; }
.pay-inv-row-checked { background: #f0fdf4; }
.pay-overdue         { color: #dc2626; font-weight: 600; }
.pay-credit          { color: #15803d; font-weight: 600; }
.pay-advance-val     { color: #1d4ed8; font-weight: 600; }
.pay-overdue-amount  { color: #dc2626; }
.pay-credit-amount   { color: #15803d; }
/* Page actions bar */
.pay-actions-bar { display: flex; gap: 8px; }
/* Section heading */
.pay-section-h4 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
/* Record-form vertical layout */
.pay-record-form { display: flex; flex-direction: column; gap: 14px; }
/* Report modal layout */
.pay-report-form { display: flex; flex-direction: column; gap: 12px; }
/* Filter button height */
.btn-filter-h { height: 38px; border-radius: 8px; }
/* Advance amount value */
.u-text-center { text-align: center; }
/* Closing balance note */
.pay-bal-note { font-size: 12px; color: var(--fg-muted); }
/* Phase 5.3 — expenses.js component classes */
.exp-readonly-input { background: #f8fafc; color: #475569; }
.exp-gst-billable  { background: #fef3c7; color: #92400e; border-radius: 6px; padding: 8px 10px; margin-top: 6px; }
/* Due date status inline spans */
.status-due-today { color: #d97706; font-weight: 600; }
.status-due-soon  { color: #d97706; }
/* Report chart containers */
.rep-chart-sm { height: 240px; }
.rep-chart-md { height: 280px; }
/* Margin utilities */
.u-mt-16 { margin-top: 16px; }
.u-mt-18 { margin-top: 18px; }
/* Outstanding card label colors */
.pay-oc-red    { color: #b91c1c; }
.pay-oc-blue   { color: #1d4ed8; }
.pay-oc-yellow { color: #92400e; }
/* Aging bucket value */
.aging-value { font-size: 14px; font-weight: 700; margin-top: 4px; }
/* Utility */
.fw-600 { font-weight: 600; }
/* Inline button icon */
.btn-inline-icon { vertical-align: -2px; margin-right: 4px; }
/* Grow filter group */
.expense-filter-group--grow { flex: 1; min-width: 220px; }

/* ── Phase 5.3 — gstr.js component classes ─────────────────────── */
/* GSTR page shell */
.gstr-page           { max-width: 1100px; }
.gstr-page-header    { margin-bottom: 24px; }
.gstr-page-title     { font-size: 22px; font-weight: 700; color: #111827; margin: 0 0 4px; }
.gstr-page-desc      { margin: 0; font-size: 14px; color: #6b7280; }
/* Section / table components */
.gstr-section        { margin-bottom: 28px; }
.gstr-section-title  { font-size: 14px; font-weight: 600; color: #111827; margin-bottom: 10px; }
.gstr-table-wrap     { overflow-x: auto; border-radius: 10px; border: 1px solid #e5e7eb; }
.gstr-table          { border-collapse: collapse; width: 100%; font-size: 13px; }
.gstr-th             { background: #f9fafb; border: 1px solid #e5e7eb; padding: 8px 10px; text-align: left; font-weight: 600; color: #374151; white-space: nowrap; }
.gstr-th-r           { text-align: right; }
.gstr-td             { border: 1px solid #e5e7eb; padding: 7px 10px; color: #111827; }
.gstr-td-r           { text-align: right; font-variant-numeric: tabular-nums; }
/* KPI grid */
.gstr-kpi-grid       { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 24px; }
.gstr-kpi-card       { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; }
/* Cards row */
.gstr-card-row       { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.gstr-card           { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 20px; flex: 1; min-width: 220px; }
.gstr-card--wide     { min-width: 240px; }
.gstr-card-title     { font-size: 13px; font-weight: 700; color: #111827; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #f3f4f6; }
/* Tab bar */
.gstr-tabs           { display: flex; gap: 0; border-bottom: 2px solid #e5e7eb; margin-bottom: 24px; }
/* Download row */
.gstr-dl-row         { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.gstr-dl-label       { font-size: 13px; color: #6b7280; font-weight: 500; }
.gstr-dl-btn         { padding: 7px 14px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-size: 13px; cursor: pointer; font-weight: 500; color: #374151; }
.gstr-dl-btn:hover   { background: #f9fafb; }
.gstr-plan-badge     { background: rgba(255,255,255,.12); border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 700; }
/* Banners */
.gstr-warn-banner    { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; }
.gstr-warn-title     { font-weight: 600; color: #92400e; font-size: 13px; margin-bottom: 6px; }
.gstr-warn-list      { margin: 0; padding-left: 18px; color: #78350f; font-size: 12.5px; line-height: 1.7; }
.gstr-info-banner    { margin-bottom: 20px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 12px 16px; font-size: 13px; color: #1e40af; }
/* Notes / empty */
.gstr-notes-block    { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 18px; font-size: 12.5px; color: #6b7280; line-height: 1.6; }
.gstr-note-label     { color: #374151; }
.gstr-empty-msg      { margin-bottom: 20px; color: #6b7280; font-size: 13px; }

/* ── Phase 5.3 — analytics.js component classes ─────────────────── */
.analytics-select       { padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; background: #fff; min-width: 120px; }
.analytics-select--md   { min-width: 130px; }
.analytics-select--lg   { min-width: 140px; }
.analytics-filter-row   { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.analytics-filter-card  { margin-bottom: 20px; padding: 14px 18px; }
.analytics-insight-scroll { padding: 12px; max-height: 300px; overflow: auto; }
.analytics-insight-item   { border-left: 4px solid #6b7280; padding: 12px 16px; margin-bottom: 8px; background: #f9fafb; border-radius: 4px; }
.analytics-insight-msg    { margin: 4px 0 0; color: #374151; font-size: 14px; }
.analytics-insight-action { margin: 4px 0 0; color: #6b7280; font-size: 12px; }
.analytics-no-insights    { padding: 12px; color: #6b7280; }
.analytics-kpi-grid       { grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); margin-bottom: 24px; }
.analytics-tax-kpi-grid   { grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 14px; margin-bottom: 20px; }
.analytics-mb-24          { margin-bottom: 24px; }
.analytics-mb-20          { margin-bottom: 20px; gap: 14px; }
.analytics-tc-card        { padding: 16px; }
.analytics-tc-val         { letter-spacing: -0.3px; }
.analytics-comp-card      { flex: 1; min-width: 80px; background: linear-gradient(145deg,#ffffff,#f8fafc); border: 1px solid rgba(226,232,240,0.7); border-radius: 10px; padding: 10px 12px; text-align: center; }
.analytics-comp-val       { font-size: 15px; font-weight: 700; }
.analytics-comp-row       { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.analytics-flex-card      { flex: 1; min-width: 280px; }
.analytics-flex-card-lg   { flex: 1.2; min-width: 300px; }
.analytics-chart-sm       { height: 160px; }
.analytics-empty          { padding: 32px 16px; text-align: center; color: #64748b; }
.analytics-empty-icon     { font-size: 28px; margin-bottom: 8px; opacity: .5; }
.analytics-empty-icon svg { width: 28px; height: 28px; vertical-align: middle; }
.analytics-insight-icon   { margin-bottom: 8px; }
.analytics-insight-icon svg  { width: 20px; height: 20px; vertical-align: middle; }
.analytics-alert-icon svg    { width: 18px; height: 18px; vertical-align: middle; }
.analytics-allclear-icon svg { width: 22px; height: 22px; vertical-align: middle; }
.analytics-empty-msg      { font-size: 13px; }
.analytics-data-tbl       { font-size: 13px; }
.u-ml-auto { margin-left: auto; }

/* ── Phase 5.3 — partner.js component classes ───────────────────── */
.partner-wrap    { max-width: 920px; }
.partner-wrap-sm { max-width: 560px; }
.partner-register-section { padding: 36px 40px; }
.partner-header-section   { padding: 24px 28px; margin-bottom: 0; }
.partner-tab-section      { padding: 0; overflow: hidden; }
.partner-register-title   { margin: 0 0 6px; font-size: 22px; font-weight: 700; color: #0f172a; }
.partner-register-desc    { margin: 0 0 28px; color: var(--fg-muted); font-size: 14px; line-height: 1.6; }
.partner-form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #374151; }
.partner-input      { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; outline: none; }
.partner-how-box    { margin-top: 20px; padding: 14px; background: var(--c-neutral-50, #f8fafc); border-radius: 8px; border: 1px solid #e2e8f0; }
.partner-how-text   { font-size: 12px; color: var(--fg-muted); line-height: 1.6; }
.partner-field      { margin-bottom: 18px; }
.partner-field-lg   { margin-bottom: 28px; }
.partner-active-badge { display: inline-flex; align-items: center; padding: 4px 12px; background: #dcfce7; color: #16a34a; border-radius: 20px; font-size: 12px; font-weight: 600; }
.partner-kpi-grid   { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 16px; margin: 20px 0; }
.partner-stat-card  { border-radius: 10px; padding: 18px 20px; }
.partner-status-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.partner-tabs       { display: flex; border-bottom: 1px solid #e2e8f0; }
.partner-tab-content { padding: 24px; }
.partner-link-row   { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.partner-link-input { flex: 1; min-width: 220px; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; }
.partner-clients-table { width: 100%; min-width: 560px; }
.partner-payouts-table  { width: 100%; min-width: 480px; }
.partner-payout-grid    { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; margin-bottom: 24px; }
.partner-payout-card         { border-radius: 8px; padding: 14px 16px; border: 1px solid; }
.partner-payout-card--neutral { background: #f8fafc; border-color: #e2e8f0; }
.partner-payout-card--green   { background: #dcfce7; border-color: #bbf7d0; }
.partner-payout-card--blue    { background: #eff6ff; border-color: #bfdbfe; }
.u-items-start   { align-items: flex-start; }
.u-flex-wrap     { flex-wrap: wrap; }

/* ── Phase 5.3 — app.js component classes ───────────────────────── */
/* Client/Vendor 360 view modal */
.c360-wrap          { display: flex; flex-direction: column; gap: 14px; max-width: 980px; }
.c360-header        { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #e2e8f0; }
.c360-name          { font-size: 20px; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 10px; }
.c360-subtitle      { font-size: 13px; color: var(--fg-muted); margin-top: 4px; }
.c360-kpi-grid      { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 10px; }
.c360-kpi-card      { padding: 12px; border-radius: 8px; }
.c360-kpi--sky      { background: #f0f9ff; border: 1px solid #bae6fd; }
.c360-kpi--green    { background: #f0fdf4; border: 1px solid #bbf7d0; }
.c360-kpi--red      { background: #fef2f2; border: 1px solid #fecaca; }
.c360-kpi--blue     { background: #eff6ff; border: 1px solid #bfdbfe; }
.c360-kpi--yellow   { background: #fffbeb; border: 1px solid #fde68a; }
.c360-kpi--purple   { background: #faf5ff; border: 1px solid #e9d5ff; }
.c360-kpi-label     { font-size: 11px; color: var(--fg-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 6px; letter-spacing: .04em; }
.c360-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.c360-section-title { margin: 0; font-size: 14px; font-weight: 600; }
.c360-table-wrap    { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.c360-detail-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.c360-detail-panel  { padding: 12px; background: var(--c-neutral-50, #f8fafc); border-radius: 8px; }
.c360-detail-label  { font-size: 11px; color: var(--fg-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.c360-sub-section   { margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0; font-size: 13px; }
.c360-legacy-dues   { padding: 10px 12px; background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 4px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.c360-legacy-note   { font-size: 11px; color: #92400e; margin-top: 2px; }
.c360-product-img   { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 1px solid #e2e8f0; background: #f1f5f9; }
/* Template preview bar */
.preview-tpl-label   { font-size: 12px; color: var(--fg-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.preview-tpl-select  { flex: 1; min-width: 220px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }
.preview-tpl-default { font-size: 11px; color: var(--c-success-600, #16a34a); font-weight: 600; white-space: nowrap; }
.preview-hint        { font-size: 11px; color: var(--fg-muted); text-align: center; padding: 12px 0 0; }
/* Signature tune controls */
.sig-tune-label { font-size: 12px; font-weight: 500; color: #334155; display: block; margin-bottom: 4px; }
.sig-tune-val   { font-weight: 400; }
.sig-tune-range { width: 100%; max-width: 280px; }
.sig-tune-hint  { display: flex; justify-content: space-between; max-width: 280px; font-size: 10px; color: var(--fg-muted); }
/* Keyboard shortcuts modal */
.kbd-shortcuts-list { display: grid; gap: 10px; padding: 4px; }
.kbd-shortcut-row   { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--c-neutral-50, #f8fafc); border-radius: 8px; }
.kbd-shortcut-label { font-weight: 500; color: #0f172a; font-size: 13px; }

/* ── Debit/Credit cell tones (ledger tables) ──────────────────────── */
.cell-debit { color: #dc2626; }
.cell-credit { color: #15803d; }

/* ── Skeleton layout helpers (PageRenderer dashboard + list variants) ── */
.sk-page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.sk-title { height: 28px; width: 220px; }
.sk-cta { height: 36px; width: 140px; border-radius: 10px; }
.sk-stats-grid { opacity: .85; }
.sk-stats-grid .stat-card { display: flex; flex-direction: column; gap: 10px; }
.sk-stats-grid .stat-card .skeleton-line { margin-bottom: 0; }
.sk-chart-card { padding: 20px; }
.sk-chart-title { height: 14px; width: 180px; margin-bottom: 16px; }
.sk-chart-area { display: block; height: 200px; width: 100%; border-radius: 10px; }
.sk-filter-bar { display: flex; gap: 12px; padding: 12px 0 16px; align-items: center; }
.sk-filter-bar .skeleton-line { height: 32px; border-radius: 8px; }
.sk-table { padding: 0; overflow: hidden; }
.sk-row { display: grid; grid-template-columns: 1.2fr 1.6fr 1fr 1fr 1fr; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--c-neutral-100, #f1f5f9); align-items: center; }
.sk-row:last-child { border-bottom: 0; }
.sk-row .skeleton-line { margin-bottom: 0; width: 100%; }
.sk-row .skeleton-line.is-w-25 { width: 60%; }
.sk-row .skeleton-line.is-w-40 { width: 75%; }

/* ── Invoice preview frame (used by Drawer + modal preview) ──────── */
/* The preview frame supplies the visual "page gutter" that the PDF gets
   from jsPDF's 11mm page margin. Keeping both gutters in sync is what
   makes the on-screen preview look identical to the downloaded PDF.
   42px ≈ 11mm at 96dpi → matches _wrapToPdf's `marginMm = 11`.          */
.invoice-preview-frame {
  padding: 42px 46px;
  background: #f8fafc;
  border-radius: 8px;
  overflow: auto;
}

/* F5: the invoice doc is a fixed ~794px-wide A4 layout. On phones that
   overflows the drawer/modal and forces horizontal scrolling. We use `zoom`
   (not transform:scale) to shrink it to fit — zoom reflows the layout box so
   there's no leftover whitespace and vertical scroll still works. This is a
   screen-only preview affordance (the PDF path is unaffected). Stepped
   breakpoints keep it predictable across phone widths. */
@media (max-width: 640px) {
  .invoice-preview-frame { padding: 12px; overflow-x: hidden; }
  .invoice-preview-frame .invoice-doc { zoom: 0.62; }
}
@media (max-width: 480px) {
  .invoice-preview-frame .invoice-doc { zoom: 0.5; }
}
@media (max-width: 380px) {
  .invoice-preview-frame .invoice-doc { zoom: 0.42; }
}

/* ── Bulk reminder banner (Phase 9 — overdue invoice list) ────────── */
.bulk-reminder-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: linear-gradient(90deg, #FFFBEB 0%, #FEF2F2 100%);
  border: 1px solid #FECACA;
  border-radius: 10px;
  margin: 0 0 12px;
}
.bulk-reminder-text {
  font-size: 13.5px;
  color: #7C2D12;
  line-height: 1.45;
}
.bulk-reminder-text strong { color: #7F1D1D; font-weight: 700; }
.bulk-reminder-banner .btn-wa { flex-shrink: 0; }

@media (max-width: 640px) {
  .bulk-reminder-banner { flex-direction: column; align-items: stretch; gap: 10px; }
  .bulk-reminder-banner .btn-wa { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════════
   PHASE 6 — Mobile bottom-tab nav + card-stack tables
   ═══════════════════════════════════════════════════════════════════ */

/* ── Bottom-tab bar (hidden on desktop, fixed bottom on mobile) ────── */
.bottom-tabs {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 64px;
  background: #ffffff;
  border-top: 1px solid var(--border, #e2e8f0);
  z-index: 90;
  padding: 6px max(env(safe-area-inset-left), 6px) max(env(safe-area-inset-bottom), 6px) max(env(safe-area-inset-right), 6px);
  box-shadow: 0 -4px 12px -8px rgba(15,23,42,0.12);
  align-items: center;
  justify-content: space-around;
  gap: 4px;
}
.bottom-tab {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--c-neutral-500, #64748B);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  transition: color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-tab .bottom-tab-icon svg { width: 22px; height: 22px; display: block; }
.bottom-tab:hover { color: var(--text, #0F172A); }
.bottom-tab:active { background: #F1F5F9; }
.bottom-tab.is-active { color: var(--primary, #2563EB); }
.bottom-tab.is-active .bottom-tab-icon svg { stroke-width: 2.25; }
.bottom-tab-label { line-height: 1.1; letter-spacing: -.01em; }

.bottom-tab-fab { flex: 0 0 auto; padding: 0; min-width: 56px; }
.bottom-tab-fab .bottom-tab-fab-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary, #2563EB);
  color: #fff;
  box-shadow: 0 8px 22px -6px rgba(37,99,235,0.55), 0 0 0 4px #fff;
  margin-top: -22px;
  transition: background .12s, transform .12s;
}
.bottom-tab-fab:hover .bottom-tab-fab-circle { background: var(--primary-hover, #1D4ED8); }
.bottom-tab-fab:active .bottom-tab-fab-circle { transform: scale(0.95); }

@media (max-width: 768px) {
  .bottom-tabs { display: flex; }
  /* Free up vertical space so fixed bottom bar doesn't overlap last rows */
  .content, main.content, .main-content {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  /* Existing floating sidebar toggle is redundant with the More tab — hide on mobile */
  .sidebar-toggle-floating { display: none; }
  /* Bottom-sheet modal also collides with the tab bar — lift it above */
  #modal-overlay { padding-bottom: 64px; }
}

/* ── Mobile card-stack tables (opt-in via .table-stack-mobile) ──────
   Convert horizontally-scrolling tables into stacked card rows under
   640px. Cells should carry `data-label="Column name"` to render the
   row-level label. Tables that already have a custom mobile layout
   (e.g. dashboard tables) are unaffected — opt-in only.
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .table-stack-mobile { display: block; min-width: 0; }
  .table-stack-mobile thead { position: absolute; left: -9999px; top: -9999px; }
  .table-stack-mobile tbody, .table-stack-mobile tr, .table-stack-mobile td { display: block; width: auto; }
  .table-stack-mobile tr {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(15,23,42,.02);
  }
  .table-stack-mobile tr.is-clickable { cursor: pointer; }
  .table-stack-mobile td {
    padding: 6px 0 !important;
    border: none !important;
    text-align: right;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 24px;
  }
  .table-stack-mobile td:first-child { font-weight: 600; color: var(--text, #0F172A); font-size: 14px; }
  .table-stack-mobile td[data-label]::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--text-muted, #64748B);
    font-size: 12px;
    text-align: left;
    flex: 0 0 auto;
  }
  .table-stack-mobile td.exp-checkbox-cell,
  .table-stack-mobile td.exp-actions-cell { justify-content: flex-end; }
  .table-stack-mobile td.exp-checkbox-cell::before,
  .table-stack-mobile td.exp-actions-cell::before { content: none; }
  /* Wrap inner table inside a non-scrolling div on mobile */
  .table-wrap:has(.table-stack-mobile) { overflow: visible; }
}

/* ── Module-unavailable empty state (delegated-page fallback) ──────── */
.module-unavailable { padding: 64px 24px; text-align: center; color: #64748b; }
.module-unavailable-icon { display: inline-flex; width: 64px; height: 64px; align-items: center; justify-content: center; border-radius: 16px; background: #f1f5f9; color: #64748b; margin-bottom: 16px; }
.module-unavailable-title { font-size: 15px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.module-unavailable-desc { font-size: 13px; color: #64748b; }

/* ── Expense totals-row helpers ─────────────────────────────────────── */
.exp-totals-label { text-align: right; font-weight: 600; color: #475569; }
.exp-totals-amount { color: #0f172a; }

/* ═══════════════════════════════════════════════════════
   GETTING STARTED / ONBOARDING
   ═══════════════════════════════════════════════════════ */
/* Sidebar re-entry item badge */
.nav-getting-started .gs-badge {
  margin-left: auto;
  font-size: 12px; font-weight: 600; line-height: 1.5;
  background: var(--primary-light); color: var(--primary);
  padding: 1px 8px; border-radius: var(--radius-full);
}
.sidebar.collapsed .nav-getting-started .gs-badge { display: none; }

/* Dashboard setup card */
.gs-card {
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  border: 1px solid var(--c-neutral-200);
  background: var(--bg-surface);
  animation: gsFadeUp var(--duration) cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes gsFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.gs-head-text { display: flex; align-items: flex-start; gap: var(--space-3); }
.gs-head-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
}
.gs-head-icon svg { width: 20px; height: 20px; }
.gs-title { font-size: 16px; font-weight: 600; color: var(--fg-default); margin: 0; letter-spacing: -0.2px; }
.gs-subtitle { font-size: 13px; color: var(--fg-muted); margin: 4px 0 0; line-height: 1.5; }
.gs-hide {
  flex-shrink: 0; border: none; background: transparent; cursor: pointer;
  font-size: 13px; color: var(--fg-muted); padding: 4px 8px; border-radius: var(--radius-sm);
}
.gs-hide:hover { background: var(--c-neutral-100); color: var(--fg-default); }

.gs-progress { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-4) 0; }
.gs-progress-bar { flex: 1; height: 8px; border-radius: var(--radius-full); background: var(--c-neutral-200); overflow: hidden; }
.gs-progress-bar span { display: block; height: 100%; border-radius: var(--radius-full); background: var(--primary); transition: width var(--duration) cubic-bezier(0.16, 1, 0.3, 1); }
.gs-progress-label { font-size: 13px; font-weight: 600; color: var(--fg-default); white-space: nowrap; }

.gs-rows { display: flex; flex-direction: column; gap: var(--space-2); }
.gs-row {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left;
  padding: var(--space-3); border: 1px solid var(--c-neutral-200); border-radius: var(--radius-md);
  background: var(--bg-surface); cursor: pointer;
  transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease;
}
.gs-row:hover { border-color: var(--primary); background: var(--primary-light); }
.gs-row.is-done, .gs-row.is-done:hover { cursor: default; background: var(--c-neutral-50); border-color: var(--c-neutral-200); }
.gs-row-icon {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--fg-muted);
  background: var(--c-neutral-100); border: 1px solid var(--c-neutral-200);
}
.gs-row-icon.is-done { background: var(--c-success-600); color: #fff; border-color: var(--c-success-600); }
.gs-row-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.gs-row-text strong { font-size: 14px; font-weight: 600; color: var(--fg-default); }
.gs-row.is-done .gs-row-text strong { color: var(--fg-muted); font-weight: 500; }
.gs-row-text span { font-size: 13px; color: var(--fg-muted); }
.gs-row-cta { flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--primary); }
.gs-row-done { flex-shrink: 0; font-size: 13px; font-weight: 500; color: var(--c-success-700); }

.gs-optional-label {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: 12px; font-weight: 600; color: var(--fg-muted);
  margin: var(--space-4) 0 var(--space-2);
}
.gs-optional-label::after { content: ''; flex: 1; height: 1px; background: var(--c-neutral-200); }

.gs-celebrate { text-align: center; padding: var(--space-8) var(--space-5); }
.gs-celebrate-icon {
  width: 52px; height: 52px; border-radius: var(--radius-full); margin: 0 auto var(--space-3);
  display: flex; align-items: center; justify-content: center;
  background: var(--c-success-50); color: var(--c-success-600);
}
.gs-celebrate-icon svg { width: 28px; height: 28px; }

/* Dedicated Getting Started page wrapper */
.gs-page { max-width: 760px; margin: 0 auto; }

/* Slim dashboard nudge (links to the Getting Started page) */
.gs-nudge {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  border: 1px solid var(--c-neutral-200);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  animation: gsFadeUp var(--duration) cubic-bezier(0.16, 1, 0.3, 1);
}
.gs-nudge-icon {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
}
.gs-nudge-icon svg { width: 18px; height: 18px; }
.gs-nudge-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.gs-nudge-text { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.gs-nudge-text strong { font-size: 14px; font-weight: 600; color: var(--fg-default); }
.gs-nudge-text span { font-size: 13px; color: var(--fg-muted); }
.gs-nudge-bar { height: 5px; max-width: 320px; border-radius: var(--radius-full); background: var(--c-neutral-200); overflow: hidden; }
.gs-nudge-bar span { display: block; height: 100%; border-radius: var(--radius-full); background: var(--primary); transition: width var(--duration) cubic-bezier(0.16, 1, 0.3, 1); }
.gs-nudge-cta {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: none; border-radius: var(--radius-md);
  background: var(--primary); color: #fff; cursor: pointer;
  font-size: 13px; font-weight: 600;
  transition: background var(--duration-fast) ease;
}
.gs-nudge-cta:hover { background: var(--primary-h); }
.gs-nudge-dismiss {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--fg-muted); cursor: pointer;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}
.gs-nudge-dismiss:hover { background: var(--c-neutral-100); color: var(--fg-default); }

@media (max-width: 640px) {
  .gs-nudge { flex-wrap: wrap; }
  .gs-nudge-body { order: 3; flex-basis: 100%; }
  .gs-nudge-cta { margin-left: auto; }
}

/* ═══════════════════════════════════════════════════════════════════
   MONETIZATION M2 — PRICING PAGE + UPGRADE MODAL
   Locked design system: #2563EB brand, Inter, 10px radius, 3 status colors.
   =================================================================== */
.pricing-wrap { max-width: 1120px; margin: 0 auto; padding: 8px 4px 48px; }

/* Header */
.pricing-head { text-align: center; padding: 12px 0 4px; }
.pricing-title { font-size: var(--text-2xl); font-weight: 700; color: var(--c-neutral-900); margin: 0 0 6px; letter-spacing: -0.02em; }
.pricing-sub { font-size: var(--text-md); color: var(--c-neutral-600); margin: 0 auto; max-width: 540px; line-height: 1.5; }

/* Billing-cycle toggle */
.pricing-toggle-row { display: flex; justify-content: center; padding: 18px 0 22px; }
.pricing-toggle { display: inline-flex; gap: 2px; padding: 4px; background: var(--c-neutral-100); border-radius: var(--radius-full); border: 1px solid var(--border-default); }
.pricing-toggle-btn { display: inline-flex; align-items: center; gap: 7px; border: none; background: transparent; cursor: pointer; padding: 8px 18px; border-radius: var(--radius-full); font-size: var(--text-base); font-weight: 600; color: var(--c-neutral-600); transition: background .15s, color .15s, box-shadow .15s; }
.pricing-toggle-btn:hover { color: var(--c-neutral-900); }
.pricing-toggle-btn.is-active { background: #fff; color: var(--primary); box-shadow: var(--elev-1); }
.pricing-toggle-save { font-size: var(--text-xs); font-weight: 700; color: var(--success); background: #E7F6EC; padding: 2px 7px; border-radius: var(--radius-full); }
.pricing-toggle-btn.is-active .pricing-toggle-save { background: #DCFCE7; }

/* Trial banner */
.pricing-trial-banner { display: flex; align-items: center; gap: 9px; max-width: 720px; margin: 0 auto 22px; padding: 11px 16px; background: var(--primary-light); border: 1px solid #DBE7FE; border-radius: var(--radius); color: #1E3A8A; font-size: var(--text-base); line-height: 1.45; }
.pricing-trial-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; box-shadow: 0 0 0 3px rgba(37,99,235,.18); }

/* Card grid */
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: stretch; padding-top: 14px; }

.plan-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 22px 20px; box-shadow: var(--elev-1); transition: box-shadow .18s, border-color .18s, transform .18s; }
.plan-card:hover { box-shadow: 0 6px 20px rgba(15,23,42,.08); }
.plan-card.is-popular { border-color: var(--primary); border-width: 2px; box-shadow: 0 10px 30px rgba(37,99,235,.16); transform: scale(1.035); transform-origin: top center; z-index: 2; }
.plan-card.is-current { border-color: var(--c-neutral-300, #cbd5e1); }

.plan-badge-popular { position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%); background: var(--primary); color: #fff; font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; padding: 5px 13px; border-radius: var(--radius-full); box-shadow: 0 4px 10px rgba(37,99,235,.3); white-space: nowrap; }
.plan-current-tag { position: absolute; top: 14px; right: 14px; background: var(--c-neutral-100); color: var(--c-neutral-700, #475569); font-size: var(--text-xs); font-weight: 600; padding: 3px 9px; border-radius: var(--radius-full); }

.plan-head { margin-bottom: 14px; }
.plan-name { font-size: var(--text-lg); font-weight: 700; color: var(--c-neutral-900); }
.plan-tagline { font-size: var(--text-sm); color: var(--c-neutral-500, #64748b); margin-top: 2px; }

.plan-price-block { min-height: 96px; margin-bottom: 16px; }
.plan-price-strike { font-size: var(--text-base); color: var(--c-neutral-400, #94a3b8); text-decoration: line-through; margin-bottom: 2px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price-amount { font-size: 30px; font-weight: 800; color: var(--c-neutral-900); letter-spacing: -0.02em; font-feature-settings: "tnum"; }
.plan-price-period { font-size: var(--text-md); font-weight: 600; color: var(--c-neutral-500, #64748b); }
.plan-price-sub { font-size: var(--text-sm); color: var(--c-neutral-600); margin-top: 4px; }
.plan-save { display: inline-block; margin-top: 8px; font-size: var(--text-xs); font-weight: 700; color: var(--success); background: #E7F6EC; padding: 3px 9px; border-radius: var(--radius-full); }

.plan-cta { width: 100%; justify-content: center; }
.plan-cta-ghost { background: #fff; color: var(--c-neutral-700, #475569); }
.plan-cta-current { background: var(--c-neutral-100); color: var(--c-neutral-500, #64748b); cursor: default; border: 1px solid var(--border-default); }
.plan-cta-current:hover { background: var(--c-neutral-100); }

.plan-features { list-style: none; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--c-neutral-100); display: flex; flex-direction: column; gap: 10px; }
.plan-features li { display: flex; align-items: flex-start; gap: 9px; font-size: var(--text-base); color: var(--c-neutral-700, #475569); line-height: 1.4; }
.plan-feat-tick { color: var(--success); flex-shrink: 0; margin-top: 1px; display: inline-flex; }

/* Enterprise row */
.pricing-enterprise { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 28px; padding: 20px 24px; background: var(--c-neutral-900); border-radius: var(--radius-lg); color: #fff; }
.pricing-enterprise-title { font-size: var(--text-lg); font-weight: 700; }
.pricing-enterprise-sub { font-size: var(--text-base); color: rgba(255,255,255,.7); margin-top: 3px; max-width: 620px; line-height: 1.45; }
.pricing-enterprise .btn { flex-shrink: 0; background: #fff; color: var(--c-neutral-900); border: none; }
.pricing-enterprise .btn:hover { background: var(--c-neutral-100); }

/* Reassurance strip */
.pricing-reassure { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; margin-top: 26px; }
.pricing-reassure-item { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-base); color: var(--c-neutral-600); }
.pricing-reassure-item svg { color: var(--success); }

/* FAQ */
.pricing-faq { margin-top: 40px; }
.pricing-faq-title { font-size: var(--text-xl); font-weight: 700; color: var(--c-neutral-900); text-align: center; margin: 0 0 20px; }
.pricing-faq-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.pricing-faq-item { background: #fff; border: 1px solid var(--border-default); border-radius: var(--radius); padding: 16px 18px; }
.pricing-faq-q { font-size: var(--text-md); font-weight: 600; color: var(--c-neutral-900); margin-bottom: 6px; }
.pricing-faq-a { font-size: var(--text-base); color: var(--c-neutral-600); line-height: 1.5; }

/* ── Upgrade modal (opened by any 402) ───────────────────────────── */
.upg-modal { padding: 4px 2px; }
.upg-reason { font-size: var(--text-md); color: var(--c-neutral-700, #475569); line-height: 1.5; margin: 0 0 16px; }
.upg-muted { color: var(--c-neutral-500, #64748b); font-weight: 400; }
.upg-reco-card { border: 1px solid var(--border-default); border-radius: var(--radius); padding: 16px; background: var(--c-neutral-50); }
.upg-reco-card.is-popular { border-color: var(--primary); background: var(--primary-light); }
.upg-reco-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.upg-reco-name { font-size: var(--text-lg); font-weight: 700; color: var(--c-neutral-900); }
.upg-reco-tag { font-size: var(--text-xs); font-weight: 600; color: var(--primary); margin-top: 2px; }
.upg-reco-price { font-size: var(--text-lg); font-weight: 800; color: var(--c-neutral-900); text-align: right; white-space: nowrap; }
.upg-reco-period { font-size: var(--text-sm); font-weight: 600; color: var(--c-neutral-500, #64748b); }
.upg-reco-feats { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--c-neutral-200); gap: 8px; }
.upg-reco-card.is-popular .upg-reco-feats { border-top-color: #DBE7FE; }
.upg-pay-note { font-size: var(--text-sm); color: var(--c-neutral-500, #64748b); margin: 14px 0 0; text-align: center; }

/* ── M3 checkout stub ────────────────────────────────────────────── */
.upg-checkout { text-align: center; padding: 8px 6px 4px; }
.upg-rocket { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: var(--radius-lg); background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.upg-checkout-title { font-size: var(--text-lg); font-weight: 600; color: var(--c-neutral-900); }
.upg-checkout-price { font-size: var(--text-md); color: var(--c-neutral-700, #475569); margin-top: 4px; font-weight: 600; }
.upg-checkout-note { font-size: var(--text-base); color: var(--c-neutral-600); line-height: 1.5; margin: 14px auto 0; max-width: 420px; }

/* ── Topbar Upgrade pill ─────────────────────────────────────────── */
.topbar-upgrade-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border: none; border-radius: var(--radius-full); background: linear-gradient(135deg, var(--primary), var(--primary-h)); color: #fff; font-size: var(--text-sm); font-weight: 600; cursor: pointer; box-shadow: 0 2px 6px rgba(37,99,235,.28); transition: filter .15s, transform .15s; }
.topbar-upgrade-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.topbar-upgrade-btn svg { color: #fff; }

/* ── Settings → Plan & Billing card ──────────────────────────────── */
.settings-billing-card { grid-column: 1 / -1; }
.settings-billing-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-billing-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .03em; color: var(--c-neutral-500, #64748b); font-weight: 600; margin-bottom: 4px; }
.settings-billing-plan { font-size: var(--text-xl); font-weight: 700; color: var(--c-neutral-900); display: flex; align-items: center; gap: 10px; }
.settings-billing-status { font-size: var(--text-sm); font-weight: 600; color: var(--c-neutral-600); background: var(--c-neutral-100); padding: 3px 10px; border-radius: var(--radius-full); }
.settings-billing-status.is-trial { color: var(--primary); background: var(--primary-light); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-card.is-popular { transform: none; }
  .pricing-faq-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .plan-price-block { min-height: 0; }
  .pricing-enterprise { flex-direction: column; align-items: flex-start; }
  .pricing-enterprise .btn { width: 100%; }
  .settings-billing-row { flex-direction: column; align-items: flex-start; }
  .settings-billing-row .btn { width: 100%; }
  /* Keep the billing-cycle toggle in reach while scrolling the cards. */
  .pricing-toggle-row { position: sticky; top: 0; z-index: 5; background: var(--bg-canvas); padding: 10px 0; margin: 0 -4px; }
}

/* ════════════════════════════════════════════════════════════════════
   MONETIZATION M5 — COUPON FIELD + REFER & EARN
   Locked tokens only (#2563EB brand, Inter, 10px radius, 3 status colors).
   ════════════════════════════════════════════════════════════════════ */

/* ── Coupon field (checkout modal) ───────────────────────────────── */
.upg-coupon-row { display: flex; gap: 8px; max-width: 360px; margin: 14px auto 0; }
.upg-coupon-input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--border-default); border-radius: var(--radius); font-size: var(--text-base); font-family: inherit; text-transform: uppercase; }
.upg-coupon-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.upg-coupon-apply { height: 38px; white-space: nowrap; }
.upg-price-was { text-decoration: line-through; color: var(--c-neutral-500, #64748b); font-weight: 600; margin-right: 8px; }
.upg-price-now { color: var(--c-neutral-900); font-weight: 800; }
.upg-coupon-applied { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: var(--text-sm); color: var(--success); }
.upg-coupon-remove { border: none; background: none; color: var(--primary); font-weight: 600; cursor: pointer; font-size: var(--text-sm); padding: 0; }
.upg-coupon-remove:hover { text-decoration: underline; }

/* ── Refer & earn card (pricing page) ────────────────────────────── */
.pricing-refer-wrap { margin-top: 30px; }
.pricing-refer { border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 22px 22px 20px; background: var(--primary-light); }
.pricing-refer-head { margin-bottom: 16px; }
.pricing-refer-title { font-size: var(--text-xl); font-weight: 700; color: var(--c-neutral-900); }
.pricing-refer-sub { font-size: var(--text-base); color: var(--c-neutral-700, #475569); margin-top: 4px; }
.pricing-refer-codebox { display: flex; flex-wrap: wrap; gap: 8px; }
.pricing-refer-link { flex: 1; min-width: 200px; height: 40px; padding: 0 12px; border: 1px solid var(--border-default); border-radius: var(--radius); background: #fff; font-size: var(--text-sm); color: var(--c-neutral-700, #475569); font-family: inherit; }
.pricing-refer-link:focus { outline: none; border-color: var(--primary); }
.pricing-refer-stats { display: flex; gap: 28px; margin-top: 18px; }
.pricing-refer-stat { display: flex; flex-direction: column; }
.pricing-refer-num { font-size: var(--text-xl); font-weight: 800; color: var(--c-neutral-900); font-feature-settings: "tnum"; }
.pricing-refer-lbl { font-size: var(--text-xs); color: var(--c-neutral-500, #64748b); font-weight: 600; }

@media (max-width: 560px) {
  .pricing-refer-codebox .btn { width: 100%; }
  .pricing-refer-stats { gap: 20px; }
}

/* ════════════════════════════════════════════════════════════════════
   MONETIZATION M6 — BILLING SELF-SERVE (Settings → Billing)
   Locked tokens only (#2563EB brand, Inter, 10px radius, 3 status colors).
   ════════════════════════════════════════════════════════════════════ */
.billing-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.billing-head { margin-bottom: 2px; }
.billing-title { font-size: var(--text-2xl, 24px); font-weight: 800; color: var(--c-neutral-900, #0F172A); margin: 0 0 4px; }
.billing-sub { font-size: var(--text-sm, 14px); color: var(--muted); margin: 0; }
.billing-card { display: block; }
.billing-card + .billing-card { margin-top: 0; }
.billing-card-title { font-size: var(--text-sm, 14px); font-weight: 700; color: var(--c-neutral-900, #0F172A); margin-bottom: 14px; }
.billing-muted { font-size: var(--text-sm, 14px); color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.billing-loading, .billing-error { padding: 28px 0; text-align: center; }
.billing-error { color: var(--danger); }

/* Banners (past-due / grace) */
.billing-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid; font-size: var(--text-sm, 14px); line-height: 1.45; }
.billing-banner .btn { flex-shrink: 0; }
.billing-banner.is-danger { background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; }
.billing-banner.is-warn { background: #FEF3C7; border-color: #FCD34D; color: #92400E; }

/* Plan card */
.billing-plan-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.billing-plan-name { font-size: var(--text-xl, 20px); font-weight: 800; color: var(--c-neutral-900, #0F172A); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.billing-plan-status { font-size: var(--text-sm, 14px); color: var(--muted); margin-top: 4px; }
.billing-plan-price { font-size: var(--text-xl, 20px); font-weight: 800; color: var(--c-neutral-900, #0F172A); white-space: nowrap; font-feature-settings: "tnum"; }
.billing-plan-cycle { font-size: var(--text-sm, 14px); font-weight: 500; color: var(--muted); }
.billing-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Status pill */
.billing-status-pill { font-size: var(--text-xs, 12px); font-weight: 700; padding: 3px 10px; border-radius: var(--radius-full); white-space: nowrap; }
.billing-status-pill.is-ok { color: #15803D; background: #DCFCE7; }
.billing-status-pill.is-trial { color: var(--primary); background: var(--primary-light); }
.billing-status-pill.is-warn { color: #B45309; background: #FEF3C7; }
.billing-status-pill.is-danger { color: #B91C1C; background: #FEE2E2; }
.billing-status-pill.is-neutral { color: var(--muted); background: var(--c-neutral-100, #F1F5F9); }

/* Usage meters */
.billing-meters { display: flex; flex-direction: column; gap: 16px; }
.billing-meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.billing-meter-label { font-size: var(--text-sm, 14px); font-weight: 600; color: var(--c-neutral-700, #334155); }
.billing-meter-value { font-size: var(--text-sm, 14px); color: var(--muted); font-feature-settings: "tnum"; }
.billing-meter-track { height: 8px; background: var(--c-neutral-100, #F1F5F9); border-radius: var(--radius-full); overflow: hidden; }
.billing-meter-fill { height: 100%; background: var(--primary); border-radius: var(--radius-full); transition: width .3s ease; }
.billing-meter.is-near .billing-meter-fill { background: var(--warn); }
.billing-meter.is-over .billing-meter-fill { background: var(--danger); }
.billing-meter.is-over .billing-meter-value { color: var(--danger); font-weight: 600; }
.billing-meter.is-muted .billing-meter-value { color: var(--muted); }

/* Add-ons */
.billing-addons { display: flex; flex-direction: column; gap: 12px; }
.billing-addon { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border: 1px solid var(--border-default, #E2E8F0); border-radius: var(--radius-md, 8px); }
.billing-addon.is-disabled { opacity: .55; }
.billing-addon-name { font-size: var(--text-sm, 14px); font-weight: 700; color: var(--c-neutral-900, #0F172A); }
.billing-addon-desc { font-size: var(--text-xs, 12px); color: var(--muted); margin-top: 2px; }
.billing-addon-price { font-size: var(--text-xs, 12px); color: var(--c-neutral-700, #334155); font-weight: 600; margin-top: 4px; font-feature-settings: "tnum"; }
.billing-addon-control { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.billing-addon-qty { width: 64px; text-align: center; padding: 7px 8px; }

/* Billing history */
.billing-history-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.billing-history { width: 100%; }
.billing-pay-status { font-size: var(--text-xs, 12px); font-weight: 700; padding: 2px 9px; border-radius: var(--radius-full); white-space: nowrap; }
.billing-pay-status.ok { color: #15803D; background: #DCFCE7; }
.billing-pay-status.danger { color: #B91C1C; background: #FEE2E2; }
.billing-pay-status.warn { color: #B45309; background: #FEF3C7; }
.billing-pay-status.neutral { color: var(--muted); background: var(--c-neutral-100, #F1F5F9); }
.billing-receipt-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.billing-receipt-link:hover { text-decoration: underline; }

/* Danger button (cancel) — matches .btn-danger but namespaced for the billing UI */
.billing-btn-danger { background: var(--surface); color: var(--danger); border: 1px solid #FCA5A5; }
.billing-btn-danger:hover { background: #FEE2E2; }

/* Cancel-confirm modal copy */
.billing-confirm p { font-size: var(--text-sm, 14px); line-height: 1.55; margin: 0 0 10px; color: var(--text); }
.billing-confirm p:last-child { margin-bottom: 0; }

/* Settings → Billing card actions */
.settings-billing-actions { display: flex; gap: 8px; flex-shrink: 0; }

@media (max-width: 560px) {
  .billing-plan-main { flex-direction: column; }
  .billing-actions { width: 100%; }
  .billing-actions .btn { flex: 1; }
  .billing-banner { flex-direction: column; align-items: flex-start; }
  .billing-banner .btn { width: 100%; }
  .settings-billing-actions { width: 100%; }
  .settings-billing-actions .btn { flex: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════
   COMMAND PALETTE (⌘K / Ctrl+K) — Phase 6.1
   ═══════════════════════════════════════════════════════════════════════ */

#cmd-palette-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(60px, 12vh, 130px);
}
#cmd-palette-overlay.is-open {
  display: flex;
  animation: cmd-pal-in 160ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes cmd-pal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cmd-pal-dialog {
  width: min(620px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15,23,42,0.2), 0 4px 16px rgba(15,23,42,0.08);
  overflow: hidden;
  animation: cmd-pal-slide 180ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes cmd-pal-slide {
  from { transform: translateY(-12px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.cmd-pal-search {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.cmd-pal-search-icon { color: #64748b; flex-shrink: 0; }
.cmd-pal-input {
  flex: 1; border: none; outline: none;
  font-size: 16px; font-weight: 500; color: #0f172a;
  background: transparent; font-family: inherit;
}
.cmd-pal-input::placeholder { color: #94a3b8; font-weight: 400; }
.cmd-pal-esc-hint {
  font-family: inherit; font-size: 11px; font-weight: 600;
  color: #64748b; background: #f1f5f9;
  padding: 3px 7px; border-radius: 6px;
  border: 1px solid #e2e8f0; flex-shrink: 0;
}

.cmd-pal-results {
  max-height: min(380px, 55vh);
  overflow-y: auto;
  padding: 8px;
}
.cmd-pal-group {
  font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 12px 4px;
}
.cmd-pal-group:first-child { padding-top: 4px; }

.cmd-pal-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer; transition: background 120ms;
  color: #1e293b;
}
.cmd-pal-item:hover,
.cmd-pal-item.is-active {
  background: #f1f5f9;
}
.cmd-pal-item.is-active { background: #eff6ff; color: #1d4ed8; }
.cmd-pal-item.is-active .cmd-pal-item-icon { color: #2563eb; }
.cmd-pal-item-icon { flex-shrink: 0; color: #64748b; display: flex; }
.cmd-pal-item-label { font-size: 14px; font-weight: 500; }
.cmd-pal-hl { background: #dbeafe; color: #1d4ed8; border-radius: 3px; font-weight: 700; font-style: normal; }

.cmd-pal-empty {
  padding: 32px 16px; text-align: center;
  font-size: 14px; color: #64748b;
}
.cmd-pal-empty strong { color: #1e293b; }

.cmd-pal-footer {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 20px; border-top: 1px solid #f1f5f9;
  font-size: 12px; color: #94a3b8;
}
.cmd-pal-footer kbd {
  font-family: inherit; font-size: 11px;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 5px; padding: 2px 5px; color: #475569;
  margin-right: 3px;
}

.cmd-pal-body-lock { overflow: hidden; }

@media (max-width: 480px) {
  #cmd-palette-overlay { padding-top: 0; align-items: flex-end; }
  .cmd-pal-dialog {
    width: 100%; border-radius: 16px 16px 0 0;
    animation: cmd-pal-slide-up 200ms cubic-bezier(.16,1,.3,1) both;
  }
  @keyframes cmd-pal-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   ERROR CARD (Components.ErrorCard) — Phase 6.5
   ═══════════════════════════════════════════════════════════════════════ */
.error-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 10px; padding: 16px 20px;
  color: #991b1b; font-size: 14px;
}
.error-card-icon { flex-shrink: 0; color: #dc2626; margin-top: 1px; display: flex; }
.error-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.error-card-msg  { font-weight: 600; color: #991b1b; }
.error-card-detail { font-size: 13px; color: #64748b; }
.error-card-retry { margin-top: 8px; }

/* ═══════════════════════════════════════════════════════════════════════
   STYLED CONFIRM DIALOG (showConfirm) — Phase 6.6
   ═══════════════════════════════════════════════════════════════════════ */
#confirm-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
#confirm-overlay.is-open { display: flex; animation: confirm-in 150ms cubic-bezier(.16,1,.3,1) both; }
@keyframes confirm-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.confirm-dialog {
  background: #fff; border: 1px solid rgba(226,232,240,0.9);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(15,23,42,0.18), 0 4px 12px rgba(15,23,42,0.08);
  width: min(400px, calc(100vw - 32px));
  animation: confirm-slide 160ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes confirm-slide {
  from { transform: translateY(-8px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.confirm-header { padding: 20px 20px 0; }
.confirm-title  { font-size: 16px; font-weight: 700; color: #0f172a; margin: 0; }
.confirm-body   { padding: 8px 20px 0; font-size: 14px; color: #475569; line-height: 1.6; }
.confirm-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; }
.btn-danger          { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover    { background: #b91c1c; border-color: #b91c1c; }
.btn-danger:focus-visible { box-shadow: 0 0 0 3px rgba(220,38,38,0.3); }

/* ═══════════════════════════════════════════════════════════════════════
   INVOICE TEMPLATE PICKER CARDS — Phase 6.2
   ═══════════════════════════════════════════════════════════════════════ */
.template-card {
  cursor: pointer;
  border: 2px solid var(--border-default);
  border-radius: 10px;
  padding: 10px 8px 8px;
  text-align: center;
  background: #fff;
  transition: border-color 180ms, box-shadow 180ms, transform 180ms;
  outline: none;
}
.template-card:hover {
  border-color: var(--c-brand-300, #93c5fd);
  box-shadow: 0 4px 12px rgba(37,99,235,0.10);
  transform: translateY(-2px);
}
.template-card.is-selected {
  border-color: var(--c-brand-600, #2563eb);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.template-card:focus-visible {
  border-color: var(--c-brand-600, #2563eb);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.25);
}
.template-card-thumb {
  width: 100%; aspect-ratio: 80/56;
  border-radius: 4px; overflow: hidden; margin-bottom: 6px;
}
.template-card-thumb svg { width: 100%; height: 100%; display: block; }
.template-card-name {
  font-size: 11px; font-weight: 700;
  color: var(--fg-body); text-transform: capitalize;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Phase 7.2: Dashboard chart range clarity ───────────────────── */
.dash-chart-range-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-chart-range-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted, #64748b);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* ── Phase 7.3: Saved views modal ───────────────────────────────── */
.sv-open-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.sv-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 32px;
}
.sv-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  padding: 2px 2px 2px 10px;
  background: var(--surface, #fff);
  transition: border-color 150ms;
}
.sv-item:hover { border-color: var(--c-brand-300, #93c5fd); }
.sv-item-apply {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-body, #0f172a);
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}
.sv-item-apply:hover { color: var(--c-brand-600, #2563eb); }
.sv-item-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-brand-700, #1d4ed8);
  background: var(--c-brand-50, #eff6ff);
  padding: 1px 6px;
  border-radius: 20px;
}
.sv-item-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-muted, #64748b);
  padding: 6px 8px;
  border-radius: var(--radius-md, 10px);
  display: flex;
  align-items: center;
  transition: color 150ms, background 150ms;
}
.sv-item-del:hover { color: var(--c-danger-600, #dc2626); background: #fef2f2; }
.sv-empty {
  font-size: 13px;
  color: var(--fg-muted, #64748b);
  text-align: center;
  padding: 16px 0 8px;
}
.sv-divider {
  height: 1px;
  background: var(--border, #e2e8f0);
  margin: 14px 0 12px;
}
.sv-save-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.sv-name-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.sv-name-input:focus {
  border-color: var(--c-brand-500, #3b82f6);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.10);
}
.sv-hint {
  font-size: 12px;
  color: var(--fg-muted, #64748b);
  margin-top: 8px;
  margin-bottom: 0;
}


/* ── Phase 8.2 — Payment Link modal component classes ─────────────── */
.paylink-modal{display:flex;flex-direction:column;gap:16px}
.paylink-url-card{background:var(--c-success-50,#f0fdf4);border:1px solid var(--c-success-100,#bbf7d0);border-radius:10px;padding:14px 16px}
.paylink-url-label{font-size:12px;color:var(--c-success-700,#15803d);font-weight:600;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:6px}
.paylink-url-text{font-family:monospace;font-size:13px;color:var(--c-neutral-900,#0f172a);word-break:break-all;line-height:1.5}
.paylink-desc{font-size:13px;color:var(--fg-muted,#64748b);line-height:1.6;margin:0}
.paylink-actions{display:flex;gap:8px;flex-wrap:wrap}
.paylink-wa-label{font-size:12px;color:var(--fg-muted,#64748b);margin-bottom:4px;display:block}
.paylink-setup-note{font-size:11px;color:var(--fg-muted,#64748b);background:var(--c-neutral-50,#f8fafc);border-radius:6px;padding:8px 10px;line-height:1.5}
.paylink-setup-note .link-brand{color:var(--c-brand-600,#2563eb)}
.paylink-webhook-url{font-size:10px;word-break:break-all}
.paylink-not-configured{padding:8px 0;display:flex;flex-direction:column;gap:12px}

/* ── Inline-style refactor helpers ────────────────────────────────────────── */

/* Required-field asterisk */
.req-asterisk{color:#dc2626}

/* Feature-gate modal */
.fg-modal{background:#fff;border-radius:16px;box-shadow:0 24px 64px rgba(15,23,42,.18);max-width:440px;width:100%;padding:0;overflow:hidden;position:relative;animation:_fgSlideUp .2s ease}
.fg-header-strip{height:4px;background:linear-gradient(90deg,#2563EB,#7C3AED)}
.fg-body{padding:28px 28px 24px}
.fg-close-btn{position:absolute;top:16px;right:16px;border:none;background:#F1F5F9;cursor:pointer;color:#64748B;width:28px;height:28px;border-radius:8px;display:flex;align-items:center;justify-content:center;transition:background .1s}
.fg-close-btn:hover{background:#E2E8F0}
.fg-content-row{display:flex;gap:16px;margin-bottom:20px}
.fg-icon-box{flex-shrink:0;width:46px;height:46px;border-radius:12px;display:flex;align-items:center;justify-content:center}
.fg-content-text{min-width:0;padding-top:2px}
.fg-title{font-size:16px;font-weight:700;color:#0F172A;margin-bottom:8px;line-height:1.3}
.fg-body-text{font-size:13.5px;color:#475569;line-height:1.6;margin:0}
.fg-note{background:#F8FAFC;border:1px solid #E2E8F0;border-radius:8px;padding:10px 14px;margin-bottom:20px;font-size:12.5px;color:#64748B;display:flex;gap:8px;align-items:flex-start}
.fg-note-icon{flex-shrink:0;margin-top:1px}
.fg-actions{display:flex;gap:10px;justify-content:flex-end}
.fg-cancel-btn{border:1.5px solid #E2E8F0;background:#fff;color:#374151;font:inherit;font-size:13px;font-weight:500;padding:9px 18px;border-radius:8px;cursor:pointer;transition:background .1s}
.fg-cancel-btn:hover{background:#F8FAFC}
.fg-cta-btn{border:none;background:#2563EB;color:#fff;font:inherit;font-size:13px;font-weight:600;padding:9px 20px;border-radius:8px;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:6px;transition:background .1s}
.fg-cta-btn:hover{background:#1D4ED8}

/* Razorpay spinner (pricing.js) */
.rzp-spin-btn{display:inline-flex;align-items:center;gap:7px}
.rzp-spin-icon{animation:_rzpSpin .8s linear infinite}
.rzp-spin-icon-slow{animation:_rzpSpin 1s linear infinite}
.rzp-verify-title{font-size:15px;font-weight:600;color:#1E40AF}
.rzp-verify-sub{font-size:13px;color:#64748B;max-width:280px;text-align:center}

/* Setup-status banner */
.ss-banner-inner{display:flex;align-items:center;gap:12px;flex:1;min-width:0;flex-wrap:wrap}
.ss-icon-row{display:flex;align-items:center;gap:8px;flex-shrink:0}
.ss-icon-box{width:30px;height:30px;border-radius:8px;background:#DBEAFE;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.ss-title{font-size:13px;font-weight:600;color:#1E40AF}
.ss-count{font-size:12px;color:#60A5FA;margin-left:8px}
.ss-progress{height:5px;width:90px;background:#DBEAFE;border-radius:3px;overflow:hidden;flex-shrink:0}
.ss-progress-fill{height:100%;background:#2563EB;border-radius:3px;transition:width .4s}
.ss-chips{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.ss-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.ss-cta-btn{font-size:12.5px;font-weight:600;color:#fff;background:#2563EB;border-radius:7px;padding:6px 14px;text-decoration:none;display:inline-flex;align-items:center;gap:5px;white-space:nowrap;transition:background .12s}
.ss-cta-btn:hover{background:#1D4ED8}
.ss-dismiss-btn{border:none;background:transparent;cursor:pointer;padding:5px;color:#93C5FD;display:flex;align-items:center;border-radius:5px;transition:color .12s}
.ss-dismiss-btn:hover{color:#1E40AF}
.ss-chip-done{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;font-weight:500;color:#059669;text-decoration:none;background:#ECFDF5;border:1px solid #A7F3D0;border-radius:20px;padding:2px 9px;white-space:nowrap}
.ss-chip-pending{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;font-weight:500;color:#2563EB;text-decoration:none;background:#EFF6FF;border:1px solid #BFDBFE;border-radius:20px;padding:2px 9px;white-space:nowrap}

/* Onboarding-flow utility */
.skeleton-w70{width:70%}
.muted-mt{margin-top:12px}
.muted-my{margin:6px 0 14px}
.flex-gap-wrap{display:flex;gap:10px;flex-wrap:wrap}

/* pages.js component classes */
.form-grid-gap{gap:10px}
.file-input-sm{font-size:13px}
.field-help-neg-mt{margin:-4px 0 14px}
.field-help-sub-mt{margin:6px 0 0}
.settings-flex-row{display:flex;gap:12px;align-items:flex-start}
.qr-logo-preview{width:90px;height:90px;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}
.mt-4px{margin-top:4px}
.icon-inline{margin-right:6px;vertical-align:-2px}
.template-preview-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:12px;margin-top:16px}
.margin-preview{background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:10px}
.margin-label{font-size:11px;color:#15803d;font-weight:600;text-transform:uppercase}
.margin-value{font-size:18px;font-weight:700;color:#15803d;margin-top:2px}
.field-error{color:#dc2626}
.field-success{color:#059669}
.field-error-sm{color:#dc2626;font-size:11px}
.checkbox-sm{width:14px;height:14px;cursor:pointer}
.skeleton-card-lg{height:120px;border-radius:16px}
.profile-wrap{max-width:860px;margin:0 auto;padding:32px 24px}
.profile-header-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:28px;flex-wrap:wrap;gap:12px}
.profile-title{font-size:22px;font-weight:700;letter-spacing:-0.02em;margin-bottom:4px}
.profile-sub{color:var(--text-muted);font-size:14px}
.card-mb{margin-bottom:16px}
.avatar-wrap{cursor:pointer;position:relative}
.avatar-edit-overlay{position:absolute;bottom:0;right:0;width:22px;height:22px;border-radius:50%;background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;border:2px solid #fff}
.profile-info{flex:1;min-width:0}
.profile-name-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:6px}
.profile-user-meta{font-size:13px;color:var(--text-muted);margin-bottom:8px}
.profile-user-since{font-size:12px;color:var(--text-faint)}
.profile-section-row{display:flex;align-items:flex-start;gap:20px;flex-wrap:wrap}
.section-hdr-sm{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}
.section-hdr-mb{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;flex-wrap:wrap;gap:10px}
.section-hdr-mb14{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;flex-wrap:wrap;gap:10px}
.section-title-flat{margin-bottom:0}
.field-help-mb{margin-bottom:16px}
.field-help-mb6{margin-bottom:6px}
.section-flex-between{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}
.flex-1-min0{flex:1;min-width:0}
.twofa-label{font-size:14px;font-weight:600;color:var(--text);margin-bottom:2px}
.business-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}
.verification-chips{display:flex;flex-wrap:wrap;gap:10px}
.subscription-info-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.page-error-mt{margin-top:40px}
.loading-pad{padding:24px}
.loading-center{padding:40px 0;text-align:center;color:var(--text-muted)}
.badge-verified{display:inline-flex;align-items:center;gap:4px;background:#ECFDF5;color:#059669;border:1px solid #A7F3D0;border-radius:6px;padding:3px 8px;font-size:11px;font-weight:700}
.badge-free{background:#F1F5F9;color:#64748B;border:1px solid #E2E8F0;border-radius:6px;padding:3px 8px;font-size:11px;font-weight:700}
.btn-sm-text{font-size:13px}
.modal-panel{background:#fff;border-radius:14px;padding:28px;width:min(520px,100%);max-height:90vh;overflow-y:auto;box-shadow:0 24px 60px rgba(0,0,0,.22)}
.modal-panel-title{font-size:17px;font-weight:700;margin-bottom:16px}
.modal-panel-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.modal-panel-field label{display:block;font-size:12px;font-weight:600;margin-bottom:4px;color:#374151}
.modal-panel-input{width:100%;padding:9px 11px;border:1px solid #D1D5DB;border-radius:7px;font:inherit;font-size:13px;outline:none}
.modal-panel-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:20px}
.badge-pending{background:#FFF7ED;color:#C2410C;border:1px solid #FED7AA;border-radius:6px;padding:3px 8px;font-size:11px;font-weight:700}
.badge-unverified{background:#F1F5F9;color:#64748B;border:1px solid #E2E8F0;border-radius:6px;padding:3px 8px;font-size:11px;font-weight:700}
.biz-field-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--text-faint);margin-bottom:3px}
.biz-field-value{font-size:13px;font-weight:500}
.biz-field-value-filled{color:var(--text)}
.biz-field-value-empty{color:var(--text-faint)}
.lock-info{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--text-faint)}
.email-badge{background:#ECFDF5;color:#059669;border:1px solid #A7F3D0;border-radius:6px;padding:2px 7px;font-size:11px;font-weight:700}
.gst-locked-badge{display:inline-flex;align-items:center;gap:4px;background:#EFF6FF;color:#2563EB;border:1px solid #BFDBFE;border-radius:6px;padding:2px 7px;font-size:11px;font-weight:700}
.profile-name-text{font-size:18px;font-weight:700;color:var(--text)}
.u-col-full{grid-column:1/-1}
.branch-skel-title{height:12px;width:160px;display:inline-block}
.branch-skel-body{height:42px;width:100%;display:inline-block}
.paylink-not-configured{padding:8px 0;display:flex;flex-direction:column;gap:12px}
