  :root {
    --navy: #0f1f38;
    --navy2: #1a3256;
    --teal: #0ea5c9;
    --teal2: #0284a8;
    --gold: #f0a500;
    --green: #22c55e;
    --red: #ef4444;
    --amber: #f59e0b;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface2: #f0f4f9;
    --border: #dde3ee;
    --text: #1a2440;
    --muted: #6b7a99;
    --shadow: 0 2px 16px rgba(15,31,56,0.09);
    --shadow-lg: 0 8px 32px rgba(15,31,56,0.14);
    --radius: 12px;
  }
  *, *::before, *::after { 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; }

  /* SIDEBAR */
  #sidebar {
    width: 240px; min-height: 100vh; background: var(--navy);
    display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
    box-shadow: 4px 0 24px rgba(15,31,56,0.18);
    overflow-y: auto;
  }
  .sidebar-logo {
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .sidebar-logo h1 { font-family: 'DM Serif Display', serif; color: #fff; font-size: 1.45rem; letter-spacing: -0.3px; }
  .sidebar-logo span { color: var(--teal); }
  .sidebar-logo p { font-size: 0.7rem; color: rgba(255,255,255,0.4); margin-top: 2px; letter-spacing: 1.5px; text-transform: uppercase; }
  .nav-section { padding: 16px 12px 8px; }
  .nav-section-label { font-size: 0.62rem; letter-spacing: 1.8px; text-transform: uppercase; color: rgba(255,255,255,0.28); padding: 0 12px; margin-bottom: 6px; }
  .nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
    color: rgba(255,255,255,0.65); font-size: 0.875rem; font-weight: 500; cursor: pointer;
    transition: all 0.15s; margin-bottom: 2px;
  }
  .nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
  .nav-item.active { background: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(14,165,201,0.35); }
  .nav-item .icon { width: 18px; text-align: center; font-size: 1rem; }
  .sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
  .sidebar-footer .user { display: flex; align-items: center; gap: 10px; }
  .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 0.8rem; flex-shrink: 0; }
  .user-info p { font-size: 0.8rem; font-weight: 600; color: #fff; }
  .user-info span { font-size: 0.7rem; color: rgba(255,255,255,0.4); }

  /* MAIN */
  #main { margin-left: 240px; flex: 1; min-height: 100vh; }
  .topbar {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0 32px; height: 64px; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 8px rgba(15,31,56,0.05);
  }
  .topbar-title { font-family: 'DM Serif Display', serif; font-size: 1.4rem; color: var(--navy); }
  .topbar-actions { display: flex; gap: 10px; align-items: center; }
  .page { display: none; padding: 32px; }
  .page.active { display: block; }

  /* BUTTONS */
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; }
  .btn-primary { background: var(--teal); color: #fff; }
  .btn-primary:hover { background: var(--teal2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(14,165,201,0.3); }
  .btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { background: var(--border); }
  .btn-danger { background: #fee2e2; color: var(--red); }
  .btn-danger:hover { background: var(--red); color: #fff; }
  .btn-sm { padding: 5px 12px; font-size: 0.8rem; }
  .btn-gold { background: var(--gold); color: #fff; }
  .btn-gold:hover { background: #d4920a; }

  /* CARDS & STATS */
  .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
  .stat-card {
    background: var(--surface); border-radius: var(--radius); padding: 22px 24px;
    box-shadow: var(--shadow); border: 1px solid var(--border); position: relative; overflow: hidden;
  }
  .stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--teal); }
  .stat-card.gold::before { background: var(--gold); }
  .stat-card.green::before { background: var(--green); }
  .stat-card.amber::before { background: var(--amber); }
  .stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
  .stat-value { font-family: 'DM Serif Display', serif; font-size: 2rem; color: var(--navy); }
  .stat-sub { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
  .stat-icon { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 2rem; opacity: 0.12; }

  .card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
  .card-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .card-header h3 { font-family: 'DM Serif Display', serif; font-size: 1.1rem; color: var(--navy); }
  .card-body { padding: 0; }

  /* TABLE */
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
  thead th { background: var(--surface2); padding: 11px 18px; text-align: left; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border-bottom: 1px solid var(--border); }
  tbody td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  tbody tr:last-child td { border-bottom: none; }
  tbody tr:hover { background: var(--surface2); }

  /* BADGES */
  .badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px; }
  .badge-green { background: #dcfce7; color: #166534; }
  .badge-blue { background: #dbeafe; color: #1e40af; }
  .badge-amber { background: #fef3c7; color: #92400e; }
  .badge-red { background: #fee2e2; color: #991b1b; }
  .badge-purple { background: #ede9fe; color: #5b21b6; }
  .badge-gray { background: #f3f4f6; color: #374151; }
  .badge-teal { background: #e0f7fa; color: #00695c; }

  /* MODAL */
  .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,31,56,0.55); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
  .modal-overlay.open { display: flex; }
  .modal { background: var(--surface); border-radius: 16px; width: 560px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
  .modal-header { padding: 24px 28px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .modal-header h2 { font-family: 'DM Serif Display', serif; font-size: 1.25rem; color: var(--navy); }
  .modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); padding: 4px; line-height: 1; border-radius: 6px; }
  .modal-close:hover { background: var(--surface2); color: var(--text); }
  .modal-body { padding: 24px 28px; }
  .modal-footer { padding: 16px 28px 24px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); }

  /* FORMS */
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
  .form-row.one { grid-template-columns: 1fr; }
  .form-group { display: flex; flex-direction: column; gap: 5px; }
  .form-group label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
  .form-group input, .form-group select, .form-group textarea {
    padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
    font-family: 'DM Sans', sans-serif; font-size: 0.875rem; color: var(--text); background: var(--surface);
    transition: border-color 0.15s;
  }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--teal); }

  /* SPLIT BUILDER */
  .split-section { margin-top: 20px; padding-top: 20px; border-top: 2px dashed var(--border); }
  .split-section h4 { font-family: 'DM Serif Display', serif; font-size: 1rem; margin-bottom: 14px; color: var(--navy2); }
  .split-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; background: var(--surface2); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); }
  .split-row select { flex: 1; }
  .split-row input[type=number] { width: 90px; }
  .split-pct-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
  .split-total { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600; padding: 8px 14px; border-radius: 8px; margin-top: 8px; }
  .split-total.ok { background: #dcfce7; color: #166534; }
  .split-total.warn { background: #fee2e2; color: #991b1b; }

  /* DASHBOARD CHART AREA */
  .chart-placeholder { background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%); border-radius: 10px; padding: 28px; color: rgba(255,255,255,0.8); position: relative; overflow: hidden; min-height: 180px; display: flex; flex-direction: column; justify-content: flex-end; }
  .chart-placeholder::before { content: ''; position: absolute; top: -30px; right: -30px; width: 200px; height: 200px; border-radius: 50%; background: rgba(14,165,201,0.15); }
  .chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 80px; }
  .chart-bar { flex: 1; background: rgba(14,165,201,0.4); border-radius: 4px 4px 0 0; transition: all 0.3s; cursor: pointer; position: relative; }
  .chart-bar:hover { background: rgba(14,165,201,0.8); }
  .chart-bar .bar-label { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 0.62rem; color: rgba(255,255,255,0.5); white-space: nowrap; }
  .chart-bar .bar-val { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 0.65rem; color: rgba(255,255,255,0.7); white-space: nowrap; }
  .chart-title { font-family: 'DM Serif Display', serif; font-size: 1rem; color: #fff; margin-bottom: 28px; }

  /* TWO COL */
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

  /* SEARCH BAR */
  .search-bar { position: relative; }
  .search-bar input { padding-left: 34px; width: 240px; }
  .search-bar::before { content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 0.8rem; }

  /* PIPELINE VIEW */
  .pipeline { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
  .pipeline-col { flex: 0 0 200px; }
  .pipeline-col-header { padding: 10px 14px; border-radius: 8px 8px 0 0; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
  .pipeline-cards { min-height: 200px; padding: 8px; background: var(--surface2); border-radius: 0 0 8px 8px; border: 1px solid var(--border); border-top: none; display: flex; flex-direction: column; gap: 8px; }
  .pipeline-card { background: var(--surface); border-radius: 8px; padding: 12px; border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.06); font-size: 0.8rem; cursor: pointer; }
  .pipeline-card:hover { border-color: var(--teal); box-shadow: 0 2px 8px rgba(14,165,201,0.15); }
  .pipeline-card .pc-name { font-weight: 700; color: var(--navy); margin-bottom: 4px; }
  .pipeline-card .pc-carrier { color: var(--muted); font-size: 0.72rem; }
  .pipeline-card .pc-val { margin-top: 6px; font-weight: 700; color: var(--teal); }

  /* TABS */
  .tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
  .tab { padding: 10px 20px; font-size: 0.875rem; font-weight: 600; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; border-radius: 6px 6px 0 0; }
  .tab:hover { color: var(--text); background: var(--surface2); }
  .tab.active { color: var(--teal); border-bottom-color: var(--teal); background: var(--surface); }

  /* AGENT CARD */
  .agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .agent-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 20px; transition: all 0.15s; }
  .agent-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .agent-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
  .agent-avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.95rem; color: #fff; flex-shrink: 0; }
  .agent-name { font-weight: 700; color: var(--navy); }
  .agent-role { font-size: 0.75rem; color: var(--muted); }
  .agent-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .agent-stat { background: var(--surface2); border-radius: 6px; padding: 8px 10px; }
  .agent-stat-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
  .agent-stat-val { font-weight: 700; font-size: 0.95rem; color: var(--navy); margin-top: 2px; }

  /* COMMISSION DETAIL */
  .commission-split-visual { background: linear-gradient(135deg, #f0f7ff, #e8f5e9); border-radius: 10px; padding: 20px; margin-top: 12px; border: 1px solid var(--border); }
  .split-flow { display: flex; flex-direction: column; gap: 8px; }
  .split-node { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
  .split-node-name { font-weight: 600; font-size: 0.875rem; }
  .split-node-type { font-size: 0.7rem; color: var(--muted); }
  .split-node-amount { font-family: 'DM Serif Display', serif; font-size: 1.1rem; color: var(--navy); }
  .split-arrow { text-align: center; color: var(--muted); font-size: 1rem; }

  /* TOAST */
  #toast { position: fixed; bottom: 28px; right: 28px; background: var(--navy); color: #fff; padding: 14px 20px; border-radius: 10px; font-size: 0.875rem; font-weight: 500; z-index: 9999; transform: translateY(100px); opacity: 0; transition: all 0.3s; box-shadow: var(--shadow-lg); border-left: 4px solid var(--teal); max-width: 320px; }
  #toast.show { transform: translateY(0); opacity: 1; }

  /* EMPTY STATE */
  .empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
  .empty-state .emoji { font-size: 3rem; margin-bottom: 12px; }
  .empty-state p { font-size: 0.9rem; }

  /* SCROLLBAR */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  @media (max-width: 900px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .agent-grid { grid-template-columns: 1fr 1fr; }
    .two-col, .three-col { grid-template-columns: 1fr; }
  }

  /* ===== AUTH SCREENS ===== */
  #auth-wrapper {
    display: none; position: fixed; inset: 0; z-index: 2000;
    background: linear-gradient(135deg, #0a1628 0%, #0f1f38 45%, #0a2a3a 100%);
    align-items: center; justify-content: center;
  }
  #auth-wrapper.visible { display: flex; }
  #auth-wrapper::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(14,165,201,0.12) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(240,165,0,0.07) 0%, transparent 50%);
    pointer-events: none;
  }
  .auth-card {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px; width: 420px; max-width: 95vw;
    backdrop-filter: blur(20px); box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    overflow: hidden; position: relative; z-index: 1;
  }
  .auth-card-header {
    background: linear-gradient(135deg, rgba(14,165,201,0.15), rgba(14,165,201,0.05));
    padding: 36px 36px 28px; border-bottom: 1px solid rgba(255,255,255,0.07); text-align: center;
  }
  .auth-logo { font-family: 'DM Serif Display', serif; font-size: 2rem; color: #fff; letter-spacing: -0.5px; }
  .auth-logo span { color: var(--teal); }
  .auth-logo-sub { font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,0.35); margin-top: 4px; }
  .auth-card-body { padding: 32px 36px; }
  .auth-title { font-family: 'DM Serif Display', serif; color: #fff; font-size: 1.35rem; margin-bottom: 6px; }
  .auth-subtitle { font-size: 0.82rem; color: rgba(255,255,255,0.45); margin-bottom: 24px; }
  .auth-form-group { margin-bottom: 16px; }
  .auth-form-group label { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.5); margin-bottom: 7px; }
  .auth-form-group input {
    width: 100%; padding: 12px 14px; background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.12); border-radius: 9px;
    font-family: 'DM Sans', sans-serif; font-size: 0.9rem; color: #fff;
    transition: border-color 0.2s, background 0.2s;
  }
  .auth-form-group input::placeholder { color: rgba(255,255,255,0.25); }
  .auth-form-group input:focus { outline: none; border-color: var(--teal); background: rgba(14,165,201,0.08); }
  .auth-form-group input.error { border-color: var(--red); }
  .auth-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 10px 14px; font-size: 0.82rem; color: #fca5a5; margin-bottom: 16px; display: none; }
  .auth-error.show { display: block; }
  .auth-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); border-radius: 8px; padding: 10px 14px; font-size: 0.82rem; color: #86efac; margin-bottom: 16px; display: none; }
  .auth-success.show { display: block; }
  .btn-auth { width: 100%; padding: 13px; background: var(--teal); color: #fff; border: none; border-radius: 9px; font-family: 'DM Sans', sans-serif; font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: all 0.2s; margin-top: 4px; letter-spacing: 0.3px; }
  .btn-auth:hover { background: var(--teal2); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(14,165,201,0.4); }
  .btn-auth:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
  .auth-link { text-align: center; margin-top: 18px; font-size: 0.82rem; color: rgba(255,255,255,0.35); }
  .auth-link a { color: var(--teal); text-decoration: none; font-weight: 600; cursor: pointer; }
  .auth-link a:hover { text-decoration: underline; }
  .auth-step { display: none; }
  .auth-step.active { display: block; }
  .otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
  .otp-input {
    width: 52px; height: 58px; text-align: center; font-size: 1.5rem; font-weight: 800;
    background: rgba(255,255,255,0.06); border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 10px; color: #fff; font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
  }
  .otp-input:focus { outline: none; border-color: var(--teal); background: rgba(14,165,201,0.1); box-shadow: 0 0 0 3px rgba(14,165,201,0.2); }
  .otp-input.filled { border-color: var(--teal); }
  .otp-email-display { text-align: center; font-size: 0.82rem; color: rgba(255,255,255,0.45); margin-bottom: 8px; }
  .otp-email-display strong { color: var(--teal); }
  .resend-link { text-align: center; font-size: 0.8rem; color: rgba(255,255,255,0.35); margin-top: 12px; }
  .resend-link a { color: var(--teal); cursor: pointer; font-weight: 600; }
  .resend-link a:hover { text-decoration: underline; }
  .auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
  .auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }
  .auth-divider span { font-size: 0.72rem; color: rgba(255,255,255,0.25); white-space: nowrap; }
  /* password strength */
  .pw-strength { margin-top: 6px; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.1); overflow: hidden; }
  .pw-strength-bar { height: 100%; border-radius: 2px; transition: all 0.3s; width: 0%; }
  .pw-strength-label { font-size: 0.7rem; color: rgba(255,255,255,0.35); margin-top: 4px; }
  /* password toggle eye */
  .pw-field-wrap { position: relative; }
  .pw-field-wrap input,
  .auth-form-group .pw-field-wrap input { width: 100%; padding-right: 42px !important; box-sizing: border-box; }
  .pw-eye {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 1.1rem;
    color: rgba(255,255,255,0.5); padding: 4px 6px; line-height: 1;
    transition: color 0.15s; z-index: 10;
  }
  .pw-eye:hover { color: rgba(255,255,255,0.9); }
  /* eye toggle for light modal fields */
  .pw-field-wrap-light { position: relative; }
  .pw-field-wrap-light input { width: 100%; padding-right: 42px !important; box-sizing: border-box; }
  .pw-eye-light {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 1.1rem;
    color: var(--muted); padding: 4px 6px; line-height: 1; transition: color 0.15s; z-index: 10;
  }
  .pw-eye-light:hover { color: var(--text); }

  /* ===== LEAD MODAL ===== */
  .lead-section-header {
    font-size:0.72rem; font-weight:800; text-transform:uppercase; letter-spacing:1.5px;
    color:#fff; background:linear-gradient(135deg,var(--navy),var(--navy2));
    padding:8px 14px; border-radius:6px; margin:18px 0 12px;
  }
  .lead-radio-opt {
    display:flex; align-items:center; gap:7px; font-size:0.875rem; font-weight:600;
    cursor:pointer; padding:6px 12px; border-radius:8px; border:1.5px solid var(--border);
    background:var(--surface2); transition:all 0.15s;
  }
  .lead-radio-opt:has(input:checked) { border-color:var(--teal); background:rgba(14,165,201,0.08); color:var(--teal); }
  .lead-radio-opt input { accent-color:var(--teal); }
  .ins-step-row { display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:8px; border:1.5px solid var(--border); background:var(--surface); transition:all 0.2s; cursor:pointer; }
  .ins-step-row:has(input:checked) { border-color:var(--green); background:rgba(34,197,94,0.06); }
  .ins-step-row.all-complete { border-color:var(--gold); background:rgba(240,165,0,0.08); }
  .ins-step-label { flex:1; font-size:0.875rem; font-weight:600; }
  .ins-step-date { font-size:0.78rem; color:var(--muted); }
  /* ===== USER MANAGEMENT ===== */
  .user-table-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.78rem; color: #fff; flex-shrink: 0; }
  .role-badge-admin { background: #fef3c7; color: #92400e; }
  .role-badge-agent { background: #dbeafe; color: #1e40af; }
  .role-badge-viewer { background: #f3f4f6; color: #374151; }
  .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
  .status-dot.active { background: var(--green); }
  .status-dot.inactive { background: var(--muted); }

  /* ── Commission Split Tree ── */
  .cl-line-card { background:var(--surface); border:1.5px solid var(--border); border-radius:12px; margin-bottom:18px; overflow:hidden; }
  .cl-line-header { background:linear-gradient(135deg,var(--navy),var(--navy2)); padding:11px 16px; display:flex; align-items:center; justify-content:space-between; }
  .cl-line-header-title { color:#fff; font-size:0.82rem; font-weight:700; letter-spacing:0.5px; }
  .cl-line-fields { padding:14px 16px; display:grid; grid-template-columns:repeat(6,1fr); gap:10px; border-bottom:1px solid var(--border); }
  .cl-line-fields .form-group label { font-size:0.65rem; }
  .cl-split-tree { padding:16px; background:var(--surface2); }
  .cl-split-tree-label { font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin-bottom:12px; }

  /* Tree node rows */
  .st-row { display:flex; align-items:center; gap:8px; padding:8px 12px; border-radius:8px; background:var(--surface); border:1.5px solid var(--border); margin-bottom:6px; position:relative; }
  .st-row.is-you  { border-left:4px solid var(--teal);   background:rgba(14,165,201,0.04); }
  .st-row.is-agency { border-left:4px solid var(--gold); }
  .st-row.is-agent  { border-left:4px solid var(--green); }
  .st-row.is-keep   { border-left:4px solid #8b5cf6; background:rgba(139,92,246,0.04); }
  .st-indent { flex-shrink:0; display:flex; align-items:center; }
  .st-indent-line { width:20px; height:2px; background:var(--border); margin-right:4px; }
  .st-type-badge { font-size:0.7rem; font-weight:700; padding:2px 8px; border-radius:20px; white-space:nowrap; flex-shrink:0; }
  .st-type-you    { background:rgba(14,165,201,0.15); color:var(--teal); }
  .st-type-agency { background:rgba(240,165,0,0.15);  color:#b45309; }
  .st-type-agent  { background:rgba(34,197,94,0.15);  color:#166534; }
  .st-type-keep   { background:rgba(139,92,246,0.15); color:#5b21b6; }
  .st-entity-sel  { flex:1; min-width:110px; padding:5px 8px; border:1.5px solid var(--border); border-radius:6px; font-size:0.8rem; background:var(--surface); }
  .st-pct-wrap    { display:flex; flex-direction:column; align-items:flex-end; gap:1px; flex-shrink:0; }
  .st-pct-input   { width:62px; padding:5px 8px; border:1.5px solid var(--border); border-radius:6px; font-size:0.82rem; text-align:right; }
  .st-pct-hint    { font-size:0.62rem; color:var(--muted); white-space:nowrap; }
  .st-dollars     { font-size:0.82rem; font-weight:800; min-width:72px; text-align:right; white-space:nowrap; flex-shrink:0; }
  .st-dollars.col-you    { color:var(--teal); }
  .st-dollars.col-agency { color:#b45309; }
  .st-dollars.col-agent  { color:#166534; }
  .st-dollars.col-keep   { color:#5b21b6; }
  .st-actions     { display:flex; gap:4px; flex-shrink:0; }
  .st-add-btn { background:none; border:1px dashed var(--border); border-radius:5px; padding:3px 8px; font-size:0.7rem; color:var(--muted); cursor:pointer; white-space:nowrap; transition:all 0.15s; }
  .st-add-btn:hover { border-color:var(--teal); color:var(--teal); background:rgba(14,165,201,0.06); }
  .st-del-btn { background:none; border:none; cursor:pointer; color:var(--muted); font-size:0.95rem; padding:2px 5px; line-height:1; }
  .st-del-btn:hover { color:var(--red); }
  .st-warn { font-size:0.7rem; color:var(--red); font-weight:700; margin-bottom:4px; }
  .st-remain { font-size:0.7rem; color:var(--muted); margin-bottom:8px; padding-left:8px; }
  .st-remain strong { color:var(--navy); }
  .st-summary { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; padding-top:10px; border-top:1px dashed var(--border); }

  /* ── Commission Batches ── */
  .invoice-doc { font-family:'DM Sans',sans-serif; max-width:620px; margin:0 auto; padding:20px; }
  .inv-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:24px; padding-bottom:16px; border-bottom:2px solid var(--navy); }
  .inv-agency-name { font-family:'DM Serif Display',serif; font-size:1.6rem; color:var(--navy); }
  .inv-meta { text-align:right; font-size:0.82rem; color:var(--muted); }
  .inv-meta strong { color:var(--navy); font-size:1rem; display:block; margin-bottom:4px; }
  .inv-to { background:var(--surface2); border-radius:8px; padding:14px 16px; margin-bottom:18px; }
  .inv-to-label { font-size:0.68rem; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin-bottom:4px; }
  .inv-to-name { font-size:1rem; font-weight:700; color:var(--navy); }
  .inv-to-sub  { font-size:0.8rem; color:var(--muted); }
  .inv-table   { width:100%; border-collapse:collapse; margin-bottom:18px; font-size:0.84rem; }
  .inv-table th { padding:8px 10px; background:var(--navy); color:#fff; font-size:0.7rem; text-transform:uppercase; letter-spacing:0.8px; text-align:left; }
  .inv-table td { padding:9px 10px; border-bottom:1px solid var(--border); }
  .inv-total-row { display:flex; justify-content:flex-end; }
  .inv-total-box { background:var(--navy); color:#fff; border-radius:8px; padding:14px 20px; text-align:right; min-width:200px; }
  .inv-total-label { font-size:0.72rem; opacity:0.6; text-transform:uppercase; letter-spacing:1px; }
  .inv-total-amount { font-family:'DM Serif Display',serif; font-size:1.8rem; color:var(--teal); margin-top:2px; }
  .inv-footer { margin-top:24px; padding-top:14px; border-top:1px solid var(--border); font-size:0.75rem; color:var(--muted); text-align:center; }
  .inv-status-badge { display:inline-block; padding:3px 10px; border-radius:20px; font-size:0.7rem; font-weight:700; }
  .inv-sent   { background:rgba(14,165,201,0.12); color:var(--teal); }
  .inv-unsent { background:rgba(156,163,175,0.15); color:#6b7280; }
  .inv-paid   { background:rgba(34,197,94,0.12); color:#166534; }
  .inv-unpaid { background:rgba(245,158,11,0.12); color:#92400e; }
  .recipient-split-row { display:flex; justify-content:space-between; padding:5px 0; border-bottom:1px dashed var(--border); font-size:0.82rem; }
  .recipient-split-row:last-child { border-bottom:none; }
  @media print {
    .modal-overlay, nav, #sidebar, .modal-header, .modal-footer, .btn { display:none !important; }
    .invoice-doc { max-width:100%; padding:0; }
    body { background:#fff; }
  }

/* Google Places autocomplete dropdown — show above modals */
.pac-container { z-index: 100000 !important; }

