:root {
    --bg-deep:       #06080f;
    --bg-surface:    rgba(255,255,255,0.035);
    --bg-surface-2:  rgba(255,255,255,0.055);
    --glass:         rgba(255,255,255,0.04);
    --glass-border:  rgba(255,255,255,0.08);
    --glass-hover:   rgba(255,255,255,0.07);
    --text-primary:  #f0f2f5;
    --text-secondary:rgba(255,255,255,0.5);
    --text-tertiary: rgba(255,255,255,0.35);
    --accent-blue:   #e8423f;
    --accent-cyan:   #00d4ff;
    --accent-purple: #a855f7;
    --accent-amber:  #f59e0b;
    --accent-red:    #ef4444;
    --accent-green:  #22c55e;
    --smooth:        cubic-bezier(0.4, 0, 0.2, 1);
    --spring:        cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Map pin colors — functional, not decorative */
    --sold-pin:      #EF4444;
    --replace-pin:   #EF4444;
    --monitor-pin:   #F59E0B;
    --current-pin:   #22C55E;
    --fc-pin:        #4f8fff;
    --other-pin:     #4f8fff;
    --usfa-pin:      #06B6D4;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Animated background ─────────────────────────── */
.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-canvas::before, .bg-canvas::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.28;
    animation: drift 20s ease-in-out infinite alternate;
    will-change: transform;
}

.bg-canvas::before {
    width: 840px; height: 840px;
    background: radial-gradient(circle, var(--accent-blue), transparent 55%);
    top: -320px; left: -220px;
}

.bg-canvas::after {
    width: 740px; height: 740px;
    background: radial-gradient(circle, var(--accent-purple), transparent 55%);
    bottom: -270px; right: -220px;
    animation-delay: -10s;
    animation-duration: 25s;
}

.bg-orb-3 {
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-cyan), transparent 55%);
    opacity: 0.15;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation: drift2 18s ease-in-out infinite alternate;
}

@keyframes drift  { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(80px,40px) scale(1.15); } }
@keyframes drift2 { 0% { transform: translate(-50%,-50%) scale(1); } 100% { transform: translate(-40%,-60%) scale(1.2); } }

/* ── Top bar ─────────────────────────────────────── */
#topbar {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 56px;
    gap: 16px;
    flex-shrink: 0;
    background: rgba(6,8,15,0.72);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.4s ease, border-color 0.4s ease, backdrop-filter 0.4s ease;
}
#topbar.transparent {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding-top: 20px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom-color: transparent;
}

.wordmark {
    display: flex;
    flex-direction: column;
    line-height: 1;
    cursor: default;
    user-select: none;
}

.wordmark-text {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 3px;
}
.shiny-text {
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0.7) 0%,
        rgba(255,255,255,0.7) 40%,
        rgba(232,66,63,1) 50%,
        rgba(255,255,255,0.7) 60%,
        rgba(255,255,255,0.7) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shinySlide 3s ease-in-out infinite;
}
@keyframes shinySlide {
    0% { background-position: 100% 50%; }
    100% { background-position: -100% 50%; }
}

.wordmark-sub {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-tertiary);
    letter-spacing: 0.3px;
    margin-top: 1px;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--glass-border);
    flex-shrink: 0;
}

.topbar-center { flex: 1; }

#nav {
    display: flex;
    gap: 4px;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s var(--smooth);
    display: flex;
    align-items: center;
    gap: 7px;
}

.nav-btn svg {
    width: 14px; height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.nav-btn:hover {
    background: var(--glass);
    color: var(--text-primary);
    border-color: var(--glass-border);
}

.nav-btn.active {
    background: rgba(232,66,63,0.12);
    border-color: rgba(232,66,63,0.28);
    color: var(--accent-blue);
}

#topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

#last-updated {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Main layout ─────────────────────────────────── */
#content {
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.view { display: none; width: 100%; height: 100%; }
.view.active {
    display: flex;
    animation: viewFadeIn 0.35s var(--smooth) both;
}
@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── MAP VIEW ────────────────────────────────────── */
#map-view { position: relative; flex-direction: row !important; }

#map-area { position: relative; flex: 1; overflow: hidden; min-width: 0; }
#map { width: 100%; height: 100%; }

/* ── Side List ────────────────────────────────────── */
#side-list {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(8,10,20,0.95);
    border-left: 1px solid var(--glass-border);
    transition: width 0.3s var(--smooth), opacity 0.3s;
    overflow: hidden;
    order: 1; /* right side */
}
#map-area { order: 0; }
#side-list.collapsed { width: 0; border-left: none; }

.sl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.sl-header-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sl-header-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}
.sl-collapse-btn {
    background: none;
    border: 1px solid var(--glass-border);
    color: var(--text-tertiary);
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}
.sl-collapse-btn:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); }

.sl-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.sl-body::-webkit-scrollbar { width: 4px; }
.sl-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.sl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    cursor: pointer;
    transition: background 0.12s;
    min-height: 44px;
}
.sl-row:hover { background: rgba(255,255,255,0.04); }
.sl-row.sl-active { background: rgba(232,66,63,0.08); border-left: 2px solid var(--accent-blue); }

.sl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sl-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.sl-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sl-meta {
    font-size: 10px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.sl-score {
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    text-align: right;
    min-width: 28px;
}
.sl-metric {
    font-size: 10px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    text-align: right;
    min-width: 55px;
    font-variant-numeric: tabular-nums;
}

.sl-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 12px;
    gap: 6px;
}

/* Toggle button when collapsed */
#sl-expand-btn {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    z-index: 500;
    display: none;
    width: 32px;
    height: 64px;
    background: rgba(8,10,20,0.9);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(12px);
}
#sl-expand-btn:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); }

/* Pin highlight on hover */
.ember.pin-highlight svg {
    filter: brightness(2) drop-shadow(0 0 8px currentColor) !important;
    transform: scale(1.5);
    transition: all 0.2s ease;
}

@media (max-width: 900px) {
    #side-list { display: none; }
    #sl-expand-btn { display: none !important; }
}

/* ── Map legend (bottom-left) ──────────────────────── */
#map-legend {
    position: absolute;
    bottom: 28px;
    left: 16px;
    z-index: 500;
    background: rgba(6,8,15,0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    gap: 14px;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.legend-set { display: flex; align-items: center; gap: 16px; }
.legend-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.legend-entry .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-entry .legend-count {
    font-size: 10px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

#map-legend-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: rgba(6,8,15,0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 16px;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
}

#map-legend:hover #map-legend-tooltip { display: block; }

#map-legend-tooltip .tip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

#map-legend-tooltip .tip-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
}

#map-legend-tooltip .tip-desc {
    color: var(--text-tertiary);
}

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

/* ── Detail panel ─────────────────────────────────── */
#detail-panel {
    position: fixed;
    top: 56px;
    right: -440px;
    width: 420px;
    height: calc(100vh - 56px);
    background: rgba(8,10,20,0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--glass-border);
    z-index: 600;
    transition: right 0.3s var(--smooth);
    overflow-y: auto;
    padding: 56px 20px 20px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

#detail-panel.open { right: 0; }

#detail-panel::-webkit-scrollbar { width: 4px; }
#detail-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

#panel-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-tertiary);
    width: 28px;
    height: 28px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--smooth);
    font-family: inherit;
}

#panel-close:hover { color: var(--text-primary); background: var(--glass-hover); border-color: rgba(255,255,255,0.15); }

#panel-nav {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}
.panel-nav-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-tertiary);
    width: 28px;
    height: 28px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--smooth);
    font-family: inherit;
    padding: 0;
}
.panel-nav-btn:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--glass-hover);
    border-color: rgba(255,255,255,0.15);
}
.panel-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
#panel-nav-counter {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 0 6px;
    font-variant-numeric: tabular-nums;
}

.panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.badge-replace    { background: rgba(239,68,68,0.1);  color: #EF4444; border: 1px solid rgba(239,68,68,0.25); }
.badge-monitor    { background: rgba(245,158,11,0.1); color: #F59E0B; border: 1px solid rgba(245,158,11,0.25); }
.badge-current    { background: rgba(34,197,94,0.1);  color: #22C55E; border: 1px solid rgba(34,197,94,0.25); }
.badge-fc_lead    { background: rgba(79,143,255,0.1); color: #4f8fff; border: 1px solid rgba(79,143,255,0.25); }
.badge-other_lead { background: rgba(79,143,255,0.1); color: #4f8fff; border: 1px solid rgba(79,143,255,0.25); }
.badge-usfa_dept  { background: rgba(6,182,212,0.1); color: #06B6D4; border: 1px solid rgba(6,182,212,0.25); }

.panel-name     { font-size: 16px; font-weight: 700; margin-bottom: 3px; letter-spacing: -0.2px; }
.panel-location { font-size: 12px; color: var(--text-tertiary); margin-bottom: 14px; }

/* Create Pre-Call Dossier CTA */
.dossier-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, rgba(232,66,63,0.18), rgba(245,158,11,0.14));
    border: 1px solid rgba(232,66,63,0.32);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.18s ease;
    font-family: inherit;
}
.dossier-btn:hover {
    background: linear-gradient(135deg, rgba(232,66,63,0.28), rgba(245,158,11,0.22));
    border-color: rgba(232,66,63,0.55);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(232,66,63,0.18);
}
.dossier-btn:active { transform: translateY(0); }
.dossier-btn:disabled { opacity: 0.55; cursor: wait; }
.dossier-btn.loading .dossier-btn-arrow { animation: dossier-pulse 1s ease-in-out infinite; }
@keyframes dossier-pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

.dossier-btn-icon {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: center;
    color: #F59E0B;
    font-size: 16px;
}
.dossier-btn-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.dossier-btn-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.1px;
    color: var(--text-primary);
}
.dossier-btn-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.1px;
}
.dossier-btn-arrow {
    flex-shrink: 0;
    font-size: 22px;
    color: rgba(255,255,255,0.4);
    line-height: 1;
    transition: transform 0.18s ease;
}
.dossier-btn:hover .dossier-btn-arrow { transform: translateX(2px); color: #F59E0B; }

.panel-section { margin-bottom: 18px; }

.panel-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--glass-border);
}

.panel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
}

.panel-row .label { color: var(--text-tertiary); }
.panel-row .value { font-weight: 500; text-align: right; }

.replacement-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.chip-due { background: rgba(239,68,68,0.12); color: #EF4444; border: 1px solid rgba(239,68,68,0.2); }
.chip-ok  { background: rgba(34,197,94,0.1);  color: #22C55E; border: 1px solid rgba(34,197,94,0.2); }

/* ── Status chips ──────────────────────────────── */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.status-replace { background: rgba(239,68,68,0.12);  color: #EF4444; border: 1px solid rgba(239,68,68,0.2); }
.status-monitor { background: rgba(245,158,11,0.1);  color: #F59E0B; border: 1px solid rgba(245,158,11,0.2); }
.status-current { background: rgba(34,197,94,0.1);   color: #22C55E; border: 1px solid rgba(34,197,94,0.2); }

/* ── Search bar ──────────────────────────────────── */
#map-search {
    position: relative;
    padding: 8px 14px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

#search-input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s var(--smooth);
}

#search-input::placeholder { color: var(--text-tertiary); }
#search-input:focus { border-color: var(--accent-blue); }

#search-icon {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

#search-clear {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    display: none;
    padding: 2px 4px;
}
#search-clear:hover { color: var(--text-primary); }

#search-results {
    margin-top: 4px;
    background: rgba(6,8,15,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.search-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.15s var(--smooth);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--glass-hover); }
.search-item-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.search-item-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* ── View switcher ──────────────────────────────── */
#view-switcher {
    position: absolute;
    top: 16px;
    left: 66px;
    z-index: 500;
    display: flex;
    background: rgba(6,8,15,0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.view-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--smooth);
}
.view-btn:hover { color: var(--text-primary); }
.view-btn.active {
    background: var(--accent-blue);
    color: #fff;
}

/* ── Filter controls ─────────────────────────────── */
#filter-controls,
#prospect-filter-controls {
    position: absolute;
    top: 16px;
    left: 260px;
    z-index: 500;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.filter-dropdown {
    position: relative;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(6,8,15,0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--smooth);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    white-space: nowrap;
}
.filter-btn:hover { border-color: rgba(255,255,255,0.15); color: var(--text-primary); }
.filter-btn.has-active { border-color: var(--accent-blue); color: var(--accent-blue); }
.filter-btn.coop-toggle.active {
    border-color: #3B82F6;
    color: #3B82F6;
    background: rgba(59,130,246,0.12);
}
.filter-btn.coop-toggle.active svg { stroke: #3B82F6; }
.filter-btn .filter-count {
    background: var(--accent-blue);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
}

.filter-btn svg {
    width: 12px; height: 12px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.filter-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: rgba(6,8,15,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    min-width: 220px;
    max-height: 260px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
    z-index: 1000;
}
.filter-menu.open { display: block; }

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: background 0.15s var(--smooth);
    user-select: none;
    white-space: nowrap;
}
.filter-option:hover { background: var(--glass-hover); }

.filter-check {
    width: 16px; height: 16px;
    border: 1.5px solid var(--glass-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s var(--smooth);
}
.filter-option.selected .filter-check {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}
.filter-option.selected .filter-check::after {
    content: '\2713';
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}
.filter-option.selected { color: var(--text-primary); }

.filter-option-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}
.filter-option.selected .filter-option-count { color: var(--text-primary); }

#reset-filters,
#reset-pfilters {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 10px;
    color: #EF4444;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--smooth);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#reset-filters:hover,
#reset-pfilters:hover { background: rgba(239,68,68,0.18); }

#export-csv-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 500;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(6,8,15,0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--smooth);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    white-space: nowrap;
}
#export-csv-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
#export-csv-btn .export-count {
    background: var(--accent-blue);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
}

.contact-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 14px;
}

.contact-name  { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.contact-title { font-size: 11px; color: var(--text-tertiary); margin-bottom: 10px; }

.contact-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 5px 0;
    transition: color 0.2s;
}

.contact-link:hover { color: #4f8fff; }
.contact-link .icon { width: 16px; text-align: center; color: var(--text-tertiary); flex-shrink: 0; font-style: normal; }
.copy-btn {
    background: none; border: none; cursor: pointer; color: var(--text-tertiary);
    font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-left: auto; flex-shrink: 0;
    transition: all 0.2s;
}
.copy-btn:hover { color: var(--accent-green); background: rgba(34,197,94,0.1); }

.notes-area {
    width: 100%; min-height: 80px; max-height: 200px; resize: vertical;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px; padding: 10px 12px; color: var(--text-primary);
    font-size: 12px; font-family: inherit; line-height: 1.6; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box;
}
.notes-area:focus { border-color: rgba(232,66,63,0.4); box-shadow: 0 0 0 3px rgba(232,66,63,0.08); }
.notes-area::placeholder { color: rgba(255,255,255,0.15); }
.notes-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.notes-save-btn {
    padding: 5px 14px; border-radius: 6px; border: none; cursor: pointer;
    font-size: 11px; font-weight: 600; font-family: inherit;
    background: rgba(232,66,63,0.15); color: #e8423f; transition: all 0.2s;
}
.notes-save-btn:hover { background: rgba(232,66,63,0.25); }
.notes-save-btn:disabled { opacity: 0.4; cursor: default; }
.notes-saved {
    font-size: 11px; color: var(--accent-green); opacity: 0;
    transition: opacity 0.3s;
}
.notes-saved.show { opacity: 1; }

/* ── ACTIVITY LOG ──────────────────────────────── */
.activity-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.activity-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03); color: var(--text-secondary);
    font-size: 11px; font-family: inherit; font-weight: 500; cursor: pointer;
    transition: all 0.2s;
}
.activity-btn:hover { background: rgba(232,66,63,0.12); border-color: rgba(232,66,63,0.3); color: #e8423f; }
.activity-btn .act-icon { font-size: 13px; font-style: normal; }

.activity-form {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 14px; margin-bottom: 14px;
    animation: fadeIn 0.2s ease;
}
.activity-form-title {
    display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    color: var(--text-primary); margin-bottom: 12px; text-transform: capitalize;
}
.activity-form-title .act-icon { font-style: normal; font-size: 14px; }
.activity-form-row {
    margin-bottom: 10px;
}
.activity-form-label {
    display: block; font-size: 10px; font-weight: 600; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.activity-form-input {
    width: 100%; padding: 8px 10px; border-radius: 6px; box-sizing: border-box;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary); font-size: 12px; font-family: inherit; outline: none;
}
.activity-form-input:focus { border-color: rgba(232,66,63,0.4); box-shadow: 0 0 0 3px rgba(232,66,63,0.06); }
.activity-form-input::placeholder { color: rgba(255,255,255,0.15); }
input[type="date"].activity-form-input { color-scheme: dark; }
.activity-outcome-chips {
    display: flex; gap: 5px; flex-wrap: wrap;
}
.outcome-chip {
    padding: 5px 10px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03); color: var(--text-secondary);
    font-size: 11px; font-family: inherit; cursor: pointer; transition: all 0.15s;
}
.outcome-chip:hover { background: rgba(232,66,63,0.1); border-color: rgba(232,66,63,0.25); color: var(--text-primary); }
.outcome-chip.selected { background: rgba(232,66,63,0.18); border-color: rgba(232,66,63,0.4); color: #e8423f; font-weight: 600; }
.activity-form-actions {
    display: flex; gap: 8px; margin-top: 14px;
}
.activity-submit-btn {
    flex: 1; padding: 8px 14px; border-radius: 6px; border: none; cursor: pointer;
    font-size: 12px; font-weight: 600; font-family: inherit;
    background: rgba(232,66,63,0.2); color: #e8423f; transition: all 0.2s;
}
.activity-submit-btn:hover { background: rgba(232,66,63,0.35); }
.activity-submit-btn:disabled { opacity: 0.4; cursor: default; }
.activity-cancel-btn {
    padding: 8px 14px; border-radius: 6px; border: none; cursor: pointer;
    font-size: 12px; font-family: inherit;
    background: rgba(255,255,255,0.05); color: var(--text-tertiary); transition: all 0.2s;
}
.activity-cancel-btn:hover { background: rgba(255,255,255,0.1); }

.activity-timeline {
    max-height: 260px; overflow-y: auto; padding-left: 14px;
    border-left: 2px solid rgba(255,255,255,0.06);
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.activity-timeline::-webkit-scrollbar { width: 4px; }
.activity-timeline::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }

.activity-entry {
    position: relative; padding: 8px 0 10px 12px; font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.activity-entry:last-child { border-bottom: none; }
.activity-entry::before {
    content: ''; position: absolute; left: -19px; top: 13px;
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(232,66,63,0.5); border: 2px solid var(--bg-primary);
}
.activity-entry-header {
    display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
}
.activity-type-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 600; color: var(--text-secondary);
    text-transform: capitalize;
}
.activity-type-badge .act-icon { font-style: normal; }
.activity-time {
    font-size: 10px; color: var(--text-tertiary); margin-left: auto;
}
.activity-desc {
    color: var(--text-secondary); font-size: 11px; line-height: 1.5;
    margin-top: 2px;
}
.activity-author {
    font-size: 10px; color: var(--text-tertiary); margin-top: 2px;
}
.activity-empty {
    font-size: 12px; color: var(--text-tertiary); padding: 12px 0;
    text-align: center; font-style: italic;
}
.activity-loading {
    font-size: 11px; color: var(--text-tertiary); padding: 8px 0;
    text-align: center;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ── DASHBOARD VIEW ──────────────────────────────── */
#dashboard-view {
    flex-direction: column;
    overflow-y: auto;
    padding: 28px 28px 40px;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

#dashboard-view::-webkit-scrollbar { width: 6px; }
#dashboard-view::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.dash-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.dash-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text-primary);
}

.dash-sub {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Dashboard section cascade */
.dash-section {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.5s var(--smooth), transform 0.5s var(--smooth);
}
.dash-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* KPI cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 18px 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 0.25s var(--smooth), box-shadow 0.25s var(--smooth), border-color 0.25s var(--smooth);
    position: relative;
    overflow: hidden;
}
.kpi-card::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(250px circle at var(--spot-x, 50%) var(--spot-y, 50%), rgba(255,255,255,0.06), transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s;
}
.kpi-card:hover {
    border-color: rgba(255,255,255,0.16);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.kpi-card:hover::after { opacity: 1; }
.kpi-card.alert { border-color: rgba(245,158,11,0.2); }
.kpi-card.alert:hover { border-color: rgba(245,158,11,0.35); box-shadow: 0 8px 24px rgba(245,158,11,0.1); }

.kpi-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
    letter-spacing: -1px;
}

.kpi-value {
    font-size: 32px;
}
.kpi-value.red   { color: var(--accent-red); }
.kpi-value.amber { color: var(--accent-amber); }
.kpi-value.blue  { color: var(--accent-blue); }
.kpi-value.green { color: #22C55E; }

.kpi-sub {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Charts grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.chart-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.chart-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
}

.chart-wrap { position: relative; height: 220px; }

/* Tables */
.full-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.full-card .chart-title { margin-bottom: 14px; }

.rep-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.rep-table th {
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--glass-border);
}

.rep-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
    color: var(--text-secondary);
}

.rep-table td:first-child { color: var(--text-primary); font-weight: 500; }
.rep-table tr:last-child td { border-bottom: none; }
.rep-table tr:hover td { background: rgba(255,255,255,0.02); }

.age-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(239,68,68,0.12);
    color: #EF4444;
    border: 1px solid rgba(239,68,68,0.2);
}

/* Sales rep leaderboard */
.rep-bar {
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    overflow: hidden;
}
.rep-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(232,66,63,0.85), rgba(245,158,11,0.85));
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.16,1,0.3,1);
}

/* Coverage gaps */
.gap-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.gap-pill {
    background: rgba(232,66,63,0.06);
    border: 1px solid rgba(232,66,63,0.15);
    color: var(--text-tertiary);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ── Dashboard: flat / sharp / dense (Robinhood-style) ────────────── */
#dashboard-view { padding: 24px 32px; }
#dashboard-view .dash-header { margin-bottom: 24px; }
#dashboard-view .dash-title { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; }
#dashboard-view .dash-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

#dashboard-view .dash-section {
    opacity: 1;
    transform: none;
    transition: none;
}

#dashboard-view .kpi-grid {
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 24px;
}

#dashboard-view .kpi-card {
    background: transparent;
    border: none;
    border-right: 1px solid rgba(255,255,255,0.06);
    border-radius: 0;
    padding: 16px 20px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: none;
    overflow: visible;
}
#dashboard-view .kpi-card:last-child { border-right: none; }
#dashboard-view .kpi-card::after { display: none; }
#dashboard-view .kpi-card:hover {
    background: rgba(255,255,255,0.015);
    border-color: rgba(255,255,255,0.06);
    transform: none;
    box-shadow: none;
}
#dashboard-view .kpi-card.alert { border-color: rgba(255,255,255,0.06); }
#dashboard-view .kpi-card.alert:hover { box-shadow: none; }

#dashboard-view .kpi-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

#dashboard-view .kpi-value {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.05;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
#dashboard-view .kpi-value.red,
#dashboard-view .kpi-value.amber,
#dashboard-view .kpi-value.blue,
#dashboard-view .kpi-value.green { color: var(--text-primary); }

#dashboard-view .kpi-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.1px;
}
.kpi-delta.up   { color: #22C55E; }
.kpi-delta.down { color: #EF4444; }
.kpi-delta.flat { color: var(--text-tertiary); }

#dashboard-view .charts-grid {
    gap: 24px;
    margin-bottom: 24px;
}

#dashboard-view .chart-card,
#dashboard-view .full-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#dashboard-view .chart-card .chart-title,
#dashboard-view .full-card .chart-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

#dashboard-view .chart-wrap { height: 240px; }

#dashboard-view .full-card { margin-bottom: 24px; }

#dashboard-view .rep-table { font-size: 12px; font-variant-numeric: tabular-nums; }
#dashboard-view .rep-table th {
    padding: 8px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
    color: var(--text-tertiary);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
#dashboard-view .rep-table td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
#dashboard-view .rep-table tr:hover td { background: rgba(255,255,255,0.015); }
#dashboard-view .rep-table tr:last-child td { border-bottom: none; }

#dashboard-view .rep-bar { height: 4px; }
#dashboard-view .rep-bar-fill {
    background: linear-gradient(90deg, #4f8fff, #22C55E);
}

#dashboard-view .age-badge {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.25);
    color: #EF4444;
    font-weight: 500;
}

#dashboard-view .gap-pill {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-secondary);
    border-radius: 4px;
    font-weight: 500;
}

#dashboard-view .status-chip {
    border-radius: 4px;
    font-weight: 500;
}

/* Legend */
.legend-row {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot  { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* Loading */
#loading {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 9998;
}

.loading-orb {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,66,63,0.6) 0%, rgba(232,66,63,0.15) 60%, transparent 100%);
    animation: loadPulse 1.4s ease-in-out infinite;
}

@keyframes loadPulse {
    0%, 100% { transform: scale(1);    opacity: 0.8; }
    50%       { transform: scale(1.18); opacity: 1; }
}

.loading-text { font-size: 14px; color: var(--text-tertiary); font-weight: 400; letter-spacing: 0.3px; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* ── TABLE VIEW ──────────────────────────────────── */
#table-view {
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-deep);
}

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.table-view-switcher {
    display: flex;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    overflow: hidden;
}

.table-view-btn {
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s var(--smooth);
    white-space: nowrap;
}
.table-view-btn.active {
    background: var(--accent-blue);
    color: #fff;
}
.table-view-btn:not(.active):hover { color: var(--text-secondary); }

.table-filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    background: rgba(6,8,15,0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-tertiary);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s var(--smooth);
    position: relative;
    white-space: nowrap;
}
.table-filter-btn:hover { border-color: rgba(255,255,255,0.14); color: var(--text-secondary); }
.table-filter-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.table-filter-count {
    background: var(--accent-blue);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 6px;
    min-width: 14px;
    text-align: center;
}

.table-search {
    flex: 1;
    min-width: 180px;
    max-width: 300px;
    padding: 7px 12px 7px 32px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s var(--smooth);
}
.table-search:focus { border-color: var(--accent-blue); }
.table-search::placeholder { color: var(--text-tertiary); }

.table-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 300px;
}
.table-search-wrap svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    height: 13px;
    fill: none;
    stroke: var(--text-tertiary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.table-row-count {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    margin-left: auto;
}
.table-row-count strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.table-scroll {
    flex: 1;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

.data-table thead { position: sticky; top: 0; z-index: 10; }

.data-table th {
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 10px;
    border-bottom: 1px solid var(--glass-border);
    background: var(--bg-deep);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s;
}
.data-table th:hover { color: var(--text-secondary); }
.data-table th.sorted { color: var(--accent-blue); }
.data-table th .sort-arrow {
    display: inline-block;
    margin-left: 3px;
    font-size: 8px;
    opacity: 0.4;
}
.data-table th.sorted .sort-arrow { opacity: 1; color: var(--accent-blue); }

.data-table td {
    padding: 9px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.data-table tbody tr.row-selected td { background: rgba(232,66,63,0.06); }

.data-table .col-name { color: var(--text-primary); font-weight: 500; }
.data-table .col-score {
    font-weight: 700;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.data-table .col-revenue {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.data-table .col-email a {
    color: #4f8fff;
    text-decoration: none;
    font-size: 11px;
}
.data-table .col-email a:hover { text-decoration: underline; }
.data-table .col-phone a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 11px;
}
.data-table .col-phone a:hover { color: var(--text-primary); }
.data-table .col-muted { color: var(--text-tertiary); }

/* Column widths */
.data-table .cw-status   { width: 90px; }
.data-table .cw-score    { width: 55px; text-align: center; }
.data-table .cw-name     { width: auto; min-width: 180px; }
.data-table .cw-city     { width: 120px; }
.data-table .cw-state    { width: 48px; text-align: center; }
.data-table .cw-apparatus { width: 140px; }
.data-table .cw-year     { width: 70px; text-align: center; }
.data-table .cw-units    { width: 50px; text-align: center; }
.data-table .cw-revenue  { width: 95px; text-align: right; }
.data-table .cw-chief    { width: 140px; }
.data-table .cw-email    { width: 180px; }
.data-table .cw-phone    { width: 115px; }
.data-table .cw-rep      { width: 120px; }

.table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-tertiary);
    font-size: 14px;
    gap: 8px;
}
.table-empty svg { width: 40px; height: 40px; stroke: var(--text-tertiary); opacity: 0.4; }

.score-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .table-toolbar { gap: 6px; padding: 10px 12px; }
    .table-view-btn { padding: 5px 10px; font-size: 11px; }
    .table-filter-btn { font-size: 10px; padding: 5px 8px; }
    .data-table { font-size: 11px; }
    .data-table th, .data-table td { padding: 7px 6px; }
}

/* ── Leaflet overrides ───────────────────────────── */
.leaflet-container { background: #06080f; -webkit-font-smoothing: antialiased; }
.leaflet-zoom-anim .leaflet-zoom-animated { will-change: transform; transition: transform 0.35s cubic-bezier(0.25,0.1,0.25,1) !important; }
.leaflet-tile-pane   { will-change: transform; }
.leaflet-marker-pane { will-change: transform; }

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.45) !important;
    border-radius: 10px !important;
    overflow: hidden;
    margin-left: 14px !important;
    margin-top: 10px !important;
}
.leaflet-control-zoom a {
    background: rgba(8,10,20,0.88) !important;
    color: var(--text-primary) !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
    width: 36px !important; height: 36px !important; line-height: 36px !important;
    font-size: 18px !important; font-weight: 300 !important;
    transition: background 0.15s !important;
}
.leaflet-control-zoom a:last-child { border-bottom: none !important; }
.leaflet-control-zoom a:hover { background: rgba(232,66,63,0.12) !important; color: #fff !important; }
.leaflet-control-zoom a.leaflet-disabled { opacity: 0.3 !important; cursor: default !important; }
.leaflet-control-attribution {
    background: rgba(6,8,15,0.7) !important;
    color: var(--text-tertiary) !important;
    font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--text-secondary) !important; }

/* ── State count pills ──────────────────────────────*/
.state-count-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6,182,212,0.12);
    border: 1px solid rgba(6,182,212,0.3);
    border-radius: 20px;
    min-width: 28px;
    height: 22px;
    padding: 0 8px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: #06B6D4;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(6,182,212,0.15);
}
.state-count-pill:hover {
    background: rgba(6,182,212,0.22);
    border-color: rgba(6,182,212,0.6);
    color: #22D3EE;
    box-shadow: 0 0 12px rgba(6,182,212,0.3);
}
.state-count-pill.selected {
    background: rgba(6,182,212,0.3);
    border-color: #06B6D4;
    color: #ECFEFF;
    box-shadow: 0 0 14px rgba(6,182,212,0.4);
}
#clear-states-btn {
    position: absolute; top: 90px; right: 16px; z-index: 800;
    background: rgba(8,10,20,0.9); border: 1px solid var(--glass-border);
    border-radius: 8px; padding: 6px 14px; color: var(--text-secondary);
    font-family: 'Inter',sans-serif; font-size: 12px; cursor: pointer;
    transition: all 0.2s; display: none;
}
#clear-states-btn:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

/* ── Marker icons ────────────────────────────────── */
.ember {
    position: relative; display: flex; align-items: center; justify-content: center;
    transform: scale(var(--ember-scale, 1));
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.ember svg { width: 100%; height: 100%; }
.ember.type-replace    svg { filter: drop-shadow(0 0 5px rgba(239,68,68,0.6)); }
.ember.type-monitor    svg { filter: drop-shadow(0 0 4px rgba(245,158,11,0.5)); }
.ember.type-current    svg { filter: drop-shadow(0 0 3px rgba(34,197,94,0.4)); }
.ember.type-fc_lead    svg { filter: drop-shadow(0 0 4px rgba(245,158,11,0.5)); }
.ember.type-other_lead svg { filter: drop-shadow(0 0 3px rgba(79,143,255,0.4)); }
.ember.type-usfa_dept  svg { filter: drop-shadow(0 0 2px rgba(6,182,212,0.3)); }

/* ── Hover tooltip ───────────────────────────────── */
.map-hover-tooltip {
    background: rgba(8,10,20,0.95) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    padding: 5px 10px !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.45) !important;
    white-space: nowrap;
}
.map-hover-tooltip::before { border-top-color: rgba(8,10,20,0.95) !important; }

/* ── Click popup ─────────────────────────────────── */
.leaflet-popup-content-wrapper {
    background: rgba(10,12,24,0.92) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-top-color: rgba(255,255,255,0.12) !important;
    border-radius: 14px !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 4px 24px rgba(0,0,0,0.35), 0 12px 48px rgba(0,0,0,0.25) !important;
    animation: popupEnter 200ms cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes popupEnter {
    from { opacity: 0; transform: translateY(4px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.leaflet-popup-tip { background: rgba(10,12,24,0.92) !important; }
.leaflet-popup-content {
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif;
    margin: 14px 16px !important;
    min-width: 200px;
}
.leaflet-popup-close-button {
    color: var(--text-tertiary) !important;
    font-size: 18px !important;
    top: 8px !important; right: 10px !important;
}
.leaflet-popup-close-button:hover { color: var(--text-primary) !important; }

.fp-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px; border-radius: 12px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
    margin-bottom: 10px;
}
.fp-badge.replace    { background: rgba(239,68,68,0.1);  color: #EF4444; border: 1px solid rgba(239,68,68,0.2); }
.fp-badge.monitor    { background: rgba(245,158,11,0.1); color: #F59E0B; border: 1px solid rgba(245,158,11,0.2); }
.fp-badge.current    { background: rgba(34,197,94,0.1);  color: #22C55E; border: 1px solid rgba(34,197,94,0.2); }
.fp-badge.fc_lead    { background: rgba(79,143,255,0.1); color: #4f8fff; border: 1px solid rgba(79,143,255,0.2); }
.fp-badge.other_lead { background: rgba(79,143,255,0.1); color: #4f8fff; border: 1px solid rgba(79,143,255,0.2); }
.fp-badge.usfa_dept  { background: rgba(6,182,212,0.1); color: #06B6D4; border: 1px solid rgba(6,182,212,0.2); }

.fp-name { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.95); margin-bottom: 2px; letter-spacing: -0.1px; }
.fp-loc  { font-size: 11px; color: rgba(255,255,255,0.4); margin-bottom: 8px; }
.fp-row  { display: flex; align-items: center; gap: 5px; font-size: 11px; color: rgba(255,255,255,0.65); margin-bottom: 3px; }
.fp-row b { color: rgba(255,255,255,0.9); font-weight: 600; }
.fp-sep  { color: rgba(255,255,255,0.2); margin: 0 4px; }
.fp-hint { font-size: 10px; color: rgba(255,255,255,0.3); margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); }

@media (max-width: 900px) {
    .kpi-grid   { grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    #detail-panel { width: min(420px, 88vw); right: calc(-1 * min(440px, 92vw)); }
    #detail-panel.open { right: 0; }
}
@media (max-width: 600px) {
    .kpi-grid { grid-template-columns: 1fr; }
    #dashboard-view { padding: 16px; }
    #detail-panel { width: 100vw; right: -105vw; }
    #detail-panel.open { right: 0; }
    #filter-controls { flex-wrap: wrap; gap: 4px; }
    .filter-btn { font-size: 11px; padding: 5px 8px; }
    #export-csv-btn { right: 10px; top: auto; bottom: 70px; font-size: 11px; padding: 6px 10px; }
}
/* ── WELCOME / LANDING PAGE ─────────────────────── */
#welcome-view {
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    position: relative;
}

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
    padding: 60px 20px 30px;
    padding-top: 160px;
    animation: fadeUp 0.8s var(--smooth);
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- THE OTTO FIRE EYE ---- */
.orb-hero {
    position: relative;
    width: 150px; height: 150px;
    margin: 20px 0 28px;
    animation: heroFloat 5s ease-in-out infinite;
    transition: filter 0.3s;
    cursor: default;
    overflow: visible;
}
.orb-hero:hover { filter: brightness(1.15); }
.orb-hero::before {
    content: '';
    position: absolute;
    inset: -60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,66,63,0.2) 0%, rgba(232,66,63,0.06) 40%, transparent 70%);
    animation: auraBreath 4s ease-in-out infinite;
    pointer-events: none;
}
@keyframes auraBreath { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.12); opacity: 1; } }
.orb-hero .fire-eye { width: 100%; height: 100%; position: relative; z-index: 1; }
.eye-glow {
    position: absolute;
    inset: -80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,66,63,0.4) 0%, rgba(232,66,63,0.15) 25%, rgba(245,158,11,0.06) 50%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}
.orb-ring {
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    border: 1.5px solid rgba(232,66,63,0.2);
    animation: orbRingPulse 4s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(232,66,63,0.06);
}
.orb-ring:nth-child(2) { inset: -42px; border-color: rgba(245,158,11,0.14); animation-delay: -1.3s; box-shadow: 0 0 20px rgba(245,158,11,0.04); }
.orb-ring:nth-child(3) { inset: -62px; border-color: rgba(255,120,50,0.08); animation-delay: -2.6s; box-shadow: 0 0 25px rgba(255,120,50,0.03); }
@keyframes heroFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes orbRingPulse { 0%, 100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.06); opacity: 1; } }

.fire-eye circle { transform-origin: 30px 30px; }
@keyframes irisRotate { to { transform: rotate(360deg); } }

.welcome-greet {
    font-size: 32px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.5px;
    max-width: 520px;
    text-align: center;
    margin-bottom: 32px;
    background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(232,66,63,0.9) 50%, rgba(245,158,11,0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    animation: greetTextIn 0.8s cubic-bezier(0.16,1,0.3,1) 0.3s forwards;
}
@keyframes greetTextIn {
    from { opacity: 0; transform: translateY(20px); filter: blur(4px); }
    to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}


/* ---- HERO CARDS ---- */
.hero-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    max-width: 820px;
    width: 100%;
    margin-bottom: 24px;
}
.hero-card {
    padding: 28px 20px 24px;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    cursor: pointer;
    transition: all 0.3s var(--smooth);
    position: relative;
    overflow: hidden;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.hero-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 18px;
    opacity: 0;
    transition: opacity 0.3s;
    background: radial-gradient(300px circle at var(--spot-x, 50%) var(--spot-y, 50%), rgba(232,66,63,0.08), transparent 60%);
    pointer-events: none;
}
.hero-card:hover::after { opacity: 1; }
.hero-card:hover {
    border-color: rgba(232,66,63,0.3);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(232,66,63,0.1);
}
.hero-card:active { transform: translateY(0) scale(0.98); }
.hero-card-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: rgba(232,66,63,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 4px;
}
.hero-card-icon svg {
    width: 24px; height: 24px;
    stroke: var(--accent-blue);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.hero-card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.hero-card-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    line-height: 1.5;
}

@media (max-width: 700px) {
    .hero-cards { grid-template-columns: 1fr; max-width: 320px; }
}
@media (max-width: 900px) and (min-width: 701px) {
    .hero-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ── Auth overlay ──────────────────────────────────────────────── */
.auth-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg-deep);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.4s ease; overflow: hidden;
}
.auth-overlay.visible { opacity: 1; pointer-events: auto; }
.auth-overlay.hidden { display: none; }
.auth-bg-orb { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; }
.auth-bg-orb-1 { width: 500px; height: 500px; top: -15%; left: -10%; background: radial-gradient(circle, rgba(232,66,63,0.12) 0%, transparent 70%); animation: authOrbFloat 14s ease-in-out infinite; }
.auth-bg-orb-2 { width: 400px; height: 400px; bottom: -10%; right: -8%; background: radial-gradient(circle, rgba(245,158,11,0.1) 0%, transparent 70%); animation: authOrbFloat 18s ease-in-out infinite reverse; }
.auth-bg-orb-3 { width: 300px; height: 300px; top: 40%; left: 60%; background: radial-gradient(circle, rgba(232,66,63,0.06) 0%, transparent 70%); animation: authOrbFloat 10s ease-in-out infinite 2s; }
@keyframes authOrbFloat { 0%, 100% { transform: translate(0,0) scale(1); } 33% { transform: translate(30px,-20px) scale(1.05); } 66% { transform: translate(-20px,15px) scale(0.95); } }
.auth-card {
    width: 100%; max-width: 400px; padding: 44px 36px 36px;
    border-radius: 28px; border: 1px solid rgba(255,255,255,0.06);
    background: rgba(10,14,26,0.8); backdrop-filter: blur(60px); -webkit-backdrop-filter: blur(60px);
    box-shadow: 0 30px 100px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.04);
    text-align: center; position: relative; z-index: 1;
}
.auth-eye-wrap { position: relative; width: 100px; height: 100px; margin: 0 auto 20px; }
.auth-eye-ring { position: absolute; inset: -8px; border-radius: 50%; border: 1px solid rgba(232,66,63,0.15); animation: authRingSpin 20s linear infinite; }
.auth-eye-ring::after { content: ''; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: rgba(232,66,63,0.5); top: -3px; left: 50%; transform: translateX(-50%); }
.auth-eye-ring-2 { position: absolute; inset: -18px; border-radius: 50%; border: 1px solid rgba(245,158,11,0.08); animation: authRingSpin 30s linear infinite reverse; }
.auth-eye-ring-2::after { content: ''; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: rgba(245,158,11,0.35); bottom: -2px; left: 50%; transform: translateX(-50%); }
@keyframes authRingSpin { to { transform: rotate(360deg); } }
.auth-eye-svg { width: 100px; height: 100px; position: relative; z-index: 1; }
.auth-eye-glow { position: absolute; inset: -20px; border-radius: 50%; background: radial-gradient(circle, rgba(232,66,63,0.15) 0%, transparent 70%); animation: authGlowPulse 4s ease-in-out infinite; }
@keyframes authGlowPulse { 0%, 100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
.auth-title { font-size: 26px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; letter-spacing: -0.3px; }
.auth-subtitle { font-size: 13px; color: var(--text-tertiary); margin-bottom: 28px; letter-spacing: 0.5px; text-transform: uppercase; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
/* font-size 16px to prevent iOS zoom-on-focus — this is the first screen new users see. */
.auth-field { width: 100%; padding: 13px 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.07); background: rgba(255,255,255,0.03); color: var(--text-primary); font-size: 16px; font-family: inherit; outline: none; transition: border-color 0.25s, background 0.25s, box-shadow 0.25s; box-sizing: border-box; }
.auth-field:focus { border-color: rgba(232,66,63,0.4); background: rgba(232,66,63,0.04); box-shadow: 0 0 0 3px rgba(232,66,63,0.08); }
.auth-field::placeholder { color: rgba(255,255,255,0.2); }
.auth-btn { width: 100%; padding: 13px; border-radius: 12px; border: none; background: linear-gradient(135deg, #e8423f 0%, #F59E0B 50%, #e8423f 100%); background-size: 200% 200%; animation: authBtnShimmer 4s ease-in-out infinite; color: #fff; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; margin-top: 4px; letter-spacing: 0.3px; }
@keyframes authBtnShimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.auth-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(232,66,63,0.3); }
.auth-btn:active { transform: translateY(0); }
.auth-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; animation: none; }
.auth-toggle { margin-top: 20px; font-size: 12px; color: var(--text-tertiary); }
.auth-toggle a { color: #e8423f; cursor: pointer; text-decoration: none; font-weight: 500; }
.auth-toggle a:hover { text-decoration: underline; }

/* Auth secondary CTA — "Create Account" / "Back to Sign In" buttons.
   Sits below the primary Sign In/Sign Up button, with a divider.
   Outlined style so it's clearly secondary but impossible to miss. */
.auth-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 18px 0 12px 0;
    color: rgba(255,255,255,0.55);
    font-size: 11px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.8px;
}
.auth-divider::before,
.auth-divider::after {
    content: ''; flex: 1; height: 1px;
    background: rgba(255,255,255,0.12);
}
.auth-btn-secondary {
    display: block;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(232,66,63,0.45);
    color: #fbbf24;
    animation: none;
    margin-top: 0;
}
.auth-btn-secondary:hover {
    background: rgba(232,66,63,0.10);
    border-color: rgba(232,66,63,0.7);
    color: #fff;
    box-shadow: 0 6px 20px rgba(232,66,63,0.18);
}
.auth-error { padding: 10px 14px; border-radius: 10px; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.15); color: #f87171; font-size: 13px; text-align: left; display: none; }
.auth-error.show { display: block; }
.auth-success { padding: 10px 14px; border-radius: 10px; background: rgba(52,211,153,0.08); border: 1px solid rgba(52,211,153,0.15); color: #34d399; font-size: 13px; text-align: left; display: none; }
.auth-success.show { display: block; }
.auth-domain-note { font-size: 11px; color: var(--text-tertiary); margin-top: -4px; text-align: left; padding-left: 4px; }
.auth-pw-wrap { position: relative; }
.auth-pw-wrap .auth-field { padding-right: 42px; }
.pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: rgba(0,0,0,0.35); padding: 4px; display: flex; align-items: center; transition: color 0.2s; }
.pw-toggle:hover { color: rgba(0,0,0,0.6); }
.auth-user-bar { position: relative; cursor: pointer; user-select: none; margin-left: 4px; }
.auth-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #e8423f, #F59E0B); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 0.5px; transition: box-shadow 0.2s, transform 0.15s; border: 2px solid transparent; }
.auth-avatar:hover { box-shadow: 0 0 0 3px rgba(232,66,63,0.25); transform: scale(1.05); }
.auth-user-bar.active .auth-avatar { border-color: #e8423f; box-shadow: 0 0 0 3px rgba(232,66,63,0.2); }
.profile-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 240px; border-radius: 12px; background: var(--bg-deep); border: 1px solid var(--glass-border); box-shadow: 0 12px 40px rgba(0,0,0,0.5); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: all 0.2s ease; z-index: 100; overflow: hidden; }
.profile-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-header { padding: 16px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; gap: 12px; }
.profile-header .profile-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #e8423f, #F59E0B); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; color: #fff; text-transform: uppercase; flex-shrink: 0; }
.profile-header .profile-info { min-width: 0; }
.profile-header .profile-name { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-header .profile-email { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-meta { padding: 12px 16px; border-bottom: 1px solid var(--glass-border); font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 6px; }
.profile-meta svg { opacity: 0.4; flex-shrink: 0; }
.profile-signout { padding: 10px 16px; font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 8px; }
.profile-signout:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

/* Mobile: bump small text inputs to 16px to prevent iOS Safari zoom-on-focus.
   Covers the rep's main data-entry surface — global search, activity log form,
   table filter — which are 12px on desktop for density. */
@media (max-width: 768px) {
    #search-input,
    .activity-form-input,
    .table-search { font-size: 16px; }
}

