/* 
   ====================================================
   Avatar 2 Digital Layout CSS
   ====================================================
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #050814;
    --bg-secondary: #0d1224;
    --bg-tertiary: #131932;
    --bg-glass: rgba(13, 18, 36, 0.75);
    
    --accent: #0f62fe;
    --accent-hover: #0043ce;
    --accent-glow: rgba(15, 98, 254, 0.35);
    
    --text-primary: #f4f6fa;
    --text-secondary: #8e9bb4;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --status-available: #059669;
    --status-sold: #1d4ed8;
    --status-hold: #8b5cf6;
    --status-mortgage: #f97316;
    --status-registered: #ff0000;
    --status-aspirealty: #059669;
    
    --status-prem-kumar: #f97316;
    --status-suresh: #ff0000;
    --status-soumith: #1d4ed8;
    
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Layout Wrapper */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #00c6ff);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(to right, #ffffff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: none;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Sidebar sections */
.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.filter-reset-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.filter-reset-btn:hover {
    opacity: 0.8;
}

/* Search Box */
.search-container {
    position: relative;
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
}

.search-input {
    width: 100%;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 36px 10px 36px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    display: none;
}

.search-clear-btn:hover {
    color: var(--text-primary);
}

/* Suggestions dropdown */
.search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: var(--bg-tertiary);
}

.suggestion-no {
    font-weight: 700;
    color: var(--accent);
}

.suggestion-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Filter Pill Grid */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.filter-pill {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.filter-pill:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.filter-pill.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Legend items */
.status-legend-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.legend-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.legend-item.active {
    border-color: var(--legend-color);
}

.legend-label-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--legend-color);
}

.legend-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.legend-item.active .legend-name {
    color: var(--text-primary);
}

.legend-count {
    font-family: var(--font-heading);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 20px;
}

/* Sidebar Footer & Login button */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.admin-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    padding: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-login-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Main Area Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header */
.dashboard-header {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background-color: var(--bg-secondary);
    z-index: 10;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: none;
}

.header-project-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-name {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.approved-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-available);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.stat-header-item {
    text-align: right;
}

.stat-header-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-header-val {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.map-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: #ffffff !important;
    background: #ffffff !important;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-viewport:active {
    cursor: grabbing;
}

/* Floating On-Screen Status Legend Card */
.floating-legend-card {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(59, 130, 246, 0.15);
    min-width: 190px;
    max-width: 240px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.floating-legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    font-weight: 800;
    color: #60a5fa;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 6px;
    cursor: pointer;
}

.floating-legend-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.floating-legend-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.2s, transform 0.3s ease;
}

.floating-legend-card.collapsed .floating-legend-toggle {
    transform: rotate(180deg);
}

.floating-legend-card.collapsed {
    padding-bottom: 10px;
}

.floating-legend-card.collapsed .floating-legend-header {
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0;
}

.floating-legend-card.collapsed .floating-legend-body {
    display: none;
}

.floating-legend-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 220px;
    overflow-y: auto;
}

.floating-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 10.5px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.floating-legend-item:hover,
.floating-legend-item.active {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(2px);
}

.floating-legend-item .label-group {
    display: flex;
    align-items: center;
    gap: 7px;
}

.floating-legend-item .color-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--status-color);
    box-shadow: 0 0 6px var(--status-color);
    flex-shrink: 0;
}

.floating-legend-item .count-badge {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 10.5px;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.4);
    padding: 1px 6px;
    border-radius: 10px;
}

/* Drag instructions */
.map-tip {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 18, 36, 0.85);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 11px;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

/* Map Container Dimensions set specifically to 1024x768 */
.map-container {
    position: absolute;
    width: 1024px;
    height: 768px;
    transform-origin: 0 0;
    user-select: none;
    box-shadow: none;
    background-color: #ffffff !important;
    background: #ffffff !important;
}

.map-image {
    width: 1024px;
    height: 768px;
    display: block;
    pointer-events: none;
}

.plots-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 1024px;
    height: 768px;
    pointer-events: none;
}

/* Plot dots styling */
.plot-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 8px;
    font-weight: 800;
    color: #ffffff;
    cursor: pointer;
    pointer-events: auto;
    border: 1px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    background-color: var(--plot-color);
    transform: translate(-50%, -50%);
    transform-origin: center center;
    transition: transform 0.1s ease, box-shadow 0.2s, opacity 0.3s;
    text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.95), 0px 1px 2px rgba(0, 0, 0, 1);
    letter-spacing: -0.2px;
    line-height: 1;
}

.plot-dot:hover {
    transform: translate(-50%, -50%) scale(1.25);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 10px var(--plot-color);
}

.plot-dot.filtered-out {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    animation: none !important;
}

.plot-dot.filtered-out::before {
    animation: none !important;
    display: none !important;
}

/* Disabled Pulsing Radar Wave on Available Plots */
.plot-dot[data-status="AVAILABLE"] {
    position: absolute;
}

.plot-dot[data-status="AVAILABLE"]::before {
    display: none !important;
    animation: none !important;
}

/* Pulsating Radar Wave & Glow for Mortgage Plots */
.plot-dot[data-status="MORTGAGE"],
.plot-dot[data-status="MORTAGAGE"] {
    position: absolute;
    animation: mortgage-pulse-dot 1.8s ease-in-out infinite;
}

.plot-dot[data-status="MORTGAGE"]::before,
.plot-dot[data-status="MORTAGAGE"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--status-mortgage, #ff6600);
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
    animation: mortgage-pulse-ring 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes mortgage-pulse-dot {
    0%, 100% {
        box-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.6), 0 0 0 0 rgba(255, 102, 0, 0.6);
    }
    50% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7), 0 0 14px 4px rgba(255, 102, 0, 0.9);
    }
}

@keyframes mortgage-pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0.85;
    }
    50% {
        opacity: 0.4;
    }
}

/* Pure Vivid Red styling & glow for Registered Plots */
.plot-dot[data-status="REGISTERED"],
.leaflet-plot-dot-item[data-status="REGISTERED"] {
    background-color: var(--status-registered, #ff0000) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 8px rgba(255, 0, 0, 0.85) !important;
}

.plot-dot[data-status="REGISTERED"]:hover,
.leaflet-plot-dot-item[data-status="REGISTERED"]:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.8), 0 0 16px rgba(255, 0, 0, 1) !important;
}

/* Highlighting searched plot */
.plot-dot.highlighted {
    transform: scale(1.4);
    z-index: 30;
    border-color: #ffffff;
    box-shadow: 0 0 24px var(--plot-color), 0 0 0 6px rgba(255, 255, 255, 0.4);
    animation: pulse-glow 1.2s infinite alternate;
}

@keyframes pulse-glow {
    from {
        box-shadow: 0 0 20px var(--plot-color), 0 0 0 4px rgba(255, 255, 255, 0.3);
    }
    to {
        box-shadow: 0 0 35px var(--plot-color), 0 0 0 10px rgba(255, 255, 255, 0.1);
    }
}

/* Floating Map Controls */
.map-controls {
    position: absolute;
    bottom: 25px;
    right: 25px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 90;
}

.map-control-btn {
    width: 48px;
    height: 48px;
    background-color: rgba(13, 20, 38, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.map-control-btn:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 10px var(--accent-glow);
    transform: translateY(-2px);
}

.map-control-btn:active {
    transform: translateY(0);
}

/* Custom Animated Details Modal (Scoped to Map Viewport) */
#modalBackdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    backdrop-filter: none;
    z-index: 1050;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#modalBackdrop.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#plotModal {
    position: absolute;
    top: 16px;
    left: 16px;
    right: auto;
    width: 240px;
    max-width: calc(100% - 32px);
    background-color: rgba(13, 20, 38, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transform: translateX(-60px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

#modalBackdrop.show #plotModal {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

#plotModal .modal-header {
    padding-bottom: 8px;
    margin-bottom: 10px;
}

#plotModal .modal-title {
    font-size: 14px;
}

#plotModal .detail-card {
    gap: 8px;
}

#plotModal .detail-row {
    padding-bottom: 6px;
}

#plotModal .detail-label {
    font-size: 11px;
}

#plotModal .detail-val {
    font-size: 12px;
}

#plotModal .status-badge {
    padding: 4px 8px;
    font-size: 10px;
}

#modalBackdrop.show #plotModal {
    transform: translateX(0);
    opacity: 1;
}

/* Staff Login Centered Modal Styling */
#loginModalBackdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(5, 7, 10, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#loginModalBackdrop.show {
    opacity: 1;
    pointer-events: auto;
}

#loginModal {
    width: 90%;
    max-width: 380px;
    background-color: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#loginModalBackdrop.show #loginModal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Detail Card Styling */
.detail-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-val {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 10px var(--badge-glow);
    background-color: var(--badge-color);
}

/* Responsive Overrides */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .header-stats {
        display: none;
    }
}

@media (max-width: 576px) {
    .dashboard-header {
        padding: 0 16px;
    }
    
    .project-name {
        font-size: 18px;
    }
    
    .custom-modal {
        padding: 20px;
    }
    
    /* Responsive Bottom Drawer for Plot Modal on Mobile */
    #plotModal {
        top: auto;
        bottom: 20px;
        right: 15px;
        left: 15px;
        width: auto;
        max-width: none;
        transform: translateY(120px);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
    }
    
    #modalBackdrop.show #plotModal {
        transform: translateY(0);
    }
}

/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #050814;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(59, 130, 246, 0.05);
    border-top-color: var(--accent, #3b82f6);
    border-radius: 50%;
    animation: loader-spin 0.8s cubic-bezier(0.5, 0.1, 0.1, 0.9) infinite;
}

@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-logo {
    font-family: var(--font-heading, 'Outfit', sans-serif);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 2px;
    margin-top: 24px;
    background: linear-gradient(135deg, var(--accent, #3b82f6), #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: loader-pulse 1.8s ease-in-out infinite alternate;
}

.loader-text {
    font-family: var(--font-main, sans-serif);
    font-size: 12px;
    color: var(--text-secondary, #8e9bb4);
    margin-top: 10px;
    letter-spacing: 0.5px;
}

@keyframes loader-pulse {
    from {
        opacity: 0.5;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1.02);
    }
}
/* Cesium 3D Globe Controls */
#toggleCesiumBtn.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 15px var(--accent-glow);
}

#cesiumContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    overflow: hidden;
}

.cesium-viewer-bottom {
    display: none !important;
}

.cesium-widget-errorPanel,
.cesium-viewer-errorPanel,
.cesium-error-panel {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ====================================================
   Director Mode Live Deal Closer & Digital Allotment Styles
   ==================================================== */

.sim-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.sim-slider {
    width: 100%;
    accent-color: #facc15;
    cursor: pointer;
}

.margin-badge {
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.margin-high {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid #10b981;
    color: #34d399;
}

.margin-mod {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid #f59e0b;
    color: #fbbf24;
}

.margin-low {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #f87171;
}

.sim-toggle-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.sim-toggle-switch input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #facc15;
    cursor: pointer;
}

.btn-director-action {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
    border: none;
    font-weight: 700;
    width: 100%;
    margin-top: 8px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    font-size: 13.5px;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
    transition: all 0.2s ease;
}

.btn-director-action:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    transform: translateY(-1px);
}

/* Director Deal Simulator Centered Modal Styling */
#dealSimulatorModalBackdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(5, 7, 10, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#dealSimulatorModalBackdrop.show {
    opacity: 1;
    pointer-events: auto;
}

#dealSimulatorModal {
    background-color: #0f172a;
    border: 1px solid rgba(250, 204, 21, 0.4);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(234, 179, 8, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

#dealSimulatorModalBackdrop.show #dealSimulatorModal {
    transform: scale(1) translateY(0);
}

#plotModal {
    width: 300px;
    max-width: calc(100% - 32px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#plotModal::-webkit-scrollbar {
    width: 6px;
}

#plotModal::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

#plotModal::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #facc15, #eab308);
    border-radius: 8px;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

#plotModal::-webkit-scrollbar-thumb:hover {
    background: #fde047;
}

/* Mobile & Touch Optimization Styles */
button,
.plot-dot,
.map-btn,
.floating-recenter-btn,
.filter-chip,
.filter-pill {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 10px 14px;
    }

    .header-stats {
        display: none;
    }

    .floating-recenter-btn {
        bottom: 18px;
        left: 50%;
        transform: translateX(-50%);
        padding: 8px 18px;
        font-size: 11.5px;
    }

    .floating-legend-card {
        bottom: 75px;
        left: 14px;
        max-width: calc(100vw - 120px);
    }
}

@media (max-width: 640px) {
    #modalBackdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background-color: rgba(5, 7, 10, 0.7) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        z-index: 2000 !important;
    }

    #plotModal {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 85vh !important;
        border-radius: 20px 20px 0 0 !important;
        transform: translateY(100%) !important;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
        margin: 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(14, 165, 233, 0.25) !important;
    }

    #modalBackdrop.show #plotModal {
        transform: translateY(0) !important;
    }

    #plotModal::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 4px;
        margin: 0 auto 12px auto;
    }
}

/* Leaflet Native Plot Marker Styling */
.leaflet-plot-marker-container {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
}

.leaflet-plot-dot-item {
    position: absolute;
    left: 0;
    top: 0;
    width: 20px !important;
    height: 20px !important;
    font-size: 10px !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    color: #ffffff;
    cursor: pointer;
    pointer-events: auto;
    border: 1.5px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    background-color: var(--plot-color);
    text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.95), 0px 1px 2px rgba(0, 0, 0, 1);
    letter-spacing: -0.2px;
    line-height: 1;
    z-index: 10;
    transform: translate(-50%, -50%) scale(var(--plot-scale, 1));
    transform-origin: center center;
    will-change: transform;
    transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.leaflet-plot-dot-item:hover {
    transform: translate(-50%, -50%) scale(calc(var(--plot-scale, 1) * 1.25)) !important;
    z-index: 25;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7), 0 0 12px var(--plot-color);
}

/* GPU acceleration and silky smooth rendering for map layers */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-image-layer {
    will-change: transform;
}

/* ----------------------------------------------------
   KMZ Layout Calibrator HUD & Controls
---------------------------------------------------- */
.floating-calibrator-toggle {
    position: absolute;
    bottom: 25px;
    left: 25px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid #f59e0b;
    color: #fbbf24;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 95;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 10px rgba(245, 158, 11, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.25s ease;
}

.floating-calibrator-toggle:hover {
    background: #f59e0b;
    color: #0f172a;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.calibrator-card {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 340px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    background: rgba(13, 20, 38, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.65), 0 0 15px rgba(245, 158, 11, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #e2e8f0;
    font-size: 12px;
    animation: calibFadeIn 0.25s ease-out;
}

@keyframes calibFadeIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.calibrator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(245, 158, 11, 0.12);
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
    cursor: grab;
    user-select: none;
}

.calibrator-header:active {
    cursor: grabbing;
}

.calibrator-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    color: #f8fafc;
    letter-spacing: 0.2px;
}

.calibrator-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calibrator-icon-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.calibrator-icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.calibrator-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

.calibrator-card.minimized .calibrator-body {
    display: none;
}

.calib-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.calib-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
}

.calib-step-pills {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.calib-step-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calib-step-btn.active {
    background: #f59e0b;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.calib-section {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calib-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 11.5px;
    color: #e2e8f0;
}

.calib-section-title i {
    color: #60a5fa;
    margin-right: 6px;
}

.calib-val-badge {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
}

/* D-Pad Controller */
.calib-dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 2px 0;
}

.calib-dpad-mid {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calib-dpad-btn {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.calib-dpad-btn:hover {
    background: #3b82f6;
    border-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.calib-dpad-btn:active {
    transform: translateY(1px);
    background: #2563eb;
}

.calib-up, .calib-down {
    width: 90px;
    height: 28px;
}

.calib-left, .calib-right {
    width: 70px;
    height: 28px;
}

.calib-center {
    width: 36px;
    height: 28px;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.calib-center:hover {
    background: #f59e0b !important;
    color: #0f172a !important;
    border-color: #fbbf24 !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6) !important;
}

/* Stepper buttons */
.calib-stepper-row {
    display: flex;
    gap: 3px;
    justify-content: space-between;
}

.calib-stepper-btn {
    flex: 1;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 4px;
    padding: 4px 2px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.calib-stepper-btn:hover {
    background: rgba(96, 165, 250, 0.25);
    border-color: #60a5fa;
    color: #fff;
}

.calib-stepper-btn:active {
    transform: scale(0.95);
}

.calib-zero-btn {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
    font-weight: 700;
}

/* Sliders */
.calib-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    border-radius: 3px;
    background: #334155;
    outline: none;
    cursor: pointer;
}

.calib-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #f59e0b;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s;
}

.calib-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Scale Grid */
.calib-scale-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.calib-scale-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.calib-sublabel {
    font-size: 9.5px;
    color: #94a3b8;
    font-weight: 600;
}

.calib-btn-group {
    display: flex;
    gap: 3px;
    width: 100%;
}

.calib-small-btn {
    flex: 1;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-radius: 4px;
    padding: 4px 0;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calib-small-btn:hover {
    background: #10b981;
    border-color: #34d399;
    color: #fff;
}

/* Readout Box */
.calib-coords-box {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 8px 10px;
    font-family: monospace;
    font-size: 10.5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calib-coord-line {
    display: flex;
    justify-content: space-between;
    color: #94a3b8;
}

.calib-coord-line strong {
    color: #38bdf8;
}

/* Action Buttons */
.calib-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.calib-action-btn {
    flex: 1;
    padding: 8px 6px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: none;
    transition: all 0.2s ease;
}

.calib-save-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.calib-save-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.calib-copy-btn {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.calib-copy-btn:hover {
    background: #3b82f6;
    color: #fff;
}

.calib-reset-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.calib-reset-btn:hover {
    background: #ef4444;
    color: #fff;
}

/* Plot Calibrator Theming & Active Targeting */
.plot-calibrator-card {
    border-color: rgba(56, 189, 248, 0.45) !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.65), 0 0 18px rgba(56, 189, 248, 0.2) !important;
}

.plot-calibrator-header {
    background: rgba(14, 165, 233, 0.16) !important;
    border-bottom: 1px solid rgba(56, 189, 248, 0.3) !important;
}

.plot-dot-calibrating {
    outline: 3px solid #38bdf8 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 16px #38bdf8, 0 0 28px rgba(56, 189, 248, 0.9) !important;
    animation: plot-calib-pulse 1s infinite alternate !important;
    z-index: 99 !important;
}

@keyframes plot-calib-pulse {
    from {
        outline-color: #38bdf8;
        filter: brightness(1.2);
    }
    to {
        outline-color: #facc15;
        filter: brightness(1.6);
    }
}

/* ====================================================
   Leaflet Layers & Overlays Switcher Styling
   ==================================================== */
.leaflet-top.leaflet-left .leaflet-control-layers {
    margin-top: 10px;
    background: rgba(15, 23, 42, 0.94) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(59, 130, 246, 0.12) !important;
    color: #f8fafc !important;
    font-family: var(--font-main) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 900 !important;
}

.leaflet-control-layers-toggle {
    filter: invert(1) brightness(1.8) !important;
    width: 36px !important;
    height: 36px !important;
    background-size: 20px 20px !important;
    border-radius: 10px !important;
}

.leaflet-control-layers-expanded {
    padding: 14px 16px !important;
    min-width: 220px !important;
    color: #f8fafc !important;
    border-radius: 12px !important;
}

.leaflet-control-layers-separator {
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    margin: 10px 0 !important;
}

.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 5px 0 !important;
    cursor: pointer !important;
    color: #cbd5e1 !important;
    font-size: 12.5px !important;
    transition: color 0.15s ease, transform 0.15s ease !important;
}

.leaflet-control-layers-base label:hover,
.leaflet-control-layers-overlays label:hover {
    color: #38bdf8 !important;
    transform: translateX(2px) !important;
}

.leaflet-control-layers input[type="radio"],
.leaflet-control-layers input[type="checkbox"] {
    accent-color: #3b82f6 !important;
    cursor: pointer !important;
    width: 15px !important;
    height: 15px !important;
    margin: 0 !important;
}

/* ====================================================
   3D Layout Interactive Modal & Viewer Styles
   ==================================================== */

.btn-3d-header {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    margin-left: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(59, 130, 246, 0.2));
    border: 1px solid rgba(168, 85, 247, 0.6);
    color: #c084fc;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.35);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-3d-header:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.45), rgba(59, 130, 246, 0.35));
    border-color: #c084fc;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
    transform: translateY(-1px);
}

.btn-3d-header i {
    font-size: 14px;
    color: #d8b4fe;
    animation: pulse-3d-cube 2s infinite ease-in-out;
}

@keyframes pulse-3d-cube {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.15) rotate(8deg); }
}

/* 3D Modal Backdrop */
.modal-3d-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-3d-backdrop.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* 3D Modal Container */
.modal-3d-container {
    width: 95vw;
    max-width: 1500px;
    height: 92vh;
    background: #090e1a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(168, 85, 247, 0.2);
    position: relative;
    animation: modal-3d-zoom-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-3d-zoom-in {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 3D Modal Header */
.modal-3d-header {
    height: 64px;
    padding: 0 20px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
    flex-shrink: 0;
}

.modal-3d-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-3d-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #a855f7, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.modal-3d-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: 0.3px;
    margin: 0;
}

.modal-3d-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
    font-weight: 700;
}

/* Header Controls & Presets */
.modal-3d-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 3px;
}

.toolbar-btn {
    background: none;
    border: none;
    color: #94a3b8;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    user-select: none;
}

.toolbar-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
}

.toolbar-btn.active {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.btn-light-mode.active {
    background: #f59e0b;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.modal-3d-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-3d-close-btn:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

/* 3D Viewport Area */
.modal-3d-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

#threeCanvasContainer {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#threeCanvasContainer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    outline: none;
}

/* 3D HUD Overlay: Top-Left Filter Bar */
.three-hud-filters {
    position: absolute;
    top: 14px;
    left: 16px;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 10px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.three-filter-pill {
    padding: 5px 10px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    transition: all 0.2s;
    user-select: none;
}

.three-filter-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.three-filter-pill.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* 3D HUD Search Box */
.three-hud-search {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 4px 8px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.three-search-input {
    background: none;
    border: none;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    outline: none;
    width: 110px;
    padding: 4px 6px;
}

.three-search-input.error {
    border-bottom: 2px solid #ef4444;
}

.three-search-input::placeholder {
    color: #64748b;
    font-weight: 500;
}

/* Bottom Controls Guide */
.three-controls-guide {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 30px;
    padding: 7px 18px;
    font-size: 11px;
    color: #94a3b8;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.three-controls-guide strong {
    color: #f8fafc;
}

/* 3D Hover Tooltip */
.three-plot-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 170px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: none;
    transform: translate(0, 0);
    transition: opacity 0.15s ease;
}

/* Quick Inspect Drawer (Right Side) */
.three-inspect-drawer {
    position: absolute;
    top: 60px;
    right: 16px;
    width: 290px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.15);
    z-index: 15;
    transform: translateX(330px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.three-inspect-drawer.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.three-inspect-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.three-inspect-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.three-drawer-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.three-drawer-close:hover {
    color: #fff;
}

.three-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.three-drawer-btn {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.2s;
    border: none;
}

.three-btn-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.three-btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.three-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
}

.three-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* Button in 2D Plot Modal to jump to 3D */
.btn-jump-3d {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(59, 130, 246, 0.2));
    border: 1px solid rgba(168, 85, 247, 0.5);
    color: #c084fc;
    font-weight: 700;
    width: 100%;
    margin-top: 10px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    font-size: 13.5px;
    transition: all 0.2s;
}

.btn-jump-3d:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(59, 130, 246, 0.35));
    border-color: #c084fc;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

@media (max-width: 820px) {
    .modal-3d-backdrop {
        padding: 0;
    }

    .modal-3d-container {
        width: 100vw;
        height: 100vh;
        max-width: none;
        border-radius: 0;
        border: none;
    }

    .modal-3d-header {
        height: auto;
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-3d-toolbar {
        flex-wrap: wrap;
        width: 100%;
        justify-content: space-between;
        gap: 6px;
    }

    .three-hud-filters {
        top: 8px;
        left: 8px;
        right: 8px;
        max-width: calc(100% - 16px);
    }

    .three-hud-search {
        top: 56px;
        right: 8px;
    }

    .three-inspect-drawer {
        width: calc(100% - 24px);
        right: 12px;
        left: 12px;
        top: auto;
        bottom: 12px;
        max-height: 48vh;
        overflow-y: auto;
        transform: translateY(120%);
    }

    .three-inspect-drawer.open {
        transform: translateY(0);
    }
}

/* ========================================================
   3D House Customization Styles
   ======================================================== */
/* 3D House Customization in Inspect Drawer */
.house-style-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.house-style-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.house-style-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.house-style-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    padding: 7px 5px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
}
.house-style-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}
.house-style-card.active {
    background: rgba(56, 189, 248, 0.15);
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}
.house-style-icon {
    font-size: 15px;
    color: #38bdf8;
}
.house-style-name {
    font-size: 10px;
    font-weight: 700;
    color: #f1f5f9;
}
.house-style-desc {
    font-size: 8.5px;
    color: #94a3b8;
    line-height: 1.1;
}








/* Adaptive application shell and overlays */
body, .app-container { width: 100%; height: 100dvh; }
.main-content, .map-viewport, .sidebar-content, .modal-3d-viewport { min-width: 0; min-height: 0; }
.sidebar { width: clamp(260px, 22vw, 320px); height: 100%; }
.sidebar-header, .sidebar-footer { flex-shrink: 0; }
.dashboard-header { height: auto; min-height: 70px; flex-shrink: 0; flex-wrap: wrap; gap: 12px; padding: 14px 20px; }
.header-project-info { min-width: 0; flex-wrap: wrap; gap: 8px 12px; }
.project-name { font-size: clamp(16px, 1.5vw, 20px); overflow-wrap: anywhere; }
.header-stats { display: flex; flex-wrap: wrap; gap: 12px; }
.stat-header-item { flex-shrink: 0; }
.btn-3d-header { margin-left: 0 !important; min-height: 44px; }
.sidebar-toggle, .sidebar-close, .modal-close, .modal-3d-close-btn, .three-drawer-close { min-width: 44px; min-height: 44px; flex-shrink: 0; }
.sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(5,8,20,.65); z-index: 99; border: 0; }
.sidebar-scrim.show { display: block; }
button:not(.plot-dot), input, select, textarea { max-width: 100%; }
button { touch-action: manipulation; }
:focus-visible { outline: 2px solid #60a5fa; outline-offset: 3px; }
#plotModal { max-height: calc(100% - 32px); overflow-y: auto; overscroll-behavior: contain; }
.detail-row { gap: 12px; }
.detail-val { min-width: 0; overflow-wrap: anywhere; }
#loginModalBackdrop { height: 100dvh; padding: 12px; }
#loginModal { width: min(100%, 400px); max-height: 100%; overflow-y: auto; padding: 20px; }
#loginModal .modal-body { padding: 12px 0 !important; }
.calibrator-card { max-width: calc(100% - 24px); max-height: calc(100% - 24px); }
.calibrator-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal-3d-container { height: 92dvh; min-width: 0; }
.modal-3d-header { height: auto; position: relative; flex-wrap: wrap; gap: 12px; padding: 12px 64px 12px 16px; }
.modal-3d-title-group { min-width: 0; }
.modal-3d-title-group > div:last-child { min-width: 0; }
.modal-3d-title-group > div:last-child > div:first-child { flex-wrap: wrap; }
.modal-3d-toolbar { width: 100%; overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; padding-bottom: 4px; }
.toolbar-group, .toolbar-btn { flex-shrink: 0; }
.toolbar-btn, .three-filter-pill { min-height: 44px; white-space: nowrap; }
.modal-3d-close-btn { position: absolute; right: 10px; top: 10px; }
.three-hud-filters { right: 180px; flex-wrap: nowrap; overflow-x: auto; }
.three-hud-filters > * { flex-shrink: 0; }
.three-inspect-drawer { max-height: calc(100% - 100px); overflow-y: auto; overscroll-behavior: contain; }
.three-controls-guide { max-width: calc(100% - 24px); }
@media (max-width: 1200px) {
    .header-stats { width: 100%; justify-content: space-between; }
    .stat-header-item { text-align: left; }
}
@media (max-width: 992px) {
    .sidebar { width: min(320px, calc(100% - 44px)); height: 100dvh; visibility: hidden; }
    .sidebar.show { visibility: visible; }
    .dashboard-header { display: grid; grid-template-columns: 44px minmax(0, 1fr); padding: 8px 12px; gap: 6px 10px; }
    .header-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
    .stat-header-item { padding-left: 6px !important; }
    .stat-header-label { font-size: 9px; letter-spacing: 0; overflow-wrap: anywhere; }
    .stat-header-val { font-size: 15px; }
    .header-project-info { gap: 4px 10px; }
    .approved-badge { font-size: 10px; }
    .btn-3d-header { padding: 8px 10px; }
}
@media (max-width: 820px) {
    .modal-3d-container { width: 100%; height: 100dvh; }
    .modal-3d-header { padding: 8px 58px 8px 12px; }
    .modal-3d-toolbar { width: calc(100% + 46px); margin-right: -46px; flex-wrap: nowrap; justify-content: flex-start; }
    .modal-3d-title { font-size: 15px; }
    .modal-3d-tag { display: none; }
    .three-hud-filters { top: 8px; left: 8px; right: 8px; }
    .three-hud-search { top: 72px; right: 8px; }
    .three-inspect-drawer { max-height: min(48dvh, calc(100% - 24px)); }
}
@media (max-width: 640px) {
    .header-project-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
    .project-name { grid-column: 1 / -1; font-size: 16px; }
    .btn-3d-header { font-size: 11px; }
    .btn-3d-header span { font-size: 0; }
    .btn-3d-header span::after { content: '3D View'; font-size: 11px; }
    .header-stats { row-gap: 6px; }
    .floating-legend-card { top: 12px; right: 12px; left: auto; bottom: auto; min-width: 0; width: min(210px, calc(100% - 76px)); max-width: none; }
    .floating-legend-body { max-height: min(180px, 30dvh); }
    #modalBackdrop { height: 100dvh !important; }
    #plotModal { max-height: 85dvh !important; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
    input, select, textarea { font-size: 16px !important; }
    .calibrator-card { top: 12px !important; right: 12px !important; left: auto !important; width: calc(100% - 24px); }
    .three-controls-guide { font-size: 10px; bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (max-height: 500px) {
    .dashboard-header { padding-top: 4px; padding-bottom: 4px; }
    .floating-legend-body { max-height: 100px; }
    .modal-3d-title-group > div:last-child > div:last-child { display: none; }
    .three-controls-guide { display: none; }
    .three-inspect-drawer { max-height: calc(100% - 24px); }
}
.sidebar { z-index: 1500; }
.sidebar-scrim { z-index: 1499; }
@media (max-width: 360px) {
    .header-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 3D tour: clear title, primary camera choices, optional view settings */
.modal-3d-header { padding: 14px 68px 14px 20px; gap: 12px 24px; }
.modal-3d-title-group { flex: 1 1 220px; }
.modal-3d-title { font-size: 18px; }
.modal-3d-tag { display: none; }
.modal-3d-toolbar { width: auto; flex: 0 1 auto; overflow: visible; flex-wrap: wrap; padding: 0; gap: 10px; }
.toolbar-btn { white-space: nowrap; line-height: 1.2; }
.camera-presets { flex-wrap: wrap; }
.three-view-settings { position: relative; }
.three-view-settings summary { list-style: none; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.three-view-settings summary::-webkit-details-marker { display: none; }
.three-view-settings[open] summary { color: #fff; background: #24324b; }
.three-settings-panel { position: absolute; top: calc(100% + 12px); right: 0; width: 300px; max-width: calc(100vw - 32px); padding: 16px; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; background: #101a2d; box-shadow: 0 16px 40px rgba(0,0,0,.45); display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; z-index: 30; max-height: 60dvh; overflow-y: auto; }
.three-settings-label { grid-column: 1 / -1; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; margin: 4px 0; }
.three-settings-panel .toolbar-group { grid-column: 1 / -1; justify-content: space-between; }
.three-settings-panel > .toolbar-btn { background: rgba(255,255,255,.04); justify-content: flex-start; padding: 10px; }
.three-settings-panel > .toolbar-btn.active { background: #2563eb; color: white; }
@media (max-width: 1100px) {
    .modal-3d-title-group { flex-basis: 100%; }
    .modal-3d-toolbar { width: 100%; justify-content: flex-start; }
}
@media (max-width: 640px) {
    .modal-3d-header { padding: 10px 58px 10px 12px; gap: 10px; }
    .modal-3d-title { font-size: 16px; }
    .modal-3d-title-group > div:last-child > div:last-child { display: none; }
    .modal-3d-icon-badge { width: 30px; height: 30px; flex-shrink: 0; }
    .modal-3d-toolbar { display: grid; grid-template-columns: minmax(0,1fr) 44px 44px; gap: 6px; width: calc(100% + 46px); margin-right: -46px; }
    .camera-presets { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); width: 100%; }
    .camera-presets .toolbar-btn { padding: 6px 3px; font-size: 10px; justify-content: center; gap: 4px; }
    .camera-presets .toolbar-btn i { display: none; }
    #threeResetViewBtn span { display: none; }
    .three-view-settings summary { justify-content: center; }
    .three-view-settings { position: static; }
    .three-settings-panel { top: calc(100% + 4px); right: 8px; }
}
@media (max-height: 500px) and (min-width: 641px) {
    .modal-3d-title-group { flex-basis: auto; }
    .modal-3d-title-group > div:last-child > div:last-child { display: none; }
    .modal-3d-toolbar { width: 100%; }
    .modal-3d-header { padding-top: 6px; padding-bottom: 6px; gap: 4px; }
}
.three-hud-filters { right: auto; width: max-content; max-width: calc(100% - 196px); }
@media (max-width: 820px) {
    .three-hud-filters { max-width: calc(100% - 16px); }
}

/* Keep the map legend content-sized at every breakpoint. */
.floating-legend-card {
    top: 12px;
    right: 12px;
    bottom: auto;
    left: auto;
    width: min(210px, calc(100% - 76px));
    min-width: 0;
    max-width: none;
    height: auto;
}
.floating-legend-body { max-height: min(180px, 30dvh); }

.leaflet-tooltip.plot-overview-tooltip {
    background: #101a2d;
    color: #dce5f4;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    white-space: normal;
    width: 230px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}
.plot-overview { font-size: 12px; line-height: 1.6; }
.plot-overview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.plot-overview-heading strong { color: #fff; font-size: 14px; }
.plot-overview-status { padding: 2px 6px; border-radius: 5px; color: #fff; font-size: 10px; font-weight: 700; }
.plot-overview small { display: block; color: #60a5fa; margin-top: 6px; font-size: 10px; }

.layout-reset-btn {
    position: absolute;
    bottom: max(28px, env(safe-area-inset-bottom));
    left: 12px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 10px;
    background: #101a2d;
    color: #fff;
    font: 600 12px var(--font-main);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.layout-reset-btn:hover { background: #24324b; }
