body { margin: 0; padding: 0; font-family: 'Inter', sans-serif; overflow: hidden; }
#map { height: 100vh; width: 100vw; z-index: 1; }

/* Navbar */
#navbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 30px;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-sizing: border-box;
    pointer-events: none; /* Let map clicks go through where empty */
}

.logo { color: white; font-size: 20px; font-weight: 600; text-shadow: 0 2px 4px rgba(0,0,0,0.5); pointer-events: auto; }
.auth-controls { display: flex; align-items: center; gap: 10px; pointer-events: auto; }

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.3); }
.nav-btn.logout { background: rgba(220, 53, 69, 0.7); border: none; }
.nav-btn.logout:hover { background: rgba(220, 53, 69, 0.9); }

/* Mapping Toolbar */
#toolbar {
    position: absolute;
    top: 80px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    width: 220px;
    transition: transform 0.3s, opacity 0.3s;
}
#toolbar.hidden { transform: translateX(120%); opacity: 0; pointer-events: none; }
#toolbar h3 { margin: 0 0 15px 0; font-size: 16px; color: #333; }

.tool-btn {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    cursor: pointer;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}
.tool-btn:hover { background: #0056b3; transform: translateY(-1px); }
.tool-btn.cancel-btn { background: #dc3545; }
.tool-btn.cancel-btn:hover { background: #c82333; }
#status-text { font-size: 13px; color: #666; margin: 5px 0 0 0; text-align: center; }

/* Overlays (Glassmorphism) */
.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 16px 32px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 350px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.4);
    transform: translateY(0);
    transition: transform 0.3s;
}
.overlay.hidden .glass-panel { transform: translateY(20px); }

.glass-panel h2 { margin: 0 0 10px 0; color: #1a1a1a; }
.glass-panel p { color: #666; font-size: 14px; margin-bottom: 20px; }

.glass-panel input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: rgba(255,255,255,0.9);
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.glass-panel input:focus { outline: none; border-color: #007bff; }

.primary-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,123,255,0.3); }
.text-btn { background: transparent; border: none; color: #666; font-weight: 500; cursor: pointer; padding: 10px; width: 100%; }
.text-btn:hover { color: #333; }

.error-msg { color: #dc3545 !important; margin-top: 10px; font-weight: 500; height: 20px; font-size: 13px;}
.msg { color: #28a745 !important; margin-top: 10px; font-weight: 500; height: 20px; font-size: 13px;}

/* Map Popup Overrides */
.popup-form { display: flex; flex-direction: column; gap: 8px; font-family: 'Inter', sans-serif;}
.popup-form input { padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.popup-form select { padding: 8px; border: 1px solid #ccc; border-radius: 4px; background: white; font-family: 'Inter', sans-serif; }
.popup-form button { padding: 8px; border-radius: 4px; border: none; font-weight: 500; cursor: pointer; color: white; background: #007bff; transition: background 0.2s;}
.popup-form button:hover { background: #0056b3; }

/* ================================================
   LOGISTICS DASHBOARD SIDEBAR
   ================================================ */
#logistics-panel {
    position: absolute;
    top: 70px;
    left: 20px;
    width: 300px;
    max-height: calc(100vh - 100px);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    box-shadow: 0 20px 48px rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    transform: translateX(0);
    opacity: 1;
}
#logistics-panel.hidden {
    transform: translateX(-120%);
    opacity: 0;
    pointer-events: none;
}

.logistics-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
    flex-shrink: 0;
}
.logistics-header h3 {
    margin: 0 0 2px 0;
    color: #f8fafc;
    font-size: 16px;
    font-weight: 700;
}
.logistics-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 12px;
}
.logistics-refresh-btn {
    position: absolute;
    top: 16px; right: 16px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.logistics-refresh-btn:hover { background: rgba(255,255,255,0.2); }

#logistics-content {
    overflow-y: auto;
    flex: 1;
    padding: 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
#logistics-content::-webkit-scrollbar { width: 4px; }
#logistics-content::-webkit-scrollbar-track { background: transparent; }
#logistics-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* Summary totals strip */
.logistics-summary {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.summary-item {
    flex: 1;
    background: rgba(99, 102, 241, 0.25);
    border: 1px solid rgba(99,102,241,0.35);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}
.summary-num {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #a5b4fc;
    line-height: 1.1;
}
.summary-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Per-place logistics cards */
.logistics-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: background 0.2s;
}
.logistics-card:hover { background: rgba(255,255,255,0.1); }

/* House filter control styling */
.house-filter-control {
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(8px);
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(2,6,23,0.06);
    box-shadow: 0 8px 20px rgba(2,6,23,0.12);
    font-size: 13px;
    color: #0f172a;
    width: auto;
}
.house-filter-control .house-filter-title { font-weight: 700; margin-bottom: 6px; }
.house-filter-control .house-filter-options { display: flex; gap: 6px; align-items: center; }
.house-filter-control .switch { display: inline-block; }
.house-filter-control .switch input { display: none; }
.house-filter-control .switch .switch-slider {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #0f172a;
    cursor: pointer;
    border: 1px solid rgba(2,6,23,0.04);
    font-weight: 600;
    transition: all 0.18s;
}
.house-filter-control .switch input:checked + .switch-slider {
    background: linear-gradient(135deg,#007bff,#0056b3);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0,123,255,0.16);
    border: none;
}

.logistics-card-icon {
    font-size: 26px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}
.logistics-card-body { flex: 1; min-width: 0; }
.logistics-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.logistics-card-stat {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 3px;
}
.logistics-card-residents {
    font-size: 11px;
    color: #64748b;
}
.pending-verification-panel {
    margin-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-top: 14px;
}
.pending-verification-panel h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #e2e8f0;
}
.pending-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.pending-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 10px;
}
.pending-card-header span {
    font-size: 12px;
    color: #cbd5e1;
}
.verify-btn {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}
.verify-btn:hover {
    background: #059669;
}
.pending-card-body div {
    font-size: 12px;
    color: #cbd5e1;
    margin-bottom: 4px;
}
.stat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
}
.stat-badge.need {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.3);
}