/* Modern CSS Variables - Airadics Premium Light Design Tokens */
:root {
    --bg-base: #f8fafc; /* Slate 50 (Very Light Gray) */
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9; /* Slate 100 */
    --border-glow: rgba(99, 102, 241, 0.12);
    --border-color: #e2e8f0; /* Slate 200 */
    
    --primary: #6366f1; /* Electric Indigo */
    --primary-glow: rgba(99, 102, 241, 0.15);
    --secondary: #0ea5e9; /* Vibrant Cyan */
    --secondary-glow: rgba(14, 165, 233, 0.15);
    
    --success: #10b981; /* Emerald Green - Active Clients */
    --success-glow: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b; /* Amber - Eligible Leads */
    --warning-glow: rgba(245, 158, 11, 0.15);
    --danger: #ef4444; /* Crimson - Blocked Leads */
    --danger-glow: rgba(239, 68, 68, 0.15);
    --contract: #8b5cf6; /* Purple - Under Contract */
    --contract-glow: rgba(139, 92, 246, 0.15);
    
    --text-main: #0f172a; /* Slate 900 (Dark Charcoal) */
    --text-muted: #64748b; /* Slate 500 */
    --text-inverse: #ffffff;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --font-display: 'Outfit', sans-serif;
    --font-sans: 'Inter', sans-serif;
}

/* Basic Resets & Scrollbars */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Sign-in screen */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, #f1f5f9 0%, #cbd5e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#login-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem;
    width: 460px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.brand-logo-large {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo-large i {
    font-size: 2rem;
    color: var(--primary);
    -webkit-text-fill-color: initial;
}

.brand-tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
}

/* OAuth Form Style */
.oauth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.oauth-input-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.firebase-google-btn {
    background: #ffffff;
    color: #1f2937;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.85rem 1.8rem;
    border-radius: var(--radius-md);
    border: 1px solid #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.firebase-google-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.firebase-google-btn svg {
    width: 18px;
    height: 18px;
}

/* Dashboard Shell */
#app-shell {
    display: grid;
    grid-template-columns: 80px 1fr;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* High-Contrast Navigation Sidebar (Left) */
.app-sidebar {
    background-color: #0f172a; /* Slate 900 Dark Sidebar */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    justify-content: space-between;
    z-index: 100;
}

.sidebar-logo {
    font-size: 1.8rem;
    color: #38bdf8;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
    margin-bottom: 2rem;
    cursor: pointer;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    list-style: none;
}

.sidebar-item {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-item:hover, .sidebar-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-item.active {
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: inset 0 0 10px rgba(56, 189, 248, 0.15);
}

.sidebar-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 70px;
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.08);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 200;
}

.sidebar-item:hover::after {
    opacity: 1;
    transform: translateX(5px);
}

.sidebar-profile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

/* Main Workspace Area */
.app-workspace {
    display: grid;
    grid-template-rows: 70px 1fr;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-base);
}

/* Top Header */
.workspace-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

.header-title-section h1 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-main);
}

.header-title-section p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.county-pill {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.county-pill i {
    color: var(--secondary);
}

.county-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

.sign-out-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s;
}

.sign-out-btn:hover {
    color: var(--danger);
}

/* Main Grid Content Panels */
.workspace-content {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Right Detail Drawer - Enlarged to accommodate onboarding details and workflow steps */
.detail-drawer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, 92vw);
    height: min(78vh, 780px);
    min-width: 380px;
    min-height: 320px;
    max-width: 96vw;
    max-height: 92vh;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
    overflow: hidden;
    resize: both;          /* native grip at the bottom-right corner */
}

.detail-drawer.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.detail-drawer .drawer-header { cursor: move; user-select: none; }
.detail-drawer .drawer-body { flex: 1 1 auto; overflow-y: auto; }

/* Sidebar Control Center (Left Panel) */
.control-sidebar {
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1.5rem;
    gap: 1.5rem;
}

.sidebar-section-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stat cards grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-card {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.stat-card.clients::after { background-color: var(--success); }
.stat-card.eligible::after { background-color: var(--warning); }
.stat-card.blocked::after { background-color: var(--danger); }
.stat-card.coverage::after { background-color: var(--contract); }

.stat-num {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    line-height: 1.1;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Interactive Filter Cards */
.filter-group {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 0;
    color: var(--text-main);
}

.filter-checkbox-label span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot.active { background-color: var(--success); }
.badge-dot.eligible { background-color: var(--warning); }
.badge-dot.blocked { background-color: var(--danger); }
.badge-dot.contract { background-color: var(--contract); }

.custom-checkbox {
    position: relative;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    background-color: var(--bg-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-checkbox:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox:checked::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 9px;
    color: white;
}

/* Lead List Search and Cards */
.search-wrapper {
    position: relative;
}

.search-wrapper i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.search-input {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 10px 8px 30px;
    color: var(--text-main);
    font-size: 0.8rem;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 2px;
}

.practice-list-item {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.practice-list-item:hover {
    background: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-title {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    color: var(--text-main);
}

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

.item-edit-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.item-edit-btn:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.status-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.status-tag.active {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.status-tag.eligible {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(14, 165, 233, 0.15);
}

.status-tag.blocked {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.status-tag.contract {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--contract);
    border: 1px solid rgba(139, 92, 246, 0.15);
}

/* Map Panel (Main Area) */
.map-panel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #e2e8f0;
    z-index: 10;
}

/* Overlay Control Widgets on Map */
.map-overlay-widget {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 99;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    box-shadow: var(--shadow-premium);
    display: flex;
    gap: 10px;
    align-items: center;
}

.widget-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
}

.widget-btn.active {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
}

.widget-btn:hover:not(.active) {
    color: var(--text-main);
    background: var(--bg-card-hover);
}

/* Drawer Details Layout */
.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.drawer-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.drawer-close:hover {
    color: var(--danger);
}

.drawer-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.drawer-clinic-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    line-height: 1.2;
    color: var(--text-main);
}

.drawer-clinic-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    align-items: center;
}

.detail-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.detail-mini-card {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.mini-card-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.mini-card-val {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

/* ONBOARDING CONTRACT FORM STYLINGS */
.onboarding-form-card {
    background: #faf5ff; /* Light purple tint */
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--contract);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.form-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-input-text {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    outline: none;
    color: var(--text-main);
}

.form-input-text:focus {
    border-color: var(--contract);
}

/* PROGRESS PIPELINE STEPS */
.setup-note { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; margin: 0; }

/* WEEKLY 1:1 CALL NOTES & COLLABORATION STYLINGS */
.notes-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.note-bubble {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.note-bubble-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.note-input-row {
    display: flex;
    gap: 8px;
}

.note-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    cursor: pointer;
}

.collab-task-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 5px;
    margin-bottom: 2px;
}

/* EDIT CLINIC OVERLAY MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: white;
    border-radius: var(--radius-lg);
    width: 480px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-base);
}

.modal-header h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 480px;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-base);
}

/* Leaflet Popups Stylings - Modified for light aesthetics */
.leaflet-popup-content-wrapper {
    background: var(--bg-surface) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.06) !important;
    padding: 5px !important;
}

.leaflet-popup-tip {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
}

/* Arch & Settings Tab Layout */
.tab-content {
    display: none;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    padding: 2.5rem;
}

.tab-content.active {
    display: block;
}

.arch-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.arch-desc {
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 800px;
    line-height: 1.6;
}

/* Code snippets style */
pre {
    background: #0f172a; /* Keep dark code snippets for readability */
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    overflow-x: auto;
    color: #e2e8f0;
}

/* Custom Toast Notification System */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 110px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #1e293b;
    border-left: 4px solid var(--primary);
    padding: 12px 18px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.danger { border-left-color: var(--danger); }

/* Leads database table styling */
.data-table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
}

.clinic-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-main);
}

.clinic-table th {
    padding: 12px 10px;
    color: var(--text-muted);
    font-family: var(--font-display);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.8px;
    border-bottom: 2px solid var(--border-color);
}

.clinic-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
}

.clinic-table tr {
    transition: background 0.2s;
}

.clinic-table tr:hover {
    background: var(--bg-card-hover);
}

/* Animations */
@keyframes modal-pop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ----- Recommended Deal Structure panel ----- */
#deal-rationale-card { display:none; border:1px solid var(--border-color); border-left:3px solid var(--primary); border-radius:8px; background:#fbfcfe; padding:12px; }
.deal-card-head { display:flex; justify-content:space-between; align-items:center; gap:8px; font-weight:700; font-size:0.78rem; color:#1e293b; }
.deal-card-head i { color:var(--primary); }
.deal-conf { font-size:0.58rem; font-weight:700; padding:2px 7px; border-radius:10px; text-transform:uppercase; letter-spacing:0.04em; white-space:nowrap; }
.deal-conf.high { background:#dcfce7; color:#15803d; }
.deal-conf.medium { background:#fef9c3; color:#a16207; }
.deal-conf.low { background:#fee2e2; color:#b91c1c; }
.deal-headline { font-size:0.95rem; font-weight:800; color:var(--primary); margin:6px 0 8px; }
.deal-why-label { font-size:0.6rem; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-muted); font-weight:700; margin-bottom:5px; }
.deal-metric-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.deal-metric { display:flex; flex-direction:column; gap:2px; background:white; border:1px solid var(--border-color); border-radius:6px; padding:5px 8px; }
.dm-lbl { font-size:0.58rem; color:var(--text-muted); }
.dm-val { font-size:0.78rem; font-weight:700; color:#1e293b; line-height:1.2; }
.deal-margin-row { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:8px; }
.deal-margin { background:white; border:1px solid var(--border-color); border-radius:6px; padding:6px 8px; text-align:center; }
.dm-big { display:block; font-size:1.05rem; font-weight:800; color:var(--success); margin-top:2px; }
.deal-elig { display:flex; gap:7px; align-items:flex-start; margin-top:9px; font-size:0.72rem; padding:7px 9px; border-radius:6px; line-height:1.32; }
.deal-elig.yes { background:#ecfdf5; color:#065f46; }
.deal-elig.no { background:#fff7ed; color:#9a3412; }
.deal-elig i { margin-top:2px; }
.deal-badges { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.deal-badge { font-size:0.62rem; font-weight:600; background:#eef2ff; color:#3730a3; padding:3px 8px; border-radius:10px; }
.deal-badge.warn { background:#fef3c7; color:#92400e; }
.deal-source { font-size:0.6rem; color:var(--text-muted); margin-top:8px; border-top:1px dashed var(--border-color); padding-top:6px; line-height:1.3; }
.deal-muted { font-size:0.72rem; color:var(--text-muted); margin-top:6px; line-height:1.35; }

/* ----- sharp pins + hover tooltip ----- */
.custom-map-icon svg { filter: drop-shadow(0 2px 3px rgba(15,23,42,0.35)); cursor: pointer; }
.pin-active svg { filter: drop-shadow(0 2px 4px rgba(16,185,129,0.45)); }
.leaflet-tooltip.clinic-tip { background:#0f172a; color:#fff; border:none; border-radius:7px; box-shadow:0 6px 16px rgba(0,0,0,0.3); padding:7px 10px; }
.leaflet-tooltip.clinic-tip.leaflet-tooltip-top:before { border-top-color:#0f172a; }
.clinic-tip-title { font-weight:700; font-size:0.78rem; }
.clinic-tip-sub { font-size:0.66rem; opacity:0.82; margin-top:1px; }
.clinic-tip-cta { font-size:0.6rem; color:#93c5fd; margin-top:4px; }
/* ----- priority + follow-up cues ----- */
.prio-dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:6px; vertical-align:middle; }
.prio-dot.high{background:#16a34a;} .prio-dot.medium{background:#f59e0b;} .prio-dot.low{background:#94a3b8;} .prio-dot.watchlist{background:#0284c7;}
.prio-chip{ font-size:0.56rem; font-weight:700; padding:2px 7px; border-radius:10px; text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; }
.prio-chip.high{background:#dcfce7;color:#15803d;} .prio-chip.medium{background:#fef9c3;color:#a16207;} .prio-chip.low{background:#f1f5f9;color:#64748b;} .prio-chip.watchlist{background:#e0f2fe;color:#0369a1;}
.item-next{ display:block; font-size:0.64rem; color:var(--text-muted); margin-top:3px; }
.item-next i{ color:#f59e0b; margin-right:3px; }
.due.overdue,.due.today{ color:#dc2626; font-weight:700; } .due.soon{ color:#b45309; font-weight:600; }
.deal-sales-row{ display:flex; flex-wrap:wrap; gap:7px; align-items:center; margin-bottom:8px; }
.deal-next-inline{ font-size:0.66rem; color:var(--text-muted); } .deal-next-inline i{ color:#f59e0b; margin-right:3px; }
.deal-next{ font-size:0.7rem; color:var(--text-muted); margin-top:9px; background:#f8fafc; border:1px dashed var(--border-color); border-radius:6px; padding:6px 9px; } .deal-next i{ color:#f59e0b; margin-right:4px; }
.deal-locked{ display:flex; gap:6px; align-items:flex-start; font-size:0.66rem; color:#475569; background:#f1f5f9; border-radius:6px; padding:6px 9px; margin:6px 0 9px; line-height:1.32; }
.deal-locked i{ color:#64748b; margin-top:2px; }
/* ----- pipeline value strip ----- */
.pipeline-strip{ display:flex; gap:8px; margin-top:10px; }
.pl-cell{ flex:1; background:#f8fafc; border:1px solid var(--border-color); border-radius:8px; padding:7px 10px; }
.pl-lbl{ display:block; font-size:0.56rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em; }
.pl-val{ font-size:1.0rem; font-weight:800; color:#1e293b; }
.pl-sub{ font-size:0.56rem; color:var(--text-muted); margin-left:3px; }

/* ----- on-map legend ----- */
.map-legend { position:absolute; bottom:16px; left:16px; z-index:99; max-width:252px;
    background:rgba(255,255,255,0.96); border:1px solid var(--border-color); border-radius:10px;
    box-shadow:0 6px 18px rgba(15,23,42,0.16); padding:10px 12px; backdrop-filter:blur(4px); }
.map-legend-head { display:flex; align-items:center; justify-content:space-between; gap:10px;
    font-weight:700; font-size:0.74rem; color:#1e293b; }
.map-legend-head i { color:var(--primary); margin-right:5px; }
.legend-toggle { cursor:pointer; background:none; border:none; color:var(--text-muted); font-size:0.8rem; padding:0; line-height:1; transition:transform .15s; }
.map-legend.collapsed .legend-toggle i { transform:rotate(-90deg); }
.map-legend.collapsed .legend-body { display:none; }
.legend-body { margin-top:8px; }
.legend-row { display:flex; align-items:center; gap:8px; margin:5px 0; font-size:0.72rem; color:#334155; }
.legend-row svg { flex:none; }
.legend-sub { font-size:0.66rem; color:var(--text-muted); line-height:1.4; margin-top:4px; }
.leaflet-tooltip.zone-tip { background:#065f46; color:#fff; border:none; border-radius:6px; padding:5px 8px; font-size:0.7rem; box-shadow:0 4px 12px rgba(0,0,0,0.25); }
.leaflet-tooltip.zone-tip.leaflet-tooltip-top:before { border-top-color:#065f46; }

/* ----- field-definition (?) tooltips ----- */
.help-icon { display:inline-flex; align-items:center; margin-left:4px; color:var(--text-muted); cursor:help; font-size:0.78em; position:relative; vertical-align:middle; }
.help-icon:hover { color:var(--primary); }
/* JS-positioned tooltip (escapes overflow clipping, wraps, clamps to viewport) */
#help-tip { position:fixed; z-index:6000; max-width:min(320px, 90vw); background:#0f172a; color:#fff;
    padding:9px 12px; border-radius:9px; font-size:0.72rem; font-weight:400; line-height:1.5;
    box-shadow:0 10px 30px rgba(0,0,0,0.32); pointer-events:none; opacity:0; transition:opacity .12s;
    white-space:normal; overflow-wrap:anywhere; }
#help-tip.show { opacity:1; }

/* ---- focus backdrop behind the clinic drawer ---- */
#drawer-scrim { position: fixed; inset: 0; background: rgba(15,23,42,0.45); z-index: 1500;
    opacity: 0; pointer-events: none; transition: opacity .3s ease; backdrop-filter: blur(1.5px); }
#drawer-scrim.show { opacity: 1; pointer-events: auto; }

/* ---- comms quick-actions ---- */
.comms-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 6px; }
.comms-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px;
    border-radius: 9px; border: 1px solid var(--border-color); background: #fff; color: var(--text-main);
    font-size: 0.68rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: all .15s; }
.comms-btn i { font-size: 0.95rem; }
.comms-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.comms-btn.email i { color: #ea4335; } .comms-btn.meet i { color: #00897b; }
.comms-btn.wa i { color: #25d366; } .comms-btn.call i { color: var(--primary); }

/* ---- exclusivity talk-track ---- */
.excl-card { margin: 12px 0 4px; border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 11px; padding: 12px 14px; }
.excl-head { font-weight: 800; color: #047857; font-size: 0.78rem; display: flex; gap: 7px; align-items: center; }
.excl-body { font-size: 0.82rem; color: #064e3b; line-height: 1.5; margin: 7px 0 10px; }
.excl-copy { font-size: 0.72rem; font-weight: 700; color: #047857; background: #fff; border: 1px solid #bbf7d0;
    border-radius: 8px; padding: 6px 11px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.excl-copy:hover { background: #ecfdf5; }

.excl-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.excl-list li { font-size: 0.78rem; color: #064e3b; line-height: 1.4; }
.excl-yes { font-weight: 800; color: #047857; }
.excl-yes::before { content: "\2713 "; }
.excl-no { font-weight: 800; color: #b91c1c; }
.excl-no::before { content: "\2715 "; }

.checker-card { background: rgba(99,102,241,0.05); border: 1px solid rgba(99,102,241,0.18); }
.checker-btn { width:100%; margin-top:6px; padding:9px; border:none; border-radius:8px; background:var(--primary);
    color:#fff; font-weight:700; font-size:0.78rem; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:7px; }
.checker-btn:hover { filter:brightness(1.06); }
.checker-result { margin-top:8px; font-size:0.76rem; }
.checker-result .chk-head { font-weight:700; color:var(--text-main); margin-bottom:4px; }
.checker-result .chk-warn { color:#92400e; background:#fffbeb; border:1px solid #fde68a; border-radius:8px; padding:8px; line-height:1.4; }
.checker-result .chk-muted { color:var(--text-muted); display:block; margin-top:4px; font-size:0.7rem; }

/* ----- Territory Planner ----- */
.planner-metrics { display:flex; flex-wrap:wrap; gap:12px; margin:18px 0; }
.pm { background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; padding:10px 16px; min-width:120px; }
.pm-k { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:#64748b; }
.pm-v { display:block; font-size:20px; font-weight:700; color:#0f172a; margin-top:2px; }
.pm-v.accent { color:#0284c7; }
.planner-actions { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:14px; }
.planner-btn { border:none; border-radius:8px; padding:10px 16px; font-size:13px; font-weight:600; cursor:pointer; }
.planner-btn.primary { background:#0284c7; color:#fff; }
.planner-btn.primary:hover { background:#0369a1; }
.planner-btn.ghost { background:#fff; border:1px solid #cbd5e1; color:#475569; }
.planner-subhead { margin:22px 0 10px; font-size:14px; text-transform:uppercase; letter-spacing:.05em; color:#475569; }
.planner-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:12px; }
.pcard { border:1px solid #e2e8f0; border-radius:12px; padding:14px; background:#fff; transition:.15s; }
.pcard.signed { border-color:#10b981; box-shadow:0 0 0 1px #10b98133; background:#f0fdf9; }
.pcard.foreclosed { opacity:.7; background:#fef2f2; border-color:#fecaca; }
.pcard-top { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.pcard-name { font-weight:700; color:#0f172a; }
.pcard-fee { font-weight:700; color:#0284c7; white-space:nowrap; }
.pcard-lines { display:flex; flex-wrap:wrap; gap:6px; margin:10px 0; }
.pline { font-size:11px; padding:3px 8px; border-radius:999px; border:1px solid transparent; }
.pline.open { background:#eff6ff; color:#0369a1; border-color:#bfdbfe; }
.pline.won { background:#dcfce7; color:#15803d; border-color:#86efac; }
.pline.taken { background:#fee2e2; color:#b91c1c; border-color:#fecaca; }
.pcard-foot { display:flex; justify-content:space-between; align-items:center; }
.pcard-hh { font-size:12px; color:#64748b; }
.pcard-meta { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 2px; }
.pchip { font-size:10.5px; padding:2px 7px; border-radius:999px; background:#f1f5f9; color:#475569; border:1px solid #e2e8f0; text-transform:capitalize; }
.pchip.startup { background:#fef3c7; color:#92400e; border-color:#fde68a; }
.pchip.estab { background:#e0e7ff; color:#3730a3; border-color:#c7d2fe; }
.pchip.conf { background:#ecfccb; color:#3f6212; border-color:#d9f99d; }
.econ-card { border:1px solid #e2e8f0; border-radius:12px; padding:14px; margin:14px 0; background:#f8fafc; }
.econ-head { font-weight:700; color:#0f172a; font-size:13px; display:flex; align-items:center; gap:8px; }
.econ-head i { color:#0284c7; }
.econ-sub { margin-left:auto; font-size:11px; font-weight:600; text-transform:capitalize; color:#475569; background:#e2e8f0; padding:2px 8px; border-radius:999px; }
.econ-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:12px 0 8px; }
.econ-cell { display:flex; flex-direction:column; }
.econ-k { font-size:11px; text-transform:uppercase; letter-spacing:.03em; color:#64748b; }
.econ-v { font-size:17px; font-weight:700; color:#0f172a; }
.econ-v.accent { color:#0284c7; }
.econ-foot { font-size:12px; color:#475569; }
.econ-note { font-size:11px; color:#94a3b8; margin-top:6px; }
.mintel-card { border:1px solid #e2e8f0; border-radius:12px; padding:14px; margin:14px 0; background:#fff; }
.mintel-head { font-weight:700; color:#0f172a; font-size:13px; display:flex; align-items:center; gap:8px; }
.mintel-head i { color:#7c3aed; }
.mintel-zip { margin-left:auto; font-size:11px; font-weight:600; color:#475569; background:#ede9fe; padding:2px 8px; border-radius:999px; }
.mintel-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:12px 0 10px; }
.mintel-cell { display:flex; flex-direction:column; }
.mintel-k { font-size:10.5px; text-transform:uppercase; letter-spacing:.02em; color:#64748b; }
.mintel-v { font-size:15px; font-weight:700; color:#0f172a; }
.mintel-bar { display:flex; height:14px; border-radius:7px; overflow:hidden; margin-bottom:6px; }
.mintel-bar span { height:100%; }
.mintel-legend { display:flex; flex-wrap:wrap; gap:10px; font-size:11px; color:#475569; }
.mintel-legend i { display:inline-block; width:9px; height:9px; border-radius:2px; margin-right:4px; vertical-align:middle; }
.mintel-foot { font-size:12px; color:#475569; margin-top:8px; }
.pcard-btn { border:none; border-radius:7px; padding:6px 14px; font-size:12px; font-weight:600; cursor:pointer; }
.pcard-btn.sign { background:#0284c7; color:#fff; }
.pcard-btn.unsign { background:#fff; border:1px solid #10b981; color:#059669; }
.pcard-btn.blocked { background:#f1f5f9; color:#94a3b8; cursor:not-allowed; }
.planner-plan-card { border:1px solid #cbd5e1; border-radius:12px; padding:16px; background:#f8fafc; margin-bottom:8px; }
.planner-plan-head { display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.planner-plan-title { font-weight:700; color:#0f172a; }
.planner-plan-title i { color:#10b981; margin-right:6px; }
.planner-plan-sub { font-size:12px; color:#64748b; }
.planner-plan-stats { display:flex; flex-wrap:wrap; gap:18px; margin-bottom:12px; }
.planner-plan-stats .k { display:block; font-size:11px; text-transform:uppercase; color:#64748b; letter-spacing:.04em; }
.planner-plan-stats .v { display:block; font-size:18px; font-weight:700; color:#0f172a; }
.planner-plan-stats .v.warn { color:#ea580c; }
.planner-plan-table { width:100%; border-collapse:collapse; font-size:13px; }
.planner-plan-table th { text-align:left; color:#64748b; font-weight:600; padding:6px 8px; border-bottom:1px solid #e2e8f0; }
.planner-plan-table td { padding:6px 8px; border-bottom:1px solid #f1f5f9; }
.planner-plan-table td.po { font-weight:700; color:#0284c7; }
.planner-plan-table td.num, .planner-plan-table th.num { text-align:right; white-space:nowrap; }
.planner-note { font-size:12px; color:#64748b; margin-top:10px; }
.warn-flag { font-size:11px; font-weight:600; color:#b45309; background:#fef3c7; border:1px solid #fde68a; padding:1px 7px; border-radius:999px; }

/* ===== Added with the move to app.js (strict CSP, server-backed edits, market-data states) ===== */
[hidden] { display: none !important; }
.tab-host { height: 100%; overflow: hidden; position: relative; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
button.sidebar-item, button.sidebar-logo { border: 0; background: transparent; font: inherit; padding: 0; }
.sidebar-menu li { list-style: none; }
.sidebar-item:focus-visible, .sidebar-logo:focus-visible, .practice-list-item:focus-visible, .link-btn:focus-visible,
.help-icon:focus-visible, .todo-remove:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.login-email-input { padding-left: 12px; height: 42px; font-size: 0.9rem; border-color: #cbd5e1; background: white; width: 100%; }
.local-signin { display: flex; flex-direction: column; gap: 0.4rem; text-align: left; }
.login-local-note { font-size: 0.72rem; color: var(--text-muted); margin: 0; }
.login-message { min-height: 1.1em; font-size: 0.8rem; color: #b91c1c; margin: 0; text-align: left; }
.firebase-google-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.market-status { font-size: 0.72rem; color: var(--text-muted); line-height: 1.35; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.market-status:empty { display: none; }
.drawer-market-block { display: flex; flex-direction: column; gap: 10px; }
.sample-badge { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; padding: 1px 7px; border-radius: 999px; }
.list-empty { font-size: 0.72rem; color: var(--text-muted); text-align: center; padding: 6px; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.todo-item { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; padding: 2px 0; }
.todo-text { flex: 1; overflow-wrap: anywhere; cursor: pointer; }
.todo-text.done { text-decoration: line-through; color: var(--text-muted); }
.todo-remove { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 2px 5px; border-radius: 4px; }
.todo-remove:hover { color: var(--danger); background: #fee2e2; }
.todo-add-row { display: flex; gap: 6px; margin-top: 6px; }
.todo-add-row .form-input-text { flex: 1; font-size: 0.75rem; padding: 4px 8px; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--primary); text-decoration: underline; }
.baa-pill { margin-left: 6px; padding: 2px 7px; border-radius: 999px; font-size: 0.6rem; font-weight: 700; color: #92400e; background: #fde68a; white-space: nowrap; }
.stage-note, .edit-note { font-size: 0.7rem; color: var(--text-muted); margin: 6px 0 0; }
.edit-error { font-size: 0.78rem; color: #b91c1c; min-height: 1em; margin: 6px 0 0; }
.map-error { padding: 2rem; color: var(--text-muted); text-align: center; }
.heat-popup { font-size: 0.75rem; color: #0f172a; font-family: 'Outfit', sans-serif; }
.heat-popup-title { font-size: 0.85rem; color: var(--primary); }
/* The map tab is a two-column grid (controls | map); .tab-content.active alone would make it a block. */
.workspace-content.tab-content.active { display: grid; padding: 0; overflow: hidden; }
