/* ==========================================================================
   EstateFlow - Real Estate Sales CRM & Pipeline OS (CSS)
   Light White Luxury Theme (Clean, High-Contrast, Modern)
   ========================================================================== */

:root {
    /* Primary Backgrounds */
    --bg-main: #F8FAFC;          /* Clean light off-white / slate-50 */
    --bg-card: #FFFFFF;          /* Pure crisp white */
    --bg-card-hover: #F8FAFC;    /* Subtle hover tint */
    --bg-sidebar: #FFFFFF;       /* Clean white sidebar */
    --bg-input: #F8FAFC;         /* Soft light input backgrounds */
    --bg-dialog: #FFFFFF;        /* Pure white modal */
    --bg-column: #F1F5F9;        /* Soft slate-100 for kanban columns */

    /* Borders */
    --border-subtle: #E2E8F0;    /* Crisp slate-200 border */
    --border-hover: #CBD5E1;     /* Slate-300 on hover */
    --border-active: #D97706;    /* Gold border active */

    /* Accent Colors (Real Estate Luxury Gold & Jewel Tones) */
    --gold-primary: #D97706;     /* Deep rich amber/gold with high contrast */
    --gold-hover: #B45309;       /* Darker gold on hover */
    --gold-glow: rgba(217, 119, 6, 0.15);
    --gold-muted: #FEF3C7;       /* Soft gold tint for badges & active states */
    --gold-text: #92400E;        /* High-contrast gold text */

    --emerald-primary: #059669;  /* Emerald for Won deals */
    --emerald-muted: #ECFDF5;
    --emerald-text: #065F46;

    --blue-primary: #2563EB;     /* Royal blue for Site Visits */
    --blue-muted: #EFF6FF;
    --blue-text: #1E40AF;

    --purple-primary: #7C3AED;
    --rose-primary: #DC2626;

    /* Typography Colors */
    --text-main: #0F172A;        /* Deep slate-900 for primary headings & text */
    --text-muted: #475569;       /* Slate-600 for descriptions & secondary text */
    --text-dim: #64748B;         /* Slate-500 for captions & icons */
    --text-light: #94A3B8;

    --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Soft Modern Shadows */
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-dialog: 0 25px 60px -15px rgba(15, 23, 42, 0.2);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ==========================================================================
   AUTHENTICATION OVERLAY (Login & Create Account)
   ========================================================================== */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(circle at 50% 20%, rgba(217, 119, 6, 0.08), transparent 60%),
                rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-overlay.hidden {
    display: none !important;
}

.auth-card {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 490px;
    padding: 38px 34px;
    box-shadow: var(--shadow-dialog);
    animation: authFadeIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 14px;
}

.auth-brand-name {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    display: block;
    line-height: 1.1;
}

.auth-brand-badge {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--gold-primary);
}

.auth-brand h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.auth-brand p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Tabs: Sign In vs Create Account */
.auth-tabs {
    display: flex;
    background: #F1F5F9;
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 22px;
    border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab-btn:hover {
    color: var(--text-main);
}

.auth-tab-btn.active {
    background: #FFFFFF;
    color: var(--gold-primary);
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Auth Alerts */
.auth-alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.4;
}

.auth-alert.error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

.auth-alert.success {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.auth-alert.hidden {
    display: none !important;
}

.auth-form.hidden {
    display: none !important;
}

.auth-footer-help {
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-footer-help a {
    color: var(--gold-primary);
    text-decoration: none;
    font-weight: 700;
    margin-left: 4px;
}

.auth-footer-help a:hover {
    text-decoration: underline;
}

.demo-credentials-pill {
    margin-top: 20px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.demo-credentials-pill code {
    background: #E2E8F0;
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--gold-primary);
    font-weight: 700;
}

/* ==========================================================================
   APP LAYOUT & SIDEBAR
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar {
    width: 275px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
    z-index: 999;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

.sidebar-header {
    margin-bottom: 20px;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-main);
    display: block;
    line-height: 1.1;
}

.logo-domain {
    font-size: 11px;
    color: var(--gold-primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* User Profile Badge */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 22px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-primary), #B45309);
    color: #FFFFFF;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.user-meta {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 4px;
}

.user-role-badge.admin {
    background: #FEF3C7;
    color: #92400E;
}

.user-role-badge.manager {
    background: #EFF6FF;
    color: #1E40AF;
}

.user-role-badge.agent, .user-role-badge.broker {
    background: #ECFDF5;
    color: #065F46;
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: var(--rose-primary);
    background: #FEF2F2;
}

/* Sidebar Nav Links */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background: #F1F5F9;
    color: var(--text-main);
}

.nav-item.active {
    background: var(--gold-muted);
    color: var(--gold-text);
    font-weight: 700;
    border: 1px solid #FDE68A;
}

.nav-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    background: var(--gold-primary);
    color: #FFFFFF;
    padding: 1px 7px;
    border-radius: 10px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 20px 0;
}

/* WhatsApp Pitch Tools Hub */
.templates-hub {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.templates-hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hub-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
}

.icon-btn-tiny {
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn-tiny:hover {
    color: var(--gold-primary);
    border-color: var(--gold-primary);
    background: #FFFFFF;
}

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tpl-item-chip {
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.tpl-item-chip:hover {
    border-color: #25D366;
    color: var(--text-main);
    background: #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.tpl-chip-actions {
    display: flex;
    gap: 6px;
    opacity: 0.6;
}

.tpl-item-chip:hover .tpl-chip-actions {
    opacity: 1;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-dim);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald-primary);
}

.status-dot.pulsing {
    box-shadow: 0 0 0 rgba(5, 150, 105, 0.4);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.6); }
    70% { box-shadow: 0 0 0 7px rgba(5, 150, 105, 0); }
    100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-main);
}

/* Top App Bar */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-toggle-btn {
    display: none;
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
}

.header-titles h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.header-titles p {
    font-size: 13px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--gold-primary);
    color: #FFFFFF;
    font-weight: 700;
}

.btn-primary:hover {
    background: var(--gold-hover);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.btn-gold {
    background: linear-gradient(135deg, #D97706, #B45309);
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

.btn-gold:hover {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}

.btn-secondary {
    background: #FFFFFF;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: #F8FAFC;
    border-color: var(--border-hover);
}

.btn-danger {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #DC2626;
}

.btn-danger:hover {
    background: #FEE2E2;
}

.btn-wa {
    background: #25D366;
    color: #FFFFFF;
    font-weight: 700;
}

.btn-wa:hover {
    background: #1EBE5D;
}

.btn-block {
    width: 100%;
}

/* ==========================================================================
   METRICS BAR
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    padding: 18px 28px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-subtle);
}

.metric-card {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-card);
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: #CBD5E1;
}

.metric-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-data {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.metric-card.pipeline-val .metric-value {
    color: var(--gold-primary);
}

.metric-card.won .metric-value {
    color: var(--emerald-primary);
}

.metric-card.site-visit .metric-value {
    color: var(--blue-primary);
}

.metric-card.follow-up .metric-value {
    color: var(--gold-primary);
}

/* ==========================================================================
   TOOLBAR PANEL (Search & Filters)
   ========================================================================== */
.toolbar-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 28px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-subtle);
}

.search-input-box {
    flex: 1;
    position: relative;
    max-width: 480px;
}

.search-input-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

.search-input-box input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.search-input-box input:focus {
    background: #FFFFFF;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.filters-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-select {
    padding: 9px 14px;
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:focus, .filter-select:hover {
    background: #FFFFFF;
    border-color: #CBD5E1;
    color: var(--text-main);
}

/* ==========================================================================
   KANBAN VIEW
   ========================================================================== */
.view-pane {
    flex: 1;
    padding: 24px 28px;
}

.view-pane.hidden {
    display: none !important;
}

/* Mobile Stage Switcher */
.mobile-stage-tabs {
    display: none;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.stage-pill {
    padding: 7px 14px;
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.stage-pill.active {
    background: var(--gold-primary);
    color: #FFFFFF;
    font-weight: 700;
    border-color: var(--gold-primary);
}

.kanban-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(290px, 1fr));
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 24px;
    align-items: start;
}

.kanban-col {
    background: var(--bg-column);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 520px;
}

.col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #E2E8F0;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.col-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

.col-count {
    background: #FFFFFF;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
}

.col-dropzone {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 440px;
    transition: background 0.2s;
}

.col-dropzone.drag-over {
    background: rgba(217, 119, 6, 0.06);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ==========================================================================
   REAL ESTATE LEAD CARD
   ========================================================================== */
.lead-card {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-card);
    position: relative;
    user-select: none;
}

.lead-card:hover {
    transform: translateY(-2px);
    border-color: #CBD5E1;
    box-shadow: var(--shadow-hover);
}

.lead-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.card-actions-quick {
    display: flex;
    align-items: center;
    gap: 4px;
}

.quick-action-link {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #FFFFFF;
    transition: transform 0.2s;
}

.quick-action-link:hover {
    transform: scale(1.15);
}

.quick-action-link.wa {
    background: #25D366;
}

.quick-action-link.call {
    background: var(--blue-primary);
}

.card-property-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
    margin-bottom: 8px;
}

.card-location {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.card-location svg {
    color: var(--text-dim);
    flex-shrink: 0;
}

.card-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px dashed var(--border-subtle);
    font-size: 12px;
}

.card-budget {
    font-weight: 700;
    color: var(--gold-primary);
}

.card-rep {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: capitalize;
    background: #F1F5F9;
    padding: 2px 7px;
    border-radius: 4px;
}

/* Site Visit Pill on Card */
.card-sitevisit-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1D4ED8;
    font-size: 11px;
    font-weight: 600;
}

.card-notes-preview {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.35;
    background: #F8FAFC;
    border: 1px solid #F1F5F9;
    padding: 6px 8px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   TABLE DIRECTORY VIEW
   ========================================================================== */
.table-card {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.table-responsive {
    overflow-x: auto;
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.leads-table th {
    background: #F8FAFC;
    padding: 14px 18px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.leads-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #F1F5F9;
    color: var(--text-main);
    vertical-align: middle;
}

.leads-table tr:hover td {
    background: #F8FAFC;
}

.client-cell {
    display: flex;
    flex-direction: column;
}

.client-name-bold {
    font-weight: 700;
    color: var(--text-main);
}

.client-phone-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.stage-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

.stage-badge.new { background: #F1F5F9; color: #475569; }
.stage-badge.contacted { background: #EFF6FF; color: #1D4ED8; }
.stage-badge.follow-up { background: #FEF3C7; color: #92400E; }
.stage-badge.site-visit-scheduled { background: #E0E7FF; color: #3730A3; }
.stage-badge.site-visit-done { background: #F5F3FF; color: #6D28D9; }
.stage-badge.negotiation { background: #FFFBEB; color: #B45309; }
.stage-badge.closed-won { background: #ECFDF5; color: #047857; }
.stage-badge.lost { background: #FEF2F2; color: #B91C1C; }

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.action-icon-btn {
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.action-icon-btn:hover {
    color: var(--gold-primary);
    border-color: var(--gold-primary);
    background: #FFFFFF;
}

/* ==========================================================================
   MODALS (HTML5 Dialog)
   ========================================================================== */
.modal-dialog {
    background: transparent;
    border: none;
    margin: auto;
    padding: 20px;
    max-width: 960px;
    width: 95%;
}

.modal-dialog::backdrop {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
}

.modal-dialog.small-dialog {
    max-width: 520px;
}

.modal-content {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-dialog);
    overflow: hidden;
    animation: authFadeIn 0.25s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: #F8FAFC;
}

.modal-title-wrap h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.modal-lead-id {
    font-size: 11px;
    color: var(--gold-primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-two-columns {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    min-height: 520px;
}

.modal-form-pane {
    padding: 24px;
    background: #FFFFFF;
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    max-height: 75vh;
}

.modal-notes-pane {
    padding: 24px;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 75vh;
}

/* Forms styling */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    background: #FFFFFF;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.15);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-with-icon {
    position: relative;
}

.input-with-icon svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

.input-with-icon input {
    padding-left: 38px;
}

.input-with-action {
    display: flex;
    gap: 6px;
}

.form-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 18px;
    margin-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

/* Notes Section */
.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.notes-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.notes-count-badge {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    color: var(--gold-primary);
    font-weight: 700;
}

.quick-pitch-box {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.quick-pitch-box label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.pitch-select-row {
    display: flex;
    gap: 8px;
}

.pitch-select-row select {
    flex: 1;
    padding: 7px 10px;
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 12px;
    outline: none;
}

.add-note-card {
    margin-bottom: 16px;
}

.add-note-card textarea {
    width: 100%;
    height: 70px;
    padding: 9px 12px;
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    resize: none;
    margin-bottom: 8px;
}

.notes-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.note-entry {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 10px;
    color: var(--text-dim);
}

.note-author {
    color: var(--gold-primary);
    font-weight: 700;
}

/* Template Form & Placeholders */
.tpl-placeholders {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tpl-placeholders span {
    font-size: 10px;
    font-family: monospace;
    background: #F1F5F9;
    padding: 3px 6px;
    border-radius: 4px;
    color: var(--gold-primary);
    border: 1px solid var(--border-subtle);
    font-weight: 700;
}

/* CSV Dropzone */
.import-body {
    padding: 24px;
}

.import-body p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.csv-dropzone {
    border: 2px dashed #CBD5E1;
    border-radius: var(--radius-lg);
    padding: 36px 20px;
    text-align: center;
    background: #F8FAFC;
    cursor: pointer;
    transition: all 0.2s;
}

.csv-dropzone:hover {
    background: #FEF3C7;
    border-color: var(--gold-primary);
}

.csv-dropzone svg {
    color: var(--gold-primary);
    margin-bottom: 10px;
}

.csv-dropzone p {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.hidden-file-input {
    display: none;
}

.import-footer-note {
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-dim);
}

/* Site Visits Tour List */
.sitevisits-modal-body {
    padding: 20px 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.sitevisits-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sitevisit-tour-card {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--gold-primary);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-card);
}

.tour-info h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.tour-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.tour-datetime {
    display: inline-block;
    background: #EFF6FF;
    color: #1D4ED8;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
    border: 1px solid #BFDBFE;
}

/* Team Roster */
.team-roster {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-member-row {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.member-info h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

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

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1080px) {
    .modal-two-columns {
        grid-template-columns: 1fr;
    }
    .modal-form-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
}

@media (max-width: 860px) {
    .mobile-toggle-btn {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -290px;
        top: 0;
        bottom: 0;
        height: 100vh;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        left: 0;
    }

    .mobile-stage-tabs {
        display: flex;
    }

    .kanban-grid {
        grid-template-columns: 1fr;
    }

    .kanban-col {
        display: none;
    }

    .kanban-col.mobile-active {
        display: flex;
    }

    .toolbar-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-row {
        flex-wrap: wrap;
    }

    .filter-select {
        flex: 1;
        min-width: 130px;
    }

    .app-header {
        padding: 16px 18px;
    }

    .header-actions {
        gap: 6px;
    }

    .btn span {
        display: none;
    }

    .btn.btn-gold span {
        display: inline;
    }

    .metrics-grid {
        padding: 14px 18px;
    }

    .view-pane {
        padding: 16px 18px;
    }
}
