/* Sales Enablement Dashboard — visual refresh */

:root {
    --navy-900: #0f172a;
    --navy-800: #1e293b;
    --navy-700: #334155;
    --navy-100: #e2e8f0;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50:  #f8fafc;
    --accent:    #2563eb;
    --accent-2:  #4f46e5;
    --accent-hover: #1d4ed8;
    --orange:    #f97316;
    --green:     #10b981;
    --red:       #ef4444;
    --gradient:  linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow:    0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --radius:    10px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
    color: var(--navy-900);
    background: var(--slate-50);
    -webkit-font-smoothing: antialiased;
}

/* ==================== LOADING BAR ==================== */
#loading-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: transparent;
    z-index: 9999;
    pointer-events: none;
}
#loading-bar.active::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 0%, #2563eb 50%, transparent 100%);
    background-size: 200% 100%;
    animation: loading-slide 1.2s linear infinite;
}
@keyframes loading-slide {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ==================== LOGIN ==================== */
.login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
}
.login-card {
    background: white; padding: 44px; border-radius: 14px;
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 440px;
}
.login-card h1 { font-size: 26px; margin-bottom: 6px; color: var(--navy-900); }
.login-card .subtitle { color: var(--slate-500); margin-bottom: 28px; font-size: 14px; }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500;
    margin-bottom: 6px; color: var(--navy-800);
}
.form-group input, .form-group select {
    width: 100%; padding: 11px 13px;
    border: 1px solid var(--slate-200); border-radius: var(--radius-sm);
    font-size: 14px; transition: all 0.15s;
    background: white;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    padding: 10px 16px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all 0.15s;
}
.btn-primary {
    background: var(--gradient);
    color: white; width: 100%;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); transform: translateY(-1px); }
.btn-primary:disabled { background: var(--slate-400); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: white; color: var(--navy-800); border: 1px solid var(--slate-200); }
.btn-secondary:hover { background: var(--slate-50); border-color: var(--slate-400); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }

.login-error {
    background: #fef2f2; color: #991b1b;
    padding: 11px 13px; border-radius: var(--radius-sm);
    margin-bottom: 16px; font-size: 13px;
    border: 1px solid #fecaca;
    display: none;
}

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

.sidebar {
    width: 290px;
    background: white;
    border-right: 1px solid var(--slate-200);
    padding: 24px 20px;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: var(--shadow-sm);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--slate-200); border-radius: 3px; }

.main {
    flex: 1;
    padding: 28px 32px;
    overflow-x: hidden;
    background: var(--slate-50);
}

/* Brand */
.brand-logo {
    display: block;
    max-width: 100%;
    height: auto;
    margin-bottom: 12px;
}
.brand {
    font-size: 18px; font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.brand-sub {
    font-size: 11px; color: var(--slate-500);
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 24px; margin-top: 2px;
}

/* User chip — restructured: email on top, actions below */
.user-card {
    background: linear-gradient(135deg, var(--slate-50) 0%, white 100%);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.user-card .user-row {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--gradient); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-email {
    font-size: 13px; font-weight: 600; color: var(--navy-900);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-role {
    font-size: 10px; color: var(--slate-500);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.user-actions {
    display: flex; gap: 6px;
}
.user-actions a {
    flex: 1; text-align: center;
    padding: 7px 10px;
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    color: var(--navy-800);
    text-decoration: none;
    font-size: 12px; font-weight: 500;
    transition: all 0.15s;
}
.user-actions a:hover {
    background: var(--slate-50);
    border-color: var(--slate-400);
    color: var(--accent);
}

/* Filters */
.filter-section h3 {
    font-size: 11px; text-transform: uppercase;
    color: var(--slate-500); margin-bottom: 8px; margin-top: 18px;
    letter-spacing: 0.06em; font-weight: 600;
}
.filter-section h3:first-child { margin-top: 0; }
.filter-section select, .filter-section input {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--slate-200); border-radius: var(--radius-sm);
    font-size: 13px; margin-bottom: 8px;
    background: white; color: var(--navy-900);
    transition: border-color 0.15s;
}
.filter-section select:focus, .filter-section input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.filter-section select[multiple] { min-height: 110px; padding: 6px; }
.filter-section select[multiple] option { padding: 4px 8px; border-radius: 4px; }
.date-row { display: flex; gap: 6px; }
.date-row input { flex: 1; }
.filter-section .hint {
    font-size: 11px; color: var(--slate-500);
    margin-top: -4px; margin-bottom: 10px;
    line-height: 1.4;
}
.filter-actions {
    margin-top: 16px; padding-top: 16px;
    border-top: 1px solid var(--slate-200);
    display: flex; flex-direction: column; gap: 6px;
}

/* ==================== TABS ==================== */
.tabs {
    display: flex; gap: 2px;
    background: white;
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--slate-200);
    overflow-x: auto;
}
.tab {
    padding: 10px 18px; background: none; border: none;
    border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px; font-weight: 500;
    color: var(--slate-500); white-space: nowrap;
    transition: all 0.15s;
}
.tab:hover { color: var(--navy-900); background: var(--slate-50); }
.tab.active {
    color: white;
    background: var(--gradient);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== KPIs ==================== */
.kpis {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 12px; margin-bottom: 24px;
}
.kpi {
    background: white;
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}
.kpi::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: var(--gradient);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}
.kpi:has(.info-bubble:hover) { z-index: 100; }
.kpi:nth-child(1)::before { background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%); }
.kpi:nth-child(2)::before { background: linear-gradient(135deg, #06b6d4 0%, #10b981 100%); }
.kpi:nth-child(3)::before { background: linear-gradient(135deg, #10b981 0%, #84cc16 100%); }
.kpi:nth-child(4)::before { background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%); }
.kpi:nth-child(5)::before { background: linear-gradient(135deg, #f97316 0%, #ec4899 100%); }
.kpi:nth-child(6)::before { background: linear-gradient(135deg, #ec4899 0%, #7c3aed 100%); }
.kpi:nth-child(7)::before { background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-label {
    font-size: 11px; text-transform: uppercase; color: var(--slate-500);
    letter-spacing: 0.06em; margin-bottom: 6px; font-weight: 600;
}
.kpi-value {
    font-size: 24px; font-weight: 700; color: var(--navy-900);
    font-variant-numeric: tabular-nums;
}
@media (max-width: 1400px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* ==================== CARDS ==================== */
.card {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--slate-200);
    border-left: 3px solid var(--accent);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}
#tab-show .card:nth-of-type(1) { border-left-color: #2563eb; }
#tab-show .card:nth-of-type(2) { border-left-color: #10b981; }
#tab-show .card:nth-of-type(3) { border-left-color: #f97316; }
#tab-opps .card { border-left-color: #7c3aed; }
#tab-join .card { border-left-color: #06b6d4; }
#tab-recs .card { border-left-color: #ec4899; }
#tab-avail .card:nth-of-type(1) { border-left-color: #facc15; }
#tab-avail .card:nth-of-type(2) { border-left-color: #84cc16; }
#tab-calc  .card { border-left-color: #10b981; }
.card h2 {
    font-size: 17px; font-weight: 600;
    margin-bottom: 14px; color: var(--navy-900);
}
.card h3 {
    font-size: 14px; font-weight: 600;
    margin-top: 20px; margin-bottom: 10px;
    color: var(--navy-800);
}
.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.muted { color: var(--slate-500); font-size: 13px; line-height: 1.5; }

.controls {
    display: flex; gap: 12px; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap;
    padding: 12px;
    background: var(--slate-50);
    border-radius: var(--radius-sm);
}
.controls label { font-size: 13px; color: var(--navy-800); font-weight: 500; }
.controls select, .controls input[type="number"] {
    padding: 7px 11px; border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm); font-size: 13px;
    background: white;
}
.controls select:focus, .controls input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.chart-wrap { position: relative; width: 100%; height: 360px; }
.chart-wrap.tall { height: 460px; }

/* ==================== TABLES ==================== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--slate-100); }
th {
    background: var(--slate-50); font-weight: 600;
    color: var(--slate-600); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.04em;
    position: sticky; top: 0;
    border-bottom: 1px solid var(--slate-200);
}
tbody tr:hover { background: var(--slate-50); }
.scroll-y {
    max-height: 480px; overflow-y: auto;
    border: 1px solid var(--slate-200); border-radius: var(--radius-sm);
}
.scroll-y::-webkit-scrollbar { width: 8px; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--slate-200); border-radius: 4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ==================== HEATMAP ==================== */
#heatmap { margin: 16px 0; overflow-x: auto; }
.heatmap-table {
    border-collapse: separate;
    border-spacing: 3px;
    width: 100%;
    table-layout: fixed;
}
.heatmap-table thead th {
    background: transparent;
    border: none;
    padding: 8px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-500);
    text-align: center;
    font-weight: 600;
    position: static;
}
.heatmap-table thead th:first-child { width: 110px; }
.heatmap-table tbody th.row-label {
    background: transparent;
    border: none;
    padding: 0 12px 0 0;
    font-size: 12px;
    color: var(--slate-600);
    font-weight: 500;
    text-align: right;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    width: 110px;
}
.heatmap-table tbody td {
    padding: 0;
    height: 38px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border: none;
    border-radius: 4px;
    transition: transform 0.1s, box-shadow 0.1s;
    cursor: default;
}
.heatmap-table tbody td:hover {
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    z-index: 2;
    position: relative;
}
.heatmap-table tbody td.hm-empty {
    background: var(--slate-100);
    color: var(--slate-400);
}
.heatmap-table tbody tr:hover { background: transparent; }

/* ==================== REVENUE CALC ==================== */
.calc-rate {
    width: 72px;
    padding: 5px 8px;
    border: 1px solid var(--slate-200);
    border-radius: 4px;
    font-size: 12px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    background: #fefce8;
}
.calc-rate:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    background: white;
}
.calc-rate.changed { background: #fef3c7; border-color: #f59e0b; }
.calc-rate.calc-pitches { width: 88px; }
#calc-table td.calc-derived {
    background: #f8fafc;
    font-weight: 600;
    color: var(--navy-800);
}
#calc-table td.calc-revenue {
    background: #ecfdf5;
    color: #047857;
    font-weight: 700;
}
#calc-totals { font-variant-numeric: tabular-nums; line-height: 1.6; }
#calc-totals strong { color: var(--navy-900); }

/* ==================== ADMIN ==================== */
.admin-page { max-width: 820px; margin: 40px auto; padding: 0 20px; }
.admin-table th, .admin-table td { padding: 12px 14px; }
.admin-table .role {
    font-size: 10px; padding: 3px 10px; border-radius: 12px;
    background: var(--slate-100); color: var(--slate-600);
    text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em;
}
.admin-table .role.admin { background: #dbeafe; color: #1e40af; }
.admin-form {
    display: grid; grid-template-columns: 1fr 140px auto;
    gap: 10px; align-items: end; margin-bottom: 24px;
}
.admin-form .btn-primary { width: auto; }
/* ==================== ASSISTANT ==================== */
.assistant-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; height: calc(100vh - 200px); min-height: 500px; }
.assist-sidebar { background: white; border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 16px; overflow-y: auto; }
.assist-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate-500); font-weight: 600; margin-bottom: 8px; }
.assist-list { display: flex; flex-direction: column; gap: 4px; }
.assist-list-item { padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; color: var(--navy-800); background: var(--slate-50); border: 1px solid transparent; transition: all 0.1s; display: flex; justify-content: space-between; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assist-list-item:hover { border-color: var(--slate-200); background: white; }
.assist-list-item.active { border-color: var(--accent); background: #eff6ff; }
.assist-list-item .del-btn { background: none; border: none; cursor: pointer; color: var(--slate-400); font-size: 14px; padding: 0 2px; flex-shrink: 0; }
.assist-list-item .del-btn:hover { color: var(--red); }
.assist-main { background: white; border: 1px solid var(--slate-200); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.assist-messages { flex: 1; overflow-y: auto; padding: 20px; }
.assist-welcome { text-align: center; padding: 60px 20px; }
.assist-welcome h2 { font-size: 20px; margin-bottom: 8px; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.assist-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 20px; }
.assist-example { background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 20px; padding: 8px 16px; font-size: 12px; color: var(--navy-800); cursor: pointer; transition: all 0.15s; }
.assist-example:hover { border-color: var(--accent); color: var(--accent); background: #eff6ff; }
.assist-msg { margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.assist-msg.user { justify-content: flex-end; }
.assist-msg .avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.assist-msg.user .avatar { background: var(--gradient); color: white; order: 2; }
.assist-msg.assistant .avatar { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.assist-msg .bubble { max-width: 75%; padding: 12px 16px; border-radius: 12px; font-size: 13px; line-height: 1.6; }
.assist-msg.user .bubble { background: var(--accent); color: white; border-bottom-right-radius: 4px; }
.assist-msg.assistant .bubble { background: var(--slate-50); border: 1px solid var(--slate-200); border-bottom-left-radius: 4px; color: var(--navy-900); }
.assist-msg.assistant .bubble table { margin: 8px 0; font-size: 12px; }
.assist-msg.assistant .bubble th { background: var(--slate-100); font-size: 11px; }
.assist-msg .save-btn { background: none; border: none; cursor: pointer; color: var(--slate-400); font-size: 11px; margin-top: 4px; padding: 2px 6px; }
.assist-msg .save-btn:hover { color: var(--accent); }
.assist-msg.thinking .bubble { background: var(--slate-50); border: 1px solid var(--slate-200); color: var(--slate-500); font-style: italic; }
.assist-input-row { display: flex; gap: 8px; padding: 16px; border-top: 1px solid var(--slate-200); background: var(--slate-50); }
.assist-input-row input { flex: 1; padding: 10px 14px; border: 1px solid var(--slate-200); border-radius: 20px; font-size: 13px; background: white; height: 40px; }
.assist-input-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
.assist-input-row .btn { border-radius: 20px; padding: 0 20px; height: 40px; font-size: 13px; white-space: nowrap; width: auto; }

/* ==================== FIELD SCHEDULE ==================== */
.field-day-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
.field-day-cell { padding: 10px 6px; border-radius: var(--radius-sm); border: 1px solid var(--slate-200); background: white; cursor: pointer; text-align: center; transition: all 0.1s; font-size: 11px; }
.field-day-cell:hover { border-color: var(--accent); }
.field-day-cell.active { background: var(--gradient); color: white; border-color: transparent; }
.field-day-cell.today:not(.active) { border-color: #10b981; box-shadow: inset 0 0 0 1px #10b981; }
.field-day-cell .dow { font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.field-day-cell .date { font-size: 14px; font-weight: 600; margin-top: 2px; }
.field-day-cell .count { font-size: 10px; opacity: 0.6; margin-top: 2px; }
.field-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; min-height: 500px; }
.field-map { width: 100%; height: 600px; border-radius: var(--radius); border: 1px solid var(--slate-200); }
.field-side h3 { font-size: 11px; text-transform: uppercase; color: var(--slate-500); letter-spacing: 0.06em; margin-top: 16px; margin-bottom: 8px; font-weight: 600; }
.field-side h3:first-child { margin-top: 0; }
.field-legend { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--navy-800); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; border: 2px solid white; box-shadow: 0 0 0 1px var(--slate-300); }
.field-unmapped-item { background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 6px; font-size: 12px; }
.field-unmapped-item .opp-name { font-weight: 600; color: var(--navy-900); margin-bottom: 2px; }
.field-unmapped-item .reason { color: var(--red); font-size: 11px; }
.field-unmapped-item button { margin-top: 4px; font-size: 11px; padding: 2px 8px; }
.leaflet-popup-content { font-size: 12px; line-height: 1.5; min-width: 220px; }
.leaflet-popup-content .pop-title { font-weight: 600; font-size: 13px; color: var(--navy-900); margin-bottom: 4px; }
.leaflet-popup-content .pop-row { display: flex; gap: 4px; margin-bottom: 2px; }
.leaflet-popup-content .pop-label { color: var(--slate-500); min-width: 60px; }
#tab-field .card { border-left-color: #06b6d4; }

/* Route panel */
.route-total { background: linear-gradient(135deg, #eff6ff 0%, #f0fdfa 100%); border: 1px solid #bfdbfe; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.route-total-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate-500); font-weight: 600; }
.route-total-value { font-size: 14px; font-weight: 700; color: var(--navy-900); margin-top: 2px; }
.route-legs { display: flex; flex-direction: column; gap: 4px; }
.route-stop { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-sm); }
.route-stop-num { background: var(--gradient); color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.route-stop-info { flex: 1; min-width: 0; }
.route-stop-name { font-size: 12px; font-weight: 600; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-stop-time { font-size: 11px; }
.route-leg { font-size: 11px; padding-left: 30px; line-height: 1.6; }

/* Route stop clickable styling */
.route-stop { cursor: pointer; transition: all 0.1s; }
.route-stop:hover { background: white !important; border-color: var(--accent) !important; box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15); }

/* ==================== LAST SYNC BADGE ==================== */
#last-sync-badge {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9998;
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 11px;
    color: var(--slate-600);
    box-shadow: var(--shadow);
    display: none;
}
#last-sync-badge.ready { display: block; }
#last-sync-badge .sync-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--slate-500);
    font-weight: 600;
    margin-right: 6px;
}
#last-sync-badge .sync-time {
    color: var(--navy-900);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Salesforce link styling */
.sf-link { color: var(--accent); text-decoration: none; font-size: 11px; margin-left: 4px; opacity: 0.7; }
.sf-link:hover { opacity: 1; text-decoration: underline; }
.leaflet-popup-content .pop-title a { color: var(--accent); text-decoration: none; }
.leaflet-popup-content .pop-title a:hover { text-decoration: underline; }
.field-unmapped-item .opp-name a { color: var(--accent); text-decoration: none; }
.field-unmapped-item .opp-name a:hover { text-decoration: underline; }

/* Saved report viewer */
.saved-report-header { padding: 12px 16px; background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%); border: 1px solid #bbf7d0; border-radius: var(--radius-sm); margin-bottom: 16px; }
.saved-report-header h2 { color: var(--navy-900); }

/* ==================== MY DAY ==================== */
#tab-myday .card { border-left-color: #7c3aed; }
.myday-appt { display: flex; gap: 12px; padding: 10px 12px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-sm); margin-bottom: 6px; align-items: flex-start; }
.myday-appt-time { width: 110px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.myday-appt-body { flex: 1; min-width: 0; }
.myday-appt-name { font-size: 13px; font-weight: 600; color: var(--navy-900); }
.myday-appt-name a { color: var(--accent); text-decoration: none; }
.myday-appt-name a:hover { text-decoration: underline; }
.myday-appt-meta { font-size: 11px; color: var(--slate-500); margin-top: 2px; line-height: 1.5; }
.myday-top200 { display: inline-block; background: #fef3c7; color: #92400e; font-size: 10px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; font-weight: 600; }

/* Info bubble for KPI tooltips */
.info-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    cursor: help;
    position: relative;
    user-select: none;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
    transition: transform 0.1s, background 0.1s;
    vertical-align: middle;
    text-transform: none;
    line-height: 1;
}
.info-bubble:hover, .info-bubble:focus {
    background: var(--accent-hover);
    transform: scale(1.1);
    outline: none;
}
.info-tip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: var(--navy-900);
    color: white;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
    text-transform: none;
    letter-spacing: normal;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.15s;
    pointer-events: none;
}
.info-tip b { font-weight: 600; }
.info-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--navy-900);
}
.info-bubble:hover .info-tip, .info-bubble:focus .info-tip { visibility: visible; opacity: 1; }

/* Table action / export buttons */
.table-actions { display: flex; justify-content: flex-end; margin-top: 12px; margin-bottom: 4px; }
.btn-export { padding: 5px 10px; font-size: 11px; }

/* Quick search */
.quick-search { position: relative; margin-bottom: 16px; }
.quick-search input { width: 100%; padding: 9px 11px; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); font-size: 12px; background: white; }
.quick-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
#quick-search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: white; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 360px; overflow-y: auto; z-index: 200; display: none; }
#quick-search-results.show { display: block; }
.qs-result { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--slate-100); display: block; text-decoration: none; color: var(--navy-900); }
.qs-result:hover { background: var(--slate-50); }
.qs-result:last-child { border-bottom: none; }
.qs-name { font-size: 12px; font-weight: 600; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-meta { font-size: 10px; color: var(--slate-500); margin-top: 2px; }
.qs-empty { padding: 10px; font-size: 11px; color: var(--slate-500); text-align: center; }
.qs-result .qs-top200 { display: inline-block; background: #fef3c7; color: #92400e; font-size: 9px; padding: 1px 5px; border-radius: 3px; margin-left: 4px; font-weight: 600; vertical-align: middle; }

/* Responsive: Field Schedule + general mobile tweaks */
@media (max-width: 900px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; }
    .main { padding: 16px; }
    .field-layout { grid-template-columns: 1fr; }
    .field-map { height: 420px; }
    .field-day-grid { grid-template-columns: repeat(5, 1fr); gap: 4px; }
    .field-day-cell { padding: 6px 2px; font-size: 10px; }
    .field-day-cell .date { font-size: 12px; }
    .kpis { grid-template-columns: repeat(2, 1fr) !important; }
    .tabs { flex-wrap: wrap; }
    .myday-appt-time { width: 80px; }
}
@media (max-width: 600px) {
    .kpis { grid-template-columns: 1fr !important; }
    .field-day-grid { grid-template-columns: repeat(5, 1fr); }
    .field-day-cell .dow { font-size: 9px; }
    .field-day-cell .date { font-size: 11px; }
    .controls { gap: 8px; padding: 8px; }
    .main { padding: 12px; }
    .card { padding: 16px; }
}

/* ==================== TEAM SCORECARDS ==================== */
#tab-team .card { border-left-color: #db2777; }
.team-type-btn { padding: 6px 14px; font-size: 12px; }
.team-type-btn.active { background: var(--gradient); color: white; border-color: transparent; }
.cell-good { background: #d1fae5 !important; color: #065f46 !important; font-weight: 600; }
.cell-warn { background: #fef3c7 !important; color: #92400e !important; font-weight: 600; }
.cell-bad  { background: #fee2e2 !important; color: #991b1b !important; font-weight: 600; }
.cell-na   { background: #f3f4f6 !important; color: #6b7280 !important; }
.scorecard-rep { font-weight: 600; color: var(--navy-900); }
.scorecard-baseline { display: block; font-size: 10px; color: var(--slate-500); font-weight: 400; margin-top: 1px; }
#team-scorecard-table td { padding: 8px 10px; }
#team-scorecard-table th { white-space: nowrap; }

/* ==================== PIPELINE TOGGLE (My Day) ==================== */
.pipeline-toggle {
    display: inline-flex;
    background: var(--slate-100);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.pipeline-toggle .pt-btn {
    background: transparent;
    border: none;
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}
.pipeline-toggle .pt-btn:hover { color: var(--navy-900); }
.pipeline-toggle .pt-btn.active {
    background: white;
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

/* ==================== AVAILABILITY MATRIX ==================== */
.avail-slicer-row {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.avail-slicer {
    flex: 1;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.avail-slicer label {
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.avail-slicer select {
    min-height: 140px;
    padding: 6px;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    font-size: 12px;
    background: white;
}
.avail-slicer-actions { display: flex; gap: 6px; }
.avail-slicer-actions .btn { padding: 4px 12px; font-size: 11px; }

.avail-matrix-wrap {
    overflow: auto;
    max-height: 70vh;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
}
table.avail-matrix {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    width: max-content;
    min-width: 100%;
}
table.avail-matrix th, table.avail-matrix td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--slate-100);
    border-right: 1px solid var(--slate-100);
    white-space: nowrap;
    text-align: center;
}
table.avail-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--navy-900);
    color: white;
    font-weight: 600;
    border-bottom: 2px solid var(--navy-700);
}
table.avail-matrix th.avail-rank,
table.avail-matrix td.avail-rank {
    width: 56px;
    text-align: center;
    font-weight: 600;
    color: var(--slate-500);
    background: var(--slate-50);
    position: sticky;
    left: 0;
    z-index: 2;
    border-right: 1px solid var(--slate-200);
}
table.avail-matrix thead th.avail-rank { background: var(--navy-900); color: white; z-index: 4; }
table.avail-matrix th.avail-metro-col,
table.avail-matrix td.avail-metro-col {
    text-align: left;
    font-weight: 600;
    background: white;
    position: sticky;
    left: 56px;
    z-index: 2;
    min-width: 220px;
    border-right: 1px solid var(--slate-200);
}
table.avail-matrix thead th.avail-metro-col { background: var(--navy-900); color: white; z-index: 4; }
table.avail-matrix tbody tr:nth-child(even) td.avail-metro-col,
table.avail-matrix tbody tr:nth-child(even) td.avail-rank { background: var(--slate-50); }
table.avail-matrix td.avail-pos { background: #d1fae5; color: #065f46; font-weight: 600; }
table.avail-matrix td.avail-neg { background: #fee2e2; color: #991b1b; font-weight: 600; }
table.avail-matrix td.avail-na { color: var(--slate-400); }

/* ==================== REQUEST DATA REFRESH BUTTON ==================== */
.refresh-request-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35), 0 2px 4px rgba(15, 23, 42, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    font-family: inherit;
}
.refresh-request-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45), 0 4px 8px rgba(15, 23, 42, 0.1);
}
.refresh-request-btn:disabled {
    opacity: 0.55;
    cursor: default;
}
.refresh-request-btn .rr-icon {
    font-size: 16px;
    line-height: 1;
}
.rr-toast {
    position: fixed;
    bottom: 75px;
    left: 20px;
    z-index: 1001;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    max-width: 320px;
}
.rr-toast.show { opacity: 1; transform: translateY(0); }
.rr-toast-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.rr-toast-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
@media (max-width: 640px) {
    .refresh-request-btn .rr-label { display: none; }
    .refresh-request-btn { padding: 12px; }
}
