/* ══════════════════════════════════════════════════════════════
   EXTRO CRM — LOADING & TRANSITION SYSTEM
   ══════════════════════════════════════════════════════════════ */

/* ── PIN LOGIN SCREEN ───────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', sans-serif;
  padding: 20px;
}

#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(242,101,34,0.18) 0%, transparent 65%);
  pointer-events: none;
}

.login-card {
  background: rgba(255,255,255,0.97);
  border: none;
  border-radius: 28px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.08);
  position: relative;
  z-index: 1;
  animation: pageFadeIn 0.3s ease;
}

body.dark-mode .login-card {
  background: rgba(22,22,22,0.97);
  border: 1px solid rgba(255,255,255,0.06);
}

.login-brand-strip {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f26522, #d4a843, #f26522);
  border-radius: 28px 28px 0 0;
}

.login-logo {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text, #111);
  margin-bottom: 6px;
}

.login-sub {
  font-size: 12px;
  color: var(--text3, #999);
  margin-bottom: 28px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border, #ddd);
  background: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.pin-dots span.filled {
  background: #f26522;
  border-color: #f26522;
  transform: scale(1.15);
}

.pin-dots span.shake {
  animation: pinShake 0.4s ease;
}

@keyframes pinShake {
  0%,100% { transform: translateX(0); }

/* ── SYNC INDICATOR STYLES ────────────────────────────────── */
.sync-spin {
  display: inline-block;
  animation: spin 1s linear infinite;
}
.live-dot {
  display: inline-block;
  animation: pulse 2s infinite;
  margin-right: 4px;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.pin-error {
  font-size: 11px;
  color: #dc3545;
  font-weight: 600;
  min-height: 18px;
  margin-bottom: 16px;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.pin-key {
  background: var(--surface2, #f4f5f7);
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 12px;
  height: 56px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text, #111);
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
  font-family: 'Poppins', sans-serif;
}

body.dark-mode .pin-key {
  background: #252525;
  border-color: #333;
  color: #fff;
}

.pin-key:hover { background: rgba(242,101,34,0.1); border-color: #f26522; }
.pin-key:active { transform: scale(0.93); }
.pin-key-blank { opacity: 0; pointer-events: none; cursor: default; }

.login-footer {
  font-size: 10px;
  color: var(--text3, #bbb);
  letter-spacing: 0.5px;
}

/* ── SPLASH SCREEN ─────────────────────────────────────────── */
#app-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

body.dark-mode #app-splash {
  background: #0d0d0d;
}

#app-splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: splashPulse 1.5s ease infinite alternate;
}

@keyframes splashPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.03); }
}

.splash-logo {
  width: 160px;
  height: auto;
  filter: drop-shadow(0 4px 20px rgba(242, 101, 34, 0.25));
}

.splash-bar-track {
  width: 200px;
  height: 3px;
  background: rgba(242, 101, 34, 0.15);
  border-radius: 99px;
  overflow: hidden;
}

.splash-bar {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #f26522, #ffd200);
  border-radius: 99px;
  animation: splashSlide 1.2s ease-in-out infinite;
}

@keyframes splashSlide {
  0%   { transform: translateX(-150%); }
  100% { transform: translateX(400%); }
}

.splash-sub {
  font-family: 'Sora', 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #aaa;
}

/* ── PAGE CONTENT FADE TRANSITION ──────────────────────────── */

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes skeletonPulse {
  0% { background-color: var(--border); }
  50% { background-color: var(--border2); }
  100% { background-color: var(--border); }
}

.skeleton {
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: 4px;
  display: inline-block;
  min-height: 1em;
  width: 100%;
}

.skeleton-text { height: 12px; margin-bottom: 8px; width: 80%; }
.skeleton-title { height: 20px; margin-bottom: 12px; width: 40%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; }


@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes syncPulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

.sync-pulse {
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  display: inline-block;
  animation: syncPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 8px var(--gold);
}


.page-transitioning .content {
  animation: none;
  opacity: 0;
  transform: translateY(6px);
}

/* ── TOPBAR TITLE — prevent wrapping ───────────────────────── */
.topbar-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55vw;
}

:root {

  --bg: #f8f9fa;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-hover: rgba(255, 255, 255, 1);
  --border: rgba(0, 0, 0, 0.08);
  --border2: rgba(0, 0, 0, 0.12);
  
  /* Brand Palette */
  --brand-yellow: #ffd200;
  --brand-gradient: linear-gradient(135deg, #f26522, #ffd200);
  
  --gold: var(--brand-orange);
  --brand-orange: #E8610A;
  --brand-orange-light: #FEF0E6;
  --brand-dark: #111111;
  --brand-dark2: #1C1C1C;
  --brand-glow: rgba(232, 97, 10, 0.08);
  --font-main: 'Sora', sans-serif;
  --font-mono: 'DM Mono', monospace;
  
  --gold2: #333333;
  --gold-dim: rgba(242, 101, 34, 0.05);
  
  --text: #0a0a0a;
  --text2: #2d2d2d;
  --text3: #6c757d;
  --green: #2ecc71;
  --green-dim: rgba(46, 204, 113, 0.1);
  --red: #e74c3c;
  --red-dim: rgba(231, 76, 60, 0.1);
  --amber: #f39c12;
  --amber-dim: rgba(243, 156, 18, 0.1);
  --blue: #3498db;
  --blue-dim: rgba(52, 152, 219, 0.1);
  
  --radius: 12px;
  --radius-lg: 24px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
  --sidebar-w: 260px;
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
}

[data-theme='dark'] {
  --bg: #0b0c10;
  --surface: #14161b;
  --surface2: #1e2128;
  --surface-hover: #23272f;
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.12);
  
  --text: #ffffff;
  --text2: #e2e8f0;
  --text3: #a1a1aa; /* Lightened from #94a3b8 for better contrast */
  
  --gold2: #ffffff;
  --gold-dim: rgba(242, 101, 34, 0.12);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
  
  --surface-glass: rgba(15, 17, 22, 0.8);
  --glass-bg: rgba(20, 22, 27, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
}

/* ── DARK MODE GLASS OVERRIDES ── */
[data-theme='dark'] .topbar {
  background: rgba(11, 12, 16, 0.8) !important;
  border-bottom: 1px solid var(--border);
}

[data-theme='dark'] #sidebar {
  background: rgba(11, 12, 16, 0.4) !important;
  border-right: 1px solid var(--border);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Background Gradients (HappyOps style) */
body::before {
  content: "";
  position: fixed;
  top: -20%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(255, 230, 180, 0.6) 0%, rgba(255, 255, 255, 0) 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(40px);
  transform: translateZ(0);
}

body::after {
  content: "";
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.3) 0%, rgba(255, 105, 180, 0.3) 50%, rgba(255, 255, 255, 0) 80%);
  z-index: -1;
  pointer-events: none;
  filter: blur(50px);
  transform: translateZ(0);
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: transparent;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  padding: 16px 12px;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.logo {
  padding: 24px 20px 32px;
}

/* ── LAYOUT SYMMETRY CORE ── */
.page > .dashboard-canvas,
.page > .stat-grid,
.page > .table-card,
.page > .charts-row:first-child,
.page > .page-actions {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.logo-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}

.logo-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
}

.nav-section {
  padding: 16px 12px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 4px 0;
  border-radius: 99px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
  font-family: 'Poppins', sans-serif;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.nav-item.active {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 8px 20px rgba(242, 101, 34, 0.25);
  transform: translateX(4px);
}
.nav-item.active .nav-icon {
  color: #fff;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  font-size: 11px;
  color: var(--text3);
  line-height: 1.5;
  text-align: center;
}

/* ── MAIN ────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 200px;
}

.topbar {
  padding: 16px 32px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.03em;
  color: var(--text);
}

.topbar-subtitle {
  font-size: 13px;
  color: var(--text3);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 24px;
  align-items: center;
}

.topbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn {
  padding: 12px 24px;
  border-radius: 99px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: fit-content;
}

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 8px 24px rgba(242, 101, 34, 0.2);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(242, 101, 34, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(244, 67, 54, 0.15);
}

.btn-whatsapp {
  background: var(--green-dim);
  color: var(--green);
}

.btn-whatsapp:hover {
  background: rgba(0, 200, 83, 0.15);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

/* ── PILL ACTION BUTTONS ─────────────────────────────────── */
.pill-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  width: 100%;
}

.pill-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  width: 100%;
  padding: 0 6px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  box-sizing: border-box;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  filter: brightness(1.1);
}

.pill-btn:active {
  transform: translateY(0);
}

/* Quote — gold */
.pill-btn-quote {
  background: rgba(242, 101, 34, 0.08);
  color: var(--gold);
  border-color: rgba(242, 101, 34, 0.25);
}

/* WhatsApp / Follow-up — green */
.pill-btn-wa {
  background: rgba(46, 204, 113, 0.08);
  color: #1a9e52 !important;
  border-color: rgba(46, 204, 113, 0.25);
}
body.dark-mode .pill-btn-wa {
  color: #2ecc71 !important;
}

/* Convert — brand gradient */
.pill-btn-convert {
  background: var(--brand-gradient);
  color: #fff;
  border: 1px solid rgba(242, 101, 34, 0.4);
  box-shadow: 0 2px 8px rgba(242, 101, 34, 0.2);
}

/* Edit — subtle surface */
.pill-btn-edit {
  background: var(--surface2);
  color: var(--text2);
  border-color: var(--border);
}

/* Delete — red */
.pill-btn-del {
  background: rgba(231, 76, 60, 0.08);
  color: var(--red);
  border-color: rgba(231, 76, 60, 0.25);
}

/* Update / Pay — blue */
.pill-btn-update {
  background: rgba(91, 138, 240, 0.08);
  color: #5b8af0;
  border-color: rgba(91, 138, 240, 0.25);
}



.content {
  padding: 16px 32px 40px;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  animation: pageFadeIn 0.25s ease forwards;
}

/* ── CARDS ─────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

/* ── QUICK ACTIONS ────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.action-card {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.15s;
  will-change: transform;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
}

.action-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-orange);
  box-shadow: 0 12px 24px rgba(242, 101, 34, 0.1);
  background: var(--brand-glow);
}

.action-icon {
  width: 40px;
  height: 40px;
  background: var(--brand-glow);
  color: var(--brand-orange);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s;
}

.action-card:hover .action-icon {
  background: var(--brand-orange);
  color: white;
  transform: rotate(5deg) scale(1.1);
}

.action-info {
  display: flex;
  flex-direction: column;
}

.action-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.action-desc {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
}

/* ── DASHBOARD GRID (BENTO SYSTEM) ───────────────────────── */
.dashboard-canvas {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s;
  overflow: visible !important; /* Force visibility for menus */
}

.bento-card:hover {
  transform: translateY(-5px) scale(1.005);
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  border-color: var(--brand-orange);
  background: var(--surface-hover);
}


/* Specific Card Spans */
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

/* Dashboard Header Metrics (Always Span 3) */
.stat-card {
  grid-column: span 3;
  padding: 18px;
  border-top: 4px solid var(--brand-orange);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-card.green { border-top-color: var(--green); }
.stat-card.red { border-top-color: var(--red); }
.stat-card.blue { border-top-color: var(--blue); }

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1.1;
}

.stat-change {
  font-size: 12px;
  color: var(--text3);
  margin-top: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── CHARTS ROW ───────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chart-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.chart-body {
  position: relative;
  height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── TABLES ───────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: visible !important; /* Force visibility for menus */
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
}

.table-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.table-count {
  font-size: 12px;
  color: var(--text3);
  background: rgba(0, 0, 0, 0.04);
  padding: 4px 12px;
  border-radius: 99px;
  margin-left: 12px;
  font-weight: 600;
}

.table-wrapper {
  width: 100%;
  overflow: visible !important; /* Fully disabled clipping to ensure menus are never cut off */
  position: relative;
}

/* Inner scroll wrapper: allows horizontal scroll without clipping dropdown menus */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  display: table;
  margin-bottom: 0;
  -webkit-overflow-scrolling: touch;
  contain: layout style;
}

.data-table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: transparent;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: top;
  white-space: nowrap;
  overflow: visible;
  position: relative;
}

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

.data-table tr {
  position: relative;
}

.data-table tr:hover td {
  background: rgba(0, 0, 0, 0.01);
}

/* Actions column — fixed width so buttons don't compress */
.data-table th:last-child,
.data-table td:last-child {
  width: 110px;
  min-width: 110px;
  overflow: visible;
}


.badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  min-width: 90px;
  white-space: normal;
}

.overdue-pulse {
  animation: pulse-red 2s infinite ease-in-out;
  border: 1px solid var(--red);
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(244, 67, 54, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0); }
}

.no-wrap { white-space: nowrap !important; }

.btn-update {
  background: rgba(91, 138, 240, 0.1);
  color: #5b8af0;
  border: 1px solid rgba(91, 138, 240, 0.3);
  font-weight: 700;
}
.btn-update:hover {
  background: #5b8af0;
  color: white;
  border-color: #5b8af0;
}

.badge-unpaid {
  background: var(--red-dim);
  color: var(--red);
}

.badge-partial {
  background: var(--amber-dim);
  color: var(--amber);
}

.badge-paid {
  background: var(--green-dim);
  color: var(--green);
}

.badge-seo {
  background: var(--blue-dim);
  color: var(--blue);
}

.badge-web {
  background: rgba(156, 39, 176, 0.1);
  color: #9c27b0;
}

.badge-gads {
  background: var(--red-dim);
  color: var(--red);
}

.badge-fb {
  background: rgba(24, 119, 242, 0.1);
  color: #1877f2;
}

.badge-social {
  background: rgba(245, 158, 58, 0.1);
  color: #f59e3a;
}

.badge-content {
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
}

.badge-creative {
  background: rgba(219, 39, 119, 0.1);
  color: #db2777;
}

.badge-tech {
  background: rgba(13, 148, 136, 0.1);
  color: #0d9488;
}

/* Pipeline Status Badges */
.badge-lead-new { background: rgba(33, 150, 243, 0.1); color: #2196f3; }
.badge-lead-contacted { background: rgba(156, 39, 176, 0.1); color: #9c27b0; }
.badge-lead-proposal { background: rgba(63, 81, 181, 0.1); color: #3f51b5; }
.badge-lead-negotiation { background: var(--amber-dim); color: var(--amber); }
.badge-lead-closed { background: var(--green-dim); color: var(--green); }
.badge-lead-lost { background: var(--red-dim); color: var(--red); }

/* Quotation Status Badges */
.badge-quote-draft { background: #f0f0f0; color: #666; }
.badge-quote-sent { background: rgba(91, 138, 240, 0.1); color: #5b8af0; }
.badge-quote-approved { background: var(--gold-dim); color: var(--gold); }
.badge-quote-converted { background: var(--green-dim); color: var(--green); }
.badge-quote-lost { background: var(--red-dim); color: var(--red); }

.amount {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}

.amount-outstanding {
  color: var(--red);
}

.amount-received {
  color: var(--green);
}

.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  color: var(--text2);
  padding: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.btn-icon:hover {
  background: var(--surface2);
  transform: translateY(-2px);
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.btn-icon:active {
  transform: translateY(0);
}

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 5, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0s 0.15s;
  display: flex;
  will-change: opacity;
}

body.dark-mode .modal-overlay {
  background: rgba(0, 0, 0, 0.72);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.15s ease, visibility 0s 0s;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.06) inset;
  transform: translateY(24px) scale(0.97);
  opacity: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.15s ease;
  will-change: transform, opacity;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

@keyframes popIn {
  to { transform: scale(1); }
}

/* Accent bar at top of modal */
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-gradient);
  border-radius: 24px 24px 0 0;
  z-index: 1;
}

.modal-header {
  padding: 36px 40px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  border-radius: 12px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  background: var(--bg);
  flex-shrink: 0;
  margin-top: 2px;
}

.modal-close:hover {
  color: var(--text);
  background: var(--border);
  transform: rotate(90deg) scale(1.1);
}

.modal-body {
  padding: 32px 40px 24px;
}

.modal-footer {
  padding: 20px 40px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.015));
}

body.dark-mode .modal-footer {
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.015));
}

/* ── FORM ─────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.form-full {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-label .required {
  color: var(--brand-orange);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg);
  border: 1.5px solid var(--border2);
  border-radius: 14px;
  padding: 13px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04) inset;
}

.form-input:hover,
.form-select:hover {
  border-color: var(--text3);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand-orange);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(242, 101, 34, 0.1);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--surface);
  color: var(--text);
}

.form-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

.form-calc {
  background: linear-gradient(135deg, rgba(242,101,34,0.06), rgba(212,168,67,0.06));
  border: 1.5px solid rgba(242,101,34,0.2);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 15px;
  color: var(--brand-orange);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  text-align: center;
}

.section-divider {
  margin: 32px 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-divider::before {
  flex: 0 0 0px;
}

/* ── MULTI-SERVICE STYLES ──────────────────────────────────── */
#b-services-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.service-row-container {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.service-row-container:hover {
  border-color: rgba(242,101,34,0.3);
  box-shadow: 0 4px 16px rgba(242,101,34,0.06);
}

.service-row {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr 1.6fr 1.4fr 1.2fr 36px;
  gap: 12px;
  padding: 16px 16px 8px;
  align-items: flex-end;
  border: none;
  background: transparent;
  position: relative;
}

.quote-row {
  display: grid;
  grid-template-columns: 1.5fr 2.5fr 1fr 36px;
  gap: 12px;
  align-items: end;
  background: var(--bg);
  padding: 16px;
  border-radius: 18px;
  border: 1.5px solid var(--border);
  margin-bottom: 10px;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.quote-row:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 16px rgba(212,168,67,0.08);
}

.service-row .form-group {
  gap: 5px;
}

.service-row .form-input,
.service-row .form-select {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.service-row .form-select {
  background-position: right 10px center;
  padding-right: 28px;
}

/* Row number badge */
.service-row-container::before {
  display: none;
}

.service-row .btn-remove {
  background: rgba(220,53,69,0.08);
  color: var(--red);
  border: 1px solid rgba(220,53,69,0.15);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.service-row .btn-remove:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  transform: scale(1.1);
}

.s-notes {
  resize: none;
  border-top: 1px dashed var(--border);
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: transparent;
  padding: 10px 16px;
  border-radius: 0;
  min-height: 38px;
  width: 100%;
  font-size: 12px;
  color: var(--text2);
  font-family: 'Poppins', sans-serif;
  outline: none;
}

.s-notes:focus {
  background: rgba(242,101,34,0.02);
  border-top-color: rgba(242,101,34,0.3);
}

.s-notes::placeholder {
  color: var(--text3);
}

.add-service-btn {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 2px dashed var(--border2);
  border-radius: 16px;
  color: var(--text3);
  font-weight: 600;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

.add-service-btn:hover {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
  background: rgba(242,101,34,0.04);
}

.s-discount-type {
  width: 52px !important;
  flex-shrink: 0;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
}

.s-discount-val {
  flex: 1;
  min-width: 70px;
  width: auto !important;
}

.s-fee-input {
  width: 100% !important;
}


/* ── FILTERS ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: 'Poppins', sans-serif;
  transition: all 0.2s;
}

.filter-chip:hover {
  border-color: var(--text);
  color: var(--text);
}

.filter-chip.active {
  background: #000;
  border-color: #000;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 99px;
  padding: 12px 24px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text);
  outline: none;
  width: 100%;
  max-width: 300px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.search-input:focus {
  border-color: #000;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

.search-input::placeholder {
  color: var(--text3);
}

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px 80px;
  color: var(--text3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.empty-illustration {
  width: 140px;
  height: 140px;
  margin-bottom: 20px;
  opacity: 0.85;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 24px;
  opacity: 0.2;
}

.empty-title {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.empty-sub {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 20px;
  line-height: 1.6;
}

.empty-action {
  margin-top: 4px;
  padding: 10px 24px;
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.2px;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ef4444;
  color: #fff;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  margin-left: auto;
  line-height: 1;
}

/* ── TOAST ────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(110%);
  transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.15s ease;
  pointer-events: none;
}

.toast.toast-in {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.toast.toast-out {
  opacity: 0;
  transform: translateX(110%);
  transition: transform 0.15s ease-in, opacity 0.15s ease-in;
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--blue); }
.toast.warning { border-left: 4px solid hsl(38, 92%, 55%); }

@keyframes slideIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

.client-name-cell {
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

.grand-total-cell {
  font-weight: 700;
  font-size: 16px;
}

/* Hide scrollbar structure for sleekness */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text3);
}

/* ── AI CONTEXT COLLAPSIBLE ── */
.ai-ctx-open .ai-ctx-body { display: block !important; }
.ai-ctx-open .ai-ctx-chevron { transform: rotate(180deg); }

.page {
  display: none;
  content-visibility: auto;
}

.page.active {
  display: block;
  animation: pageFadeIn 0.18s ease;
}


.mobile-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  z-index: 95;
}

.sidebar-overlay.show {
  display: block;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  #sidebar {
    left: -240px;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.1);
  }

  #sidebar.open {
    left: 0;
  }

  #main {
    margin-left: 0;
  }

  .mobile-toggle {
    display: flex;
  }

  .topbar {
    padding: 16px 24px;
  }

  .topbar-title {
    font-size: 24px;
  }

  .content {
    padding: 16px 20px 48px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .charts-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .chart-body {
    height: 220px;
  }

  .table-card {
    border-radius: var(--radius);
  }

  .table-header {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 12px 16px;
  }


  .modal {
    width: 95vw;
    max-width: 95vw;
    border-radius: 18px;
  }

  .modal-header {
    padding: 28px 24px 20px;
  }

  .modal-body {
    padding: 20px 24px 16px;
  }

  .modal-footer {
    padding: 16px 24px 24px;
  }

  .form-grid,
  .form-grid-3 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .service-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "cat cat" "mod disc" "amt val" "rem rem";
    gap: 10px;
  }

  .service-row .btn-remove {
    margin-top: 10px;
    width: 100%;
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 12px 16px;
  }
  .topbar-title {
    font-size: 20px;
  }
  .content {
    padding: 12px 16px 32px;
  }
  .stat-card, .chart-card {
    padding: 20px;
  }
  .search-input {
    max-width: 100%;
  }
  .table-header {
    padding: 12px 16px;
  }
  .data-table th,
  .data-table td {
    padding: 12px;
    font-size: 13px;
  }
  .action-row {
    flex-wrap: wrap;
  }
}

/* ── SAAS UPGRADE STYLES ──────────────────────────────────── */

/* ACTIVITY FEED */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.activity-item:hover { background: var(--gold-dim); }
.activity-icon { font-size: 18px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: var(--surface); border-radius: 50%; border: 1px solid var(--border); }
.activity-content { flex: 1; font-size: 12px; }
.activity-time { font-size: 10px; color: var(--text3); margin-top: 4px; }

/* MOBILE FAB */
.mobile-fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px rgba(242, 101, 34, 0.4);
  z-index: 90;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: transform 0.2s;
}
.mobile-fab:active { transform: scale(0.9); }

@media (max-width: 768px) {
  .mobile-fab { display: flex; }
  
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Momentum scrolling for iOS */
  }

  /* RESPONSIVE CARDS FOR TABLES */
  .data-table, .data-table thead, .data-table tbody, .data-table th, .data-table td, .data-table tr { 
    display: block; 
  }
  .data-table thead tr { 
    position: absolute; top: -9999px; left: -9999px; 
  }
  .data-table tr { 
    border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; background: var(--surface); padding: 12px; 
  }
  .data-table td { 
    border: none; border-bottom: 1px solid var(--border); position: relative; padding-left: 50% !important; text-align: right; white-space: normal; 
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td:before { 
    position: absolute; left: 12px; width: 45%; padding-right: 10px; white-space: nowrap; content: attr(data-label); font-weight: 700; text-align: left; color: var(--text3); font-size: 11px; text-transform: uppercase; 
  }
  .pill-actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    justify-content: flex-end;
    gap: 6px;
  }
  .pill-btn {
    width: auto;
    min-width: 64px;
    padding: 0 10px;
    font-size: 10px;
    height: 28px;
  }
  .data-table td[data-label="Actions"] {
    text-align: right;
    padding-left: 12px !important;
  }
  .data-table td[data-label="Actions"]:before {
    display: none;
  }
  /* Hide less important columns on mobile */
  .data-table td[data-label="Period"],
  .data-table th:nth-child(4) { display: none; }

  /* Login card full width on small screens */
  .login-card {
    padding: 32px 24px 28px;
    border-radius: 20px;
  }

  /* Topbar actions wrap on mobile */
  #topbar-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  #topbar-actions .btn {
    font-size: 11px;
    padding: 7px 12px;
  }
}


/* ── PRINT OPTIMIZATION (THE ENGINE) ───────────────────────── */
@media print {
  @page {
    margin: 0;
    size: A4 portrait;
  }

  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm;
    height: auto;
    color: #000 !important;
    overflow: visible !important;
    display: block !important;
  }

  body::before,
  body::after {
    display: none !important;
  }

  #sidebar,
  .topbar,
  .mobile-toggle,
  .btn,
  .filter-bar,
  .search-input,
  .sidebar-overlay,
  .modal-close,
  .modal-footer,
  #toast-container,
  .modal-header,
  #main,
  .modal-overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  #print-mount {
    display: block !important;
    position: static !important;
    width: 100% !important;
    z-index: 9999999 !important;
    padding: 0 !important;
    background: white !important;
  }

  #printable-invoice {
    display: block !important;
    width: 100% !important;
    page-break-after: avoid;
    background: white !important;
  }

  table {
    border-collapse: collapse !important;
    width: 100% !important;
    table-layout: auto;
  }

  th {
    background: #f8f8f8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border-bottom: 2px solid #000 !important;
  }

  td {
    border-bottom: 1px solid #eee !important;
  }

  tr {
    page-break-inside: avoid !important;
    page-break-after: auto;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ── LEAD SERVICES UI ────────────────────────────────────── */
.lead-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 8px;
}

.service-checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  background: var(--surface);
  border: 1px solid var(--border);
}

.service-checkbox-group:hover {
  border-color: var(--brand-orange);
  background: var(--brand-glow);
}

.service-checkbox-group input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.service-checkbox-group span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

.mini-badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.mini-badge {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ── iOS PWA PROMPT ───────────────────────────────────── */
.ios-prompt-wrapper {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  z-index: 10000;
  width: 90%;
  max-width: 400px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  animation: pwaSlideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pwaSlideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.ios-prompt-header {
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:12px;
}

.ios-prompt-icon {
  width:44px;
  height:44px;
  border-radius:10px;
}

.ios-prompt-title {
  font-weight:700;
  font-size:16px;
}

.ios-prompt-body {
  font-size:13px;
  color: var(--text3);
  line-height:1.5;
}

.ios-prompt-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
}
/* ── THEME SWITCH STYLES (PREMIUM) ── */
.theme-switch { 
  position: relative; 
  display: inline-block; 
  width: 44px; 
  height: 24px; 
}
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider { 
  position: absolute; 
  cursor: pointer; 
  top: 0; left: 0; right: 0; bottom: 0; 
  background-color: var(--border2); 
  transition: .4s cubic-bezier(0.4, 0, 0.2, 1); 
  border-radius: 24px; 
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.slider:before { 
  position: absolute; 
  content: "☀️"; 
  height: 18px; 
  width: 18px; 
  left: 3px; 
  bottom: 2px; 
  background-color: #fff; 
  transition: .4s cubic-bezier(0.4, 0, 0.2, 1); 
  border-radius: 50%; 
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
input:checked + .slider { background: var(--brand-gradient); border-color: transparent; }
input:checked + .slider:before { 
  transform: translateX(20px); 
  content: "🌙";
  background-color: #0b0c10;
  color: #fff;
}



/* ══════════════════════════════════════════════════════════════
   PREMIUM PROPOSAL DOCUMENT — v3
   ══════════════════════════════════════════════════════════════ */

.proposal-doc {
  background: #ffffff;
  color: #1a1a1a;
  font-family: 'Poppins', 'Inter', sans-serif;
  line-height: 1.6;
  max-width: 820px;
  margin: 0 auto;
}

/* ── COVER HEADER ─────────────────────────────────────────── */
.proposal-cover {
  background: linear-gradient(135deg, #0f0f0f 0%, #1c1c1c 60%, #2a1a0a 100%);
  color: white;
  padding: 44px 44px 36px;
  position: relative;
  overflow: hidden;
}

.proposal-cover::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(242,101,34,0.18) 0%, transparent 70%);
  pointer-events: none;
}

.proposal-cover::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f26522, #d4a843, #f26522);
}

.proposal-cover-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.proposal-cover-logo {
  max-height: 44px;
  max-width: 160px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.proposal-cover-logo-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: white;
}

.proposal-cover-logo-sub {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.4);
  margin-top: 3px;
}

.proposal-cover-badge {
  background: linear-gradient(135deg, #f26522, #d4a843);
  color: white;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 99px;
  align-self: flex-start;
}

.proposal-cover-body {
  padding-bottom: 4px;
}

.proposal-cover-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 8px;
}

.proposal-cover-client {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.15;
  color: #ffffff;
  margin-bottom: 6px;
}

.proposal-cover-tagline {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  font-weight: 400;
}

/* ── META STRIP ───────────────────────────────────────────── */
.proposal-meta-strip {
  background: #1a1a1a;
  display: flex;
  gap: 0;
}

.proposal-meta-item {
  flex: 1;
  padding: 12px 20px;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.proposal-meta-item:last-child { border-right: none; }

.proposal-meta-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 3px;
}

.proposal-meta-value {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  font-family: 'DM Mono', monospace;
}

.proposal-meta-value.highlight {
  color: #f26522;
}

/* ── BODY ─────────────────────────────────────────────────── */
.proposal-body {
  padding: 36px 44px;
}

.proposal-section {
  margin-bottom: 36px;
}

.proposal-section:last-child { margin-bottom: 0; }

/* ── SECTION TITLE ────────────────────────────────────────── */
.proposal-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 800;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 18px;
}

.proposal-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, #eee, transparent);
}

.proposal-section-num {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #f26522, #d4a843);
  color: white;
  font-size: 11px;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'DM Mono', monospace;
}

/* ── GREETING & INTRO ─────────────────────────────────────── */
.proposal-greeting {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  margin-bottom: 14px;
}

.proposal-intro {
  font-size: 13.5px;
  line-height: 1.85;
  color: #444;
}

.proposal-intro p { margin-bottom: 14px; }
.proposal-intro p:last-child { margin-bottom: 0; }

/* ── SERVICE CARDS ────────────────────────────────────────── */
.proposal-services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .proposal-services-grid { grid-template-columns: 1fr; }
}

.proposal-service-card {
  border: 1px solid #ebebeb;
  border-radius: 10px;
  padding: 20px 20px 18px;
  background: #fafafa;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.proposal-service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f26522, #d4a843);
}

.proposal-service-icon {
  font-size: 22px;
  margin-bottom: 10px;
  display: block;
}

.proposal-service-name {
  font-size: 13px;
  font-weight: 800;
  color: #111;
  margin-bottom: 8px;
  line-height: 1.3;
}

.proposal-service-desc {
  font-size: 12px;
  color: #666;
  line-height: 1.65;
}

/* ── INVESTMENT TABLE ─────────────────────────────────────── */
.proposal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #ebebeb;
}

.proposal-table thead th {
  background: #111;
  color: rgba(255,255,255,0.7);
  padding: 11px 18px;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.proposal-table thead th:last-child { text-align: right; }

.proposal-table tbody td {
  padding: 11px 18px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}

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

.proposal-table tbody tr:hover { background: #fafafa; }

.proposal-table tfoot td {
  padding: 13px 18px;
  background: linear-gradient(135deg, #f26522, #d4a843);
  font-weight: 800;
  color: white;
  font-size: 13px;
}

.proposal-table tfoot td:last-child {
  text-align: right;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
}

.proposal-amount {
  text-align: right;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: #111;
}

/* ── TIMELINE ─────────────────────────────────────────────── */
.proposal-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.proposal-timeline-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  position: relative;
}

.proposal-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 30px;
  bottom: -8px;
  width: 2px;
  background: linear-gradient(180deg, #f26522, transparent);
}

.proposal-timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f26522, #d4a843);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  font-family: 'DM Mono', monospace;
  box-shadow: 0 2px 8px rgba(242,101,34,0.3);
}

.proposal-timeline-content {
  padding-bottom: 20px;
  flex: 1;
}

.proposal-timeline-phase {
  font-size: 12px;
  font-weight: 800;
  color: #111;
  margin-bottom: 3px;
}

.proposal-timeline-desc {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
}

/* ── TERMS ────────────────────────────────────────────────── */
.proposal-terms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .proposal-terms-grid { grid-template-columns: 1fr; }
}

.proposal-terms-item {
  background: #fafafa;
  border: 1px solid #ebebeb;
  border-radius: 8px;
  padding: 14px 16px;
}

.proposal-terms-icon {
  font-size: 18px;
  margin-bottom: 6px;
}

.proposal-terms-title {
  font-size: 11px;
  font-weight: 800;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.proposal-terms-text {
  font-size: 11.5px;
  color: #666;
  line-height: 1.55;
}

/* ── WHY US ───────────────────────────────────────────────── */
.proposal-why-banner {
  background: linear-gradient(135deg, #0f0f0f 0%, #1c1c1c 60%, #2a1a0a 100%);
  border-radius: 10px;
  padding: 24px 28px;
  color: white;
  position: relative;
  overflow: hidden;
}

.proposal-why-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(242,101,34,0.2) 0%, transparent 70%);
}

.proposal-why-banner-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #f26522;
  margin-bottom: 8px;
}

.proposal-why-text {
  font-size: 13.5px;
  line-height: 1.75;
  color: rgba(255,255,255,0.8);
  position: relative;
}

/* ── SIGNATURE SECTION ────────────────────────────────────── */
.proposal-signature-section {
  border-top: 2px dashed #e8e8e8;
  padding-top: 28px;
  margin-top: 36px;
}

.proposal-signature-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #999;
  text-align: center;
  margin-bottom: 24px;
}

.proposal-signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.proposal-signature-box {
  text-align: center;
}

.proposal-signature-line {
  height: 1px;
  background: #ddd;
  margin-bottom: 8px;
  position: relative;
}

.proposal-signature-line::before {
  content: '✕';
  position: absolute;
  left: 0;
  top: -8px;
  font-size: 10px;
  color: #ccc;
}

.proposal-signature-name {
  font-size: 12px;
  font-weight: 700;
  color: #111;
}

.proposal-signature-role {
  font-size: 10px;
  color: #999;
  margin-top: 2px;
}

/* ── FOOTER ───────────────────────────────────────────────── */
.proposal-doc-footer {
  background: #0f0f0f;
  color: white;
  padding: 22px 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.proposal-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.proposal-footer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f26522, #d4a843);
  flex-shrink: 0;
}

.proposal-footer-brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.proposal-footer-right {
  text-align: right;
}

.proposal-footer-contact {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 2px;
}

.proposal-footer-ref {
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.5px;
}

/* ── PRINT ────────────────────────────────────────────────── */
@media print {
  .proposal-doc { box-shadow: none; }
  .proposal-cover,
  .proposal-meta-strip,
  .proposal-table thead,
  .proposal-table tfoot,
  .proposal-doc-footer,
  .proposal-why-banner { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 768px) {
  .proposal-cover { padding: 28px 20px 24px; }
  .proposal-cover-client { font-size: 22px; }
  .proposal-cover-top { flex-wrap: wrap; gap: 12px; }
  .proposal-meta-strip { flex-wrap: wrap; }
  .proposal-meta-item { min-width: 45%; }
  .proposal-body { padding: 24px 20px; }
  .proposal-doc-footer { padding: 16px 20px; flex-direction: column; text-align: center; }
  .proposal-footer-right { text-align: center; }
  .proposal-signature-grid { grid-template-columns: 1fr; gap: 20px; }
  .proposal-terms-grid { grid-template-columns: 1fr 1fr; }
}


/* ── PREMIUM STATUS DROPDOWNS ── */
:root {
  --status-draft-bg: hsla(210, 20%, 50%, 0.1);
  --status-draft-text: hsl(210, 20%, 60%);
  
  --status-sent-bg: hsla(38, 92%, 50%, 0.1);
  --status-sent-text: hsl(38, 92%, 55%);
  
  --status-approved-bg: hsla(142, 71%, 45%, 0.1);
  --status-approved-text: hsl(142, 71%, 45%);
  
  --status-converted-bg: hsla(245, 75%, 65%, 0.1);
  --status-converted-text: hsl(245, 75%, 65%);
  
  --status-lost-bg: hsla(0, 84%, 60%, 0.1);
  --status-lost-text: hsl(0, 84%, 60%);
  
  --status-new-bg: hsla(199, 89%, 48%, 0.15);
  --status-new-text: hsl(199, 89%, 48%);
}

.status-dropdown {
  position: relative;
  display: inline-block;
  user-select: none;
}

.status-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  width: 130px;
  justify-content: center;
}

.status-trigger:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.status-trigger::after {
  content: '▼';
  font-size: 8px;
  opacity: 0.5;
  transition: transform 0.2s;
}

.status-dropdown.open .status-trigger::after {
  transform: rotate(180deg);
}

/* Status Specific Styles */
.st-draft { background: var(--status-draft-bg); color: var(--status-draft-text); border-color: hsla(210, 20%, 60%, 0.2); }
.st-sent { background: var(--status-sent-bg); color: var(--status-sent-text); border-color: hsla(38, 92%, 55%, 0.2); }
.st-approved { background: var(--status-approved-bg); color: var(--status-approved-text); border-color: hsla(142, 71%, 45%, 0.2); }
.st-converted { background: var(--status-converted-bg); color: var(--status-converted-text); border-color: hsla(245, 75%, 65%, 0.2); }
.st-lost { background: var(--status-lost-bg); color: var(--status-lost-text); border-color: hsla(0, 84%, 60%, 0.2); }
.st-new { background: var(--status-new-bg); color: var(--status-new-text); border-color: hsla(199, 89%, 48%, 0.2); }

.status-dropdown.open {
  z-index: 2000; /* Increased to stay above all other section-dividers and funnel cards */
}

/* Helper to lift the entire table card when a menu is active */
.table-card.has-open-menu {
  z-index: 1000 !important;
  position: relative;
}

/* Ensure internal stacking: Table body above Funnel section */
#leads-body {
  position: relative;
  z-index: 1;
}

.table-card.has-open-menu #leads-body {
  z-index: 10;
}

#lead-funnel-container {
  position: relative;
  z-index: 1;
}

.table-card.has-open-menu .table-scroll {
  overflow: visible !important;
}

/* Custom Menu */
.status-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.2), 0 8px 10px -6px rgba(0,0,0,0.2);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  padding: 6px;
  backdrop-filter: blur(12px);
}

.status-dropdown.open .status-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}

.status-item:hover {
  background: rgba(0,0,0,0.03);
  color: var(--text);
}

[data-theme='dark'] .status-item:hover {
  background: rgba(255,255,255,0.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-item.active {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

[data-theme='dark'] .status-item.active {
  background: rgba(255,255,255,0.1);
}

/* Status Dots */
.dot-draft { background: var(--status-draft-text); }
.dot-sent { background: var(--status-sent-text); box-shadow: 0 0 8px var(--status-sent-text); animation: pulse-sent 2s infinite; }
.dot-approved { background: var(--status-approved-text); }
.dot-converted { background: var(--status-converted-text); }
.dot-lost { background: var(--status-lost-text); }
.dot-new { background: var(--status-new-text); }

@keyframes pulse-sent {
  0% { box-shadow: 0 0 0 0 hsla(38, 92%, 55%, 0.4); }
  70% { box-shadow: 0 0 0 6px hsla(38, 92%, 55%, 0); }
  100% { box-shadow: 0 0 0 0 hsla(38, 92%, 55%, 0); }
}

/* ── COMMAND PALETTE ───────────────────────────────────── */
.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.cmd-item:hover, .cmd-item.selected {
  background: var(--brand-glow);
}

.cmd-item-icon {
  width: 32px;
  height: 32px;
  background: var(--surface2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.cmd-item-info {
  flex: 1;
}

.cmd-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.cmd-item-sub {
  font-size: 11px;
  color: var(--text3);
}

.cmd-item-shortcut {
  font-size: 10px;
  color: var(--text3);
  font-weight: 700;
  opacity: 0.6;
}

/* ── FLOATING ACTION BUTTON (FAB) ─────────────────────────── */
.fab-container {
  display: none; /* Hidden by default (Desktop) */
}

@media (max-width: 768px) {
  .fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
  }
}

.fab-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f26522, #d4a843);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(242, 101, 34, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}

.fab-main:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 16px 48px rgba(242, 101, 34, 0.55);
}

.fab-main.active {
  transform: rotate(45deg);
  background: #2d3436;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.fab-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fab-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface); /* Fallback */
  background-color: #ffffff; /* Explicitly solid white for light mode */
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  color: #111111; /* Sharp contrast */
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.dark-mode .fab-item {
  background-color: #1e1e1e; /* Explicitly solid dark for dark mode */
  color: #ffffff;
  border-color: rgba(255,255,255,0.1);
}

.fab-item:hover {
  transform: translateX(-8px);
  background-color: var(--surface2);
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

.fab-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f26522, #d4a843);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: white;
  box-shadow: 0 4px 10px rgba(242, 101, 34, 0.2);
}

/* ── OVERDUE ROW HIGHLIGHTING ─────────────────────────── */
.row-overdue {
  background: rgba(224, 92, 92, 0.03) !important;
}

.row-overdue td:first-child {
  border-left: 4px solid var(--red) !important;
}


