:root {
    --bg: #0d0d0d;
    --surface: #161616;
    --surface2: #1f1f1f;
    --surface3: #2a2a2a;
    --border: rgba(255,255,255,0.06);
    --border2: rgba(255,255,255,0.11);
    --accent: #f97316;
    --accent2: #ea6a0a;
    --accent-glow: rgba(249,115,22,0.12);
    --blue: #fb923c;
    --amber: #fbbf24;
    --red: #f05c5c;
    --purple: #e879a0;
    --text: #f5f5f5;
    --text2: #a3a3a3;
    --text3: #525252;
    --radius: 12px;
    --radius-sm: 8px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; font-size: 14px; }

  .sidebar { width: 224px; min-height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100%; z-index: 100; }
  .logo { padding: 22px 20px 18px; border-bottom: 1px solid var(--border); }
  .logo-text { font-family: 'Syne', sans-serif; font-size: 21px; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
  .logo-sub { font-size: 10px; color: var(--text3); letter-spacing: 2px; text-transform: uppercase; margin-top: 3px; }
  .nav { padding: 14px 12px; flex: 1; overflow-y: auto; min-height: 0; }
  .nav-section { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text3); padding: 8px 8px 4px; margin-top: 6px; }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text2); font-size: 13.5px; font-weight: 400; transition: all 0.15s; margin-bottom: 2px; }
  .nav-item:hover { background: var(--surface2); color: var(--text); }
  .nav-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 500; }
  .nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
  .nav-badge { margin-left: auto; background: var(--accent); color: #000; font-size: 10px; font-weight: 700; border-radius: 20px; padding: 1px 7px; }
  .sidebar-footer { padding: 14px 12px; border-top: 1px solid var(--border); }
  .user-card { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 8px; border-radius: var(--radius-sm); transition: background 0.15s; }
  .user-card:hover { background: var(--surface2); }
  .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #f97316, #ea580c); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
  .user-name { font-size: 13px; font-weight: 500; color: var(--text); }
  .user-role { font-size: 11px; color: var(--text3); }
  .user-edit-hint { font-size: 10px; color: var(--accent); margin-top: 1px; }

  .main { margin-left: 224px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
  .topbar { padding: 15px 28px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: var(--surface); position: sticky; top: 0; z-index: 50; }
  .topbar-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; flex: 1; }
  .topbar-subtitle { font-size: 12px; color: var(--text3); font-weight: 400; font-family: 'DM Sans', sans-serif; display: block; margin-top: 1px; }
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; font-family: 'DM Sans', sans-serif; white-space: nowrap; }
  .btn-primary { background: var(--accent); color: #000; }
  .btn-primary:hover { background: #ea6a0a; color: #fff; }
  .btn-ghost { background: var(--surface2); color: var(--text2); border: 1px solid var(--border2); }
  .btn-ghost:hover { background: var(--surface3); color: var(--text); }
  .btn-export { background: rgba(249,115,22,0.12); color: var(--accent); border: 1px solid rgba(249,115,22,0.3); }
  .btn-export:hover { background: rgba(249,115,22,0.22); }
  .btn-sm { padding: 5px 11px; font-size: 12px; }
  .content { padding: 22px 28px; flex: 1; }

  .page { display: none; }
  .page.active { display: block; }
  #page-leads.active, #page-quotations.active, #page-tasks.active, #page-customers.active { display: flex; flex-direction: column; height: calc(100vh); }

  .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
  .stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; }
  .stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
  .stat-card.green::before { background: var(--accent); }
  .stat-card.blue::before { background: var(--blue); }
  .stat-card.amber::before { background: var(--amber); }
  .stat-card.purple::before { background: var(--purple); }
  .stat-label { font-size: 11px; color: var(--text3); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 7px; }
  .stat-value { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; line-height: 1; }
  .stat-card.green .stat-value { color: var(--accent); }
  .stat-card.blue .stat-value { color: var(--blue); }
  .stat-card.amber .stat-value { color: var(--amber); }
  .stat-card.purple .stat-value { color: var(--purple); }
  .stat-change { font-size: 11px; color: var(--text3); margin-top: 5px; }
  .stat-card.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
  .stat-card.clickable:hover { border-color: var(--blue); transform: translateY(-1px); }
  .stat-change .pos { color: var(--accent); }

  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
  .grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 22px; }
  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
  .card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .card-title { font-size: 13px; font-weight: 600; color: var(--text); }
  .card-body { padding: 14px 20px; }

  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; }
  th { padding: 9px 13px; text-align: left; font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
  td { padding: 11px 13px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text2); vertical-align: middle; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: rgba(255,255,255,0.02); color: var(--text); }
  .td-name { font-weight: 500; color: var(--text); }

  .badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; white-space: nowrap; }
  .badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
  .badge-new { background: rgba(251,146,60,0.15); color: #fb923c; }
  .badge-new::before { background: #fb923c; }
  .badge-contacted { background: rgba(232,121,160,0.15); color: #e879a0; }
  .badge-contacted::before { background: #e879a0; }
  .badge-qualified { background: rgba(251,191,36,0.15); color: #fbbf24; }
  .badge-qualified::before { background: #fbbf24; }
  .badge-proposal { background: rgba(249,115,22,0.12); color: var(--accent); }
  .badge-proposal::before { background: var(--accent); }
  .badge-won { background: rgba(249,115,22,0.2); color: var(--accent); }
  .badge-won::before { background: var(--accent); }
  .badge-lost { background: rgba(240,92,92,0.15); color: var(--red); }
  .badge-lost::before { background: var(--red); }
  .badge-sent { background: rgba(251,146,60,0.15); color: #fb923c; }
  .badge-sent::before { background: #fb923c; }
  .badge-accepted { background: rgba(249,115,22,0.2); color: var(--accent); }
  .badge-accepted::before { background: var(--accent); }
  .badge-rejected { background: rgba(240,92,92,0.15); color: var(--red); }
  .badge-rejected::before { background: var(--red); }
  .badge-draft { background: rgba(138,150,170,0.12); color: var(--text3); }
  .badge-draft::before { background: var(--text3); }

  .toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
  .search-box { position: relative; flex: 1; min-width: 180px; }
  .search-box input { width: 100%; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 8px 12px 8px 34px; color: var(--text); font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; }
  .search-box input::placeholder { color: var(--text3); }
  .search-box input:focus { border-color: var(--accent); }
  .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
  select { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text2); font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; cursor: pointer; }
  select:focus { border-color: var(--accent); }

  /* MODALS */
  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .modal-overlay.open { opacity: 1; pointer-events: all; }
  .modal { background: var(--surface); border: 1px solid var(--border2); border-radius: 16px; width: 560px; max-width: 95vw; max-height: 90vh; overflow-y: auto; transform: translateY(16px); transition: transform 0.2s; }
  .modal-overlay.open .modal { transform: translateY(0); }
  .modal-sm .modal { width: 400px; }
  .modal-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .modal-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; }
  .modal-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 20px; line-height: 1; }
  .modal-close:hover { color: var(--text); }
  .modal-body { padding: 18px 22px; }
  .modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
  .form-group { margin-bottom: 13px; }
  .form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
  .form-input { width: 100%; background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 9px 12px; color: var(--text); font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; transition: border-color 0.15s; }
  .form-input:focus { border-color: var(--accent); }
  .form-input::placeholder { color: var(--text3); }
  .form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }

  /* FUNNEL */
  .funnel-wrap { padding: 16px 20px; }
  .funnel-stage { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
  .funnel-bar-wrap { flex: 1; height: 40px; }
  .funnel-bar { height: 100%; border-radius: var(--radius-sm); display: flex; align-items: center; padding: 0 12px; font-size: 13px; font-weight: 500; color: rgba(0,0,0,0.75); position: relative; overflow: hidden; }
  .funnel-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, transparent 100%); }
  .funnel-label { width: 85px; text-align: right; font-size: 12px; color: var(--text2); flex-shrink: 0; }
  .funnel-count { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); flex-shrink: 0; width: 36px; text-align: center; }
  .funnel-arrow { text-align: center; color: var(--text3); font-size: 11px; margin: -2px 0 -2px 121px; }

  .pipeline-row { display: flex; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); align-items: center; }
  .pipeline-row:last-child { border-bottom: none; }
  .pipeline-company { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
  .pipeline-amount { font-size: 13px; color: var(--accent); font-weight: 600; min-width: 80px; text-align: right; }

  .activity-item { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
  .activity-item:last-child { border-bottom: none; }
  .activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
  .activity-text { font-size: 13px; color: var(--text2); line-height: 1.5; flex: 1; }
  .activity-text strong { color: var(--text); font-weight: 500; }
  .activity-time { font-size: 11px; color: var(--text3); white-space: nowrap; margin-top: 2px; }

  .conv-meter { position: relative; height: 6px; background: var(--surface3); border-radius: 4px; margin-top: 6px; overflow: hidden; }
  .conv-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.5s; }

  .mini-chart { display: flex; align-items: flex-end; gap: 4px; height: 54px; }
  .mini-bar { flex: 1; border-radius: 3px 3px 0 0; min-width: 6px; opacity: 0.75; transition: opacity 0.15s; }
  .mini-bar:hover { opacity: 1; }

  .empty { text-align: center; padding: 40px 20px; color: var(--text3); }
  .empty-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.4; }
  .empty-text { font-size: 13px; }

  .action-btns { display: flex; gap: 5px; }
  .icon-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; cursor: pointer; color: var(--text3); line-height: 0; transition: all 0.15s; }
  .icon-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
  .icon-btn.red:hover { background: rgba(240,92,92,0.1); color: var(--red); border-color: rgba(240,92,92,0.3); }

  /* SALESPERSON TEAM */
  .sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .sp-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
  .sp-avatar { width: 42px; height: 42px; min-width: 42px; min-height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden; }
  .sp-name { font-size: 14px; font-weight: 600; color: var(--text); }
  .sp-stats { font-size: 11px; color: var(--text3); }
  .sp-badge { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; display: inline-block; margin-top: 2px; }
  .sp-badge.manager { background: rgba(249,115,22,0.15); color: var(--accent); }
  .sp-badge.sales { background: rgba(251,146,60,0.15); color: #fb923c; }

  /* SETTINGS */
  .settings-section { margin-bottom: 28px; }
  .settings-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .settings-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .settings-row:last-child { border-bottom: none; }
  .settings-label { font-size: 13px; color: var(--text); font-weight: 500; }
  .settings-desc { font-size: 12px; color: var(--text3); margin-top: 2px; }

  /* EXPORT DROPDOWN */
  .export-wrap { position: relative; }
  .export-menu { position: absolute; top: calc(100% + 6px); right: 0; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); padding: 6px; min-width: 200px; z-index: 200; display: none; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
  .export-wrap.open .export-menu { display: block; }
  .export-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text2); transition: all 0.12s; }
  .export-opt:hover { background: var(--surface2); color: var(--text); }
  .export-opt-icon { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

  /* TOAST */
  .toast { position: fixed; bottom: 24px; right: 24px; background: var(--surface3); border: 1px solid var(--border2); border-radius: var(--radius); padding: 12px 18px; font-size: 13px; color: var(--text); z-index: 9999; display: flex; align-items: center; gap: 10px; transform: translateY(60px); opacity: 0; transition: all 0.3s; pointer-events: none; }
  .toast.show { transform: translateY(0); opacity: 1; }
  .toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

  /* CUSTOM CONFIRM MODAL */
  #confirm-modal-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.7);z-index:99998;display:none;align-items:center;justify-content:center; }
  #confirm-modal-overlay.open { display:flex; }
  #confirm-modal-box { background:var(--surface);border:1px solid var(--border2);border-radius:var(--radius);padding:28px 28px 22px;width:340px;max-width:90vw; }
  #confirm-modal-icon { font-size:28px;margin-bottom:10px; }
  #confirm-modal-title { font-family:'Syne',sans-serif;font-size:16px;font-weight:700;color:var(--text);margin-bottom:6px; }
  #confirm-modal-msg { font-size:13px;color:var(--text2);margin-bottom:20px;line-height:1.5; }
  #confirm-modal-actions { display:flex;gap:8px;justify-content:flex-end; }

  /* AUTH SCREEN */
  #auth-screen { position: fixed; inset: 0; background: var(--bg); z-index: 99999; display: flex; align-items: center; justify-content: center; }
  #auth-screen.hidden { display: none; }
  .auth-card { background: var(--surface); border: 1px solid var(--border2); border-radius: 20px; padding: 40px 36px; width: 380px; max-width: 95vw; }
  .auth-logo { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; color: var(--accent); margin-bottom: 6px; }
  .auth-sub { font-size: 13px; color: var(--text3); margin-bottom: 28px; }
  .auth-tabs { display: flex; gap: 0; margin-bottom: 22px; border: 1px solid var(--border2); border-radius: var(--radius-sm); overflow: hidden; }
  .auth-tab { flex: 1; padding: 8px; text-align: center; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text2); transition: all 0.15s; }
  .auth-tab.active { background: var(--accent); color: #000; }
  .auth-error { background: rgba(240,92,92,0.12); border: 1px solid rgba(240,92,92,0.3); color: var(--red); font-size: 12px; padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; display: none; }
  .auth-error.show { display: block; }
  #app-shell { display: none; }
  #app-shell.visible { display: flex; width: 100%; }

  /* LINE ITEMS */
  .line-item-row { display:grid; grid-template-columns:84px 1fr 70px 100px 28px; gap:6px; align-items:center; }
  .line-item-row input, .line-item-row select { background:var(--surface2); border:1px solid var(--border2); border-radius:var(--radius-sm); padding:7px 10px; color:var(--text); font-family:'DM Sans',sans-serif; font-size:12px; outline:none; width:100%; }
  .line-item-row select { cursor:pointer; }
  .line-item-row input:focus, .line-item-row select:focus { border-color:var(--accent); }
  .line-item-total { font-size:11px; color:var(--text2); text-align:right; padding-right:4px; }

  /* CHECKBOXES */
  .row-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
  .th-check { width: 36px; padding-right: 0; }
  .td-check { width: 36px; padding-right: 0; vertical-align: middle; }
  .select-all-wrap { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text3); white-space: nowrap; }
  .btn-reload { background: var(--surface2); color: var(--text2); border: 1px solid var(--border2); gap: 6px; }
  .btn-reload:hover { background: var(--surface3); color: var(--text); }
  .perf-tab.active { background: var(--accent); color: #000; border-color: var(--accent); }
  .perf-bar-wrap { display:flex; align-items:center; gap:12px; margin-bottom:10px; }
  .perf-bar-label { font-size:12px; color:var(--text2); min-width:100px; text-align:right; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .perf-bar-track { flex:1; height:28px; background:var(--surface3); border-radius:6px; overflow:hidden; position:relative; }
  .perf-bar-fill { height:100%; border-radius:6px; display:flex; align-items:center; padding:0 10px; font-size:12px; font-weight:600; color:#000; transition:width 0.4s ease; white-space:nowrap; }
  .perf-rank { font-size:11px; color:var(--text3); min-width:20px; text-align:center; }
  .perf-table { width:100%; border-collapse:collapse; }
  .perf-table th { font-size:10px; color:var(--text3); text-transform:uppercase; letter-spacing:1px; padding:6px 10px; text-align:left; border-bottom:1px solid var(--border); }
  .perf-table td { font-size:13px; padding:10px 10px; border-bottom:1px solid var(--border); color:var(--text); }
  .perf-table tr:last-child td { border-bottom:none; }
  .perf-medal { font-size:14px; }
  .task-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
  .task-row:last-child { border-bottom: none; }
  .task-check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border2); cursor: pointer; flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
  .task-check:hover { border-color: var(--accent); }
  .task-check.done { background: var(--accent); border-color: var(--accent); }
  .task-check.done::after { content: '✓'; font-size: 10px; color: #000; font-weight: 700; }
  .task-body { flex: 1; min-width: 0; }
  .task-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .task-row.is-done .task-title { color: var(--text3); text-decoration: line-through; }
  .task-meta { display: flex; gap: 10px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
  .task-type-pill { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 20px; }
  .pill-call { background: rgba(79,142,247,0.15); color: var(--blue); }
  .pill-email { background: rgba(155,111,255,0.15); color: var(--purple); }
  .pill-meeting { background: rgba(245,166,35,0.15); color: var(--amber); }
  .pill-followup { background: rgba(0,229,160,0.12); color: var(--accent); }
  .pill-whatsapp { background: rgba(0,200,100,0.15); color: #00c864; }
  .pill-note { background: rgba(138,150,170,0.12); color: var(--text3); }
  .task-due { font-size: 11px; color: var(--text3); }
  .task-due.overdue { color: var(--red); font-weight: 500; }
  .task-due.today { color: var(--amber); font-weight: 500; }
  .task-lead-link { font-size: 11px; color: var(--blue); cursor: pointer; }
  .task-lead-link:hover { text-decoration: underline; }

  /* ACTIVITY LOG DRAWER */
  .drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 900; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
  .drawer-overlay.open { opacity: 1; pointer-events: all; }
  .drawer { position: fixed; top: 0; right: 0; height: 100%; width: 520px; max-width: 95vw; background: var(--surface); border-left: 1px solid var(--border2); z-index: 901; transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1); display: flex; flex-direction: column; }
  .drawer-overlay.open .drawer { transform: translateX(0); }
  .drawer-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; flex-shrink: 0; }
  .drawer-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; flex: 1; }
  .drawer-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
  .drawer-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 20px; padding: 2px; margin-top: -2px; }
  .drawer-close:hover { color: var(--text); }
  .drawer-tabs { display: flex; gap: 2px; padding: 10px 20px 0; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .drawer-tab { padding: 7px 14px; font-size: 13px; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; margin-bottom: -1px; }
  .drawer-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
  .drawer-tab:hover { color: var(--text); }
  .drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
  .drawer-footer { padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }

  /* ACTIVITY TIMELINE */
  .timeline { padding: 4px 0; }
  .tl-item { display: flex; gap: 14px; padding-bottom: 18px; position: relative; }
  .tl-item:not(:last-child)::before { content:''; position:absolute; left:15px; top:32px; bottom:0; width:1px; background:var(--border); }
  .tl-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; border: 1px solid var(--border2); }
  .tl-content { flex: 1; }
  .tl-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
  .tl-type { font-size: 12px; font-weight: 600; color: var(--text); text-transform: capitalize; }
  .tl-time { font-size: 11px; color: var(--text3); }
  .tl-subject { font-size: 13px; color: var(--text); margin-bottom: 3px; }
  .tl-body { font-size: 12px; color: var(--text2); line-height: 1.5; }
  .tl-outcome { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 20px; }
  .outcome-positive { background: rgba(0,229,160,0.12); color: var(--accent); }
  .outcome-neutral { background: rgba(138,150,170,0.1); color: var(--text3); }
  .outcome-negative { background: rgba(240,92,92,0.1); color: var(--red); }

  /* OVERDUE BANNER */
  .overdue-banner { background: rgba(240,92,92,0.1); border: 1px solid rgba(240,92,92,0.25); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--red); }
  .overdue-banner svg { flex-shrink: 0; }

  /* LIGHT MODE */
  html[data-theme="light"] {
    --bg: #f4f4f5;
    --surface: #ffffff;
    --surface2: #f1f1f3;
    --surface3: #e4e4e7;
    --border: rgba(0,0,0,0.07);
    --border2: rgba(0,0,0,0.13);
    --accent: #f97316;
    --accent2: #ea6a0a;
    --accent-glow: rgba(249,115,22,0.10);
    --blue: #f97316;
    --amber: #d97706;
    --red: #dc2626;
    --purple: #db2777;
    --text: #111111;
    --text2: #52525b;
    --text3: #a1a1aa;
  }
  html[data-theme="light"] body { background: var(--bg); }
  html[data-theme="light"] select { color: var(--text2); }
  html[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.45); }
  html[data-theme="light"] .drawer-overlay { background: rgba(0,0,0,0.3); }
  html[data-theme="light"] tr:hover td { background: rgba(0,0,0,0.02); }
  html[data-theme="light"] .line-item-row input { background: var(--surface2); }

  /* THEME TOGGLE */
  .theme-toggle { display:flex; align-items:center; gap:8px; padding:8px 8px; margin-bottom:6px; }
  .theme-toggle-label { font-size:11px; color:var(--text3); flex:1; }
  .toggle-switch { position:relative; width:44px; height:24px; flex-shrink:0; }
  .toggle-switch input { opacity:0; width:0; height:0; position:absolute; }
  .toggle-track { position:absolute; inset:0; background:var(--surface3); border-radius:12px; cursor:pointer; transition:background 0.2s; border:1px solid var(--border2); display:flex; align-items:center; justify-content:space-between; padding:0 4px; }
  .toggle-track .t-icon { font-size:11px; line-height:1; z-index:1; }
  .toggle-thumb { position:absolute; top:3px; left:3px; width:16px; height:16px; background:#fff; border-radius:50%; transition:transform 0.2s; box-shadow:0 1px 3px rgba(0,0,0,0.3); z-index:2; }
  .toggle-switch input:checked ~ .toggle-track { background:var(--accent-glow); border-color:rgba(249,115,22,0.3); }
  .toggle-switch input:checked ~ .toggle-thumb { transform:translateX(20px); background:var(--accent); }

  /* 2-BLOCK LAYOUT */
  .split-layout { display:flex; gap:0; height:calc(100vh - 61px); overflow:hidden; }
  .split-list { width:340px; min-width:280px; flex-shrink:0; border-right:1px solid var(--border); display:flex; flex-direction:column; overflow:hidden; }
  .split-list-toolbar { padding:12px 14px; border-bottom:1px solid var(--border); display:flex; flex-direction:column; gap:8px; flex-shrink:0; }
  .split-list-toolbar .toolbar { margin-bottom:0; }
  .split-list-items { flex:1; overflow-y:auto; }
  .split-list-item { padding:12px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.12s; position:relative; }
  .split-list-item:hover { background:var(--surface2); }
  .split-list-item.active { background:var(--accent-glow); border-left:3px solid var(--accent); padding-left:11px; }
  .split-list-item.active .sli-name { color:var(--accent); }
  .sli-name { font-size:13px; font-weight:500; color:var(--text); margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .sli-company { font-size:11px; color:var(--text3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:5px; }
  .sli-meta { display:flex; align-items:center; justify-content:space-between; gap:6px; }
  .sli-date { font-size:11px; color:var(--text3); }
  .sli-sp { display:flex; align-items:center; gap:4px; font-size:11px; color:var(--text3); }

  .split-detail { flex:1; display:flex; flex-direction:column; overflow:hidden; }
  .split-detail-placeholder { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; color:var(--text3); }
  .split-detail-placeholder .ph-emoji { font-size:42px; }
  .split-detail-placeholder .ph-title { font-size:15px; font-weight:500; color:var(--text2); }
  .split-detail-placeholder .ph-sub { font-size:13px; }

  .split-detail-header { padding:14px 20px 0; border-bottom:1px solid var(--border); flex-shrink:0; }
  .split-detail-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:10px; }
  .split-detail-name { font-family:'Syne',sans-serif; font-size:17px; font-weight:700; color:var(--text); }
  .split-detail-sub { font-size:12px; color:var(--text3); margin-top:2px; }
  .split-detail-actions { display:flex; gap:6px; flex-shrink:0; }
  .split-detail-tabs { display:flex; gap:2px; }
  .split-detail-tab { padding:7px 14px; font-size:13px; color:var(--text3); cursor:pointer; border-bottom:2px solid transparent; transition:all 0.15s; margin-bottom:-1px; }
  .split-detail-tab.active { color:var(--accent); border-bottom-color:var(--accent); font-weight:500; }
  .split-detail-tab:hover { color:var(--text); }
  .split-detail-body { flex:1; overflow-y:auto; padding:16px 20px; }
  .split-detail-footer { padding:12px 20px; border-top:1px solid var(--border); flex-shrink:0; }

  /* QUOTE SPLIT */
  .qsli-num { font-size:12px; font-family:monospace; background:var(--surface2); padding:2px 6px; border-radius:4px; color:var(--text); }
  .qsli-client { font-size:13px; font-weight:500; color:var(--text); margin:4px 0 2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .qsli-bottom { display:flex; align-items:center; justify-content:space-between; gap:6px; margin-top:4px; }
  .qsli-amount { font-size:12px; font-weight:600; color:var(--accent); }

  /* TASK SPLIT */
  .tsli-title { font-size:13px; font-weight:500; color:var(--text); margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .tsli-meta { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
  .tsli-lead { font-size:11px; color:var(--text3); }
  .split-list-item.task-overdue { border-left:3px solid var(--red) !important; }
  .split-list-item.task-overdue .tsli-title { color:var(--red); }
  .split-list-item.task-today { border-left:3px solid var(--amber) !important; }
  .split-list-item.task-today .tsli-title { color:var(--amber); }
  .split-list-item.task-done .tsli-title { text-decoration:line-through; color:var(--text3); }
  .today-focus-header { padding:10px 14px 6px; font-size:10px; color:var(--text3); letter-spacing:1.5px; text-transform:uppercase; border-bottom:1px solid var(--border); background:var(--surface2); }

  /* REMINDER CARDS */
  .reminder-card { background:var(--surface); border:1px solid var(--border2); border-radius:var(--radius); padding:16px 18px; margin-bottom:12px; }
  .reminder-card.urgent { border-color:rgba(240,92,92,0.35); background:rgba(240,92,92,0.04); }
  .reminder-card.warning { border-color:rgba(251,191,36,0.35); background:rgba(251,191,36,0.04); }
  .reminder-type-tag { display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:600; padding:2px 8px; border-radius:20px; margin-bottom:8px; }
  .reminder-type-tag.quote-followup { background:rgba(249,115,22,0.12); color:var(--accent); }
  .reminder-type-tag.quote-expiry { background:rgba(251,191,36,0.12); color:var(--amber); }
  .reminder-type-tag.lead-stagnant { background:rgba(232,121,160,0.12); color:var(--purple); }
  .reminder-type-tag.lead-noquote { background:rgba(79,142,247,0.12); color:var(--blue); }
  .reminder-title { font-size:14px; font-weight:600; color:var(--text); margin-bottom:3px; }
  .reminder-sub { font-size:12px; color:var(--text3); margin-bottom:12px; }
  .reminder-actions { display:flex; gap:8px; flex-wrap:wrap; }

  /* LOGIN REMINDER POPUP */
  .reminder-popup-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.75); z-index:99999; display:flex; align-items:center; justify-content:center; }
  .reminder-popup { background:var(--surface); border:1px solid var(--border2); border-radius:16px; width:480px; max-width:95vw; padding:0; overflow:hidden; }
  .reminder-popup-header { padding:18px 22px 14px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
  .reminder-popup-title { font-family:'Syne',sans-serif; font-size:16px; font-weight:700; }
  .reminder-popup-counter { font-size:12px; color:var(--text3); }
  .reminder-popup-body { padding:22px; }
  .reminder-popup-footer { padding:14px 22px; border-top:1px solid var(--border); display:flex; gap:8px; justify-content:flex-end; }

  /* SMART ALERTS CONFIG */
  .alert-config-row { display:flex; align-items:center; justify-content:space-between; padding:12px 0; border-bottom:1px solid var(--border); gap:16px; }
  .alert-config-row:last-child { border-bottom:none; }
  .alert-config-label { font-size:13px; font-weight:500; color:var(--text); }
  .alert-config-desc { font-size:11px; color:var(--text3); margin-top:2px; }
  .alert-config-controls { display:flex; align-items:center; gap:10px; flex-shrink:0; }
  .alert-threshold-input { width:52px; background:var(--surface2); border:1px solid var(--border2); border-radius:var(--radius-sm); padding:5px 8px; color:var(--text); font-size:13px; text-align:center; outline:none; font-family:'DM Sans',sans-serif; }
  .alert-threshold-input:focus { border-color:var(--accent); }
  .alert-unit { font-size:12px; color:var(--text3); }

  /* VIEW TOGGLE (List / Board) */
  .view-toggle { display:flex; background:var(--surface2); border:1px solid var(--border2); border-radius:var(--radius-sm); overflow:hidden; flex-shrink:0; }
  .view-toggle-btn { padding:7px 13px; font-size:12px; font-weight:500; color:var(--text3); cursor:pointer; display:flex; align-items:center; gap:6px; transition:all 0.15s; background:transparent; border:none; font-family:'DM Sans',sans-serif; }
  .view-toggle-btn svg { width:13px; height:13px; flex-shrink:0; }
  .view-toggle-btn.active { background:var(--accent); color:#000; }
  .view-toggle-btn:not(.active):hover { background:var(--surface3); color:var(--text); }

  /* KANBAN BOARD */
  .kanban-board { display:flex; gap:14px; padding:18px 22px; overflow-x:auto; overflow-y:hidden; flex:1; height:calc(100vh - 61px); align-items:stretch; }
  .kanban-col { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); width:268px; min-width:268px; flex-shrink:0; display:flex; flex-direction:column; overflow:hidden; }
  .kanban-col-header { padding:14px 14px 12px; border-bottom:1px solid var(--border); position:relative; flex-shrink:0; }
  .kanban-col-header::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; border-radius:var(--radius) var(--radius) 0 0; background:var(--stage-color, var(--accent)); }
  .kanban-col-title-row { display:flex; align-items:center; gap:8px; margin-bottom:5px; }
  .kanban-col-title { font-family:'Syne',sans-serif; font-size:13px; font-weight:700; color:var(--text); letter-spacing:0.2px; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .kanban-col-count { font-size:11px; font-weight:700; background:var(--surface3); color:var(--text2); border-radius:20px; padding:1px 8px; min-width:20px; text-align:center; flex-shrink:0; }
  .kanban-col-value { font-size:11px; color:var(--text3); }
  .kanban-col-body { flex:1; overflow-y:auto; padding:10px; display:flex; flex-direction:column; gap:8px; min-height:60px; transition:background 0.15s; }
  .kanban-col-body.drag-over { background:var(--accent-glow); box-shadow:inset 0 0 0 1px rgba(249,115,22,0.35); }
  .kanban-card { background:var(--surface2); border:1px solid var(--border2); border-radius:var(--radius-sm); padding:11px 12px; cursor:grab; transition:border-color 0.15s, box-shadow 0.15s, opacity 0.15s; }
  .kanban-card:active { cursor:grabbing; }
  .kanban-card:hover { border-color:var(--accent); box-shadow:0 2px 10px rgba(0,0,0,0.25); }
  .kanban-card.dragging { opacity:0.35; }
  .kanban-card-name { font-size:13px; font-weight:600; color:var(--text); margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .kanban-card-company { font-size:11px; color:var(--text3); margin-bottom:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .kanban-card-bottom { display:flex; align-items:center; justify-content:space-between; gap:6px; }
  .kanban-card-value { font-size:12px; font-weight:600; color:var(--accent); }
  .kanban-col-empty { padding:22px 8px; text-align:center; color:var(--text3); font-size:11.5px; }
