/* ============================================================
   Akash CRM — Design System
   Deep Navy + Electric Blue | Inter Font | Premium Agency UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --sidebar-w: 260px;
  --topbar-h: 64px;

  /* Palette */
  --bg-body:      #0b0f1a;
  --bg-sidebar:   #0f1729;
  --bg-card:      #141d2e;
  --bg-card-alt:  #1a2540;
  --bg-input:     #1e2d47;
  --border:       rgba(255,255,255,.07);
  --border-light: rgba(255,255,255,.12);

  --accent:       #3b82f6;
  --accent-light: #60a5fa;
  --accent-glow:  rgba(59,130,246,.25);
  --accent-hover: #2563eb;

  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #06b6d4;

  --text-primary: #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:   #64748b;

  --radius:       10px;
  --radius-lg:    16px;
  --radius-xl:    20px;
  --shadow:       0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.5);

  --transition:   all .2s ease;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-sidebar); }
::-webkit-scrollbar-thumb { background: var(--bg-card-alt); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.crm-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
  background: rgba(255,255,255,0.04);
}

.sidebar-brand img {
  max-height: 40px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: screen;
  filter: brightness(1.1) drop-shadow(0 1px 4px rgba(59,130,246,0.3));
}

/* Legacy brand sub-elements (keep for safety) */
.sidebar-brand-icon { display: none; }
.sidebar-brand-text { display: none; }
.sidebar-brand-sub  { display: none; }

/* Navigation */
.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 20px 6px;
}

.nav-item { list-style: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-link i { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-link .nav-badge { margin-left: auto; }

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(59,130,246,.08);
  padding-left: 24px;
}

.nav-link.active {
  color: var(--accent-light);
  background: linear-gradient(90deg, rgba(59,130,246,.15), transparent);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card-alt);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-user:hover { background: var(--bg-input); }

.sidebar-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-name  { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.sidebar-user-role  { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ════════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════ */
.crm-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 1030;
}

.topbar-title { font-size: 17px; font-weight: 700; color: var(--text-primary); flex: 1; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 38px; height: 38px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover { background: var(--bg-input); color: var(--text-primary); border-color: var(--accent); }

.topbar-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* ════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.crm-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 28px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.crm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.crm-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crm-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-card-title i { color: var(--accent); }

.crm-card-body { padding: 22px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle, var(--stat-color, var(--accent)) 0%, transparent 70%);
  opacity: .08;
  transform: translate(20px, -20px);
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: rgba(var(--stat-rgb, 59,130,246), .15);
  color: var(--stat-color, var(--accent));
}

.stat-value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-trend { font-size: 12px; font-weight: 600; margin-top: 4px; }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger);  }

/* Color variants */
.stat-blue   { --stat-color: #3b82f6; --stat-rgb: 59,130,246;   }
.stat-green  { --stat-color: #10b981; --stat-rgb: 16,185,129;   }
.stat-orange { --stat-color: #f59e0b; --stat-rgb: 245,158,11;   }
.stat-purple { --stat-color: #8b5cf6; --stat-rgb: 139,92,246;   }
.stat-red    { --stat-color: #ef4444; --stat-rgb: 239,68,68;     }
.stat-cyan   { --stat-color: #06b6d4; --stat-rgb: 6,182,212;    }

/* ════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */
.crm-table { width: 100%; border-collapse: collapse; }

.crm-table thead th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
  white-space: nowrap;
}

.crm-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 13.5px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.crm-table tbody tr:last-child td { border-bottom: none; }

.crm-table tbody tr:hover td {
  background: rgba(59,130,246,.04);
  color: var(--text-primary);
}

.crm-table .text-strong { color: var(--text-primary); font-weight: 600; }

/* Links inside table cells should always be clearly readable */
.crm-table tbody td a {
  color: var(--text-primary);
  font-weight: 500;
  transition: color .15s ease;
}
.crm-table tbody td a:hover { color: var(--accent-light); }
.crm-table tbody td a.text-strong,
.crm-table tbody td a[style*="accent"] { color: var(--accent-light); }

/* ── Sub-line / secondary info inside table cells ─────────────
   Covers: email under mobile, project under client, site URL
   under business name, invoice ref under amount, etc.
   Use --text-secondary (#94a3b8) NOT --text-muted (#64748b)
   so it remains legible on the dark card background.          */
.crm-table tbody td .text-muted,
.crm-table tbody td [class*="text-muted"],
.crm-table tbody td small.text-muted,
.crm-table tbody td div.text-muted,
.crm-table tbody td a.text-muted {
  color: var(--text-secondary) !important;  /* #94a3b8 — readable */
}

/* External links (live URL, website) shown as underlined sub-text */
.crm-table tbody td a.text-muted,
.crm-table tbody td a.small.text-muted {
  color: var(--text-secondary) !important;
  text-decoration-color: rgba(148,163,184,.4) !important;
}
.crm-table tbody td a.text-muted:hover,
.crm-table tbody td a.small.text-muted:hover {
  color: var(--accent-light) !important;
  text-decoration-color: var(--accent-light) !important;
}

/* Inline metadata text (font-size:12px, font-size:11px) */
.crm-table tbody td [style*="color:var(--text-muted)"],
.crm-table tbody td [style*="color: var(--text-muted)"] {
  color: var(--text-secondary) !important;
}


/* ════════════════════════════════════════════════════════════
   FORMS & INPUTS
   ═══════════════════════════════════════════════════════════ */
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.form-control, .form-select {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius) !important;
  padding: 10px 14px !important;
  font-size: 13.5px !important;
  font-family: 'Inter', sans-serif !important;
  transition: var(--transition) !important;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
  outline: none !important;
}

.form-control::placeholder { color: var(--text-muted) !important; }
.form-select option { background: var(--bg-input); }

textarea.form-control { resize: vertical; min-height: 90px; }

.input-group-text {
  background: var(--bg-card-alt) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius);
  padding: 9px 18px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-hover), #4f46e5); transform: translateY(-1px); color: #fff; }

.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; transform: translateY(-1px); }

.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); }

.btn-warning  { background: var(--warning); color: #000; }
.btn-warning:hover { background: #d97706; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: var(--bg-card-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

/* Action button group in tables */
.action-btns { display: flex; gap: 5px; }
.action-btns .btn { width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 13px; }

/* ════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  letter-spacing: .2px;
}

/* ════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */
.crm-alert {
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  padding: 12px 16px;
}

.alert-success { background: rgba(16,185,129,.15); color: #6ee7b7; }
.alert-danger  { background: rgba(239,68,68,.15);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.15); color: #fcd34d; }
.alert-info    { background: rgba(6,182,212,.15);  color: #67e8f9; }

/* ════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.page-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-breadcrumb a { color: var(--text-muted); }
.page-breadcrumb a:hover { color: var(--accent); }

/* ════════════════════════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════════════════════ */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-bar .form-control,
.filter-bar .form-select { max-width: 200px; }

/* ════════════════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════════════ */
.progress {
  height: 6px;
  background: var(--bg-card-alt);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  background: linear-gradient(90deg, var(--accent), #6366f1);
  border-radius: 99px;
  transition: width .4s ease;
}

/* ════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 22px;
}

.modal-title { font-size: 16px; font-weight: 700; }
.modal-body  { padding: 22px; }
.modal-footer { border-top: 1px solid var(--border); padding: 14px 22px; }
.btn-close   { filter: invert(1) brightness(.7); }

/* ════════════════════════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════════════════════ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(59,130,246,.12) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(139,92,246,.1) 0%, transparent 50%);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px var(--accent-glow);
}

.auth-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  margin-bottom: 8px;
}

.auth-logo-badge img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.auth-title { font-size: 24px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.auth-sub   { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }

/* ════════════════════════════════════════════════════════════
   CALENDAR / TIMELINE
   ═══════════════════════════════════════════════════════════ */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; background: var(--border); }

.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -25px; top: 4px;
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}
.timeline-time  { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.timeline-body  { font-size: 13px; color: var(--text-secondary); }
.timeline-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }

/* ════════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════ */
.chart-container { position: relative; }

/* ════════════════════════════════════════════════════════════
   INVOICE / QUOTATION PRINT STYLES
   ═══════════════════════════════════════════════════════════ */
@media print {

  /* ── Page setup ─────────────────────────────────────────── */
  @page {
    size: A4 portrait;
    margin: 0 !important;
  }

  /* ── Hide non-print UI ──────────────────────────────────── */
  .crm-sidebar,
  .crm-topbar,
  .no-print,
  .page-header,
  .alert,
  .crm-alert,
  .alert-dismissible,
  button,
  .btn,
  .action-btns,
  .page-breadcrumb {
    display: none !important;
  }

  /* ── Reset page shell ───────────────────────────────────── */
  html, body {
    background: #fff !important;
    color: #1e293b !important;
    font-size: 11pt !important;
    padding: 10mm 14mm 12mm 14mm !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .crm-main {
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  /* ── Print card wrapper ─────────────────────────────────── */
  .crm-card.print-doc {
    max-width: 100% !important;
    width: 100% !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    color: #1e293b !important;
    page-break-inside: avoid;
  }

  /* ── Fix Bootstrap grid for print ──────────────────────── */
  .row {
    display: flex !important;
    flex-wrap: nowrap !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .col-md-5 { flex: 0 0 41.666% !important; max-width: 41.666% !important; }
  .col-md-6 { flex: 0 0 50% !important;     max-width: 50% !important; }
  .col-md-7 { flex: 0 0 58.333% !important; max-width: 58.333% !important; }
  .col-md-12,
  .col-lg-12 { flex: 0 0 100% !important;   max-width: 100% !important; }

  [class*="col-"] {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* ── Compress spacing ───────────────────────────────────── */
  .print-doc .mb-5  { margin-bottom: 14px !important; }
  .print-doc .mb-4  { margin-bottom: 10px !important; }
  .print-doc .mb-3  { margin-bottom: 8px !important; }
  .print-doc .mt-4  { margin-top: 12px !important; }
  .print-doc .mt-5  { margin-top: 16px !important; }
  .print-doc .mt-md-0 { margin-top: 0 !important; }
  .print-doc .p-5   { padding: 0 !important; }
  .print-doc .p-3   { padding: 6px 10px !important; }

  .print-doc hr {
    margin: 10px 0 !important;
    border-color: #cbd5e1 !important;
    border-top: 1.5px solid #cbd5e1 !important;
  }

  /* ── Preserve all colors ────────────────────────────────── */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .print-doc .text-primary   { color: #3b82f6 !important; }
  .print-doc .text-danger    { color: #ef4444 !important; }
  .print-doc .text-success   { color: #22c55e !important; }
  .print-doc .text-muted     { color: #64748b !important; }
  .print-doc .text-dark      { color: #0f1729 !important; }
  .print-doc .bg-primary     { background-color: #3b82f6 !important; color: #fff !important; }
  .print-doc .bg-success     { background-color: #22c55e !important; color: #fff !important; }
  .print-doc .bg-danger      { background-color: #ef4444 !important; color: #fff !important; }
  .print-doc .bg-secondary   { background-color: #64748b !important; color: #fff !important; }
  .print-doc .bg-warning     { background-color: #f59e0b !important; }
  .print-doc .fw-bold        { font-weight: 700 !important; }
  .print-doc .fw-semibold    { font-weight: 600 !important; }

  /* ── Table styles ───────────────────────────────────────── */
  .print-doc table th,
  .print-doc table td {
    padding: 5px 8px !important;
    font-size: 10pt !important;
    color: #1e293b !important;
  }

  .print-doc thead[style*="background:#f1f5f9"] {
    background: #f1f5f9 !important;
  }

  .print-doc table { page-break-inside: avoid; }
  .print-doc tr { page-break-inside: avoid; page-break-after: auto; }

  /* ── Subject banner ─────────────────────────────────────── */
  .print-doc [style*="border-left: 4px solid #3b82f6"] {
    border-left: 4px solid #3b82f6 !important;
    background: #f8fafc !important;
  }

  /* ── Logo (company logo, not signature) ─────────────────── */
  .print-doc > .row img,
  .print-doc .col-md-6 img[alt] {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    height: 50px !important;
    width: auto !important;
    object-fit: contain !important;
    max-width: 200px !important;
  }

  /* ── Signature image ────────────────────────────────────── */
  .print-doc img[alt="Authorized Signatory"] {
    height: 55px !important;
    max-width: 180px !important;
    object-fit: contain !important;
    opacity: 0.9 !important;
  }

  /* ── Keep Terms+Signature block together ────────────────── */
  .print-doc .row.mt-4 {
    page-break-inside: avoid;
    page-break-before: avoid;
  }

  /* ── Totals table ───────────────────────────────────────── */
  .print-doc .table-borderless td {
    padding: 3px 6px !important;
    font-size: 10.5pt !important;
  }

  .print-doc .table-borderless tr[style*="font-size:18px"] td {
    font-size: 13.5pt !important;
    padding-top: 6px !important;
  }

  /* ── Full-width columns ─────────────────────────────────── */
  .table-responsive { overflow: visible !important; }
}

/* ════════════════════════════════════════════════════════════
   MISC UTILITIES
   ═══════════════════════════════════════════════════════════ */
.gap-8  { gap: 8px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state i  { font-size: 48px; margin-bottom: 16px; opacity: .4; display: block; }
.empty-state h5 { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p  { font-size: 13px; }

.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}

.tag {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Dropdown overrides */
.dropdown-menu {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.dropdown-item {
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 13px;
  padding: 8px 12px;
}
.dropdown-item:hover { background: var(--bg-input); color: var(--text-primary); }
.dropdown-divider   { border-color: var(--border); }

/* Nav pills (for tabs) */
.nav-pills .nav-link {
  color: var(--text-secondary);
  border-radius: var(--radius);
  font-size: 13px;
  padding: 8px 16px;
}
.nav-pills .nav-link.active {
  background: var(--accent);
  color: #fff;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius) !important;
  padding: 6px 12px !important;
}
.dataTables_wrapper .dataTables_length select {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { color: var(--text-muted) !important; font-size: 12px; }
.dataTables_wrapper .paginate_button {
  background: var(--bg-card-alt) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  border-radius: 6px !important;
}
.dataTables_wrapper .paginate_button.current,
.dataTables_wrapper .paginate_button:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

/* Responsive */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .crm-sidebar { transform: translateX(-260px); width: 260px; }
  .crm-sidebar.open { transform: translateX(0); }
  .crm-topbar  { left: 0; }
  .crm-main    { margin-left: 0; padding: 16px; }
  .filter-bar .form-control,
  .filter-bar .form-select { max-width: 100%; }
  .stat-card { flex-direction: column; text-align: center; }
}
