/* ═══════════════════════════════════════════════════════════════════════════
   ACCOUNTING SYSTEM PRO — Design System & App Styles
   Theme: Deep Navy · Gold Accents · Premium Legal/Professional
   Font: Inter (body) · Playfair Display (headings) · JetBrains Mono (numbers)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-root:     #060D18;
  --bg-dark:     #0A1628;
  --bg-sidebar:  #0C1830;
  --bg-card:     #101F38;
  --bg-elevated: #142340;
  --bg-input:    #0C1830;
  --bg-hover:    #1a2f50;
  --bg-modal:    #0f1e38;

  /* Borders */
  --border:       rgba(255,255,255,0.07);
  --border-md:    rgba(255,255,255,0.11);
  --border-focus: #c9a84c;

  /* Gold palette */
  --gold:         #c9a84c;
  --gold-light:   #dfc070;
  --gold-dim:     rgba(201,168,76,0.12);
  --gold-glow:    rgba(201,168,76,0.25);

  /* Semantic colours */
  --blue:    #2563eb;
  --teal:    #0ea5e9;
  --green:   #10b981;
  --amber:   #f59e0b;
  --red:     #ef4444;
  --purple:  #8b5cf6;
  --pink:    #ec4899;

  /* Text */
  --text-1: #f0f4f8;
  --text-2: #8fa3bf;
  --text-3: #4d6280;
  --text-gold: #c9a84c;

  /* Typography */
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --r-xs:  4px;
  --r-sm:  8px;
  --r:     12px;
  --r-lg:  16px;
  --r-xl:  24px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.4);
  --shadow:    0 4px 20px rgba(0,0,0,0.5);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.55);
  --tl-color:   var(--gold);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
  --shadow-gold: 0 0 20px rgba(201,168,76,0.2);

  /* Layout */
  --sidebar-w: 256px;
  --topbar-h:  62px;

  /* Transitions */
  --t: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html                   { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body                   { font-family: var(--font-sans); background: var(--bg-root); color: var(--text-1); min-height: 100vh; }
a                      { color: inherit; text-decoration: none; }
button                 { cursor: pointer; font-family: inherit; border: none; }
input, textarea, select{ font-family: inherit; }
img                    { max-width: 100%; }
::selection            { background: var(--gold-dim); color: var(--gold-light); }
::-webkit-scrollbar    { width: 4px; height: 4px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── App Shell ──────────────────────────────────────────────────────────────── */
.asp-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-root);
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.asp-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--t);
  position: relative;
  z-index: 50;
}
.asp-sidebar::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent 0%, var(--gold-glow) 40%, var(--gold-glow) 60%, transparent 100%);
  opacity: 0.5;
}

/* Brand / Logo Area */
.asp-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
  flex-shrink: 0;
}
.asp-brand-logo {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  object-fit: contain;
  background: var(--gold-dim);
  padding: 4px;
  flex-shrink: 0;
}
.asp-brand-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--gold-dim), rgba(37,99,235,0.12));
  border: 1px solid rgba(201,168,76,0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.asp-brand-text { overflow: hidden; }
.asp-brand-name {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.asp-brand-type {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 1px;
}

/* Nav */
.asp-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}
.asp-nav-section {
  margin-bottom: 4px;
}
.asp-nav-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 8px 8px 4px;
}
.asp-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: background var(--t), color var(--t);
  margin-bottom: 1px;
  user-select: none;
  white-space: nowrap;
  border: 1px solid transparent;
}
.asp-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}
.asp-nav-item.active {
  background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(37,99,235,0.08));
  color: var(--gold);
  border-color: rgba(201,168,76,0.15);
}
.asp-nav-item .nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}
.asp-nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.asp-nav-item.active .asp-nav-icon { opacity: 1; }

/* Sidebar Footer / User Card */
.asp-sidebar-foot {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.asp-user-card {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t);
  border: 1px solid transparent;
}
.asp-user-card:hover { background: var(--bg-hover); border-color: var(--border-md); }
.asp-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #2563eb);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.asp-user-name  { font-size: 13px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asp-user-role  { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }

/* ── Main Area ──────────────────────────────────────────────────────────────── */
.asp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.asp-topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  flex-shrink: 0;
}
.asp-topbar-title { font-size: 17px; font-weight: 700; color: var(--text-1); flex: 1; }
.asp-topbar-sub   { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: 8px; }
.asp-topbar-actions { display: flex; align-items: center; gap: 6px; }

/* ── Page Content ─────────────────────────────────────────────────────────────*/
.asp-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Login Page ─────────────────────────────────────────────────────────────── */
.asp-login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-root);
  position: relative; overflow: hidden;
}
/* Animated grid background */
.asp-login-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(201,168,76,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,168,76,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
}
/* Glow orbs */
.asp-login-orb1 {
  position: absolute; top: -160px; right: -160px;
  width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.asp-login-orb2 {
  position: absolute; bottom: -200px; left: -200px;
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.asp-login-card {
  position: relative;
  width: 100%; max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--r-xl);
  padding: 48px 40px 40px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(201,168,76,0.06);
  animation: asp-login-in var(--t-spring);
}
@keyframes asp-login-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.asp-login-logo-area { text-align: center; margin-bottom: 36px; }
.asp-login-logo-img  { max-height: 72px; max-width: 190px; object-fit: contain; }
.asp-login-app-name  { font-family: var(--font-serif); font-size: 26px; color: var(--gold); letter-spacing: 0.02em; }
.asp-login-app-sub   { font-size: 11px; color: var(--text-3); margin-top: 5px; letter-spacing: 0.1em; text-transform: uppercase; }

.asp-login-heading { font-size: 20px; font-weight: 700; margin-bottom: 5px; }
.asp-login-subhead { font-size: 13.5px; color: var(--text-2); margin-bottom: 28px; }

.asp-login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
  display: flex; align-items: flex-start; gap: 8px;
}

.asp-form-group  { margin-bottom: 18px; }
.asp-form-label  { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 7px; }
.asp-form-input  {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size: 14.5px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.asp-form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.asp-form-input::placeholder { color: var(--text-3); }

.asp-login-btn {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: #0a0a0a;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--r-sm);
  border: none; cursor: pointer;
  margin-top: 6px;
  transition: background var(--t), transform var(--t), box-shadow var(--t);
  letter-spacing: 0.02em;
}
.asp-login-btn:hover  { background: var(--gold-light); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(201,168,76,0.4); }
.asp-login-btn:active { transform: translateY(0); }
.asp-login-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.asp-login-footer { text-align: center; margin-top: 22px; font-size: 12px; color: var(--text-3); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  font-family: var(--font-sans);
  user-select: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed !important; transform: none !important; }
.btn-primary  { background: var(--gold); color: #080808; }
.btn-primary:hover { background: var(--gold-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(201,168,76,0.35); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-1); border: 1px solid var(--border-md); }
.btn-secondary:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.18); }
.btn-danger    { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.22); }
.btn-danger:hover { background: rgba(239,68,68,0.22); }
.btn-success   { background: rgba(16,185,129,0.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.22); }
.btn-success:hover { background: rgba(16,185,129,0.22); }
.btn-ghost     { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); }
.btn-sm  { padding: 5px 11px; font-size: 12.5px; gap: 5px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 7px; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title  { font-size: 15px; font-weight: 700; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.card-sub    { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }

/* ── KPI Cards ──────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative; overflow: hidden;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
  cursor: default;
}
.kpi-card:hover { transform: translateY(-2px); border-color: var(--border-md); box-shadow: var(--shadow); }
.kpi-bar { position: absolute; top: 0; left: 0; right: 0; height: 2px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.kpi-icon  { width: 38px; height: 38px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.kpi-value { font-size: 22px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.02em; color: var(--text-1); line-height: 1; }
.kpi-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 5px; }

/* ── Form Elements ──────────────────────────────────────────────────────────── */
.form-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.form-grid-2  { grid-template-columns: 1fr 1fr; }
.form-grid-3  { grid-template-columns: 1fr 1fr 1fr; }
.form-full    { grid-column: 1 / -1; }
.form-group   { display: flex; flex-direction: column; gap: 6px; }
.form-label   { font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  color: var(--text-1);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
  transition: border-color var(--t), box-shadow var(--t);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-3); }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%234d6280' stroke-width='2.5'%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;
}
.form-select option { background: var(--bg-card); color: var(--text-1); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint  { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.form-error { font-size: 11.5px; color: var(--red); }
.form-row   { display: flex; gap: 12px; align-items: flex-start; }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  width: 38px; height: 22px;
  background: var(--border-md);
  border-radius: 11px;
  position: relative; cursor: pointer;
  transition: background var(--t);
  flex-shrink: 0;
}
.toggle.on { background: var(--gold); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white; border-radius: 50%;
  transition: transform var(--t);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.toggle.on::after { transform: translateX(16px); }
.toggle-label { font-size: 13px; color: var(--text-2); }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.badge::before { content:''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-draft     { background: rgba(100,116,139,0.15); color: #94a3b8; }
.badge-sent      { background: rgba(37,99,235,0.15);  color: #93c5fd; }
.badge-partial   { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-paid      { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-overdue   { background: rgba(239,68,68,0.15);  color: #fca5a5; }
.badge-void      { background: rgba(100,116,139,0.1); color: #64748b; }
.badge-active    { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-inactive  { background: rgba(100,116,139,0.15);color: #94a3b8; }
.badge-open      { background: rgba(14,165,233,0.15); color: #7dd3fc; }
.badge-completed { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-high      { background: rgba(239,68,68,0.15);  color: #fca5a5; }
.badge-medium    { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-low       { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-admin     { background: rgba(201,168,76,0.15); color: #dfc070; }
.badge-pending   { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* ── Data Table ─────────────────────────────────────────────────────────────── */
.table-wrap  { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
.data-table  { width: 100%; border-collapse: collapse; }
.data-table thead tr { background: var(--bg-sidebar); }
.data-table th {
  text-align: left; padding: 11px 14px;
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.09em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text-2);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background var(--t);
}
.data-table tbody tr:hover td { background: var(--bg-elevated); color: var(--text-1); }
.data-table tbody tr:last-child td { border-bottom: none; }
.td-bold  { font-weight: 600; color: var(--text-1) !important; }
.td-mono  { font-family: var(--font-mono); font-size: 13px; }
.td-act   { display: flex; gap: 3px; justify-content: flex-end; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.asp-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: asp-fade-in 0.15s ease;
}
@keyframes asp-fade-in { from { opacity: 0; } to { opacity: 1; } }
.asp-modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-md);
  border-radius: var(--r-xl);
  width: 100%; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: asp-slide-up var(--t-spring);
}
@keyframes asp-slide-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.asp-modal-sm  { max-width: 420px; }
.asp-modal-md  { max-width: 620px; }
.asp-modal-lg  { max-width: 880px; }
.asp-modal-xl  { max-width: 1080px; }
.asp-modal-hd  { padding: 22px 26px 0; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.asp-modal-ttl { font-size: 17px; font-weight: 700; }
.asp-modal-cls {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--border-md);
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t);
}
.asp-modal-cls:hover { background: var(--bg-hover); color: var(--text-1); }
.asp-modal-body { padding: 22px 26px; overflow-y: auto; flex: 1; }
.asp-modal-foot { padding: 0 26px 22px; display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.asp-tabs     { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.asp-tab      {
  padding: 10px 18px;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-3); background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer;
  transition: color var(--t), border-color var(--t);
  white-space: nowrap; margin-bottom: -1px;
}
.asp-tab:hover { color: var(--text-1); }
.asp-tab.on    { color: var(--gold); border-bottom-color: var(--gold); }

/* ── Search Bar ─────────────────────────────────────────────────────────────── */
.asp-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border-md);
  border-radius: var(--r-sm); padding: 8px 12px;
  transition: border-color var(--t), box-shadow var(--t);
}
.asp-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.asp-search input { background: none; border: none; outline: none; color: var(--text-1); font-size: 13.5px; width: 100%; }
.asp-search input::placeholder { color: var(--text-3); }

/* ── Logo / File Upload Zone ────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-md);
  border-radius: var(--r-lg);
  padding: 32px 20px; text-align: center;
  background: var(--bg-input);
  cursor: pointer; transition: all var(--t);
  position: relative; overflow: hidden;
}
.upload-zone:hover    { border-color: var(--gold); background: var(--gold-dim); }
.upload-zone.has-file { border-style: solid; border-color: rgba(201,168,76,0.3); background: rgba(201,168,76,0.05); }
.upload-zone-img      { max-height: 80px; max-width: 200px; object-fit: contain; margin: 0 auto 10px; display: block; }
.upload-zone-hint     { font-size: 12px; color: var(--text-3); }
.upload-zone-name     { font-size: 13px; color: var(--gold); font-weight: 600; }

/* ── Series / Number Preview ────────────────────────────────────────────────── */
.num-preview {
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.06em;
  margin-top: 14px;
}
.series-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  position: relative;
}
.series-card.is-default {
  border-color: rgba(201,168,76,0.35);
  background: rgba(201,168,76,0.04);
}
.series-default-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--gold-dim); color: var(--gold);
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* ── Toasts ─────────────────────────────────────────────────────────────────── */
.asp-toasts {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.asp-toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  padding: 13px 16px;
  min-width: 280px; max-width: 400px;
  display: flex; align-items: flex-start; gap: 11px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: asp-toast-in var(--t-spring);
}
@keyframes asp-toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.asp-toast.success { border-left: 3px solid var(--green); }
.asp-toast.error   { border-left: 3px solid var(--red); }
.asp-toast.info    { border-left: 3px solid var(--teal); }
.asp-toast.warning { border-left: 3px solid var(--amber); }
.toast-title { font-weight: 700; font-size: 13.5px; color: var(--text-1); }
.toast-msg   { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }

/* ── Coming-Soon Placeholder ────────────────────────────────────────────────── */
.asp-coming-soon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px; text-align: center; gap: 14px;
}
.asp-coming-phase {
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 11px; font-weight: 700;
  padding: 3px 12px; border-radius: 20px;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.asp-coming-icon { font-size: 52px; color: var(--text-3); }
.asp-coming-soon h2 { font-size: 22px; font-weight: 700; color: var(--text-1); }
.asp-coming-soon p  { font-size: 14px; color: var(--text-2); max-width: 340px; line-height: 1.6; }

/* ── Empty State ────────────────────────────────────────────────────────────── */
.asp-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; text-align: center; gap: 12px;
}
.asp-empty svg  { color: var(--text-3); }
.asp-empty h3   { font-size: 17px; font-weight: 700; color: var(--text-1); }
.asp-empty p    { font-size: 13.5px; color: var(--text-2); max-width: 300px; line-height: 1.5; }

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.asp-spinner    { width: 28px; height: 28px; border: 2.5px solid var(--border-md); border-top-color: var(--gold); border-radius: 50%; animation: asp-spin 0.7s linear infinite; }
.asp-spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.asp-spinner-lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes asp-spin { to { transform: rotate(360deg); } }
.asp-loader-page { display: flex; align-items: center; justify-content: center; height: 60vh; }

/* ── Permission Matrix ──────────────────────────────────────────────────────── */
.perm-table    { width: 100%; border-collapse: collapse; }
.perm-table th { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.09em; padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: center; }
.perm-table th:first-child { text-align: left; }
.perm-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); text-align: center; }
.perm-table td:first-child { text-align: left; font-size: 13px; color: var(--text-1); font-weight: 500; }
.perm-cb { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }

/* ── Confirm Dialog ─────────────────────────────────────────────────────────── */
.asp-confirm-msg { font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ── Utilities ──────────────────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end  { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }  .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-xs   { font-size: 11px; }  .text-sm { font-size: 13px; }
.text-base { font-size: 14px; }  .text-lg  { font-size: 16px; }
.text-muted { color: var(--text-3); } .text-secondary { color: var(--text-2); }
.text-gold  { color: var(--gold); }   .text-green { color: var(--green); }
.text-red   { color: var(--red); }    .text-amber { color: var(--amber); }
.font-bold  { font-weight: 700; }     .font-semibold { font-weight: 600; }
.font-mono  { font-family: var(--font-mono); }
.font-serif { font-family: var(--font-serif); }
.text-right { text-align: right; }  .text-center { text-align: center; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer    { cursor: pointer; }
.divider    { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.amt        { font-family: var(--font-mono); white-space: nowrap; }
.amt-pos    { color: var(--green); }
.amt-neg    { color: var(--red); }

/* ── Animations ─────────────────────────────────────────────────────────────── */
.fade-in    { animation: asp-fade-in 0.22s ease; }
.slide-in   { animation: asp-slide-up var(--t-spring); }
.stagger>*  { animation: asp-fade-in 0.3s ease both; }
.stagger>*:nth-child(1){animation-delay:0.04s}
.stagger>*:nth-child(2){animation-delay:0.08s}
.stagger>*:nth-child(3){animation-delay:0.12s}
.stagger>*:nth-child(4){animation-delay:0.16s}
.stagger>*:nth-child(5){animation-delay:0.20s}
.stagger>*:nth-child(6){animation-delay:0.24s}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .asp-sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 200; box-shadow: var(--shadow-lg); transition: left var(--t-spring); }
  .asp-sidebar.open { left: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .asp-modal { border-radius: var(--r-lg) var(--r-lg) 0 0; position: absolute; bottom: 0; left: 0; right: 0; max-height: 92vh; }
}
@media (min-width: 1400px) { .kpi-grid { grid-template-columns: repeat(6,1fr); } }
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr; } .asp-login-card { padding: 32px 24px; } }

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 2 — Invoice Print & UI Styles
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Invoice Line-item Builder ─────────────────────────────────────────────── */
.inv-builder-wrap { background: var(--bg-card); border-radius: var(--r-lg); overflow: hidden; }
.inv-item-row-grid {
  display: grid;
  grid-template-columns: 3fr 1fr 80px 1fr 90px 80px 80px 36px;
  gap: 6px;
  margin-bottom: 8px;
  align-items: start;
}

/* ── Invoice Print View (used in detail screen + @media print) ─────────────── */
.invoice-print-wrap {
  background: #fff;
  color: #1a1a1a;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  padding: 32px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  line-height: 1.5;
}
.inv-letterhead { margin-bottom: 16px; text-align: center; }
.inv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 20px; }
.inv-header-left { flex: 1; }
.inv-firm-name { font-size: 18px; font-weight: 800; color: #0f2a50; margin-bottom: 4px; }
.inv-firm-address { font-size: 11px; color: #555; line-height: 1.5; }
.inv-header-right { text-align: right; }
.inv-type-label { font-size: 20px; font-weight: 800; color: #0f2a50; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.inv-meta-table { font-size: 11px; border-collapse: collapse; }
.inv-meta-table td { padding: 2px 8px 2px 0; color: #444; }
.inv-meta-table td:first-child { color: #888; }

.inv-bill-row { display: flex; gap: 20px; margin-bottom: 18px; }
.inv-bill-box { flex: 1; background: #f8f9fb; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 14px; }
.inv-bill-lbl  { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #888; margin-bottom: 5px; }
.inv-bill-name { font-size: 14px; font-weight: 700; color: #0f2a50; margin-bottom: 3px; }
.inv-bill-addr { font-size: 11px; color: #555; line-height: 1.5; }

.inv-items-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 11px; }
.inv-items-table thead tr { background: #0f2a50; color: #fff; }
.inv-items-table th { padding: 8px 10px; text-align: left; font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.inv-items-table td { padding: 7px 10px; border-bottom: 1px solid #e8edf2; }
.inv-items-table tbody tr:nth-child(even) td { background: #f8f9fb; }

.inv-totals-row { display: flex; gap: 16px; margin-bottom: 16px; }
.inv-tax-breakdown { flex: 1; background: #f8f9fb; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; }
.inv-tax-breakdown th { background: #e8edf2; padding: 5px 8px; font-size: 10px; text-align: right; font-weight: 700; }
.inv-tax-breakdown th:first-child { text-align: left; }
.inv-tax-breakdown td { padding: 4px 8px; font-size: 10px; border-bottom: 1px solid #eee; text-align: right; }
.inv-tax-breakdown td:first-child { text-align: left; }

.inv-totals-box { width: 230px; }
.inv-total-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #eee; font-size: 11px; color: #444; }
.inv-grand-total { display: flex; justify-content: space-between; padding: 10px; background: #0f2a50; color: #fff; border-radius: 6px; margin-top: 4px; font-weight: 700; font-size: 14px; }

.inv-in-words { font-size: 11px; background: #fffbe6; border: 1px solid #f0d060; border-radius: 6px; padding: 8px 12px; margin-bottom: 14px; color: #666; }
.inv-bank-details { background: #f0f6ff; border: 1px solid #c0d8f8; border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; font-size: 11px; color: #333; }
.inv-footer-area { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 24px; padding-top: 14px; border-top: 2px solid #e2e8f0; }
.inv-footer-text { text-align: center; font-size: 10px; color: #888; margin-top: 10px; border-top: 1px solid #eee; padding-top: 8px; }

/* ── @media print — clean paper output ────────────────────────────────────── */
@media print {
  .asp-sidebar, .asp-topbar, .asp-toasts, .btn, .card-header .btn { display: none !important; }
  .asp-main { overflow: visible !important; }
  .asp-content { padding: 0 !important; overflow: visible !important; }
  body { background: #fff !important; color: #000 !important; }

  #asp-invoice-print {
    padding: 16px !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 11px !important;
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  .inv-firm-name { color: #000 !important; }
  .inv-type-label { color: #000 !important; }
  .inv-items-table thead tr { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv-grand-total { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 3 — Clients & CRM Styles
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Client Avatar ────────────────────────────────────────────────────────── */
.client-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold-dim), rgba(37,99,235,0.12));
  border: 2px solid rgba(201,168,76,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--gold);
}
.client-avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.client-avatar-lg { width: 64px; height: 64px; font-size: 22px; border-width: 3px; }

/* ── Client Profile Header ────────────────────────────────────────────────── */
.client-profile-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 28px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.client-profile-header::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--blue), var(--gold));
  opacity: 0.6;
}
.client-profile-meta { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.client-profile-info { flex: 1; min-width: 0; }
.client-profile-name { font-size: 22px; font-weight: 800; color: var(--text-1); line-height: 1.2; }
.client-profile-tags { display: flex; gap: 7px; margin-top: 6px; flex-wrap: wrap; }

/* ── Activity Timeline ────────────────────────────────────────────────────── */
.timeline-wrap { padding: 8px 0; position: relative; }
.timeline-wrap::before {
  content: '';
  position: absolute; left: 14px; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent 0%, var(--border-md) 10%, var(--border-md) 90%, transparent 100%);
}
.timeline-item {
  display: flex; gap: 16px; padding: 10px 4px 10px 0;
  position: relative; min-height: 48px;
}
.timeline-dot {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-elevated);
  border: 2px solid var(--tl-color, var(--border-md));
  box-shadow: 0 0 0 3px var(--bg-card);
  position: relative; z-index: 1; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
}
.timeline-dot::after {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tl-color, var(--text-3));
}
.timeline-body {
  flex: 1; min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
  transition: border-color var(--t);
}
.timeline-body:hover { border-color: var(--border-md); }

/* ── Client Stats Row ────────────────────────────────────────────────────── */
.client-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 768px) {
  .client-stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Client Table Row Hover ──────────────────────────────────────────────── */
.data-table tbody tr.client-row { cursor: pointer; }
.data-table tbody tr.client-row td { transition: background var(--t); }

/* ── Import Zone ─────────────────────────────────────────────────────────── */
.import-step-indicator {
  display: flex; justify-content: center; gap: 0; margin-bottom: 24px;
}
.import-step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 18px;
  font-size: 12px; font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid var(--border);
}
.import-step.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.import-step.done { color: var(--green); border-bottom-color: var(--green); }
.import-step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}

/* ── Client Notes ────────────────────────────────────────────────────────── */
.client-note-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  border-left: 3px solid var(--gold);
  transition: border-color var(--t);
}
.client-note-card:hover { border-color: rgba(201,168,76,0.35); }
.client-note-text { font-size: 13.5px; color: var(--text-1); line-height: 1.7; white-space: pre-wrap; }
.client-note-meta { font-size: 11px; color: var(--text-3); margin-top: 8px; }

/* ── Mini SVG Bar Chart ──────────────────────────────────────────────────── */
.mini-chart-wrap { overflow-x: auto; padding: 4px 0; }

/* ── Client Filter Tabs ──────────────────────────────────────────────────── */
.status-tab-group { display: flex; gap: 2px; background: var(--bg-elevated); padding: 3px; border-radius: var(--r-sm); }
.status-tab {
  padding: 5px 14px; border-radius: calc(var(--r-sm) - 1px); border: none; background: none;
  font-size: 12px; font-weight: 600; color: var(--text-3); cursor: pointer;
  transition: all var(--t); white-space: nowrap;
}
.status-tab:hover { color: var(--text-1); }
.status-tab.on  { background: var(--gold); color: #080808; }

/* ── Code Badge (client code) ────────────────────────────────────────────── */
.client-code-badge {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  color: var(--text-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  padding: 2px 8px; border-radius: 4px;
}

/* ── Info Row (profile details) ──────────────────────────────────────────── */
.info-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; width: 56px; flex-shrink: 0; }
.info-row-value { font-size: 13px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Export / Import buttons group ──────────────────────────────────────── */
.import-export-group { display: flex; gap: 8px; align-items: center; }

/* ── Client profile two-column grid ─────────────────────────────────────── */
.client-profile-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .client-profile-grid { grid-template-columns: 1fr; }
}

/* ── Responsive client table ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .clients-table-hide-md { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 4 — Tasks · Reminders · Automations
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Kanban Board ─────────────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
  min-height: 400px;
}
@media (max-width: 1100px) { .kanban-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .kanban-board { grid-template-columns: 1fr; } }

.kanban-col {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 200px;
}

.kanban-col-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.kanban-col-icon { font-size: 14px; }
.kanban-col-count {
  margin-left: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px; color: var(--text-3);
}

.kanban-col-body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  min-height: 80px;
}

/* ── Task Card ───────────────────────────────────────────────────────────── */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  position: relative;
  overflow: hidden;
}
.task-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--gold), transparent);
  opacity: 0;
  transition: opacity var(--t);
}
.task-card:hover {
  border-color: var(--border-md);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.task-card:hover::before { opacity: 1; }

.task-card-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.task-card-title {
  font-size: 13px; font-weight: 600; color: var(--text-1); line-height: 1.45;
  margin-bottom: 4px;
}
.task-card-footer {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  flex-wrap: wrap; padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Task Detail Thread ──────────────────────────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: 12px; }
.comment-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 13.5px; line-height: 1.7;
  color: var(--text-1);
  white-space: pre-wrap;
}

/* ── Reminder Cards ──────────────────────────────────────────────────────── */
.reminder-item {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  padding: 14px 16px;
  transition: border-color var(--t);
}
.reminder-item:hover { border-color: var(--border-md); }
.reminder-item.due   { border-left-color: var(--red); }
.reminder-item.soon  { border-left-color: var(--amber); }
.reminder-item.done  { opacity: 0.55; }
.reminder-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.reminder-title  { font-weight: 700; font-size: 14px; color: var(--text-1); }
.reminder-message{ font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.6; }
.reminder-meta   { display: flex; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--text-3); flex-wrap: wrap; }

/* ── Automation Rule Card ────────────────────────────────────────────────── */
.automation-rule {
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 16px;
  transition: border-color var(--t), opacity var(--t);
}
.automation-rule.inactive { opacity: 0.6; border-left-color: var(--border-md); }
.automation-flow {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px;
}
.automation-chip {
  padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
}
.automation-chip.trigger { background: rgba(37,99,235,0.12); color: #60a5fa; }
.automation-chip.action  { background: rgba(16,185,129,0.1); color: #34d399; }
.automation-arrow { color: var(--text-3); font-size: 16px; }

/* ── Toggle Switch ───────────────────────────────────────────────────────── */
.asp-toggle-wrap {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.asp-toggle-rail {
  width: 38px; height: 20px; border-radius: 10px;
  position: relative; cursor: pointer; transition: background 0.2s;
  flex-shrink: 0;
}
.asp-toggle-thumb {
  position: absolute; top: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: left 0.2s;
}

/* ── Due / Priority chips ────────────────────────────────────────────────── */
.due-chip {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 700;
}
.pri-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.sts-badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
}

/* ── Task sidebar details ────────────────────────────────────────────────── */
.task-detail-row {
  display: flex; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.task-detail-label { color: var(--text-3); }
.task-detail-value { color: var(--text-1); }

/* ── Automation form trigger/action sections ─────────────────────────────── */
.auto-trigger-section {
  background: rgba(37,99,235,0.07);
  border: 1px solid rgba(37,99,235,0.15);
  border-radius: var(--r); padding: 14px 16px;
}
.auto-action-section {
  background: rgba(16,185,129,0.07);
  border: 1px solid rgba(16,185,129,0.15);
  border-radius: var(--r); padding: 14px 16px;
}
.auto-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── Overdue highlight on task rows ─────────────────────────────────────── */
.task-overdue-row td { background: rgba(239,68,68,0.04) !important; }
.task-overdue-row:hover td { background: rgba(239,68,68,0.08) !important; }

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 5 — File Manager
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Two-pane layout ─────────────────────────────────────────────────────── */
.fm-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  height: calc(100vh - 64px);
  overflow: hidden;
  position: relative;
}

/* ── Left sidebar ────────────────────────────────────────────────────────── */
.fm-sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding: 14px 10px;
}
.fm-sidebar-head { padding: 0 4px 12px; }

.fm-storage-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}
.fm-storage-label {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-3); font-weight: 600;
}

.fm-nav-section { margin-bottom: 16px; }
.fm-nav-section-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0 8px; margin-bottom: 4px;
}

.fm-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  cursor: pointer; border: none; background: transparent; width: 100%;
  text-align: left; transition: all var(--t);
}
.fm-nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.fm-nav-item.active {
  background: var(--gold-dim); color: var(--gold);
  font-weight: 700;
}

.fm-folder-item {
  display: flex; align-items: center; gap: 0;
  padding: 4px 6px;
}
.fm-folder-item > button { padding: 4px 4px 4px 8px; }

/* ── Main content ────────────────────────────────────────────────────────── */
.fm-main {
  display: flex; flex-direction: column;
  overflow: hidden; padding: 0;
}

.fm-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}

.fm-breadcrumb {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; color: var(--text-1);
}

.fm-kpi-row {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.fm-kpi-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; border-right: 1px solid var(--border);
  flex: 1; min-width: 0;
}
.fm-kpi-card:last-child { border-right: none; }

/* ── File grid ───────────────────────────────────────────────────────────── */
.fm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
}

.fm-file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  position: relative;
}
.fm-file-card:hover {
  border-color: var(--border-md);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.fm-file-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.fm-file-thumb {
  height: 110px; position: relative; overflow: hidden;
  background: var(--bg-elevated);
}
.fm-file-type-icon {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}

.fm-version-badge {
  position: absolute; top: 6px; right: 6px;
  background: var(--gold); color: #080808;
  font-size: 9px; font-weight: 800;
  padding: 1px 6px; border-radius: 20px;
}

.fm-checkbox {
  position: absolute; top: 6px; left: 6px;
  opacity: 0; transition: opacity var(--t);
}
.fm-file-card:hover .fm-checkbox,
.fm-file-card.selected .fm-checkbox { opacity: 1; }

.fm-file-info {
  padding: 8px 10px;
}
.fm-file-name {
  font-size: 12px; font-weight: 600; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 3px;
}
.fm-file-meta {
  display: flex; gap: 6px;
  font-size: 10.5px; color: var(--text-3);
}
.fm-file-actions {
  display: flex; gap: 4px; justify-content: flex-end;
  padding: 4px 4px 0; margin-top: 2px;
  opacity: 0; transition: opacity var(--t);
}
.fm-file-card:hover .fm-file-actions { opacity: 1; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.fm-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center;
}

/* ── Detail side panel ───────────────────────────────────────────────────── */
.fm-detail-panel {
  width: 300px; flex-shrink: 0;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  /* Overlays the main area on narrow screens */
}
.fm-detail-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.fm-detail-actions {
  display: flex; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.fm-detail-tabs {
  display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.fm-detail-tab {
  flex: 1; padding: 8px 4px;
  border: none; background: none; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  border-bottom: 2px solid transparent;
  transition: color var(--t), border-color var(--t);
  text-transform: capitalize;
}
.fm-detail-tab.on { color: var(--gold); border-bottom-color: var(--gold); }
.fm-detail-body {
  flex: 1; overflow-y: auto; padding: 14px;
}
.fm-detail-rows { display: flex; flex-direction: column; gap: 0; }
.fm-detail-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.fm-detail-row:last-child { border-bottom: none; }
.fm-detail-label { color: var(--text-3); flex-shrink: 0; margin-right: 8px; }
.fm-detail-val {
  color: var(--text-1); text-align: right;
  overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}

/* ── Upload modal drop zone ──────────────────────────────────────────────── */
.fm-upload-drop {
  border: 2px dashed var(--border-md);
  border-radius: var(--r-lg);
  padding: 28px 20px;
  text-align: center; cursor: pointer;
  transition: border-color var(--t), background var(--t);
  background: var(--bg-elevated);
}
.fm-upload-drop:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
}

/* ── Drag-drop overlay ───────────────────────────────────────────────────── */
.fm-drop-overlay {
  position: absolute; inset: 0;
  background: rgba(8,8,8,0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  border-radius: var(--r-xl);
  border: 3px dashed var(--gold);
}
.fm-drop-inner {
  text-align: center; color: white;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .fm-layout { grid-template-columns: 180px 1fr; }
}
@media (max-width: 768px) {
  .fm-layout { grid-template-columns: 1fr; height: auto; }
  .fm-sidebar { display: none; }
  .fm-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .fm-detail-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); }
}

/* ── List view (file manager in list) — override table padding ───────────── */
.fm-main .table-wrap { overflow-x: auto; flex: 1; }
.fm-main > .card { flex: 1; overflow: hidden; margin: 12px; border-radius: var(--r); }

/* ── File type color badges ──────────────────────────────────────────────── */
.ft-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700;
}

/* ── Version list ────────────────────────────────────────────────────────── */
.fm-version-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
}
.fm-version-row.current { background: var(--gold-dim); border-color: rgba(201,168,76,0.25); }

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 6 — Email & Templates
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Email page tab bar inherits .asp-tabs from Phase 1 ─────────────────── */

/* ── Body Editor ─────────────────────────────────────────────────────────── */
.body-editor-wrap {
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-elevated);
}
.body-editor-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.body-editor-ta {
  display: block; width: 100%;
  padding: 12px 14px;
  border: none; outline: none; resize: vertical;
  background: var(--bg-elevated);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 13px; line-height: 1.7;
  box-sizing: border-box;
  min-height: 200px;
}
.body-editor-ta::placeholder { color: var(--text-3); font-family: var(--font-sans, sans-serif); }

/* ── Variable picker ─────────────────────────────────────────────────────── */
.var-picker-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 300;
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  max-height: 340px; overflow-y: auto;
  padding: 8px;
}
.var-picker-group {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 8px 8px 4px;
}
.var-picker-item {
  display: block; width: 100%;
  text-align: left; border: none; background: none;
  padding: 5px 10px; cursor: pointer;
  font-size: 12px; font-family: var(--font-mono, monospace);
  color: var(--gold); border-radius: var(--r-sm);
  transition: background var(--t);
}
.var-picker-item:hover { background: var(--gold-dim); }

/* ── Template card ───────────────────────────────────────────────────────── */
.email-tpl-card {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  padding: 16px;
  transition: border-color var(--t), box-shadow var(--t);
}
.email-tpl-card:hover { border-color: var(--border-md); box-shadow: var(--shadow-md); }
.email-tpl-cat {
  display: inline-block;
  font-size: 10.5px; font-weight: 700;
  color: var(--text-3); background: var(--bg-card);
  border: 1px solid var(--border-md);
  padding: 2px 9px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.07em;
}

/* ── Email log ───────────────────────────────────────────────────────────── */
.email-preview-frame {
  width: 100%; height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: white;
}
.email-preview-body {
  background: white; color: #222;
  padding: 20px; border-radius: var(--r);
  border: 1px solid var(--border);
  font-family: Arial, sans-serif;
  font-size: 14px; line-height: 1.8;
  max-height: 480px; overflow-y: auto;
}

/* ── Contact list card ───────────────────────────────────────────────────── */
.email-list-card {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue, #2563eb);
  border-radius: var(--r);
  padding: 16px;
  transition: border-color var(--t);
}
.email-list-card:hover { border-color: var(--border-md); }

/* ── Client email picker (inline dropdown in Compose) ────────────────────── */
.client-email-picker {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 300;
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  min-width: 280px; max-height: 260px; overflow-y: auto;
}
.client-email-item {
  padding: 9px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.client-email-item:hover { background: var(--bg-hover); }
.client-email-item:last-child { border-bottom: none; }

/* ── Bulk send result ────────────────────────────────────────────────────── */
.bulk-result-grid {
  display: flex; justify-content: center; gap: 32px;
  padding: 20px 0; text-align: center;
}
.bulk-result-num { font-size: 32px; font-weight: 800; }
.bulk-result-label { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ── SMTP test section ───────────────────────────────────────────────────── */
.smtp-test-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
}

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 7 — Expense Tracking
   ══════════════════════════════════════════════════════════════════════════ */

/* ── KPI Row ─────────────────────────────────────────────────────────────── */
.exp-kpi-row {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.exp-kpi-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 18px;
  flex: 1; min-width: 0;
  transition: border-color var(--t);
}
.exp-kpi-card:hover { border-color: var(--border-md); }

/* ── Category badge ──────────────────────────────────────────────────────── */
.exp-cat-badge {
  display: inline-block;
  padding: 2px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  color: var(--text-2);
}

/* ── Vendor cards ────────────────────────────────────────────────────────── */
.vendor-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  padding: 16px;
  transition: border-color var(--t), box-shadow var(--t);
}
.vendor-card:hover {
  border-color: var(--border-md);
  box-shadow: var(--shadow-md);
}

/* ── Expense calculator card ─────────────────────────────────────────────── */
.exp-calc-card { position: sticky; top: 16px; }

.exp-calc-box {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  padding: 14px;
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.exp-calc-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.exp-calc-row:last-child { border-bottom: none; padding-bottom: 0; }
.exp-calc-total {
  font-size: 15px; font-weight: 800;
  color: var(--gold);
  padding-top: 6px;
  border-top: 2px solid var(--border-md) !important;
  border-bottom: none !important;
}

/* ── Generic dropdown (shared by ClientPicker, VendorPicker) ─────────────── */
.asp-dropdown {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0; z-index: 300;
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  max-height: 220px; overflow-y: auto;
}
.asp-dropdown-item {
  padding: 9px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.asp-dropdown-item:hover  { background: var(--bg-hover); }
.asp-dropdown-item:last-child { border-bottom: none; }

/* ── Bar chart container ─────────────────────────────────────────────────── */
.bar-chart-wrap {
  padding: 8px 0;
  overflow-x: auto;
}

/* ── GST summary table ───────────────────────────────────────────────────── */
.gst-total-row {
  background: var(--gold-dim);
  font-weight: 800;
  border-top: 2px solid var(--border-md);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .exp-kpi-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .exp-kpi-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 8 — Reports & Analytics
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Period bar ──────────────────────────────────────────────────────────── */
.rpt-period-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 18px;
}

/* ── KPI grid ────────────────────────────────────────────────────────────── */
.rpt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.rpt-kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  transition: border-color var(--t);
}
.rpt-kpi-card:hover { border-color: var(--border-md); }
.rpt-kpi-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.rpt-kpi-value {
  font-size: 18px; font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.rpt-kpi-sub {
  font-size: 10px; color: var(--text-3);
  margin-top: 4px;
}

/* ── Report section ──────────────────────────────────────────────────────── */
.rpt-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 14px;
}
.rpt-section-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.rpt-section-title {
  font-size: 13px; font-weight: 700;
  color: var(--text-1);
}
.rpt-section > .table-wrap { padding: 0; }
.rpt-section > .table-wrap .data-table { border-radius: 0; border: none; }

/* ── Row list (P&L breakdown) ────────────────────────────────────────────── */
.rpt-two-col-list {
  padding: 10px 16px;
  display: flex; flex-direction: column; gap: 0;
}
.rpt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-2);
}
.rpt-row:last-child { border-bottom: none; }
.rpt-row-total {
  font-size: 14px; font-weight: 800;
  color: var(--text-1);
  padding-top: 10px; padding-bottom: 4px;
  border-top: 2px solid var(--border-md);
  border-bottom: none;
}

/* ── Empty chart placeholder ─────────────────────────────────────────────── */
.rpt-empty-chart {
  display: flex; align-items: center; justify-content: center;
  height: 120px;
  color: var(--text-3); font-size: 13px;
  background: var(--bg-card);
  border-radius: var(--r);
}

/* ── Aging bucket cards ──────────────────────────────────────────────────── */
.aging-bucket-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.aging-bucket {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  border-top: 3px solid var(--border);
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}
.aging-bucket:hover { box-shadow: var(--shadow-md); }

/* ── GSTR summary box ────────────────────────────────────────────────────── */
.gstr-box {
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: var(--r);
  padding: 16px 20px;
  margin-top: 14px;
}

/* ── Export cards ────────────────────────────────────────────────────────── */
.export-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  transition: border-color var(--t), box-shadow var(--t);
}
.export-card:hover { border-color: var(--border-md); box-shadow: var(--shadow-md); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .rpt-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .aging-bucket-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .rpt-kpi-grid { grid-template-columns: 1fr; }
  .aging-bucket-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 9 — AI Assistant
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Floating chat widget ────────────────────────────────────────────────── */
.ai-chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: var(--font);
}

.ai-chat-toggle {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, #a07830 100%);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(201,168,76,0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ai-chat-toggle:hover  { transform: scale(1.08); box-shadow: 0 6px 28px rgba(201,168,76,0.55); }
.ai-chat-toggle.open   { background: linear-gradient(135deg, #555 0%, #333 100%); box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* ── Chat panel ──────────────────────────────────────────────────────────── */
.ai-chat-panel {
  position: absolute;
  bottom: 68px; right: 0;
  width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: ai-panel-in 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes ai-panel-in {
  from { opacity:0; transform: scale(0.9) translateY(12px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

.ai-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1a1208 0%, #0d0d0d 100%);
  border-bottom: 1px solid rgba(201,168,76,0.2);
  color: #fff;
}
.ai-chat-icon-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.6); font-size: 14px; padding: 2px 6px;
  border-radius: var(--r-sm);
  transition: color 0.15s, background 0.15s;
}
.ai-chat-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 14px; min-height: 280px; max-height: 400px;
  display: flex; flex-direction: column; gap: 10px;
}

.ai-chat-welcome {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 8px; text-align: center;
}

.ai-suggestion-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 6px 10px;
  font-size: 11px; color: var(--text-2); cursor: pointer;
  text-align: left; transition: border-color 0.15s, color 0.15s;
}
.ai-suggestion-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ── Messages ────────────────────────────────────────────────────────────── */
.ai-msg { display: flex; }
.ai-msg-user      { justify-content: flex-end; }
.ai-msg-assistant { justify-content: flex-start; }

.ai-msg-bubble {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px; line-height: 1.55;
}
.ai-msg-user .ai-msg-bubble      { background: var(--gold); color: #1a1208; border-bottom-right-radius: 4px; font-weight: 500; }
.ai-msg-assistant .ai-msg-bubble { background: var(--bg-card); color: var(--text-1); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-msg-error .ai-msg-bubble     { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #f87171; }

.ai-msg-text strong { font-weight: 700; }

/* ── Typing indicator ────────────────────────────────────────────────────── */
.ai-msg-typing {
  display: flex; align-items: center; gap: 4px; padding: 10px 14px;
}
.ai-msg-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); opacity: 0.6;
  animation: ai-bounce 1.2s ease-in-out infinite;
}
.ai-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-msg-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-bounce {
  0%,80%,100% { transform: translateY(0); opacity: 0.4; }
  40%          { transform: translateY(-5px); opacity: 1; }
}

/* ── Chat input ──────────────────────────────────────────────────────────── */
.ai-chat-input-row {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.ai-chat-input {
  flex: 1; resize: none;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r); padding: 8px 10px;
  font-family: var(--font); font-size: 13px; color: var(--text-1);
  outline: none; transition: border-color 0.15s;
  line-height: 1.4;
}
.ai-chat-input:focus { border-color: var(--gold); }
.ai-chat-input::placeholder { color: var(--text-3); }
.ai-chat-send {
  width: 38px; height: 38px; align-self: flex-end;
  background: var(--gold); border: none; border-radius: var(--r);
  color: #1a1208; font-weight: 800; font-size: 16px; cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-chat-send:disabled { opacity: 0.35; cursor: default; transform: none; }
.ai-chat-send:not(:disabled):hover { opacity: 0.88; transform: scale(1.05); }

/* ── AI Page — not configured banner ─────────────────────────────────────── */
.ai-not-configured {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center;
}

/* ── Smart Insights ──────────────────────────────────────────────────────── */
.ai-insights-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px;
}

.ai-insights-grid {
  display: flex; flex-direction: column; gap: 14px;
}

.ai-insights-summary {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(201,168,76,0.08) 0%, rgba(201,168,76,0.03) 100%);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: var(--r-lg);
}

.ai-top-action {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--r);
}

.ai-insights-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}

.ai-insight-card {
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  border-left-width: 3px;
  transition: box-shadow var(--t);
}
.ai-insight-card:hover { box-shadow: var(--shadow-md); }
.ai-insight-card-title {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}

/* ── Inline chat (AI page tab) ───────────────────────────────────────────── */
.ai-inline-chat {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--bg-elevated); overflow: hidden;
  min-height: 500px;
}
.ai-inline-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 380px; max-height: 520px;
}
.ai-inline-msg { display: flex; }
.ai-inline-msg-user      { justify-content: flex-end; }
.ai-inline-msg-assistant { justify-content: flex-start; }
.ai-inline-bubble {
  max-width: 80%; padding: 10px 15px;
  border-radius: 16px; font-size: 13px; line-height: 1.6;
}
.ai-inline-msg-user .ai-inline-bubble      { background: var(--gold); color: #1a1208; font-weight: 500; border-bottom-right-radius: 4px; }
.ai-inline-msg-assistant .ai-inline-bubble { background: var(--bg-card); color: var(--text-1); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

.ai-quick-btn {
  padding: 7px 14px; border-radius: 20px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-2); cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.ai-quick-btn:hover { border-color: var(--gold); color: var(--gold); }

.ai-inline-input-row {
  display: flex; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border); background: var(--bg-card);
}
.ai-inline-input {
  flex: 1; resize: none;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 12px;
  font-family: var(--font); font-size: 13px; color: var(--text-1);
  outline: none; transition: border-color 0.15s;
}
.ai-inline-input:focus { border-color: var(--gold); }
.ai-inline-send {
  padding: 0 20px; background: var(--gold); border: none;
  border-radius: var(--r); color: #1a1208; font-weight: 700;
  font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: opacity 0.15s;
}
.ai-inline-send:disabled { opacity: 0.35; cursor: default; }
.ai-inline-send:not(:disabled):hover { opacity: 0.88; }

/* ── Responsive: hide floating widget on very small screens ──────────────── */
@media (max-width: 480px) {
  .ai-chat-panel { width: calc(100vw - 32px); right: 0; }
  .ai-insights-cards { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 10 — Users & Roles
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Page header (reusable) ──────────────────────────────────────────────── */
.asp-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Users table ─────────────────────────────────────────────────────────── */
.tr-muted td { opacity: 0.5; }

/* ── Role cards grid ─────────────────────────────────────────────────────── */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.role-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  border-top-width: 3px;
  transition: box-shadow var(--t), transform var(--t);
}
.role-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 8px;
}

.role-perm-summary {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-bottom: 4px;
}

/* ── Permission table ────────────────────────────────────────────────────── */
.perm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.perm-table th {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.perm-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.perm-table tr:last-child td { border-bottom: none; }
.perm-table tr:hover td { background: var(--bg-hover); }

/* Checkbox in permission table */
.perm-cb {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}
.perm-cb:disabled { cursor: default; opacity: 0.5; }

/* ── Audit log ───────────────────────────────────────────────────────────── */
.audit-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .roles-grid { grid-template-columns: repeat(2, 1fr); }
  .audit-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .roles-grid { grid-template-columns: 1fr; }
  .audit-kpi-row { grid-template-columns: 1fr 1fr; }
  .asp-page-header { flex-direction: column; }
}
