/* ============================================================
   INVOICEFLOW — App / Dashboard Styles
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary:        #6C8FEF;
  --primary-dark:   #5570CC;
  --primary-light:  #E0E8FD;
  --primary-xlight: #F3F6FE;
  --success:        #34C77B;
  --success-bg:     #E1F9ED;
  --success-text:   #0D6B3E;
  --warning:        #F5A623;
  --warning-bg:     #FEF3C7;
  --warning-text:   #92400E;
  --danger:         #E5503C;
  --danger-bg:      #FDECEB;
  --danger-text:    #8B1A10;
  --info:           #6C8FEF;
  --info-bg:        #E0E8FD;
  --info-text:      #3B5099;
  --purple:         #8B6FE0;
  --purple-bg:      #EFEBFD;
  --purple-text:    #4C3391;
  --muted-bg:       #F0F2F5;
  --muted-text:     #4B5563;
  --sidebar-bg:     #242B3A;
  --sidebar-hover:  #313A4D;
  --sidebar-active: rgba(108,143,239,.2);
  --sidebar-text:   #B8BFD1;
  --sidebar-active-text: #FFFFFF;
  --bg:             #F0F2F7;
  --surface:        #FFFFFF;
  --border:         #DDE3ED;
  --border-light:   #EDF0F5;
  --text-primary:   #1A1F2E;
  --text-secondary: #4B5468;
  --text-muted:     #5C6478;
  --text-faint:     #6B7280;
  --shadow-sm:      0 1px 4px 0 rgba(0,0,0,.03);
  --shadow:         0 2px 10px -2px rgba(0,0,0,.06);
  --shadow-lg:      0 8px 24px -4px rgba(0,0,0,.08);
  --radius-sm:      10px;
  --radius:         14px;
  --radius-lg:      18px;
  --radius-xl:      24px;
  --font:           'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --sidebar-w:      240px;
  --header-h:       64px;
  --ease:           0.18s ease;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
}

/* ─── LAYOUT ─────────────────────────────────────────────────── */

.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ─── SIDEBAR ────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: transform .3s ease;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px; height: 64px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.brand-icon {
  width: 32px; height: 32px; background: var(--primary);
  border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-icon svg { width: 18px; height: 18px; fill: white; }
.brand-name { font-size: 17px; font-weight: 700; color: white; }

.sidebar-section { padding: 20px 12px 8px; }
.sidebar-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #9099AC;
  padding: 0 8px; margin-bottom: 4px;
}
.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--sidebar-text);
  cursor: pointer; transition: all var(--ease);
  user-select: none;
}
.sidebar-nav-item:hover { background: var(--sidebar-hover); color: #CBD5E1; }
.sidebar-nav-item.active {
  background: var(--sidebar-active); color: var(--sidebar-active-text);
  border-right: 2px solid var(--primary);
}
.sidebar-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-badge {
  margin-left: auto; min-width: 20px; height: 20px;
  background: var(--primary); color: white;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 6px;
}

.sidebar-bottom {
  margin-top: auto; padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--ease);
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-avatar {
  width: 34px; height: 34px; background: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(148,163,184,.6); }

/* ─── SIDEBAR USER CHEVRON ───────────────────────────────────── */

.sidebar-user-chevron {
  width: 14px; height: 14px;
  color: rgba(148,163,184,.4);
  margin-left: auto; flex-shrink: 0;
  transition: transform 0.2s, color 0.2s;
}
.sidebar-user.menu-open .sidebar-user-chevron {
  transform: rotate(180deg);
  color: rgba(148,163,184,.8);
}

/* ─── SIDEBAR USER MENU (account popup) ─────────────────────── */

.sidebar-bottom { position: relative; }

.sidebar-user-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px; right: 12px;
  background: #1E293B;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 -8px 32px rgba(0,0,0,.45);
  animation: sum-in .15s ease;
  z-index: 10;
}
.sidebar-user-menu.open { display: block; }
@keyframes sum-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sum-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 12px;
}
.sum-avatar {
  width: 36px; height: 36px; background: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}
.sum-header-info { min-width: 0; }
.sum-name { font-size: 13px; font-weight: 600; color: #F1F5F9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-email { font-size: 11px; color: rgba(148,163,184,.7); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sum-divider { height: 1px; background: rgba(255,255,255,.08); margin: 4px 0; }

.sum-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  background: none; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: rgba(148,163,184,.9);
  cursor: pointer; text-align: left; font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.sum-item:hover { background: rgba(255,255,255,.07); color: white; }
.sum-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sum-item-danger:hover { background: rgba(239,68,68,.15); color: #F87171; }

/* ─── MAIN ───────────────────────────────────────────────────── */

.main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ─── TOP HEADER ─────────────────────────────────────────────── */

.app-header {
  height: var(--header-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.header-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px;
  transition: border-color var(--ease);
  position: relative;
}
.header-search:focus-within { border-color: var(--primary); }
.header-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.header-search input {
  background: none; border: none; outline: none;
  font-size: 13px; color: var(--text-primary); width: 200px; font-family: var(--font);
}
.header-search input::placeholder { color: var(--text-faint); }

/* Global search dropdown */
.global-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  min-width: 360px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
  z-index: 999;
  max-height: 400px;
  overflow-y: auto;
}
.global-search-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .12s;
}
.global-search-item:hover { background: var(--bg); }
.global-search-icon { font-size: 18px; flex-shrink: 0; }
.global-search-info { flex: 1; min-width: 0; }
.global-search-label { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-search-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-search-type { font-size: 10px; font-weight: 600; color: var(--primary); background: rgba(79,124,255,.1); padding: 2px 8px; border-radius: 20px; flex-shrink: 0; }
.global-search-empty { padding: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }

.header-icon-btn {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); background: none; border: 1.5px solid var(--border);
  cursor: pointer; color: var(--text-muted); transition: all var(--ease);
  position: relative;
}
.header-icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }
.header-icon-btn svg { width: 18px; height: 18px; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: var(--danger);
  border-radius: 50%; border: 2px solid var(--surface);
}

/* ─── SIDEBAR HAMBURGER BUTTON ─────────────────────────────── */

.sidebar-menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: none; border: 1.5px solid var(--border);
  cursor: pointer; color: var(--text-primary); flex-shrink: 0;
  transition: all var(--ease);
}
.sidebar-menu-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.sidebar-menu-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* ─── SIDEBAR BACKDROP (mobile overlay) ─────────────────────── */

.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 199;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sidebar-backdrop.show { display: block; }

/* ─── CONTENT AREA ───────────────────────────────────────────── */

.content-area {
  flex: 1; overflow-y: auto; padding: 28px; min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

/* ─── VIEWS ──────────────────────────────────────────────────── */

.view { display: none; }
.view.active { display: block; }

/* ─── PAGE HEADER ────────────────────────────────────────────── */

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 800; color: var(--text-primary); letter-spacing: -.02em; }
.page-desc { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ─── BUTTONS ────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: var(--font);
  cursor: pointer; text-decoration: none; border: none;
  transition: all var(--ease); white-space: nowrap; line-height: 1;
}
.btn-sm { padding: 6px 12px; font-size: 12px; gap: 5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon-only { padding: 9px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-sm svg { width: 14px; height: 14px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(108,143,239,.35); transform: translateY(-1px); }

.btn-secondary { background: var(--surface); color: var(--text-secondary); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }

.btn-ghost-danger { background: none; color: var(--danger); border: 1.5px solid var(--danger-bg); }
.btn-ghost-danger:hover { background: var(--danger-bg); border-color: var(--danger); }

/* ─── CARDS ──────────────────────────────────────────────────── */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ─── KPI CARDS ──────────────────────────────────────────────── */

.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; margin-bottom: 28px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: all var(--ease);
}
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kpi-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
}
.kpi-card.blue::before   { background: var(--primary); }
.kpi-card.green::before  { background: var(--success); }
.kpi-card.orange::before { background: var(--warning); }
.kpi-card.red::before    { background: var(--danger); }
.kpi-card.purple::before { background: var(--purple); }

.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.kpi-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon.blue   { background: var(--primary-light); color: var(--primary); }
.kpi-icon.green  { background: var(--success-bg);    color: var(--success); }
.kpi-icon.orange { background: var(--warning-bg);    color: var(--warning); }
.kpi-icon.red    { background: var(--danger-bg);     color: var(--danger); }
.kpi-icon.purple { background: var(--purple-bg);     color: var(--purple); }
.kpi-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.kpi-label { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text-primary); letter-spacing: -.02em; line-height: 1; }
.kpi-change {
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 4px; margin-top: 8px;
}
.kpi-change.up   { color: var(--success); }
.kpi-change.down { color: var(--danger); }
.kpi-change.neutral { color: var(--text-muted); }
.kpi-change svg { width: 14px; height: 14px; }

/* ─── DASHBOARD GRID ─────────────────────────────────────────── */

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 28px; }
.dash-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }

.chart-wrap { position: relative; height: 240px; }
canvas { max-width: 100%; }

/* ─── TABLES ─────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
.app-table { width: 100%; border-collapse: collapse; }
.app-table thead th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
  background: var(--bg); border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.app-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--ease);
}
.app-table tbody tr:last-child { border-bottom: none; }
.app-table tbody tr:hover { background: var(--bg); }
.app-table td {
  padding: 13px 16px; font-size: 14px;
  color: var(--text-secondary); vertical-align: middle;
}
.app-table td.bold { font-weight: 600; color: var(--text-primary); }
.bold { font-weight: 600; color: var(--text-primary); }
.app-table-actions { display: flex; gap: 6px; align-items: center; }

/* Customer avatar in table */
.cust-cell { display: flex; align-items: center; gap: 11px; }
.cust-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}

/* ─── BADGES ─────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.badge svg { width: 8px; height: 8px; fill: currentColor; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-paid     { background: var(--success-bg); color: var(--success-text); }
.badge-sent     { background: var(--info-bg);    color: var(--info-text); }
.badge-draft    { background: var(--muted-bg);   color: var(--muted-text); }
.badge-overdue  { background: var(--danger-bg);  color: var(--danger-text); }
.badge-pending  { background: var(--warning-bg); color: var(--warning-text); }
.badge-viewed   { background: var(--purple-bg);  color: var(--purple-text); }
.badge-cancelled{ background: var(--muted-bg);   color: var(--muted-text); }
.badge-recurring{ background: var(--primary-light); color: #1E40AF; }
.badge-onetime  { background: var(--muted-bg);   color: var(--muted-text); }
.badge-scheduled{ background: var(--purple-bg);  color: var(--purple-text); }

/* ─── SEARCH & FILTER BAR ────────────────────────────────────── */

.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 14px;
  transition: border-color var(--ease); flex: 1; min-width: 200px;
}
.search-input:focus-within { border-color: var(--primary); }
.search-input svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-input input {
  background: none; border: none; outline: none;
  font-size: 14px; color: var(--text-primary); width: 100%; font-family: var(--font);
}
.search-input input::placeholder { color: var(--text-faint); }
.filter-select {
  padding: 9px 14px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-secondary); font-family: var(--font);
  cursor: pointer; transition: border-color var(--ease); outline: none;
}
.filter-select:focus { border-color: var(--primary); }

/* ─── TABS ───────────────────────────────────────────────────── */

.tab-bar {
  display: flex; gap: 4px; margin-bottom: 24px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 4px;
  border: 1.5px solid var(--border); width: fit-content;
}
.tab {
  padding: 8px 18px; font-size: 14px; font-weight: 500; cursor: pointer;
  border-radius: 6px; color: var(--text-muted); border: none; background: none;
  transition: all var(--ease); font-family: var(--font);
}
.tab.active { background: var(--primary); color: white; font-weight: 600; }
.tab:not(.active):hover { color: var(--text-primary); background: var(--surface); }

/* ─── MODALS ─────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  z-index: 500; display: none; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  width: 100%; max-width: 600px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  animation: modal-in .2s ease;
}
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 960px; }
@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px; border-bottom: 1.5px solid var(--border); flex-shrink: 0;
}
.modal-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: none; background: var(--bg); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-muted); transition: all var(--ease);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 28px; overflow-y: auto; flex: 1; }
.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
.modal-footer {
  padding: 20px 28px; border-top: 1.5px solid var(--border);
  display: flex; justify-content: flex-end; gap: 12px; flex-shrink: 0;
}

/* ─── FORMS ──────────────────────────────────────────────────── */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.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: 13px; font-weight: 600; color: var(--text-secondary); }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  padding: 10px 14px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary); font-family: var(--font);
  transition: border-color var(--ease), box-shadow var(--ease);
  outline: none; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,143,239,.12);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-faint); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-divider { grid-column: 1/-1; height: 1px; background: var(--border); margin: 4px 0; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toggle-info .toggle-label-main { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.toggle-info .toggle-label-sub { font-size: 12px; color: var(--text-muted); }
.toggle {
  position: relative; width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 24px; cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; background: white;
  border-radius: 50%; top: 3px; left: 3px;
  transition: transform .2s; box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── INVOICE BUILDER ────────────────────────────────────────── */

.invoice-line-items { border: 1.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin: 16px 0; }
.line-items-header {
  display: grid; grid-template-columns: 3fr 1fr 1.2fr 1fr 40px;
  padding: 10px 16px; background: var(--bg);
  border-bottom: 1.5px solid var(--border); gap: 8px;
}
.line-items-header span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.line-item-row {
  display: grid; grid-template-columns: 3fr 1fr 1.2fr 1fr 40px;
  padding: 10px 12px; gap: 8px; align-items: center;
  border-bottom: 1px solid var(--border-light);
}
.line-item-row:last-child { border-bottom: none; }
.line-item-row input, .line-item-row select {
  padding: 7px 10px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-family: var(--font);
  color: var(--text-primary); outline: none; transition: border-color var(--ease); width: 100%;
}
.line-item-row input:focus, .line-item-row select:focus { border-color: var(--primary); }
.line-item-total { font-size: 14px; font-weight: 600; color: var(--text-primary); text-align: right; }
.line-item-del {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer; color: var(--text-faint);
  border-radius: var(--radius-sm); transition: all var(--ease);
}
.line-item-del:hover { background: var(--danger-bg); color: var(--danger); }
.line-item-del svg { width: 16px; height: 16px; }
.add-line-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  color: var(--primary); cursor: pointer; border: none;
  background: var(--primary-xlight); width: 100%;
  transition: background var(--ease); border-top: 1.5px solid var(--primary-light);
}
.add-line-btn:hover { background: var(--primary-light); }
.add-line-btn svg { width: 16px; height: 16px; }

.invoice-totals { margin-top: 12px; display: flex; justify-content: flex-end; }
.totals-table { width: 280px; display: flex; flex-direction: column; gap: 8px; }
.totals-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-secondary); }
.totals-row.total { font-size: 18px; font-weight: 800; color: var(--text-primary); border-top: 2px solid var(--border); padding-top: 10px; margin-top: 4px; }

/* ─── ACTIVITY & QUICK LISTS ──────────────────────────────────── */

.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.activity-icon svg { width: 16px; height: 16px; }
.activity-text { flex: 1; }
.activity-text strong { font-weight: 600; color: var(--text-primary); }
.activity-desc { font-size: 13px; color: var(--text-secondary); }
.activity-time { font-size: 12px; color: var(--text-muted); }

/* Quick customer list */
.customer-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.customer-list-item:last-child { border-bottom: none; }
.cli-info { flex: 1; min-width: 0; }
.cli-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.cli-email { font-size: 12px; color: var(--text-muted); }
.cli-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ─── EMPTY STATE ────────────────────────────────────────────── */

.empty-state {
  text-align: center; padding: 60px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-icon {
  width: 72px; height: 72px; background: var(--bg); border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.empty-icon svg { width: 36px; height: 36px; color: var(--text-faint); stroke: currentColor; fill: none; stroke-width: 1.5; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.empty-desc { font-size: 14px; color: var(--text-muted); max-width: 340px; line-height: 1.7; }

/* ─── SETTINGS ───────────────────────────────────────────────── */

.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav-item {
  padding: 10px 14px; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--ease); display: flex; align-items: center; gap: 9px;
}
.settings-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.settings-nav-item:hover { background: var(--bg); color: var(--text-primary); }
.settings-nav-item.active { background: var(--primary-xlight); color: var(--primary); font-weight: 600; }

.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 24px; }
.settings-card-header { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.settings-card-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.settings-card-desc { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.settings-card-body { padding: 24px; }
.settings-card-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; background: var(--bg); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Logo upload */
.logo-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 32px; text-align: center; cursor: pointer;
  transition: all var(--ease); position: relative;
}
.logo-upload-area:hover, .logo-upload-area.drag-over { border-color: var(--primary); background: var(--primary-xlight); }
.logo-upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon { width: 48px; height: 48px; background: var(--bg); border-radius: var(--radius); margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; }
.upload-icon svg { width: 24px; height: 24px; color: var(--text-muted); }
.upload-text { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--text-muted); }
.logo-preview { max-height: 80px; max-width: 200px; object-fit: contain; }

/* ─── AUTOMATIONS ────────────────────────────────────────────── */

.automation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.automation-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  transition: all var(--ease);
}
.automation-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.auto-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.auto-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.auto-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.auto-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.auto-desc { font-size: 13px; color: var(--text-muted); line-height: 1.65; }
.auto-details { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.auto-row { display: flex; align-items: center; gap: 10px; }
.auto-row-label { font-size: 12px; color: var(--text-muted); width: 100px; flex-shrink: 0; }
.auto-row-val { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.auto-row select {
  padding: 5px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; font-family: var(--font); color: var(--text-secondary);
  background: var(--surface); cursor: pointer; outline: none;
}

/* ─── REPORTS ────────────────────────────────────────────────── */

.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chart-container { position: relative; height: 260px; }

/* ─── TEMPLATES ──────────────────────────────────────────────── */

.templates-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.template-card {
  border: 2px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; cursor: pointer; transition: all var(--ease);
}
.template-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.template-card.selected { border-color: var(--primary); }
.template-preview { height: 180px; position: relative; overflow: hidden; }
.template-footer { padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
.template-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.template-selected { display: none; }
.template-card.selected .template-selected { display: inline-flex; }

/* Invoice mini preview inside template card */
.inv-preview {
  background: white; padding: 14px; height: 100%; font-size: 9px; color: #444;
  display: flex; flex-direction: column; gap: 6px;
}
.inv-prev-header { display: flex; justify-content: space-between; align-items: flex-start; }
.inv-prev-logo { width: 28px; height: 16px; border-radius: 2px; }
.inv-prev-meta { text-align: right; }
.inv-prev-company { font-weight: 700; font-size: 10px; }
.inv-prev-divider { height: 1px; background: #e2e8f0; }
.inv-prev-to { font-size: 8px; color: #888; }
.inv-prev-items { flex: 1; }
.inv-prev-row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid #f1f5f9; }
.inv-prev-total { font-weight: 700; font-size: 10px; text-align: right; }

/* ─── INVOICE PREVIEW (full) ─────────────────────────────────── */

.invoice-preview-paper {
  background: white; border-radius: var(--radius-lg);
  padding: 48px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); max-width: 720px; margin: 0 auto;
  font-size: 14px; color: #374151;
}
.inv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; }
.inv-logo { max-height: 60px; max-width: 160px; }
.inv-logo-placeholder { width: 120px; height: 50px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-size: 16px; font-weight: 700; }
.inv-title { text-align: right; }
.inv-title h2 { font-size: 32px; font-weight: 800; color: var(--text-primary); letter-spacing: -.02em; }
.inv-title .inv-num { font-size: 14px; color: var(--text-muted); }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.inv-from label, .inv-to label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); display: block; margin-bottom: 8px; }
.inv-party-name { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.inv-party-detail { font-size: 13px; color: var(--text-muted); line-height: 1.65; }
.inv-meta-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-bottom: 32px; background: var(--bg); border-radius: var(--radius); padding: 18px; }
.inv-meta-item label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); display: block; margin-bottom: 4px; }
.inv-meta-item span { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.inv-items-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.inv-items-table thead th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); border-bottom: 2px solid var(--border); }
.inv-items-table thead th:last-child { text-align: right; }
.inv-items-table tbody td { padding: 12px 12px; font-size: 14px; border-bottom: 1px solid var(--border-light); }
.inv-items-table tbody td:last-child { text-align: right; font-weight: 600; }
.inv-totals-section { display: flex; justify-content: flex-end; margin-bottom: 32px; }
.inv-totals-box { width: 280px; }
.inv-total-row { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; color: var(--text-secondary); border-bottom: 1px solid var(--border-light); }
.inv-total-row:last-child { font-size: 18px; font-weight: 800; color: var(--text-primary); border-bottom: none; border-top: 2px solid var(--border); padding-top: 12px; margin-top: 4px; }
.inv-footer { border-top: 1px solid var(--border); padding-top: 20px; }
.inv-footer p { font-size: 12px; color: var(--text-muted); line-height: 1.75; }
.inv-footer strong { color: var(--text-secondary); }

/* ─── TOAST NOTIFICATIONS ────────────────────────────────────── */

.toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--text-primary); color: white;
  padding: 14px 18px; border-radius: var(--radius); min-width: 280px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  animation: toast-in .25s ease;
}
.toast.fade-out { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast-text { font-size: 14px; font-weight: 500; flex: 1; }
.toast.success { background: #065F46; }
.toast.error   { background: #991B1B; }
.toast.info    { background: var(--primary-dark); }

/* ─── MISC ───────────────────────────────────────────────────── */

.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 12px; }
.text-right { text-align: right; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.items-center { align-items: center; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* Scrollbar for content */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
/* ─── ROW CLICKABLE ─────────────────────────────────────────── */

.app-table tbody tr.row-clickable { cursor: pointer; }
.app-table tbody tr.row-clickable:hover { background: var(--primary-xlight); }

/* ─── CUSTOMER DETAIL MODAL ───────────────────────────────── */

.cust-detail-hero {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 20px; border-bottom: 1.5px solid var(--border); margin-bottom: 20px;
}
.cust-detail-avatar {
  width: 56px !important; height: 56px !important;
  font-size: 18px !important; flex-shrink: 0;
}
.cust-detail-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 20px;
}
.cust-detail-stat {
  background: var(--bg); border-radius: var(--radius);
  padding: 14px 16px; text-align: center;
}
.cust-detail-stat-val { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.cust-detail-stat-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: 2px; }

.cust-detail-fields {
  display: flex; flex-direction: column; gap: 0;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px;
}
.cust-detail-field {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--border-light);
}
.cust-detail-field:last-child { border-bottom: none; }
.cust-detail-field-lbl {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); min-width: 72px; padding-top: 1px;
}
.cust-detail-field-val { font-size: 14px; color: var(--text-secondary); flex: 1; word-break: break-word; }
a.cust-detail-field-val { color: var(--primary); text-decoration: none; }
a.cust-detail-field-val:hover { text-decoration: underline; }

.cust-detail-inv-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-bottom: 1px solid var(--border-light);
  cursor: pointer; transition: background var(--ease);
  border-radius: var(--radius-sm);
}
.cust-detail-inv-row:last-child { border-bottom: none; }
.cust-detail-inv-row:hover { background: var(--primary-xlight); }

.cust-detail-invs-section {
  border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
/* ─── RESPONSIVE ─────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .automation-grid { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .templates-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }

  /* Sidebar slides in as an overlay */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 280px; transform: translateX(-105%);
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,.3);
  }

  /* Show hamburger, hide search bar */
  .sidebar-menu-btn { display: flex; }
  .header-search { display: none; }

  .main-wrap { width: 100%; }
  .app-header { padding: 0 16px; }
  .header-right { gap: 8px; }

  /* Hide the 'Back to Site' link on mobile to save space */
  .header-right a.btn-secondary { display: none; }

  .settings-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .line-items-header, .line-item-row { grid-template-columns: 2fr 1fr 1fr 40px; }
  .line-items-header span:nth-child(3), .line-item-row > *:nth-child(3) { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }

  /* Tables: no horizontal scroll needed — card layout handles it */
  .table-wrap { overflow-x: hidden; }
  .app-table { min-width: 0; width: 100%; }

  /* Dashbord grids: single column */
  .dash-grid { grid-template-columns: 1fr; }

  /* ─── Mobile table → stacked card list ────────────── */
  .app-table thead { display: none; }
  .app-table, .app-table tbody, .app-table tbody tr, .app-table tbody td { display: block; width: 100%; }
  .app-table tbody tr {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }
  .app-table tbody tr.row-clickable:active { background: var(--primary-xlight); }
  .app-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    gap: 12px;
    color: var(--text-secondary);
  }
  .app-table tbody td:last-child { border-bottom: none; }
  /* Label on the left using data-label attribute */
  .app-table tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); flex-shrink: 0; min-width: 72px;
  }
  /* Customer name cell spans full width (no label) */
  .app-table tbody td[data-label=""] { padding: 12px 14px; }
  .app-table tbody td[data-label=""]::before { display: none; }
  /* Hide desktop-only actions column — actions live in detail modal */
  .app-table tbody td.td-actions { display: none; }
  /* Empty-state colspan td */
  .app-table tbody td[colspan] { display: block; border: none; }
}

@media (max-width: 540px) {
  .content-area { padding: 12px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .templates-grid { grid-template-columns: 1fr; }
  .header-title { font-size: 17px; }
  .header-subtitle { display: none; }

  /* Modals slide up from bottom on small phones */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    margin: 0; border-radius: 20px 20px 0 0;
    max-height: 92vh; overflow-y: auto;
  }
  /* Keep large modals in place */
  .modal.modal-xl, .modal.modal-lg { border-radius: 20px 20px 0 0; }

  /* Quick invoice button: icon only on tiny screens */
  #quick-invoice-btn span { display: none; }

  /* Invoice preview paper: reduce padding on phone */
  .invoice-preview-paper { padding: 20px 14px; }
  .modal-body { padding: 12px; }
  .modal-header { padding: 16px 16px; }
  .modal-footer { padding: 14px 16px; }
  .inv-title h2 { font-size: 22px; }
  .inv-parties { grid-template-columns: 1fr; gap: 16px; }
  .inv-meta-row { grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  .inv-totals-box { width: 100%; }
}

/* ──────────────────────────────────────────────────────────
   AUTH SCREEN OVERLAY
   ────────────────────────────────────────────────────────── */

.auth-screen {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 40px;
}

.auth-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  padding: 36px 32px;
  margin: auto;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.auth-logo svg {
  width: 28px;
  height: 28px;
  fill: var(--primary);
}

.auth-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.auth-form .form-group { margin-bottom: 14px; }
.auth-form .form-label { font-size: 13px; font-weight: 600; margin-bottom: 5px; display: block; color: var(--text-secondary); }
.auth-form .required { color: var(--danger); }

.auth-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.auth-google-btn:hover {
  background: var(--hover-bg, #f1f5f9);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-links {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.auth-links a,
.auth-link-btn {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}

.auth-links a:hover { text-decoration: underline; }

/* Plan selection in signup */
.auth-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 8px;
}

.auth-plan-option { cursor: pointer; }
.auth-plan-option input { display: none; }

.auth-plan-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  transition: all 0.15s;
  position: relative;
}

.auth-plan-option input:checked + .auth-plan-card {
  border-color: var(--primary);
  background: var(--primary-xlight, #eff6ff);
}

.auth-plan-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-plan-price {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-plan-badge {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.auth-trial-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 16px;
}

@media (max-width: 540px) {
  .auth-card { padding: 24px 18px; border-radius: 16px; }
  .auth-plans { grid-template-columns: 1fr; gap: 8px; }
}

/* ──────────────────────────────────────────────────────────
   TRIAL GATE OVERLAY
   ────────────────────────────────────────────────────────── */

.trial-gate {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 40px;
}

.trial-gate-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  margin: auto;
}

.trial-gate-header {
  padding: 28px 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.trial-gate-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  flex-shrink: 0;
}

.trial-gate-logo svg {
  width: 26px;
  height: 26px;
  fill: var(--primary);
}

.trial-steps-bar {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  justify-content: flex-end;
  max-width: 200px;
}

.trial-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.trial-step-dot.active {
  background: var(--primary);
  color: #fff;
}

.trial-step-dot.done {
  background: var(--success);
  color: #fff;
}

.trial-step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 12px;
  max-width: 40px;
}

.trial-step-content {
  display: none;
  padding: 28px 32px;
}

.trial-step-content.active {
  display: block;
}

.trial-step-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.trial-step-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.65;
}

.trial-step-desc strong {
  color: var(--text-primary);
}

/* Plan cards */
.trial-plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.trial-plan-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
  text-align: center;
}

.trial-plan-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.14);
}

.trial-plan-card.selected {
  border-color: var(--primary);
  background: #EFF6FF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.trial-plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 8px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.trial-plan-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.trial-plan-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.trial-plan-period {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.trial-plan-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

.trial-plan-discount {
  font-size: 16px;
  font-weight: 700;
  color: #10B981;
  margin-top: 2px;
}

.trial-plan-old-price {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  margin-right: 4px;
}

.trial-plan-discount-badge {
  display: inline-block;
  background: #10B981;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 6px;
  letter-spacing: 0.3px;
}

.trial-plan-card.selected .trial-plan-discount-badge {
  background: #fff;
  color: var(--primary);
}

/* Payment step extras */
.payment-security-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #166534;
  font-weight: 500;
  margin-bottom: 20px;
}

.payment-security-badge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.card-brand-logos {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.card-brand-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  height: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-brand-chip svg {
  width: 48px;
  height: 28px;
  display: block;
}

/* Subscription upsell card */
.sub-upsell {
  margin-top: 24px;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 60%, #4338CA 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.sub-upsell-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.sub-upsell-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sub-upsell-icon svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
}

.sub-upsell-text {
  flex: 1;
  min-width: 0;
}

.sub-upsell-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.sub-upsell-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.sub-upsell-perk {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   EXTENDED FEATURES — Expenses, Products, Quotes, Banking, AI
   ═══════════════════════════════════════════════════════════════ */

/* ─── KPI grid variants ─── */

.kpi-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 24px; }
.kpi-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }

@media (max-width: 900px) {
  .kpi-grid-3,
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kpi-grid-3,
  .kpi-grid-4 { grid-template-columns: 1fr; }
}

/* ─── Badge colour extensions ─── */

.badge-blue       { background: var(--info-bg, #EFF6FF); color: var(--info-text, #1E40AF); }
.badge-purple     { background: #F5F3FF; color: #5B21B6; }
.badge-orange     { background: var(--warning-bg, #FFF7ED); color: var(--warning-text, #C2410C); }
.badge-green      { background: var(--success-bg, #F0FDF4); color: var(--success-text, #15803D); }
.badge-red        { background: var(--danger-bg, #FEF2F2); color: var(--danger-text, #B91C1C); }

/* ─── AI Assistant Layout ─── */

.ai-assistant-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  height: calc(100vh - 220px);
  min-height: 500px;
}

.ai-chat-container {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.ai-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-chat-header-left .ai-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-header-left .ai-icon svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
}

.ai-chat-header-left .ai-label strong { font-size: 14px; }
.ai-chat-header-left .ai-label span  { font-size: 12px; color: var(--success); }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message rows */
.ai-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fadeSlideUp 0.3s ease;
}

.ai-msg-bot { justify-content: flex-start; }
.ai-msg-user { justify-content: flex-end; }

.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #F1F5F9;
}

.ai-msg-avatar svg { width: 18px; height: 18px; stroke: var(--primary); }

.ai-msg-user .ai-msg-avatar {
  order: 1;
  background: var(--primary);
  color: #fff;
}

.ai-msg-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.ai-msg-bot .ai-msg-bubble {
  background: #F1F5F9;
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.ai-msg-user .ai-msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-msg-bubble p    { margin: 0 0 8px; }
.ai-msg-bubble p:last-child { margin-bottom: 0; }
.ai-msg-bubble table { width: 100%; border-collapse: collapse; }
.ai-msg-bubble th,
.ai-msg-bubble td   { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border-light); }
.ai-msg-bubble ul   { margin: 6px 0 6px 16px; padding: 0; }
.ai-msg-bubble li   { margin: 4px 0; }

/* Chat input area */
.ai-chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-suggest-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-suggest-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-xlight);
}

.ai-input-row {
  display: flex;
  gap: 8px;
}

.ai-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.ai-input:focus { border-color: var(--primary); }

/* AI Sidebar panel */
.ai-sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ai-sidebar-panel .card { margin: 0; }

.ai-sidebar-panel .card-header { padding: 14px 18px; }

.ai-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
}

.ai-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.ai-action-btn:hover {
  border-color: var(--primary);
  background: var(--primary-xlight);
}

.ai-action-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary);
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .ai-assistant-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .ai-sidebar-panel { order: -1; }
}

/* ─── Receipt Upload Zone ─── */

.receipt-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg);
}

.receipt-upload-zone:hover {
  border-color: var(--primary);
  background: var(--primary-xlight);
}

.receipt-upload-zone svg {
  width: 40px;
  height: 40px;
  stroke: var(--text-faint);
  margin-bottom: 12px;
}

.receipt-upload-zone p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.receipt-upload-zone span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   FEATURES 2 — Bills, Inventory, Leads, Appointments,
   Notes & Tasks, Budgeting, Report Builder, Tax Hub,
   Cloud & Backup, Bank Connect
   ═══════════════════════════════════════════════════════════════ */

/* ── KPI Grid Variants ─────────────────────────────────────── */
.kpi-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card.red   { border-left: 4px solid #ef4444; }
.kpi-card.purple{ border-left: 4px solid #8b5cf6; }

/* ── Lead Pipeline Board ───────────────────────────────────── */
.pipeline-board {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px;
}
.pipeline-column {
  min-width: 200px; flex: 1; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column;
}
.pipeline-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1.5px solid var(--border);
  font-weight: 600; font-size: 13px;
}
.pipeline-count {
  background: var(--primary); color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700;
}
.pipeline-value {
  padding: 4px 14px; font-size: 12px; color: var(--primary); font-weight: 600;
}
.pipeline-cards { padding: 8px; min-height: 60px; flex: 1; }

.lead-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
  cursor: grab; transition: box-shadow .15s;
}
.lead-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.lead-card-name { font-weight: 600; font-size: 13px; }
.lead-card-company { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lead-card-value { font-size: 12px; color: var(--primary); font-weight: 600; margin-top: 4px; }
.lead-card-actions { display: flex; gap: 4px; margin-top: 6px; }

/* ── Mini Calendar ─────────────────────────────────────────── */
.mini-calendar {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 0;
}
.cal-header { text-align: center; margin-bottom: 12px; font-size: 15px; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center;
}
.cal-day-name {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  padding: 4px 0;
}
.cal-cell {
  font-size: 13px; padding: 6px 0; border-radius: 6px;
  cursor: default; position: relative;
}
.cal-cell.empty { visibility: hidden; }
.cal-cell.today {
  background: var(--primary); color: #fff; font-weight: 700; border-radius: 50%;
}
.cal-cell.has-event::after {
  content: ''; position: absolute; bottom: 2px; left: 50%;
  transform: translateX(-50%); width: 5px; height: 5px;
  border-radius: 50%; background: var(--primary);
}
.cal-cell.today.has-event::after { background: #fff; }

/* ── Task List ─────────────────────────────────────────────── */
.task-list { padding: 8px 0; max-height: 500px; overflow-y: auto; }
.task-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.task-item:hover { background: var(--bg); }
.task-item.completed .task-title {
  text-decoration: line-through; opacity: .5;
}
.task-check { padding-top: 2px; }
.task-check input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer;
}
.task-content { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 13px; }
.task-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.task-actions { display: flex; gap: 4px; }

/* ── Notes List ────────────────────────────────────────────── */
.notes-list { padding: 12px; display: grid; gap: 10px; max-height: 500px; overflow-y: auto; }
.note-card {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
}
.note-card-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.note-card-title { font-weight: 600; font-size: 13px; }
.note-card-date { font-size: 11px; color: var(--text-muted); }
.note-card-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.note-card-footer {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--border);
}

/* ── Budget Grid ───────────────────────────────────────────── */
.budget-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
.budget-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.budget-card-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.budget-cat-name { font-weight: 600; font-size: 14px; text-transform: capitalize; }
.budget-amounts {
  display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px;
}
.budget-bar-track {
  width: 100%; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden;
}
.budget-bar-fill {
  height: 100%; background: var(--primary); border-radius: 4px;
  transition: width .3s ease;
}
.budget-bar-fill.over { background: #ef4444; }

/* ── Compliance Items ──────────────────────────────────────── */
.compliance-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg); border-radius: 6px;
  font-size: 13px;
}
.compliance-check { color: #22c55e; font-weight: 700; }

/* ── Bank Connect ──────────────────────────────────────────── */
.bank-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px;
}
.bank-connect-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-family: var(--font);
  font-size: 13px; font-weight: 500; transition: all .15s;
}
.bank-connect-btn:hover:not([disabled]) {
  border-color: var(--primary); background: var(--card);
  box-shadow: 0 2px 8px rgba(108,143,239,.12);
}
.bank-connect-btn[disabled] { opacity: .55; cursor: default; }
.bank-connect-btn.connected { border-color: var(--success); background: rgba(16,185,129,.04); }

.bank-logo {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.bank-logo img {
  display: block; width: 100%; height: 100%;
  object-fit: contain; border-radius: 6px;
}
.bank-logo-fallback {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
}

.bank-account-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); transition: border-color .15s;
}
.bank-account-card:hover { border-color: var(--primary-light); }

.bank-account-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.bank-account-icon img {
  display: block; width: 100%; height: 100%;
  object-fit: contain; border-radius: 8px;
}

.bank-account-info { flex: 1; min-width: 0; }
.bank-account-name { font-weight: 600; font-size: 14px; }
.bank-account-number { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.bank-account-balance { text-align: right; }
.bank-balance-label { font-size: 11px; color: var(--text-muted); }
.bank-balance-value { font-weight: 700; font-size: 16px; color: var(--primary); }
.bank-account-status { text-align: center; min-width: 80px; }

/* ── Text Utilities ────────────────────────────────────────── */
.text-danger { color: #ef4444; }
.text-center { text-align: center; }

/* ── Responsive overrides ──────────────────────────────────── */
@media (max-width: 768px) {
  .kpi-grid-3 { grid-template-columns: 1fr; }
  .kpi-grid-4 { grid-template-columns: 1fr 1fr; }
  .pipeline-board { flex-direction: column; }
  .pipeline-column { min-width: 100%; }
  .bank-grid { grid-template-columns: 1fr 1fr; }
  .bank-account-card { flex-wrap: wrap; }
  .budget-grid { grid-template-columns: 1fr; }
}

#receipt-preview {
  margin-top: 16px;
  text-align: center;
}

#receipt-preview-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.ocr-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}

/* ─── Quote Line Items ─── */

.line-items-container {
  margin-top: 16px;
}

.line-item-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 90px 36px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.line-item-row input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text-primary);
}

.line-item-row input:focus {
  border-color: var(--primary);
  outline: none;
}

.line-item-total {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: var(--text-primary);
}

.line-item-del {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--danger-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.line-item-del:hover { background: var(--danger); }
.line-item-del svg { width: 14px; height: 14px; stroke: var(--danger-text); }
.line-item-del:hover svg { stroke: #fff; }

.quote-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.quote-totals div {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.quote-totals .total-row {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

/* ─── fadeSlideUp animation ─── */

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Print / PDF-friendly tweaks ─── */

@media print {
  .sidebar, .page-header, .modal-overlay, .toolbar { display: none !important; }
  .content-area { margin-left: 0 !important; padding: 0 !important; }
}

/* ─── Subscription upsell extras ─── */

.sub-upsell-perk {
  color: rgba(255,255,255,0.8);
}

.sub-upsell-perk svg {
  width: 13px;
  height: 13px;
  stroke: #A5B4FC;
  flex-shrink: 0;
}

.sub-upsell-btn {
  background: #fff;
  color: #312E81;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}

.sub-upsell-btn:hover {
  background: #EDE9FE;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .sub-upsell { flex-direction: column; align-items: flex-start; }
  .sub-upsell-btn { width: 100%; text-align: center; }
}

.trial-confirm-box {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.trial-confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  font-size: 14px;
  border-bottom: 1px solid #DBEAFE;
}

.trial-confirm-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.trial-confirm-row .label {
  color: var(--text-muted);
}

.trial-confirm-row .value {
  font-weight: 600;
  color: var(--text-primary);
}

.trial-confirm-row .value.free {
  color: var(--success);
  font-weight: 700;
}

.trial-confirm-row .value.highlight {
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
}

.trial-tos-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  text-align: center;
  margin-top: 12px;
}

.trial-tos-note a {
  color: var(--primary);
  text-decoration: underline;
}

/* Gate footer */
.trial-gate-footer {
  padding: 16px 32px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  gap: 12px;
}

.trial-gate-footer .btn-primary {
  flex: 1;
}

/* Responsive */
@media (max-width: 600px) {
  .trial-gate-card { border-radius: 16px; }
  .trial-gate-header {
    padding: 20px 20px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .trial-steps-bar { max-width: 100%; justify-content: flex-start; }
  .trial-step-content { padding: 20px; }
  .trial-plans-grid { grid-template-columns: 1fr; gap: 10px; }
  .trial-gate-footer { padding: 14px 20px 22px; flex-wrap: wrap; }
  .trial-gate-footer .btn-primary { order: -1; }
}
