:root {
    --bg: #f0ede8;
    --panel: rgba(255, 255, 255, 0.90);
    --surface: rgba(248, 246, 243, 0.90);
    --surface-2: rgba(237, 233, 227, 0.90);
    --text: #1a1710;
    --muted: #6b6560;
    --line: rgba(255, 103, 31, 0.20);
    --blue: #FF671F;
    --blue-dark: #cc4f12;
    --green: #10b981;
    --red: #ef4444;
    --orange: #FF671F;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --soft-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 48% 8%, rgba(255, 103, 31, 0.18), transparent 28%),
        linear-gradient(180deg, #f5f2ed 0%, #ede9e3 58%, #e5e1da 100%);
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-mode {
    --bg: #0f0f0f;
    --panel: rgba(15, 15, 15, 0.95);
    --surface: rgba(28, 28, 28, 0.92);
    --surface-2: rgba(36, 36, 36, 0.92);
    --text: #e8e8e8;
    --muted: #a0a0a0;
    --line: rgba(212, 175, 55, 0.22);
    background:
        radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.08), transparent 30%),
        linear-gradient(180deg, #0f0f0f 0%, #0a0a0a 100%);
}

body.auth-locked #wrap {
    visibility: hidden;
}

.access-screen {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
    background: var(--bg, #f0ede8);
    color: var(--text, #1a1710);
    transition: background 0.3s ease, color 0.3s ease;
}

body:not(.auth-locked) .access-screen {
    display: none;
}

.access-panel {
    width: min(540px, calc(100vw - 32px));
    padding: 36px;
    background: rgba(10, 14, 22, 0.42);
    border-radius: 20px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 232, 150, 0.28),
        0 0 28px rgba(212, 175, 55, 0.24),
        0 10px 25px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(18px) saturate(1.12);
    text-align: center;
}

.pcg-logo {
    display: grid;
    place-items: center;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    padding: 8px;
    background:
        radial-gradient(circle, rgba(208, 163, 55, 0.16), rgba(5, 7, 11, 0.84) 62%),
        rgba(5, 7, 11, 0.84);
    border: 2px solid #d0a337;
    border-radius: 50%;
    box-shadow:
        0 0 0 1px rgba(208, 163, 55, 0.22),
        0 0 18px rgba(208, 163, 55, 0.52),
        0 0 46px rgba(208, 163, 55, 0.30),
        0 0 86px rgba(208, 163, 55, 0.16);
}

.pcg-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.access-panel h1 {
    position: relative;
    margin: 0 0 16px;
    font-size: clamp(18px, 4.2vw, 26px);
    font-weight: 600;
    color: #d4af37;
    white-space: nowrap;
}

.access-warning {
    margin: 0 0 24px;
    padding: 16px;
    background: rgba(32, 5, 10, 0.6);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(127, 29, 29, 0.15);
    font-size: 14px;
    color: #e2e8f0;
}

.access-warning i {
    display: block;
    margin-bottom: 9px;
    color: #fbbf24;
    font-size: 22px;
}

.access-warning b {
    display: block;
    margin-bottom: 8px;
    color: #ff4141;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.access-warning p {
    margin: 0;
    font-size: 11px;
    line-height: 1.55;
}

.access-warning span {
    display: block;
    margin-top: 12px;
    color: #ef4444;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 10px;
    letter-spacing: 1px;
}

.access-panel label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.access-input-row {
    display: grid;
    grid-template-columns: 1fr 58px;
    width: min(340px, 100%);
    margin: 0 auto;
    border: 1px solid rgba(217, 170, 50, 0.74);
    border-radius: 7px;
    overflow: hidden;
}

body.auth-locked .access-input-row input {
    min-height: 44px;
    padding: 10px 14px;
    color: #e5e7eb;
    background: rgba(17, 19, 24, 0.92);
    border: 0;
    border-radius: 0;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 1px;
}

body.auth-locked .access-input-row input:focus {
    border: 0;
    box-shadow: inset 0 0 0 1px rgba(217, 170, 50, 0.34);
}

body.auth-locked .access-input-row button {
    min-height: 44px;
    margin: 0;
    color: #05070b;
    background: #d0a337;
    border: 0;
    border-radius: 0;
}

.access-message {
    min-height: 20px;
    margin-top: 12px;
    color: #f87171;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.access-hint {
    margin: 0 0 20px;
    color: #d0a337;
    font-size: 13px;
    line-height: 1.5;
}

.access-panel label.access-remember {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    color: #d0a337;
    font-size: 13px;
    cursor: pointer;
}

.access-remember input {
    accent-color: #d0a337;
}

.admin-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.admin-overlay[hidden] {
    display: none;
}

.admin-panel {
    width: min(720px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg);
    color: var(--text);
    border: 1px solid #d0a337;
    border-radius: 10px;
    padding: 20px 24px 24px;
}

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

.admin-panel-header h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.admin-create-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.admin-create-form input,
.admin-create-form select {
    flex: 1 1 140px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(128, 128, 128, 0.4);
    background: var(--panel);
    color: var(--text);
}

.admin-create-form button {
    padding: 8px 16px;
    border: 0;
    border-radius: 6px;
    background: #d0a337;
    color: #05070b;
    font-weight: 700;
    cursor: pointer;
}

.admin-form-message {
    min-height: 18px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 700;
    color: #f87171;
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-users-table th,
.admin-users-table td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.25);
}

.admin-users-table button {
    margin-right: 6px;
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(128, 128, 128, 0.4);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
}

.admin-users-table button.danger {
    border-color: #f87171;
    color: #f87171;
}

.admin-status-active {
    color: #4ade80;
    font-weight: 700;
}

.admin-status-disabled {
    color: #f87171;
    font-weight: 700;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}

.admin-tab {
    padding: 8px 16px;
    border: 0;
    background: transparent;
    color: var(--text);
    opacity: 0.6;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 2px solid transparent;
}

.admin-tab.active {
    opacity: 1;
    border-bottom-color: #d0a337;
}

.admin-loc-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.admin-loc-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
}

.admin-loc-fields input[type="text"],
.admin-loc-fields input[type="number"] {
    flex: 1 1 120px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(128, 128, 128, 0.4);
    background: var(--panel);
    color: var(--text);
}

.admin-loc-fields label.admin-loc-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    font-size: 13px;
}

#adminLocType {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(128, 128, 128, 0.4);
    background: var(--panel);
    color: var(--text);
}

.admin-loc-form-actions {
    display: flex;
    gap: 8px;
}

.admin-loc-form-actions button {
    padding: 8px 16px;
    border: 0;
    border-radius: 6px;
    background: #d0a337;
    color: #05070b;
    font-weight: 700;
    cursor: pointer;
}

#adminLocCancelBtn {
    background: transparent;
    border: 1px solid rgba(128, 128, 128, 0.4);
    color: var(--text);
}

.access-theme-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.80);
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.access-theme-btn:hover {
    background: rgba(255, 103, 31, 0.22);
    border-color: rgba(255, 103, 31, 0.50);
    color: #FF671F;
    transform: scale(1.08);
}

body:not(.auth-locked) .access-theme-btn {
    display: none;
}

@keyframes accessScreenExit {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes accessPanelExit {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to   { opacity: 0; transform: scale(1.06) translateY(-8px); }
}

body.access-exiting .access-screen {
    animation: accessScreenExit 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
}

body.access-exiting .access-panel {
    animation: accessPanelExit 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.access-screen footer {
    position: fixed;
    bottom: 18px;
    color: rgba(148, 163, 184, 0.28);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.eyebrow {
    margin: 0 0 4px;
    color: #2563eb;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.side-brand {
    flex-shrink: 0;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--soft-shadow);
}

.side-brand h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.brand-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.92;
}

.brand-text {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.brand-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--surface-2);
    transform: translateY(-1px);
}

.icon-btn i {
    font-size: 16px;
}

.row {
    margin-bottom: 12px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--soft-shadow);
}

details.row {
    padding: 0;
}

details.row[open] {
    padding: 0 16px 16px;
}

details.row[open] > summary.section-title {
    margin: 0 -16px 8px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.section-title i {
    color: var(--blue);
}

summary.section-title::marker {
    display: none;
}

summary.section-title::after {
    content: "▼";
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s ease;
}

details.row[open] summary.section-title::after {
    transform: rotate(180deg);
}
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.icon-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.36);
    box-shadow: none;
    transform: none;
}

body.dark-mode .icon-btn {
    color: rgba(217, 170, 50, 0.7);
    background: transparent;
    border-color: rgba(217, 170, 50, 0.25);
}

body.dark-mode .icon-btn:hover {
    color: #d9aa32;
    background: rgba(217, 170, 50, 0.1);
    border-color: rgba(217, 170, 50, 0.5);
    box-shadow: none;
}

.legend-details {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    padding-top: 8px;
}

body.dark-mode .legend-details {
    border-top-color: rgba(217, 170, 50, 0.2);
}

.legend-details > summary {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.legend-details > summary::-webkit-details-marker {
    display: none;
}

body.dark-mode .legend-details > summary {
    color: rgba(217, 170, 50, 0.7);
}

.side-brand .eyebrow {
    color: #bfdbfe;
}

body.dark-mode .side-brand {
    background: linear-gradient(135deg, rgba(5, 7, 11, 0.72), rgba(12, 14, 20, 0.60));
    border-color: rgba(189, 148, 52, 0.45);
    box-shadow: 0 0 30px rgba(189, 148, 52, 0.14);
}

body.dark-mode .side-brand .eyebrow {
    color: #d9aa32;
}

body.dark-mode .top-legend span {
    color: #eee7d8;
    background: rgba(217, 170, 50, 0.08);
    border-color: rgba(217, 170, 50, 0.25);
}

.top-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 5px;
    margin-top: 8px;
}

.top-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 26px;
    padding: 4px 8px;
    color: #e8eef7;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    backdrop-filter: blur(24px);
}

#wrap {
    position: relative;
    display: flex;
    height: 100vh;
    min-height: 0;
}

#panel {
    width: 350px;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--panel);
    border-right: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(36px) saturate(1.6);
}

.panel-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

body.dark-mode #panel {
    border-right-color: rgba(189, 148, 52, 0.28);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
}

#map {
    flex: 1;
    min-width: 0;
    background: #05070b;
    will-change: transform;
}

.leaflet-zoom-animated {
    will-change: transform;
}

body.dark-mode #map {
    background: #03050a;
}

.map-error {
    display: grid;
    place-items: center;
    height: 100%;
    padding: 32px;
    color: #991b1b;
    background: #fee2e2;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
}

body.dark-mode .map-error {
    color: #fecaca;
    background: #450a0a;
}

body.presentation-mode #panel {
    display: none;
}

body.presentation-mode #map {
    width: 100%;
}

.floating-exit {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: none;
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 9px 14px;
    color: #ffffff;
    background: rgba(21, 35, 58, 0.5);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: var(--shadow);
    backdrop-filter: blur(28px);
}

body.presentation-mode .floating-exit {
    display: inline-flex;
}

@media print {
    #panel {
        display: none;
    }

    #wrap {
        height: 100vh;
    }
}

.row {
    margin-bottom: 8px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 12px;
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(32px) saturate(1.5);
}

.utility-hidden {
    display: none;
}

details.row {
    padding: 0;
    overflow: visible;
}

details.row > :not(summary) {
    margin-left: 0;
    margin-right: 0;
}

details.row > :last-child {
    margin-bottom: 0;
}

details.row[open] {
    padding: 0 16px 16px;
}

details.row[open] > summary.section-title {
    margin: 0 -16px 8px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.section-title i {
    color: var(--blue);
}

summary.section-title {
    margin: 0;
    list-style: none;
    user-select: none;
    border-radius: 12px;
    transition: background 0.2s ease;
}

summary.section-title:hover {
    background: var(--surface);
}

summary.section-title::marker {
    display: none;
}

summary.section-title::after {
    content: "▼";
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s ease;
}

details.row[open] summary.section-title::after {
    transform: rotate(180deg);
}
summary.section-title::after {
    color: #64748b;
    font-family: "Font Awesome 6 Free";
    font-size: 12px;
    font-weight: 900;
    transition: transform 0.16s ease;
}

details[open] > summary.section-title::after {
    transform: translateY(-50%) rotate(180deg);
}

.section-title i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--blue);
    background: rgba(219, 234, 254, 0.82);
    border: 1px solid rgba(147, 197, 253, 0.4);
    border-radius: 8px;
    font-size: 11px;
}

body.dark-mode .section-title i {
    color: #d9aa32;
    background: rgba(217, 170, 50, 0.12);
    border-color: rgba(217, 170, 50, 0.28);
}

.mini-title {
    margin-bottom: 8px;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

body.dark-mode .mini-title,
body.dark-mode label {
    color: #c8b98f;
}

label {
    display: block;
    margin: 9px 0 4px;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 8px 0 10px;
}

.filter-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    margin: 0;
    padding: 8px 9px;
    color: #1e3a8a;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    text-transform: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-option:hover {
    background: rgba(212, 175, 55, 0.07);
    border-color: rgba(212, 175, 55, 0.35);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
}

body.dark-mode .filter-option:hover {
    background: rgba(217, 170, 50, 0.07);
    border-color: rgba(217, 170, 50, 0.45);
    box-shadow: 0 0 0 3px rgba(217, 170, 50, 0.1);
}

body.dark-mode .filter-option {
    color: #eee7d8;
    background: rgba(17, 19, 24, 0.72);
    border-color: rgba(189, 148, 52, 0.25);
}

.filter-option input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--blue);
}

.search-type-toggle {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    min-inline-size: 0;
    margin: 7px 0 10px;
    padding: 3px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.52);
}

body.dark-mode .search-type-toggle {
    border-color: rgba(189, 148, 52, 0.25);
    background: rgba(17, 19, 24, 0.62);
}

.search-type-toggle label {
    display: block;
    min-width: 0;
    margin: 0;
    cursor: pointer;
}

.search-type-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.search-type-toggle span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 31px;
    padding: 6px 7px;
    color: #475569;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 800;
    text-transform: none;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.search-type-toggle input:checked + span {
    color: #ffffff;
    background: linear-gradient(135deg, #d4af37, #a97b22);
    box-shadow: 0 6px 15px rgba(212, 175, 55, 0.18);
}

body.dark-mode .search-type-toggle span {
    color: #c8b98f;
}

body.dark-mode .search-type-toggle input:checked + span {
    color: #05070b;
    background: linear-gradient(135deg, #d0a337, #a97b22);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.28);
}

select,
input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.55);
    border-radius: 9px;
    font-size: 13px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"] {
    color: #eee7d8;
    background: rgba(17, 19, 24, 0.88);
    border-color: rgba(189, 148, 52, 0.3);
}

body.dark-mode select:hover,
body.dark-mode input[type="text"]:hover,
body.dark-mode input[type="password"]:hover,
body.dark-mode input[type="number"]:hover {
    border-color: rgba(217, 170, 50, 0.6);
    box-shadow: 0 0 0 3px rgba(217, 170, 50, 0.09);
}

select {
    cursor: pointer;
}

select:hover,
input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover {
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.07);
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.14);
}

body.dark-mode select:focus,
body.dark-mode input:focus {
    border-color: #d0a337;
    box-shadow: 0 0 0 3px rgba(208, 163, 55, 0.18);
}

.button-row {
    display: grid;
    grid-template-columns: 1fr 0.72fr;
    gap: 8px;
    margin-top: 10px;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 36px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background: var(--surface-2);
    border-color: var(--blue);
}

button:active {
    transform: translateY(1px);
}

button.primary {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

button.primary:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
}

button.secondary {
    background: transparent;
    color: var(--muted);
}

button.secondary:hover {
    color: var(--text);
    border-color: var(--text);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.result {
    margin-top: 12px;
    padding: 11px 12px;
    color: #1e3a8a;
    background: rgba(239, 246, 255, 0.78);
    border: 1px solid rgba(147, 197, 253, 0.62);
    border-left: 4px solid var(--blue);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
}

body.dark-mode .result {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.52);
    border-color: rgba(217, 170, 50, 0.22);
    border-left-color: #d0a337;
}

.result-muted {
    display: block;
    margin-top: 8px;
    color: #475569;
}

body.dark-mode .result-muted {
    color: #a4adba;
}

.hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.county-detail-list {
    display: none;
    gap: 10px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    animation: countyPop 0.2s ease-out;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

.county-detail-list.is-open {
    display: grid;
}

body.dark-mode .county-detail-list {
    background: rgba(17, 19, 24, 0.72);
    border-color: rgba(189, 148, 52, 0.24);
}

.county-detail-head {
    display: grid;
    gap: 7px;
}

.county-list-title {
    min-width: 0;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.15;
}

.county-list-state {
    align-self: start;
    justify-self: start;
    padding: 2px 6px;
    color: #ffffff;
    background: var(--blue);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.3;
    text-transform: uppercase;
}

body.dark-mode .county-list-state {
    color: #05070b;
    background: #d0a337;
}

.county-count-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.county-count-strip span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 6px;
    color: #1e3a8a;
    background: rgba(219, 234, 254, 0.82);
    border: 1px solid rgba(147, 197, 253, 0.45);
    border-radius: 7px;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

body.dark-mode .county-count-strip span {
    color: #eee7d8;
    background: rgba(217, 170, 50, 0.09);
    border-color: rgba(217, 170, 50, 0.25);
}

.county-detail-section {
    display: grid;
    gap: 5px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.county-detail-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--blue);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.3;
    text-transform: uppercase;
}

.county-detail-item {
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
    padding: 5px 7px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.county-location-jump {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    margin: 0;
    text-align: left;
    box-shadow: none;
}

.county-location-jump span {
    min-width: 0;
}

.county-location-jump i {
    color: var(--blue);
    font-size: 11px;
}

.county-location-jump:hover {
    background: rgba(212, 175, 55, 0.07);
    border-color: rgba(212, 175, 55, 0.32);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
}

body.dark-mode .county-location-jump:hover {
    background: rgba(217, 170, 50, 0.07);
    border-color: rgba(217, 170, 50, 0.36);
    box-shadow: 0 0 0 3px rgba(217, 170, 50, 0.1);
}

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

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


#counts {
    display: grid;
    gap: 5px;
}

.radius-manual-controls {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.utility-hidden {
    display: none;
}

.pinned-addresses {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.pinned-address-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.pinned-address-text {
    min-width: 0;
    color: #334155;
    font-size: 13px;
    line-height: 1.35;
}

.pinned-address-remove,
.popup-remove-pin {
    width: auto;
    min-height: 32px;
    margin-top: 0;
    padding: 6px 10px;
    color: #ffffff;
    background: #475569;
    border-color: #475569;
    font-size: 12px;
}

.autocomplete-container {
    position: relative;
}

.suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.48);
    border-radius: 10px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.suggestions div {
    padding: 10px 12px;
    color: #334155;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

.suggestions div:hover {
    background: #f1f5f9;
}

.suggestions div:last-child {
    border-bottom: none;
}

.leaflet-control-zoom a {
    color: #0f172a;
}

.map-icon-marker,
.map-pin-marker {
    --marker-color: #1e3a8a;
    display: inline-grid;
    place-items: center;
    position: relative;
    width: 28px;
    height: 28px;
    color: var(--marker-color);
    background: #ffffff;
    border: 2px solid var(--marker-color);
    border-radius: 50%;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.26);
    font-size: 14px;
    line-height: 1;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.location-marker-pulse .map-icon-marker,
.location-marker-pulse .map-pin-marker {
    animation: markerLift 0.95s ease-out;
}

.location-marker-pulse .map-icon-marker::after,
.location-marker-pulse .map-pin-marker::after {
    content: "";
    position: absolute;
    inset: -9px;
    border: 2px solid var(--marker-color);
    border-radius: inherit;
    animation: markerRing 0.95s ease-out;
}

@keyframes markerLift {
    0% {
        transform: scale(1);
    }

    32% {
        transform: scale(1.22);
        box-shadow: 0 14px 28px rgba(15, 23, 42, 0.32);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes markerRing {
    0% {
        opacity: 0.72;
        transform: scale(0.55);
    }

    100% {
        opacity: 0;
        transform: scale(1.85);
    }
}

.map-icon-marker--mp {
    --marker-color: #2d58cf;
}

.map-icon-marker--bww-pa {
    --marker-color: #dc2626;
}

.map-icon-marker--bww-nj,
.map-icon-marker--bww-go {
    --marker-color: #c2410c;
}

.map-icon-marker--dunkin {
    --marker-color: #f97316;
}

.map-icon-marker--combo {
    --marker-color: #db2777;
}

.map-pin-marker {
    --marker-color: #16a34a;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 30px;
}

.map-county-summary {
    display: none;
    min-width: 190px;
    max-width: 260px;
    margin: 12px 12px 0 0;
    padding: 10px 13px;
    color: #1e3a8a;
    background: rgba(220, 235, 255, 0.32);
    border: 1px solid rgba(147, 197, 253, 0.55);
    border-left: 3px solid #2563eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    font-family: 'Manrope', sans-serif;
    line-height: 1.35;
    pointer-events: none;
    backdrop-filter: blur(28px);
}

.map-county-summary.is-active {
    display: grid;
    gap: 3px;
}

.map-county-summary b {
    color: #1e3a8a;
    font-size: 13px;
}

.map-county-summary span {
    color: #3b82f6;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.map-county-summary small {
    color: #1e40af;
    font-size: 12px;
    font-weight: 700;
}

body.dark-mode .map-county-summary {
    color: #eee7d8;
    background: rgba(13, 15, 21, 0.94);
    border-color: rgba(217, 170, 50, 0.38);
    border-left-color: #d0a337;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
}

body.dark-mode .map-county-summary b {
    color: #d9aa32;
}

body.dark-mode .map-county-summary span {
    color: #a4adba;
}

body.dark-mode .map-county-summary small {
    color: #eee7d8;
}

/* County detail — floating card */
.county-detail-panel {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 900;
    width: 272px;
    max-height: 440px;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.60);
    border-radius: 16px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(36px) saturate(1.6);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.county-detail-panel.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

body.dark-mode .county-detail-panel {
    border-color: rgba(189, 148, 52, 0.24);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
}

.cdp-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 14px 11px;
    border-bottom: 1px solid var(--line);
}

.cdp-header-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cdp-state-badge {
    display: inline-block;
    width: fit-content;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #ffffff;
    background: var(--blue);
    border-radius: 999px;
}

body.dark-mode .cdp-state-badge {
    background: #d0a337;
    color: #05070b;
}

.cdp-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.cdp-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    min-height: 28px;
    margin: 0;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cdp-close:hover {
    color: var(--text);
    background: rgba(37, 99, 235, 0.07);
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: none;
    transform: none;
}

body.dark-mode .cdp-close:hover {
    background: rgba(217, 170, 50, 0.09);
    border-color: rgba(217, 170, 50, 0.35);
}

.cdp-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

.cdp-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--blue);
}

body.dark-mode .cdp-section-label {
    color: #d0a337;
}

.cdp-item {
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    line-height: 1.3;
    margin-bottom: 4px;
}

.cdp-item:last-child {
    margin-bottom: 0;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.leaflet-popup-content {
    color: #1f2937;
    font-family: 'Manrope', sans-serif;
    line-height: 1.45;
}

/* Figma-inspired sidebar skin */
#panel {
    width: 342px;
    min-width: 342px;
    background:
        radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(30, 41, 59, 0.80), rgba(5, 7, 11, 0.72)),
        rgba(5, 7, 11, 0.62);
    border-right: 1px solid rgba(212, 175, 55, 0.28);
    box-shadow: 14px 0 34px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(28px) saturate(1.2);
}

.panel-scroll {
    padding: 14px 12px;
    scrollbar-color: rgba(204, 127, 63, 0.45) transparent;
}

body.dark-mode #panel {
    background:
        linear-gradient(180deg, rgba(6, 8, 14, 0.76), rgba(5, 7, 11, 0.66)),
        rgba(5, 7, 11, 0.52);
    border-right-color: rgba(189, 148, 52, 0.22);
    box-shadow: 16px 0 42px rgba(0, 0, 0, 0.5);
    scrollbar-color: rgba(189, 148, 52, 0.45) transparent;
}

.side-brand {
    position: sticky;
    top: 0;
    z-index: 20;
    margin-bottom: 12px;
    padding: 14px;
    color: #eee7d8;
    background:
        linear-gradient(135deg, rgba(30, 41, 59, 0.82), rgba(5, 7, 11, 0.74)),
        rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.12);
}

body.dark-mode .side-brand {
    color: #eee7d8;
    background: linear-gradient(135deg, rgba(5, 7, 11, 0.72), rgba(12, 14, 20, 0.60));
    border-color: rgba(189, 148, 52, 0.45);
    box-shadow: 0 0 32px rgba(189, 148, 52, 0.12);
}

.side-brand .eyebrow,
body.dark-mode .side-brand .eyebrow {
    color: currentColor;
    opacity: 0.66;
}

.brand-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
}

body.dark-mode .brand-actions {
    background: rgba(0, 0, 0, 0.28);
    border-color: rgba(189, 148, 52, 0.28);
}

.icon-btn,
body.dark-mode .icon-btn {
    color: currentColor;
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.22);
    width: 36px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
    border-radius: 12px;
    line-height: 1;
}

.icon-btn:hover,
body.dark-mode .icon-btn:hover {
    color: currentColor;
    background: rgba(255, 255, 255, 0.34);
    border-color: rgba(255, 255, 255, 0.44);
}

.legend-details {
    border-top-color: rgba(255, 255, 255, 0.28);
}

.legend-details > summary,
body.dark-mode .legend-details > summary {
    color: currentColor;
    opacity: 0.72;
}

.top-legend span,
body.dark-mode .top-legend span {
    color: currentColor;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.28);
}

.row {
    margin-bottom: 10px;
    background: rgba(20, 10, 14, 0.52);
    border: 1px solid rgba(212, 175, 55, 0.22);
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(22px) saturate(1.15);
}

body.dark-mode .row {
    background: rgba(8, 10, 16, 0.56);
    border-color: rgba(189, 148, 52, 0.2);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

summary.section-title {
    border-radius: 16px;
}

summary.section-title:hover {
    background: rgba(212, 175, 55, 0.08);
}

body.dark-mode summary.section-title:hover {
    background: rgba(189, 148, 52, 0.1);
}

.section-title {
    color: #eee7d8;
}

body.dark-mode .section-title {
    color: #eee7d8;
}

.section-title i {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.12);
    border-color: rgba(212, 175, 55, 0.24);
    border-radius: 9px;
}

body.dark-mode .section-title i {
    color: #d0a337;
    background: rgba(189, 148, 52, 0.12);
    border-color: rgba(189, 148, 52, 0.26);
    border-radius: 9px;
}

label {
    color: #c8b98f;
}

body.dark-mode label,
body.dark-mode .mini-title {
    color: #c8b98f;
}

.hint {
    color: #a4adba;
}

body.dark-mode .hint {
    color: #a4adba;
}

.filter-option,
.search-type-toggle,
select,
input[type="text"],
input[type="password"],
input[type="number"],
.result,
.county-detail-list,
.county-detail-item {
    border-radius: 12px;
}

.filter-option {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.56);
    border-color: rgba(212, 175, 55, 0.24);
}

.filter-option:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

body.dark-mode .filter-option:hover {
    background: rgba(189, 148, 52, 0.1);
    border-color: rgba(189, 148, 52, 0.45);
    box-shadow: 0 0 0 3px rgba(189, 148, 52, 0.12);
}

body.dark-mode .filter-option {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.6);
    border-color: rgba(189, 148, 52, 0.25);
}

.filter-option input {
    accent-color: #d4af37;
}

.search-type-toggle {
    padding: 4px;
    background: rgba(8, 10, 16, 0.48);
    border-color: rgba(212, 175, 55, 0.22);
}

body.dark-mode .search-type-toggle {
    background: rgba(8, 10, 16, 0.48);
    border-color: rgba(189, 148, 52, 0.22);
}

.search-type-toggle span {
    color: #c8b98f;
    border-radius: 9px;
}

.search-type-toggle input:checked + span {
    color: #05070b;
    background: linear-gradient(135deg, #d4af37, #a97b22);
    box-shadow: 0 8px 18px rgba(212, 175, 55, 0.28);
}

body.dark-mode .search-type-toggle input:checked + span {
    color: #05070b;
    background: linear-gradient(135deg, #d0a337, #a97b22);
    box-shadow: 0 8px 18px rgba(189, 148, 52, 0.28);
}

select,
input[type="text"],
input[type="password"],
input[type="number"] {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.58);
    border-color: rgba(212, 175, 55, 0.28);
}

body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"] {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.58);
    border-color: rgba(189, 148, 52, 0.28);
}

select:hover,
input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
select:focus,
input:focus {
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.16);
}

body.dark-mode select:hover,
body.dark-mode input[type="text"]:hover,
body.dark-mode input[type="password"]:hover,
body.dark-mode input[type="number"]:hover,
body.dark-mode select:focus,
body.dark-mode input:focus {
    border-color: rgba(208, 163, 55, 0.7);
    box-shadow: 0 0 0 3px rgba(189, 148, 52, 0.16);
}

button.primary {
    color: #05070b;
    background: linear-gradient(135deg, #d4af37, #a97b22);
    border-color: rgba(212, 175, 55, 0.44);
    box-shadow: 0 10px 22px rgba(212, 175, 55, 0.2);
}

body.dark-mode button.primary {
    color: #05070b;
    background: linear-gradient(135deg, #d0a337, #a97b22);
    border-color: rgba(217, 170, 50, 0.44);
    box-shadow: 0 10px 22px rgba(189, 148, 52, 0.2);
}

button.primary:hover {
    background: linear-gradient(135deg, #ddb040, #c49230);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.24), 0 12px 24px rgba(212, 175, 55, 0.22);
}

body.dark-mode button.primary:hover {
    background: linear-gradient(135deg, #ddb040, #c49230);
    box-shadow: 0 0 0 3px rgba(189, 148, 52, 0.28), 0 12px 24px rgba(189, 148, 52, 0.2);
}

button.secondary {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.5);
    border-color: rgba(212, 175, 55, 0.26);
}

body.dark-mode button.secondary {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.5);
    border-color: rgba(189, 148, 52, 0.26);
}

.result {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.5);
    border-color: rgba(212, 175, 55, 0.24);
    border-left-color: #d4af37;
}

body.dark-mode .result {
    color: #eee7d8;
    background: rgba(8, 10, 16, 0.5);
    border-color: rgba(189, 148, 52, 0.24);
    border-left-color: #d0a337;
}

.county-count-strip span,
body.dark-mode .county-count-strip span {
    color: #7c2d12;
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.24);
}

body.dark-mode .county-count-strip span {
    color: #eee7d8;
    background: rgba(189, 148, 52, 0.12);
    border-color: rgba(189, 148, 52, 0.24);
}

/* Access-screen inspired reroll: neutral black + gold, no blue cast */
body,
body.dark-mode {
    --bg: #000000;
    --panel: rgba(15, 15, 15, 0.82);
    --surface: rgba(20, 20, 20, 0.68);
    --surface-2: rgba(28, 28, 28, 0.72);
    --text: #eee7d8;
    --muted: #a4adba;
    --line: rgba(208, 163, 55, 0.26);
    --blue: #d0a337;
    --blue-dark: #a97b22;
    background:
        radial-gradient(circle at 50% 12%, rgba(208, 163, 55, 0.12), transparent 24%),
        linear-gradient(180deg, #000000 0%, #050505 52%, #0a0a0a 100%);
}

#panel,
body.dark-mode #panel {
    background:
        radial-gradient(circle at 50% 0%, rgba(208, 163, 55, 0.10), transparent 30%),
        linear-gradient(180deg, rgba(18, 18, 18, 0.78), rgba(4, 4, 4, 0.70)),
        rgba(0, 0, 0, 0.62);
    border-right-color: rgba(208, 163, 55, 0.28);
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.48);
}

.side-brand,
body.dark-mode .side-brand {
    color: #eee7d8;
    background:
        linear-gradient(135deg, rgba(28, 28, 28, 0.86), rgba(6, 6, 6, 0.78)),
        rgba(10, 10, 10, 0.74);
    border-color: rgba(208, 163, 55, 0.48);
    box-shadow: 0 0 30px rgba(208, 163, 55, 0.13);
}

.row,
body.dark-mode .row {
    background: rgba(14, 14, 14, 0.58);
    border-color: rgba(208, 163, 55, 0.24);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.brand-actions,
body.dark-mode .brand-actions,
.filter-option,
body.dark-mode .filter-option,
.search-type-toggle,
body.dark-mode .search-type-toggle,
select,
input[type="text"],
input[type="password"],
input[type="number"],
body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
button.secondary,
body.dark-mode button.secondary,
.result,
body.dark-mode .result,
.county-detail-list,
body.dark-mode .county-detail-list,
.county-detail-item {
    background-color: rgba(8, 8, 8, 0.58);
    border-color: rgba(208, 163, 55, 0.26);
}

.section-title,
body.dark-mode .section-title,
label,
body.dark-mode label,
body.dark-mode .mini-title,
.filter-option,
body.dark-mode .filter-option,
select,
input[type="text"],
input[type="password"],
input[type="number"],
body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
button.secondary,
body.dark-mode button.secondary,
.result,
body.dark-mode .result {
    color: #eee7d8;
}

.section-title i,
body.dark-mode .section-title i,
.county-location-jump i {
    color: #d0a337;
    background: rgba(208, 163, 55, 0.12);
    border-color: rgba(208, 163, 55, 0.28);
}

.hint,
body.dark-mode .hint {
    color: #a4adba;
}

.county-count-strip span,
body.dark-mode .county-count-strip span,
.top-legend span,
body.dark-mode .top-legend span {
    color: #eee7d8;
    background: rgba(208, 163, 55, 0.10);
    border-color: rgba(208, 163, 55, 0.24);
}

summary.section-title:hover,
body.dark-mode summary.section-title:hover,
.filter-option:hover,
body.dark-mode .filter-option:hover,
.county-location-jump:hover,
body.dark-mode .county-location-jump:hover {
    background: rgba(208, 163, 55, 0.10);
    border-color: rgba(208, 163, 55, 0.44);
    box-shadow: 0 0 0 3px rgba(208, 163, 55, 0.12);
}

.search-type-toggle input:checked + span,
body.dark-mode .search-type-toggle input:checked + span,
button.primary,
body.dark-mode button.primary {
    color: #050505;
    background: linear-gradient(135deg, #d0a337, #a97b22);
    border-color: rgba(208, 163, 55, 0.5);
    box-shadow: 0 10px 22px rgba(208, 163, 55, 0.20);
}

button.primary:hover,
body.dark-mode button.primary:hover {
    background: linear-gradient(135deg, #ddb040, #c49230);
    box-shadow: 0 0 0 3px rgba(208, 163, 55, 0.24), 0 12px 24px rgba(208, 163, 55, 0.20);
}

/* Portal-matched theme: warm cream light + pure black dark, orange accent */
body,
body.dark-mode {
    --bg: #f0ede8;
    --panel: rgba(255, 255, 255, 0.90);
    --surface: rgba(248, 246, 243, 0.90);
    --surface-2: rgba(237, 233, 227, 0.90);
    --text: #1a1710;
    --muted: #6b6560;
    --line: rgba(255, 103, 31, 0.20);
    --blue: #FF671F;
    --blue-dark: #cc4f12;
    background:
        radial-gradient(circle at 48% 8%, rgba(255, 103, 31, 0.18), transparent 28%),
        linear-gradient(180deg, #f5f2ed 0%, #ede9e3 58%, #e5e1da 100%);
}

#panel,
body.dark-mode #panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 245, 241, 0.86)),
        rgba(255, 255, 255, 0.80);
    border-right-color: rgba(255, 103, 31, 0.15);
    box-shadow: 16px 0 38px rgba(80, 40, 10, 0.10);
    scrollbar-color: rgba(255, 103, 31, 0.38) transparent;
}

.side-brand,
body.dark-mode .side-brand {
    color: #1a1710;
    background:
        linear-gradient(135deg, rgba(255, 130, 60, 0.96), rgba(255, 90, 30, 0.92)),
        #FF671F;
    border-color: rgba(255, 180, 140, 0.70);
    box-shadow: 0 16px 34px rgba(204, 79, 18, 0.20);
}

.row,
body.dark-mode .row {
    background: rgba(255, 255, 255, 0.80);
    border-color: rgba(255, 103, 31, 0.15);
    box-shadow: 0 12px 28px rgba(80, 40, 10, 0.07);
}

.brand-actions,
body.dark-mode .brand-actions,
.filter-option,
body.dark-mode .filter-option,
.search-type-toggle,
body.dark-mode .search-type-toggle,
select,
input[type="text"],
input[type="password"],
input[type="number"],
body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
button.secondary,
body.dark-mode button.secondary,
.result,
body.dark-mode .result,
.county-detail-list,
body.dark-mode .county-detail-list,
.county-detail-item {
    background-color: rgba(248, 246, 243, 0.88);
    border-color: rgba(255, 103, 31, 0.20);
}

.section-title,
body.dark-mode .section-title,
label,
body.dark-mode label,
body.dark-mode .mini-title,
.filter-option,
body.dark-mode .filter-option,
select,
input[type="text"],
input[type="password"],
input[type="number"],
body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
button.secondary,
body.dark-mode button.secondary,
.result,
body.dark-mode .result {
    color: #1a1710;
}

.hint,
body.dark-mode .hint {
    color: #6b6560;
}

.section-title i,
body.dark-mode .section-title i,
.county-location-jump i {
    color: #FF671F;
    background: rgba(255, 103, 31, 0.12);
    border-color: rgba(255, 103, 31, 0.28);
}

summary.section-title:hover,
body.dark-mode summary.section-title:hover,
.filter-option:hover,
body.dark-mode .filter-option:hover,
.county-location-jump:hover,
body.dark-mode .county-location-jump:hover {
    background: rgba(255, 103, 31, 0.08);
    border-color: rgba(255, 103, 31, 0.34);
    box-shadow: 0 0 0 3px rgba(255, 103, 31, 0.10);
}

.search-type-toggle input:checked + span,
body.dark-mode .search-type-toggle input:checked + span,
button.primary,
body.dark-mode button.primary {
    color: #ffffff;
    background: linear-gradient(135deg, #FF671F, #cc4f12);
    border-color: rgba(255, 103, 31, 0.40);
    box-shadow: 0 10px 22px rgba(255, 103, 31, 0.22);
}

button.primary:hover,
body.dark-mode button.primary:hover {
    background: linear-gradient(135deg, #ff8040, #e05a1a);
    box-shadow: 0 0 0 3px rgba(255, 103, 31, 0.20), 0 12px 24px rgba(255, 103, 31, 0.20);
}

.top-legend span,
body.dark-mode .top-legend span,
.county-count-strip span,
body.dark-mode .county-count-strip span {
    color: #1a1710;
    background: rgba(255, 255, 255, 0.50);
    border-color: rgba(255, 103, 31, 0.18);
}

/* Dark mode: pure black + orange (matches Portal dark theme) */
body.dark-mode {
    --bg: #0f0f0f;
    --panel: rgba(15, 15, 15, 0.95);
    --surface: rgba(28, 28, 28, 0.92);
    --surface-2: rgba(36, 36, 36, 0.92);
    --text: #e8e8e8;
    --muted: #a0a0a0;
    --line: rgba(212, 175, 55, 0.22);
    --blue: #d4af37;
    --blue-dark: #a97b22;
    background:
        radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.08), transparent 30%),
        linear-gradient(180deg, #0f0f0f 0%, #0a0a0a 100%);
}

body.dark-mode #panel {
    background:
        linear-gradient(180deg, rgba(20, 20, 20, 0.96), rgba(12, 12, 12, 0.98)),
        #0f0f0f;
    border-right-color: rgba(212, 175, 55, 0.22);
    box-shadow: 16px 0 42px rgba(0, 0, 0, 0.60);
    scrollbar-color: rgba(212, 175, 55, 0.40) transparent;
}

body.dark-mode .side-brand {
    color: #e8e8e8;
    background:
        linear-gradient(135deg, rgba(28, 28, 28, 0.96), rgba(18, 18, 18, 0.96)),
        #0f0f0f;
    border-color: rgba(212, 175, 55, 0.40);
    box-shadow: 0 0 28px rgba(212, 175, 55, 0.10);
}

body.dark-mode .row {
    color: #e8e8e8;
    background: rgba(28, 28, 28, 0.88);
    border-color: rgba(212, 175, 55, 0.20);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
}

body.dark-mode .brand-actions,
body.dark-mode .filter-option,
body.dark-mode .search-type-toggle,
body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
body.dark-mode button.secondary,
body.dark-mode .result,
body.dark-mode .county-detail-list,
body.dark-mode .county-detail-item {
    color: #e8e8e8;
    background-color: rgba(28, 28, 28, 0.88);
    border-color: rgba(212, 175, 55, 0.22);
}

body.dark-mode .section-title,
body.dark-mode label,
body.dark-mode .mini-title {
    color: #e8e8e8;
}

body.dark-mode .hint {
    color: #a0a0a0;
}

body.dark-mode .section-title i,
body.dark-mode .county-location-jump i {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.12);
    border-color: rgba(212, 175, 55, 0.28);
}

body.dark-mode summary.section-title:hover,
body.dark-mode .filter-option:hover,
body.dark-mode .county-location-jump:hover {
    background: rgba(212, 175, 55, 0.10);
    border-color: rgba(212, 175, 55, 0.42);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

body.dark-mode .search-type-toggle input:checked + span,
body.dark-mode button.primary {
    color: #ffffff;
    background: linear-gradient(135deg, #d4af37, #a97b22);
    border-color: rgba(212, 175, 55, 0.44);
    box-shadow: 0 10px 22px rgba(212, 175, 55, 0.22);
}

body.dark-mode button.primary:hover {
    background: linear-gradient(135deg, #ddb040, #c49230);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.24), 0 12px 24px rgba(212, 175, 55, 0.20);
}

body.dark-mode .top-legend span,
body.dark-mode .county-count-strip span {
    color: #e8e8e8;
    background: rgba(212, 175, 55, 0.10);
    border-color: rgba(212, 175, 55, 0.22);
}

/* Typography — matches Portal (Raleway headings, Source Sans 3 body) */
body,
select,
input,
button {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.access-panel h1,
.side-brand h1,
.section-title,
.county-list-title,
.mini-title,
button,
.filter-option,
.search-type-toggle span {
    font-family: 'Raleway', 'Source Sans 3', sans-serif;
}

.access-panel h1,
.side-brand h1 {
    font-family: 'Raleway', sans-serif;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-brand h1 {
    font-size: 16px;
    letter-spacing: 0.05em;
}

.section-title {
    font-weight: 700;
}

label,
.eyebrow,
.legend-details > summary,
.county-detail-heading,
.cdp-section-label {
    font-family: 'Raleway', 'Source Sans 3', sans-serif;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.hint,
.result,
.county-detail-item,
.pinned-address-text,
.leaflet-popup-content {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#map {
    position: relative;
}

.panel-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    background: var(--panel);
}

.panel-footer-count {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.brand-top {
    align-items: flex-start;
}

.brand-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    margin-left: auto;
}

.version-badge {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #1a1710;
    background: rgba(255, 255, 255, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
}

body.dark-mode .version-badge {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.10);
    border-color: rgba(212, 175, 55, 0.28);
}

body.dark-mode .version-badge {
    background: rgba(212, 175, 55, 0.10);
    border-color: rgba(212, 175, 55, 0.22);
    color: rgba(212, 175, 55, 0.55);
}

.map-filter-checks {
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-filter-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255, 103, 31, 0.10);
    border: 1px solid rgba(255, 103, 31, 0.24);
    border-radius: 999px;
    color: rgba(255, 103, 31, 0.80);
    font-family: 'Source Sans 3', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.map-filter-check:hover {
    background: rgba(255, 103, 31, 0.18);
    border-color: rgba(255, 103, 31, 0.44);
}

.map-filter-check input[type="checkbox"] {
    width: 11px;
    height: 11px;
    margin: 0;
    accent-color: #FF671F;
    cursor: pointer;
}

body.dark-mode .map-filter-check {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.20);
    color: rgba(212, 175, 55, 0.65);
}

body.dark-mode .map-filter-check:hover {
    background: rgba(212, 175, 55, 0.14);
    border-color: rgba(212, 175, 55, 0.38);
}

/* ── Theme transition: ripple + particles (matches Portal effect) ── */
@keyframes themeRippleExpand {
    from { clip-path: circle(0% at var(--rx) var(--ry)); }
    to   { clip-path: circle(180% at var(--rx) var(--ry)); }
}

@keyframes themeParticleFly {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--px), var(--py)) scale(0); }
}

.theme-ripple {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    animation: themeRippleExpand 0.65s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.theme-particle {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    animation: themeParticleFly 0.6s ease-out forwards;
}

@media (max-width: 980px) {
    #wrap {
        flex-direction: column;
        height: auto;
    }

    body {
        overflow: auto;
    }

    #panel {
        width: 100%;
        min-width: 0;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--line);
        box-shadow: none;
    }

    #map {
        height: 62vh;
        min-height: 420px;
    }
}

@media (max-width: 560px) {
    .access-panel {
        padding: 28px 20px;
    }

    .access-panel h1 {
        font-size: clamp(16px, 5.1vw, 20px);
        letter-spacing: 0.12em;
    }

    .side-brand h1 {
        font-size: 16px;
    }

    #panel {
        padding: 12px;
    }

    .row {
        padding: 12px;
    }

    .button-row {
        grid-template-columns: 1fr;
    }

    .search-type-toggle {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .top-legend span {
        min-height: 28px;
        padding: 5px 8px;
        font-size: 11px;
    }
}

/* Dark mode: original black & gold palette */
body.dark-mode {
    --bg: #05070b;
    --panel: #0b0e14;
    --surface: #101622;
    --surface-2: #182031;
    --text: #eee7d8;
    --muted: #a4adba;
    --line: rgba(212, 175, 55, 0.24);
    --blue: #d4af37;
    --blue-dark: #a97b22;
    background:
        radial-gradient(circle at 50% 18%, rgba(212, 175, 55, 0.12), transparent 24%),
        linear-gradient(180deg, #000000 0%, #05070b 46%, #090b10 100%);
}

body.dark-mode #panel {
    background: #0b0e14;
    scrollbar-color: rgba(212, 175, 55, 0.4) transparent;
}

/* Login screen is always black & gold, regardless of theme */
.access-screen {
    background: radial-gradient(circle at 50% 31%, rgba(191, 151, 54, 0.14), transparent 18%), #05070b;
    color: #e7d7aa;
}

.access-panel h1 {
    font-family: 'Cinzel', Georgia, serif;
    letter-spacing: 0.14em;
}

.side-brand h1 {
    font-family: 'Cinzel', Georgia, serif;
}

/* Key-free dark basemap: invert the standard OSM tiles */
.dark-tiles {
    filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9) saturate(0.7);
}

/* Sidebar spacing and scrolling (cards inset from the panel edge) */
#panel {
    display: block;
    overflow-y: auto;
    padding: 14px 12px;
}

#panel > .row,
#panel > .side-brand {
    margin-bottom: 12px;
}

/* Dark mode surfaces: black/navy with gold borders, no grey */
body.dark-mode summary.section-title,
body.dark-mode .filter-option,
body.dark-mode .search-type-toggle,
body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
body.dark-mode button.secondary,
body.dark-mode .result,
body.dark-mode .brand-actions {
    background: rgba(16, 22, 34, 0.72) !important;
    background-color: rgba(16, 22, 34, 0.72) !important;
    border-color: rgba(212, 175, 55, 0.24);
    color: #eee7d8;
}

body.dark-mode summary.section-title:hover,
body.dark-mode .filter-option:hover {
    background: rgba(212, 175, 55, 0.10) !important;
}

body.dark-mode .row {
    background: rgba(24, 31, 45, 0.55);
}

/* ── Header actions polish (v2.6) ─────────────────────────── */
.icon-btn[hidden] {
    display: none;
}

.brand-side {
    gap: 8px;
}

.brand-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
}

.brand-actions .icon-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.brand-actions .icon-btn i {
    font-size: 15px;
}

.brand-actions .icon-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
}

.brand-actions .icon-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.brand-actions .icon-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

body.dark-mode .brand-actions .icon-btn:hover {
    background: rgba(217, 170, 50, 0.18);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

#adminToggle {
    position: relative;
    margin-right: 2px;
}

#adminToggle::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d0a337;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.version-badge {
    align-self: flex-end;
    padding: 2px 10px;
    font-size: 10px;
    letter-spacing: 0.06em;
}

/* Admin: new BWW stores tab */
.admin-badge {
    display: inline-block;
    min-width: 18px;
    margin-left: 6px;
    padding: 1px 6px;
    color: #05070b;
    background: var(--blue);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.admin-badge[hidden] { display: none; }

.admin-scan-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.admin-scan-coord {
    width: 46%;
    margin-right: 2%;
}

.admin-scan-status {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.admin-scan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-scan-actions button[hidden] { display: none; }
.admin-scan-actions button { width: auto; flex: 0 0 auto; }

/* Login button: lock -> unlock animation */
body.auth-locked .access-input-row button i {
    display: inline-block;
    transition: transform 0.15s ease;
}

@keyframes lockUnlockPop {
    0%   { transform: scale(1) rotate(0deg); }
    30%  { transform: scale(0.7) rotate(-10deg); }
    65%  { transform: scale(1.35) rotate(8deg); }
    100% { transform: scale(1) rotate(0deg); }
}

body.auth-locked .access-input-row button.is-unlocked {
    background: #2fae63;
    box-shadow: 0 0 0 4px rgba(47, 174, 99, 0.30), 0 0 18px rgba(47, 174, 99, 0.55);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

body.auth-locked .access-input-row button.is-unlocked i {
    animation: lockUnlockPop 0.45s ease;
}

@keyframes lockDeniedShake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-4px); }
    40%      { transform: translateX(4px); }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(3px); }
}

body.auth-locked .access-input-row button.is-denied {
    animation: lockDeniedShake 0.4s ease;
}

/* Map loading skeleton, shown briefly while location data loads after login */
.map-loading {
    position: absolute;
    inset: 0;
    z-index: 950;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #05070b;
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: opacity 0.3s ease;
}

.map-loading[hidden] {
    display: none;
}

.map-loading-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(255, 103, 31, 0.25);
    border-top-color: var(--blue);
    animation: mapLoadingSpin 0.8s linear infinite;
}

@keyframes mapLoadingSpin {
    to { transform: rotate(360deg); }
}

/* Toasts: transient confirmations for admin actions */
.toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 320px;
    padding: 12px 16px;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--blue);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    backdrop-filter: blur(18px);
    animation: toastIn 0.25s ease;
    pointer-events: auto;
}

.toast.is-leaving {
    animation: toastOut 0.25s ease forwards;
}

.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }

.toast i {
    flex: 0 0 auto;
    font-size: 15px;
}

.toast-success i { color: var(--green); }
.toast-error i { color: var(--red); }
.toast-info i { color: var(--blue); }

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

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(8px) scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
    .map-loading-spinner { animation-duration: 1.6s; }
    .toast, .toast.is-leaving { animation: none; }
}

/* Admin tables: search box and sortable headers */
.admin-table-filter {
    width: 100%;
    margin: 4px 0 10px;
}

.admin-users-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.admin-users-table th.sortable:hover {
    color: var(--blue);
}

.admin-users-table th.sortable i {
    margin-left: 4px;
    font-size: 11px;
    opacity: 0.5;
}

.admin-users-table th.sortable.is-active i {
    opacity: 1;
    color: var(--blue);
}

/* Marker hover tooltip */
.leaflet-tooltip.map-marker-tooltip {
    padding: 4px 10px;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.20);
    font-size: 12px;
    font-weight: 700;
}

.leaflet-tooltip.map-marker-tooltip::before {
    border-top-color: var(--line);
}

/* Marker clustering: recolor the plugin's default circles to match the app accent */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(255, 103, 31, 0.25);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    color: #ffffff;
    background-color: var(--blue);
    font-weight: 700;
}

body.dark-mode .marker-cluster-small,
body.dark-mode .marker-cluster-medium,
body.dark-mode .marker-cluster-large {
    background-color: rgba(212, 175, 55, 0.25);
}

body.dark-mode .marker-cluster-small div,
body.dark-mode .marker-cluster-medium div,
body.dark-mode .marker-cluster-large div {
    color: #05070b;
    background-color: var(--blue);
}

/* Territory Tools: drag-to-resize handle on the drawn radius circle */
.radius-drag-handle {
    display: block;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border: 3px solid var(--blue);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
    cursor: grab;
}

.leaflet-marker-draggable .radius-drag-handle:active,
.radius-drag-handle:active {
    cursor: grabbing;
}

/* Login screen: entrance animation, icons, password toggle, ambient embers */
.access-panel {
    position: relative;
    z-index: 1;
    animation: accessPanelIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pcg-logo {
    animation: accessLogoIn 0.6s ease-out 0.08s both;
}

.access-panel h1 {
    animation: accessFieldIn 0.45s ease-out 0.18s both;
}

.access-row-1 {
    animation: accessFieldIn 0.45s ease-out 0.26s both;
}

.access-row-2 {
    animation: accessFieldIn 0.45s ease-out 0.33s both;
}

.access-remember.access-row-3 {
    animation: accessFieldIn 0.4s ease-out 0.4s both;
}

@keyframes accessPanelIn {
    0%   { opacity: 0; transform: translateY(18px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes accessLogoIn {
    0%   { opacity: 0; transform: scale(0.7); filter: brightness(1.8); }
    60%  { opacity: 1; }
    100% { opacity: 1; transform: scale(1); filter: brightness(1); }
}

@keyframes accessFieldIn {
    0%   { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Input icons and password show/hide toggle */
.access-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.access-input-icon {
    position: absolute;
    left: 14px;
    color: rgba(212, 175, 55, 0.65);
    font-size: 13px;
    pointer-events: none;
}

body.auth-locked .access-input-row input {
    padding-left: 38px;
}

body.auth-locked .access-input-row #accessToken {
    padding-right: 36px;
}

/* Fully-qualified selector: overrides body.auth-locked .access-input-row button's
   gold/44px styling, since this toggle is also a <button> inside that same row. */
body.auth-locked .access-input-row button.access-toggle-password {
    position: absolute;
    right: 8px;
    min-height: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    color: rgba(212, 175, 55, 0.7);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s ease;
}

body.auth-locked .access-input-row button.access-toggle-password:hover {
    color: #d4af37;
    background: transparent;
}

.access-toggle-password:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 1px;
}

/* Clearer, more visible focus ring than the plain inset line */
body.auth-locked .access-input-row input:focus {
    border: 0;
    box-shadow: inset 0 0 0 1.5px rgba(212, 175, 55, 0.6), 0 0 0 3px rgba(212, 175, 55, 0.18);
}

/* Gentle press feedback on the login button (layers on top of the lock/unlock animation) */
body.auth-locked .access-input-row button[type="submit"] {
    transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.25s ease;
}

body.auth-locked .access-input-row button[type="submit"]:active {
    transform: scale(0.94);
}

/* Wrong password: one brief red pulse around the whole panel, in addition to the button shake */
@keyframes accessErrorPulse {
    0%   { box-shadow: inset 0 0 0 1px rgba(255, 232, 150, 0.28), 0 0 28px rgba(212, 175, 55, 0.24), 0 10px 25px rgba(0, 0, 0, 0.5); }
    30%  { box-shadow: inset 0 0 0 1.5px rgba(248, 113, 113, 0.85), 0 0 34px rgba(239, 68, 68, 0.45), 0 10px 25px rgba(0, 0, 0, 0.5); }
    100% { box-shadow: inset 0 0 0 1px rgba(255, 232, 150, 0.28), 0 0 28px rgba(212, 175, 55, 0.24), 0 10px 25px rgba(0, 0, 0, 0.5); }
}

.access-panel.access-error-pulse {
    animation: accessErrorPulse 0.6s ease;
}

/* Ambient embers: a handful of soft gold specks that drift in once and settle (not a looping effect) */
.access-embers {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.access-embers span {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #d4af37;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 8px 2px rgba(212, 175, 55, 0.65);
    animation: emberDrift 3.2s ease-out both;
}

.access-embers span:nth-child(1) { top: 22%; left: 18%; animation-delay: 0.1s; }
.access-embers span:nth-child(2) { top: 68%; left: 78%; animation-delay: 0.5s; }
.access-embers span:nth-child(3) { top: 78%; left: 28%; animation-delay: 0.9s; }
.access-embers span:nth-child(4) { top: 15%; left: 82%; animation-delay: 1.3s; }
.access-embers span:nth-child(5) { top: 46%; left: 8%; animation-delay: 1.7s; }

@keyframes emberDrift {
    0%   { opacity: 0; transform: translateY(26px); }
    35%  { opacity: 0.85; }
    100% { opacity: 0.22; transform: translateY(-40px); }
}

@media (prefers-reduced-motion: reduce) {
    .access-panel,
    .pcg-logo,
    .access-panel h1,
    .access-row-1,
    .access-row-2,
    .access-remember.access-row-3,
    .access-embers span {
        animation: none;
        opacity: 1;
        transform: none;
        filter: none;
    }
    .access-panel.access-error-pulse {
        animation: none;
    }
    body.auth-locked .access-input-row button[type="submit"]:active {
        transform: none;
    }
}

/* Richer marker info card (replaces the plain Leaflet popup text) */
.leaflet-popup.pcg-popup-wrap .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.28);
}

.leaflet-popup.pcg-popup-wrap .leaflet-popup-content {
    margin: 0;
    min-width: 220px;
}

.pcg-popup {
    padding: 12px 14px;
    font-family: 'Manrope', sans-serif;
}

.pcg-popup-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    font-size: 14px;
}

.pcg-popup-head i {
    color: var(--blue);
}

.pcg-popup-type {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pcg-popup-row {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text);
}

.pcg-popup-row i {
    margin-top: 2px;
    width: 12px;
    color: var(--muted);
    font-size: 11px;
}

.pcg-popup-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.pcg-popup-actions button {
    flex: 1 1 auto;
    padding: 6px 8px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.pcg-popup-actions button:hover {
    background: var(--blue);
    color: #ffffff;
}

.pcg-popup-actions button:active {
    transform: scale(0.96);
}

/* Presentation Mode: auto-tour controls */
.tour-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(21, 35, 58, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(28px);
}

body.presentation-mode .tour-controls {
    display: inline-flex;
}

.tour-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tour-controls button:hover {
    background: rgba(255, 255, 255, 0.24);
}

.tour-status {
    min-width: 44px;
    padding: 0 4px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

/* Map Sketch: active tool state and sketch pin marker */
#measureBtn.active,
#sketchPinBtn.active {
    color: #ffffff;
    background: var(--blue);
    border-color: var(--blue);
}

.map-sketch-pin {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    color: #ffffff;
    background: #7c3aed;
    border: 2px solid #ffffff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.45);
}

.map-sketch-pin i {
    transform: rotate(45deg);
    font-size: 11px;
}
