html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: #fafafa;
}

/* ---- header ---- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 20px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* ---- header social icons ---- */
.header-social {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-social a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    text-decoration: none;
}

.header-social a img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.15s ease;
}

/* Hide animated image by default */
.header-social a .animated-icon {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
}

/* On hover: Hide static image, show animated APNG */
.header-social a:hover .static-icon {
    display: none;
}

.header-social a:hover .animated-icon {
    display: block;
}

.header-social a:hover img {
    transform: scale(1.1);
}

.header-brand img {
    max-height: 56px;
    max-width: 100%;
}

.site-main {
    height: calc(100vh - 72px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ---- hero ---- */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    margin-bottom: 8px;
}

.hero-text {
    text-align: center;
    flex: 1;
}

.hero-text h2 {
    color: #b71c1c;
    margin: 0 0 4px;
}

.hero h4 {
    color: #333;
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

/* Top-Left Toggle Button */
.panel-toggle-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
    transition: all 0.2s ease;
    user-select: none;
}

.panel-toggle-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.panel-toggle-btn.active-collapsed {
    background: #d32f2f;
    color: #ffffff;
    border-color: #b71c1c;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.35);
}

.panel-toggle-btn.active-collapsed:hover {
    background: #b71c1c;
}

.toggle-badge {
    background: #ffffff;
    color: #d32f2f;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
}

/* ---- layout grid ---- */
.content-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 12px;
    padding: 0 16px 16px;
    min-height: 0;
    position: relative;
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.content-grid.panel-collapsed {
    grid-template-columns: 0px 1fr;
}

/* ---- panel ---- */
.panel {
    background: #ffffff;
    overflow-y: auto;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    z-index: 10;
    min-width: 420px;
    box-sizing: border-box;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-grid.panel-collapsed .panel {
    opacity: 0;
    pointer-events: none;
    min-width: 0;
    padding: 0;
    transform: translateX(-100%);
}

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

.panel-header h3 {
    margin: 0;
    color: #b71c1c;
}

.btn-close-panel {
    background: none;
    border: none;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-close-panel:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ---- map panel ---- */
.map-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.search-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.map-canvas {
    flex: 1;
    width: 100%;
    min-height: 400px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.10);
}

/* ---- municipality markers ---- */
.muni-marker {
    background: #1e293b;
    color: #fff;
    font-size: 13px;
    line-height: 1.2;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.35);
    transition: transform .08s ease-in-out;
    border: 1px solid rgba(255, 0, 0, 0.25);
}

.muni-marker:hover {
    transform: scale(1.06);
    z-index: 2;
}

/* ---- town markers ---- */
.town-marker {
    background-color: #1e293b;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.15s ease;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.town-marker:hover {
    transform: scale(1.08);
    background-color: #0f172a;
}

.town-marker .town-badge {
    background-color: #d32f2f;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
}

/* ---- imported marker layers ---- */
.layer-marker {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: #ffffff;
    border: 1.5px solid #d32f2f; /* Red outer border */
    border-radius: 4px;
    overflow: hidden; /* Clip the icon to the left */
    padding: 0;
    height: 24px;
    box-sizing: border-box;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}

/* The icon filling the left side with a vertical divider bar */
.layer-marker img {
    height: 100%;
    width: 24px;
    object-fit: contain;
    padding: 2px 3px;
    box-sizing: border-box;
    border-right: 1px solid #1e3a8a; /* Vertical blue divider line */
    background-color: #f8fafc;
    flex-shrink: 0;
    display: block;
}

/* Hide label by default (zoomed out) */
.layer-marker span {
    display: none;
    padding: 0 6px; /* Internal text padding */
    font-size: 12px;
    font-weight: 500;
    color: #222;
    line-height: 1;
}

/* Show label when zoomed in */
.layer-marker.show-label span {
    display: inline-flex;
    align-items: center;
}

/* When zoomed out (icon only, no label visible), remove the right divider line */
.layer-marker:not(.show-label) img {
    border-right: none;
}

/* If a marker has only text and NO icon */
.layer-marker:not(:has(img)) span {
    padding: 0 8px;
}

.layer-marker.clickable {
    cursor: pointer;
}

.layer-marker.clickable:hover {
    transform: scale(1.06);
    z-index: 2;
}

/* ---- numbered selection pills (Map Pins) ---- */
.selection-pin {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d32f2f;
    border: 2px solid #fff;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(0,0,0,.45);
}

.selection-pin span {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

/* ---- interest list ---- */
.interest-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    max-height: 26vh;
    overflow-y: auto;
    margin-bottom: 12px;
}

.interest-head {
    padding: 8px 12px;
    background: #fbe9e7;
    font-size: 0.9rem;
}

.interest-empty {
    padding: 14px 12px;
    color: #9e9e9e;
    text-align: center;
    font-size: .85rem;
}

.interest-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-top: 1px solid #eee;
    font-size: .85rem;
}

.interest-icon {
    color: #d32f2f;
    white-space: nowrap;
}

    .interest-icon::before {
        content: "\25CF";
        font-size: 11px;
        margin-right: 4px;
        vertical-align: middle;
    }

.type-face::before {
    color: #d32f2f;
}

.type-muni::before {
    color: #f57c00;
}

.type-location::before {
    color: #1976d2;
}

.type-area::before {
    color: #388e3c;
}

.interest-badge {
    background: #d32f2f;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    line-height: 1;
    margin-right: 2px;
}

.interest-type {
    font-weight: 700;
    white-space: nowrap;
}

.interest-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- form elements ---- */
.lead-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

    .form-field label {
        font-size: 12px;
        font-weight: 600;
        color: #475569;
    }

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

.submit-btn {
    width: 100%;
    margin-top: 6px;
    background-color: #d32f2f !important;
    border-color: #d32f2f !important;
    font-weight: 600;
}

    .submit-btn:hover {
        background-color: #b71c1c !important;
        border-color: #b71c1c !important;
    }

.disclaimer {
    font-size: .75em;
    color: #666;
    margin-top: 10px;
    margin-bottom: 0;
}

/* ---- admin pages ---- */
.admin-page {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 48px;
    box-sizing: border-box;
}

.admin-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

    .admin-head h1 {
        font-size: 1.5rem;
        color: #b71c1c;
        margin: 0;
    }

.admin-logout {
    font-size: .9rem;
    color: #d32f2f;
    text-decoration: none;
}

    .admin-logout:hover {
        text-decoration: underline;
    }

.admin-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.10);
    padding: 16px 18px;
    margin-bottom: 16px;
}

    .admin-card h2 {
        font-size: 1.05rem;
        margin: 0 0 8px;
    }

.muted {
    color: #757575;
    font-size: .88rem;
}

.upload-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 10px;
}

.file-input::file-selector-button {
    margin-right: 10px;
    border: none;
    background: #d32f2f;
    color: #fff;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
}

.layer-override {
    min-width: 260px;
}

    .layer-override input {
        width: 100%;
        padding: 7px 9px;
        border: 1px solid #ccc;
        border-radius: 4px;
    }

.result-ok, .result-fail {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: .92rem;
}

.result-ok {
    background: #e8f5e9;
    color: #1b5e20;
    border-left: 4px solid #388e3c;
}

.result-fail {
    background: #ffebee;
    color: #b71c1c;
    border-left: 4px solid #d32f2f;
}

.imports-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

    .imports-table th, .imports-table td {
        text-align: left;
        padding: 6px 8px;
        border-bottom: 1px solid #eee;
    }

.status-ok {
    color: #388e3c;
    font-weight: 600;
}

.status-fail {
    color: #d32f2f;
    font-weight: 600;
}

.admin-login {
    max-width: 360px;
    margin: 60px auto;
    background: #fff;
    padding: 24px 26px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,.12);
}

    .admin-login h1 {
        font-size: 1.3rem;
        color: #b71c1c;
        margin-top: 0;
    }

.admin-error {
    color: #d32f2f;
    font-size: .9rem;
    background: #ffebee;
    padding: 8px 10px;
    border-radius: 4px;
}

.btn-primary {
    background: #d32f2f;
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

    .btn-primary:hover {
        background: #b71c1c;
    }

/* ---- Responsive (Mobile) ---- */
@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .panel {
        min-width: 100%;
    }

    .map-canvas {
        min-height: 60vh;
    }
}

/* ---- Pole Hover Tooltip ---- */
.pole-hover-popup .maplibregl-popup-content {
    background: #1e293b;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

.pole-hover-popup .maplibregl-popup-tip {
    border-top-color: #1e293b;
}

.pole-tooltip-title {
    font-size: 13px;
    font-weight: 700;
    color: #f87171;
    margin-bottom: 2px;
}

.pole-tooltip-info {
    font-size: 11px;
    color: #cbd5e1;
}

.pole-tooltip-coords {
    font-size: 10px;
    color: #94a3b8;
    font-family: monospace;
    margin-top: 3px;
}

/* ---- Map Toolbar ---- */
.map-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.map-toolbar .search-bar {
    flex: 1;
    margin-bottom: 0;
}

.measure-toolbar {
    display: flex;
    gap: 6px;
}

.btn-tool {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-tool:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-tool.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* ---- Marquee Selection Box (Ctrl + Drag) ---- */
.marquee-selection-box {
    position: fixed;
    border: 2px dashed #d32f2f;
    background-color: rgba(211, 47, 47, 0.15);
    pointer-events: none;
    z-index: 9999;
}

/* ---- Clear Area Filter Floating Pill ---- */
.clear-filter-pill {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    background: #d32f2f;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: none;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease;
}

.clear-filter-pill:hover {
    transform: translateX(-50%) scale(1.05);
    background: #b71c1c;
}

/* ---- Measurement Display HUD ---- */
.measure-hud {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    background: #1e293b;
    color: #ffffff;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    display: none;
    align-items: center;
    gap: 12px;
}

.measure-hud button {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
}

.measure-hud button:hover {
    color: #ffffff;
}

.measure-pin {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    border: 2px solid #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ---- Map Tools Flyout ---- */
.map-tools-container {
    position: relative;
    display: inline-block;
}

.tools-flyout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    background: transparent;
}

.tools-flyout-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 250px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 151;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: flyoutFadeIn 0.15s ease;
}

@keyframes flyoutFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tools-flyout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
}

.btn-flyout-close {
    background: none;
    border: none;
    font-size: 14px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-flyout-close:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.tools-flyout-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tools-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.flyout-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.flyout-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.flyout-item.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
}

.flyout-item-icon {
    font-size: 13px;
}

.flyout-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

.flyout-toggle-row input[type="checkbox"] {
    cursor: pointer;
    width: 15px;
    height: 15px;
    accent-color: #d32f2f;
}

.tools-flyout-divider {
    height: 1px;
    background-color: #e2e8f0;
    margin: 8px 0 6px;
}

/* ---- Admin Modal Dialog Popup ---- */
.admin-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 10000;
}

.admin-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 480px;
    z-index: 10001;
    box-sizing: border-box;
    animation: modalScaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.admin-modal-header h3 {
    margin: 0;
    color: #b71c1c;
    font-size: 1.2rem;
}

.modal-icon-preview {
    width: 38px;
    height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.modal-icon-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-input-sm::file-selector-button {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 8px;
    transition: all 0.15s ease;
}

.file-input-sm::file-selector-button:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.rz-datalist-content {
    max-height: 100% !important;
}