/* ============================================================================
   DISCOVER YORK - CARTOGRAPHIC ATELIER DESIGN SYSTEM
   Impeccable Minimalist Light Theme | Zero AI-Slop | Clean Editorial Craft
   ============================================================================ */

:root {
    /* Pure Minimalist Surfaces */
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f8fafc;
    --bg-subtle: #f1f5f9;
    --bg-muted: #e2e8f0;

    /* Hairline Architectural Borders */
    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-focus: #1e3a8a;

    /* High-Contrast Editorial Typography */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #596780;
    --text-inverse: #ffffff;

    /* Restrained Heritage Accents */
    --accent-navy: #1e3a8a;
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --accent-subtle: #eff6ff;

    /* Subtle Semantic Category Tokens */
    --cat-attractions: #b91c1c;
    --cat-historic: #6d28d9;
    --cat-hotels: #b45309;
    --cat-dining: #c2410c;
    --cat-parks: #15803d;
    --cat-shops: #2563eb;
    --cat-transit: #475569;

    /* Natural Ambient Depth (Zero Neon Glow) */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 4px 14px -2px rgba(15, 23, 42, 0.04);
    --shadow-modal: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: var(--font-sans);
    --font-display: 'Bricolage Grotesque', var(--font-sans);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Micro Interactions */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 9999px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s cubic-bezier(0.16, 1, 0.3, 1);

    /* Semantic Stacking Context Scale (Impeccable Design Law) */
    --z-base: 1;
    --z-map-control: 800;
    --z-spotlight: 850;
    --z-drawer: 900;
    --z-header: 1000;
    --z-dropdown: 1050;
    --z-backdrop: 1100;
    --z-modal: 1200;
    --z-toast: 1300;
    --z-loader: 1400;
}

/* ============================================================================
   BASE RESETS & VIEWPORT
   ============================================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue-hover);
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Accessibility: Reduced Motion (Impeccable & Minimalist Law) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .pinpoint-pulse-ring,
    .spotlight-pulse-dot,
    .picking-pulse-dot,
    .measure-pulse-dot {
        animation: none !important;
    }
}

/* Minimalist Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Map Canvas */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-base);
    background-color: #e5e7eb;
}

/* ============================================================================
   CLEAN LOADING SCREEN
   ============================================================================ */

.loader-overlay {
    position: fixed;
    inset: 0;
    background-color: var(--bg-surface);
    z-index: var(--z-loader);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 320px;
    gap: 16px;
}

.loader-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    padding: 6px;
    background: var(--bg-surface);
}

.loader-text {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
}

.progress-bar-container {
    width: 240px;
    height: 4px;
    background: var(--bg-muted);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-navy);
    border-radius: var(--radius-pill);
    transition: width 0.2s ease;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    width: 240px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================================================
   TOP NAVIGATION HEADER
   ============================================================================ */

.map-header {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    height: 52px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
}

.hub-dock-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    transition: var(--transition-fast);
}

.hub-dock-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

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

.logo-image {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.map-title {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.header-tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 2px;
}

.network-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.network-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.network-dot.offline {
    background: #f59e0b;
}

/* Header Search */
.header-search-box {
    position: relative;
    flex: 1;
    max-width: 440px;
    margin: 0 auto;
}

.search-box-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 36px;
    padding: 0 36px 0 34px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition-fast);
    outline: none;
}

.search-input:focus {
    background: var(--bg-surface);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.search-shortcut-hint {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    pointer-events: none;
}

.search-clear-btn {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    font-size: 0.72rem;
    transition: var(--transition-fast);
}

.search-clear-btn:hover {
    color: var(--text-primary);
    background: var(--bg-muted);
}

.search-clear-btn.hidden {
    display: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(320px, calc(100dvh - 120px));
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-modal);
    display: none;
    z-index: var(--z-dropdown);
}

.search-results.visible {
    display: block;
}

.search-result-item {
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-subtle);
}

.search-result-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.search-result-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Header Action Buttons */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-weather-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.header-chat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    background: var(--accent-navy);
    color: var(--text-inverse);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.header-chat-btn:hover {
    background: var(--accent-blue-hover);
}

/* Mobile Backdrop Scrim */
.hub-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: var(--z-backdrop);
    transition: opacity var(--transition-base);
}

.hub-backdrop.hidden {
    display: none;
    pointer-events: none;
    opacity: 0;
}

/* ============================================================================
   LEFT SIDEBAR (DRAWER / EXPLORER PANEL)
   ============================================================================ */

.control-hub {
    position: absolute;
    top: 76px;
    left: 14px;
    bottom: 40px;
    width: 380px;
    max-width: calc(100vw - 28px);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.control-hub.collapsed {
    transform: translateX(calc(-100% - 24px));
    pointer-events: none;
    opacity: 0;
}

.hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.hub-header-title {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin: 0;
}

.hub-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 1px 0 0 0;
}

.icon-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

/* Tab Navigation */
.deck-tabs {
    display: flex;
    padding: 8px 12px;
    gap: 4px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
}

.deck-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: var(--transition-fast);
}

.deck-tab-btn:hover {
    color: var(--text-primary);
}

.deck-tab-btn.active {
    background: var(--bg-surface);
    color: var(--accent-navy);
    box-shadow: var(--shadow-sm);
}

.deck-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

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

/* Sections */
.hub-section {
    margin-bottom: 20px;
}

.hub-section:last-child {
    margin-bottom: 0;
}

.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================================
   EXPLORE TAB COMPONENTS
   ============================================================================ */

/* Weather Minimal Card */
.weather-card-clean {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    background: var(--bg-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weather-temp-block {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.weather-temp-main {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.weather-condition-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.weather-metrics-row {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Quick Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.quick-cat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    text-align: left;
}

.quick-cat-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.quick-cat-btn.active-spotlight {
    background: var(--accent-subtle);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.quick-cat-btn i {
    font-size: 0.9rem;
    color: var(--cat-color, var(--text-muted));
}

/* ============================================================================
   DIRECTIONS TAB COMPONENTS
   ============================================================================ */

.transport-modes {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.mode-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--accent-navy);
    color: var(--text-inverse);
    border-color: var(--accent-navy);
}

.routing-input-group {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.input-icon {
    position: absolute;
    left: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    z-index: 2;
}

.start-icon {
    color: #10b981;
}

.end-icon {
    color: #ef4444;
}

.input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    height: 38px;
    padding: 0 58px 0 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-fast);
}

.input-wrapper input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.input-action-btn {
    position: absolute;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.input-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-muted);
}

#btn-my-location {
    right: 30px;
}

#btn-pick-start, #btn-pick-end {
    right: 4px;
}

.routing-swap-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: -3px 0;
    position: relative;
    z-index: 2;
}

.swap-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.swap-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: rotate(180deg);
}

.quick-route-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.quick-chips-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.quick-chip-btn {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 3px 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.quick-chip-btn:hover {
    background: var(--accent-subtle);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.routing-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.calc-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    background: var(--accent-navy);
    color: var(--text-inverse);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.calc-btn:hover {
    background: var(--accent-blue-hover);
}

.clear-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.clear-btn:hover {
    background: var(--bg-subtle);
    color: #ef4444;
    border-color: #fecaca;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    display: none;
    z-index: var(--z-dropdown);
}

.autocomplete-dropdown.visible {
    display: block;
}

.autocomplete-item {
    padding: 8px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--bg-subtle);
}

.search-result-item.selected {
    background: var(--bg-subtle);
}

/* Turn-by-Turn Panel */
.turn-by-turn-panel {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    margin-top: 14px;
    overflow: hidden;
}

.turn-by-turn-panel.collapsed {
    display: none;
}

.tbt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.tbt-action-link {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-blue);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 3px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tbt-action-link:hover {
    background: var(--accent-subtle);
    border-color: var(--accent-blue);
}

.tbt-summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.tbt-time {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--accent-navy);
}

.tbt-dist {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tbt-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
}

.tbt-list li {
    padding: 8px 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    gap: 8px;
    align-items: flex-start;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.tbt-list li:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.tbt-list li.active-step {
    background: var(--accent-subtle);
    color: var(--accent-navy);
    font-weight: 600;
}

.tbt-list li:last-child {
    border-bottom: none;
}

.routing-alert {
    padding: 8px 12px;
    margin-top: 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
}

.routing-alert.hidden {
    display: none;
}

/* ============================================================================
   LAYERS & TOOLS TAB
   ============================================================================ */

.layers-legend-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}

.layer-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    transition: var(--transition-fast);
}

.layer-legend-item:hover {
    background: var(--bg-subtle);
}

.layer-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.layer-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.layer-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-count {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Minimal Switch Toggle */
.layer-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
}

.layer-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.layer-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--bg-muted);
    border-radius: var(--radius-pill);
    transition: var(--transition-fast);
}

.layer-slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--bg-surface);
    border-radius: 50%;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.layer-switch input:checked + .layer-slider {
    background-color: var(--accent-navy);
}

.layer-switch input:checked + .layer-slider::before {
    transform: translateX(14px);
}

/* Buffer Controls */
.buffer-controls {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: var(--bg-surface);
}

.tool-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.tool-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
}

.tool-btn.active {
    background: var(--accent-subtle);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.tool-btn.hidden {
    display: none;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
}

.premium-slider {
    width: 100%;
    accent-color: var(--accent-navy);
}

.buffer-slider-group.hidden {
    display: none;
}

.buffer-preset-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.buffer-preset-btn {
    height: 28px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.buffer-preset-btn:hover {
    background: var(--border-subtle);
    color: var(--text-primary);
}

.buffer-preset-btn.active {
    background: var(--accent-subtle);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.buffer-stats-panel {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
}

.buffer-stats-panel.hidden {
    display: none;
}

.tools-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

/* ============================================================================
   SPOTLIGHT ALERT & TOP COORD DISPLAY
   ============================================================================ */

.spotlight-alert {
    position: absolute;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-card);
    padding: 6px 14px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: var(--z-spotlight);
    font-size: 0.78rem;
    color: var(--text-primary);
}

.spotlight-alert.visible {
    display: flex;
}

.spotlight-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--spotlight-color, var(--accent-blue));
}

.spotlight-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-blue);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

.spotlight-reset-btn:hover {
    background: var(--border-subtle);
}

.picking-alert {
    position: absolute;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-navy);
    color: var(--text-inverse);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-modal);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: var(--z-dropdown);
    font-size: 0.78rem;
    font-weight: 600;
}

.picking-alert.hidden {
    display: none;
}

.picking-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.picking-cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition-fast);
}

.picking-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.coord-display {
    position: absolute;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    padding: 4px 12px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    display: none;
    z-index: var(--z-spotlight);
}

.coord-display.visible {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================================
   BOTTOM BRANDING & CREDITS & NORTH ARROW
   ============================================================================ */

.student-id-pill {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-card);
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    z-index: var(--z-drawer);
    white-space: nowrap;
}

.student-id-pill a {
    color: var(--text-primary);
    text-decoration: none;
}

.student-id-pill a:hover {
    color: var(--accent-blue);
}

.credits-container {
    position: absolute;
    bottom: 14px;
    left: 14px;
    z-index: var(--z-drawer);
}

.credit-icon-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    padding: 6px 10px;
    font-size: 0.72rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.credit-expand {
    display: none;
}

.north-arrow-container {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: var(--z-drawer);
    pointer-events: none;
}

/* ============================================================================
   LEAFLET CUSTOM MAP CONTROLS & POPUPS
   ============================================================================ */

.leaflet-top.leaflet-right {
    top: 76px;
    right: 14px;
}

.leaflet-control-zoom,
.leaflet-control-layers {
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-card) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    transition: var(--transition-fast);
}

.leaflet-control-zoom a:hover {
    background-color: var(--bg-subtle) !important;
}

/* Metric Scale Control */
.leaflet-bottom.leaflet-left {
    bottom: 50px;
    left: 14px;
    z-index: var(--z-map-control);
}

.leaflet-control-scale-line {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-strong) !important;
    border-top: none !important;
    color: var(--text-primary) !important;
    font-family: var(--font-body) !important;
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    padding: 2px 6px !important;
    border-radius: 0 0 2px 2px !important;
    box-shadow: var(--shadow-sm) !important;
    line-height: 1.2 !important;
}

/* Leaflet Clean Minimalist Tooltips */
.leaflet-tooltip {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-card) !important;
    font-family: var(--font-body) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    padding: 4px 8px !important;
    white-space: nowrap !important;
}

.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
    display: none !important;
}

/* ============================================================================
   MAP PINPOINTS & ACTIVE FOCUS SYSTEM (ZERO EMOJIS, CARTOGRAPHIC TEARDROP)
   ============================================================================ */
.custom-div-icon {
    background: transparent !important;
    border: none !important;
}

.york-map-pin {
    position: relative;
    width: 28px;
    height: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.28));
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.york-map-pin:hover {
    transform: scale(1.18) translateY(-2px);
    filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.35));
    z-index: 9999 !important;
}

.pin-marker-head {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--pin-color, #1e3a8a);
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.pin-marker-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.pin-marker-icon svg {
    width: 14px;
    height: 14px;
    fill: #ffffff;
}

.pin-marker-point {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--pin-color, #1e3a8a);
    margin-top: -3px;
    z-index: 1;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

/* Active Pinpoint Focus State */
.york-map-pin.pin-active-selected {
    transform: scale(1.22) translateY(-3px);
    z-index: 10000 !important;
}

.york-map-pin.pin-active-selected .pin-marker-head {
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4), 0 4px 10px rgba(15, 23, 42, 0.35);
}

.york-map-pin.pin-active-selected::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 6px;
    background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0) 70%);
    border-radius: 50%;
    animation: pinpoint-ground-pulse 1.8s ease-in-out infinite;
}

@keyframes pinpoint-ground-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
    50% { transform: translateX(-50%) scale(1.6); opacity: 0.2; }
}

/* Cluster Marker */
.glass-cluster {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--accent-navy);
    color: var(--accent-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-fast);
}

.glass-cluster:hover {
    transform: scale(1.12);
}

/* Leaflet Clean Popups */
.leaflet-popup-content-wrapper {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-modal) !important;
    padding: 0 !important;
    overflow: hidden;
    max-width: calc(100vw - 32px) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    line-height: 1.4 !important;
    width: 300px !important;
    max-width: calc(100vw - 32px) !important;
}

.leaflet-popup-tip-container {
    display: none;
}

.leaflet-container a.leaflet-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    width: 24px !important;
    height: 24px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--text-primary) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
    font-size: 16px !important;
    line-height: 1 !important;
    z-index: 10 !important;
    transition: background var(--transition-fast);
}

.leaflet-container a.leaflet-popup-close-button:hover {
    background: #ffffff !important;
    color: var(--status-danger) !important;
}

.premium-popup-container {
    display: flex;
    flex-direction: column;
}

/* Hero Photographic Banner */
.popup-hero-media {
    position: relative;
    width: 100%;
    height: 124px;
    background: var(--bg-subtle);
    overflow: hidden;
}

.popup-hero-media.hidden {
    display: none;
}

.popup-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.popup-hero-img:hover {
    transform: scale(1.05);
}

.popup-hero-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.75) 100%);
    pointer-events: none;
}

.popup-hero-badges {
    position: absolute;
    bottom: 8px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    z-index: 2;
}

.popup-banner-no-media {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
}

.popup-category-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.popup-category-badge.on-dark {
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

.popup-distance-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.popup-distance-badge.on-dark {
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

.popup-body {
    padding: 12px 14px 14px 14px;
}

.popup-header-title {
    margin-bottom: 8px;
}

.popup-title {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.popup-subtitle {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.popup-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 6px;
}

.popup-tab-btn {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.popup-tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-subtle);
}

.popup-tab-btn.active {
    color: var(--accent-navy);
    background: var(--bg-subtle);
}

.popup-tab-content {
    display: none;
}

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

.info-item-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.78rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.info-item-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.info-quick-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 10px;
}

.info-action-chip {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: var(--transition-fast);
}

.info-action-chip:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* 4-Action Utility Toolbar */
.popup-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 10px;
}

.popup-btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.popup-btn-action:hover {
    background: var(--border-subtle);
    border-color: var(--border-strong);
}

.popup-btn-action.popup-btn-directions {
    grid-column: span 2;
    background: var(--accent-navy);
    color: var(--text-inverse);
    border-color: var(--accent-navy);
    height: 34px;
}

.popup-btn-action.popup-btn-directions:hover {
    background: var(--accent-blue-hover);
    border-color: var(--accent-blue-hover);
}

.popup-btn-action.popup-btn-buffer {
    grid-column: span 2;
}

/* Wikipedia Heritage Tab */
.popup-wiki-body {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.popup-wiki-text {
    margin: 0 0 8px 0;
}

.popup-wiki-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-navy);
    text-decoration: none;
    margin-bottom: 6px;
}

.popup-wiki-link:hover {
    text-decoration: underline;
}

.popup-wiki-attr {
    font-size: 0.66rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 6px;
    margin-top: 6px;
}

/* App Toast Notification */
.app-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-modal);
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: var(--z-toast);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.app-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.app-toast i {
    color: var(--accent-navy);
}

/* ============================================================================
   AI ASSISTANT (CONCIERGE) DRAWER & MODAL
   ============================================================================ */

.chat-trigger-pill {
    position: absolute;
    bottom: 54px;
    right: 14px;
    height: 40px;
    padding: 0 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    z-index: var(--z-header);
    transition: var(--transition-fast);
}

.chat-trigger-pill:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
}

.chat-trigger-pill.active {
    background: var(--accent-navy);
    color: var(--text-inverse);
}

.chat-window-container {
    position: absolute;
    bottom: 100px;
    right: 14px;
    width: 360px;
    max-width: calc(100vw - 28px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-modal);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: var(--z-modal);
}

.chat-window-container.expanded {
    display: flex;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-action {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.chat-header-action:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-page);
}

.chat-bubble {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.45;
}

.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--accent-navy);
    color: var(--text-inverse);
}

.chat-prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.prompt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.prompt-chip i {
    color: var(--accent-blue);
    font-size: 0.7rem;
}

.prompt-chip:hover {
    background: var(--bg-subtle);
    border-color: var(--accent-blue);
    color: var(--accent-navy);
    transform: translateY(-1px);
}

.chat-input-area {
    display: flex;
    align-items: center;
    padding: 10px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    gap: 6px;
}

.chat-input-area input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 0.82rem;
}

.chat-input-area input:focus {
    border-color: var(--accent-blue);
    background: var(--bg-surface);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--accent-navy);
    color: var(--text-inverse);
    transition: var(--transition-fast);
}

.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* API Key Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-backdrop);
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-modal);
    width: 400px;
    max-width: calc(100vw - 32px);
    padding: 20px;
}

/* Offline Toast */
.offline-toast {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    font-size: 0.78rem;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: var(--z-toast);
}

.offline-toast.visible {
    display: flex;
}

/* Mobile Handle */
.mobile-handle {
    display: none;
}

/* ============================================================================
   RESPONSIVE DESIGN (TABLET, MOBILE & PRINT)
   ============================================================================ */

@media (max-width: 768px) {
    .map-header {
        top: max(8px, env(safe-area-inset-top));
        left: max(8px, env(safe-area-inset-left));
        right: max(8px, env(safe-area-inset-right));
        height: 48px;
        padding: 0 8px;
        gap: 8px;
    }

    .header-tagline, .network-badge, .header-weather-pill, .search-shortcut-hint {
        display: none !important;
    }

    .header-branding .map-title {
        font-size: 0.85rem;
    }

    .header-chat-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        justify-content: center;
        flex-shrink: 0;
    }

    .header-chat-btn span {
        display: none;
    }

    .leaflet-top.leaflet-right {
        top: calc(64px + env(safe-area-inset-top));
        right: max(8px, env(safe-area-inset-right));
    }

    .control-hub {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 72dvh;
        height: 72vh;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
        z-index: var(--z-dropdown);
        box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.15);
    }

    .control-hub.collapsed {
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
    }

    /* Coordinated mobile bottom stack with safe-area insets to eliminate all overlaps */
    .student-id-pill {
        bottom: max(12px, env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.68rem;
        padding: 4px 10px;
        max-width: calc(100vw - 20px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        z-index: var(--z-drawer);
    }

    .credits-container {
        bottom: calc(44px + env(safe-area-inset-bottom));
        left: max(10px, env(safe-area-inset-left));
        z-index: var(--z-drawer);
    }

    .leaflet-bottom.leaflet-left {
        bottom: calc(80px + env(safe-area-inset-bottom));
        left: max(10px, env(safe-area-inset-left));
        z-index: var(--z-map-control);
    }

    .north-arrow-container {
        bottom: calc(44px + env(safe-area-inset-bottom));
        right: max(10px, env(safe-area-inset-right));
        z-index: var(--z-drawer);
    }

    .chat-trigger-pill {
        bottom: calc(88px + env(safe-area-inset-bottom));
        right: max(10px, env(safe-area-inset-right));
        z-index: var(--z-drawer);
        padding: 0 12px;
        font-size: 0.78rem;
    }

    .chat-window-container {
        right: max(8px, env(safe-area-inset-right));
        left: max(8px, env(safe-area-inset-left));
        bottom: calc(52px + env(safe-area-inset-bottom));
        height: calc(100dvh - 120px);
        height: calc(100vh - 120px);
        width: auto;
    }

    /* 44px minimum touch targets */
    .mode-btn,
    .quick-cat-btn,
    .calc-btn,
    .clear-btn,
    .search-result-item {
        min-height: 44px;
    }

    .input-action-btn {
        width: 32px;
        height: 32px;
    }

    .deck-tab-btn {
        min-height: 40px;
    }
}

/* Touch device tactile active press feedback */
@media (hover: none) {
    .quick-cat-btn:active,
    .deck-tab-btn:active,
    .tool-btn:active,
    .calc-btn:active,
    .clear-btn:active,
    .search-result-item:active,
    .hub-dock-btn:active {
        transform: scale(0.97);
        background-color: var(--bg-muted);
    }
}

/* Compact Mobile (< 400px, e.g. iPhone SE) */
@media (max-width: 400px) {
    .header-branding .map-title {
        display: none;
    }

    .search-input {
        font-size: 0.78rem;
        padding-left: 28px;
    }

    .search-box-icon {
        left: 8px;
    }
}

/* Mobile Landscape orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .map-header {
        top: 4px;
        left: 4px;
        right: 4px;
        height: 40px;
    }

    .control-hub {
        top: 48px;
        left: 4px;
        bottom: 4px;
        width: 320px;
        height: auto;
        border-radius: var(--radius-md);
        transform: translateX(0);
        z-index: var(--z-dropdown);
    }

    .control-hub.collapsed {
        transform: translateX(calc(-100% - 16px));
    }

    .chat-window-container {
        height: calc(100vh - 56px);
        width: 320px;
        right: 4px;
        bottom: 4px;
    }
}
/* ============================================================================
   GEODESIC MEASUREMENT WORKBENCH & SPATIAL DATA SHEET
   ============================================================================ */

/* Tool Button Small */
.tool-btn-sm {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.74rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tool-btn-sm:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
}

/* Buffer Export Controls */
.buffer-export-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

/* Geodesic Measurement Banner */
.measure-alert {
    position: absolute;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-modal);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: var(--z-header);
    transition: var(--transition-fast);
}

.measure-alert.hidden {
    display: none;
}

.measure-mode-toggle {
    display: flex;
    gap: 3px;
    background: var(--bg-subtle);
    padding: 3px;
    border-radius: var(--radius-pill);
}

.measure-toggle-btn {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: none;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-fast);
}

.measure-toggle-btn.active {
    background: var(--accent-navy);
    color: var(--text-inverse);
}

.measure-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.measure-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
    animation: pulse-ring 1.5s infinite;
}

.measure-actions {
    display: flex;
    gap: 4px;
}

.measure-action-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.measure-action-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

/* Spatial Attribute Inspector (Data Table Modal) */
.data-table-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border-subtle);
    width: 92vw;
    max-width: 1040px;
    height: 84vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-enter 0.25s ease-out;
}

@keyframes modal-enter {
    from { opacity: 0; transform: scale(0.97) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.data-table-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
}

.data-table-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.data-table-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--accent-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.data-table-heading {
    margin: 0;
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.data-table-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.data-table-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.data-table-filter-bar {
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--bg-subtle);
}

.table-search-box {
    position: relative;
    flex: 1;
}

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

.table-search-box input {
    width: 100%;
    height: 34px;
    padding: 0 12px 0 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: var(--transition-fast);
}

.table-search-box input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.table-cat-dropdown {
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

.data-table-scroll-wrapper {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.spatial-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    text-align: left;
}

.spatial-data-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 2;
    border-bottom: 2px solid var(--border-subtle);
}

.spatial-data-table th {
    padding: 10px 14px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.spatial-data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.spatial-data-table tbody tr {
    transition: background var(--transition-fast);
}

.spatial-data-table tbody tr:hover {
    background: var(--bg-subtle);
}

.table-locate-btn {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--accent-navy);
    color: var(--text-inverse);
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.table-locate-btn:hover {
    background: var(--accent-blue-hover);
}

/* Clean Print Stylesheet */
@media print {
    .map-header,
    .control-hub,
    .chat-trigger-pill,
    .chat-window-container,
    .leaflet-control-zoom,
    .leaflet-control-layers,
    .hub-backdrop,
    .spotlight-alert,
    .coord-display,
    .credits-container,
    .offline-toast,
    .modal-overlay {
        display: none !important;
    }

    #map {
        position: relative !important;
        width: 100% !important;
        height: 180mm !important;
        page-break-inside: avoid;
    }

    .student-id-pill {
        position: fixed !important;
        bottom: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    .north-arrow-container {
        position: fixed !important;
        bottom: 10px !important;
        right: 10px !important;
    }
}
