/* Light theme (default) */
:root,
[data-theme="light"] {
    --bg: #f6f6f9;
    --bg-elevated: #ffffff;
    --bg-card: #efeff4;
    --border: #dddde8;
    --text: #1a1a24;
    --text-muted: #6b6b7b;
    --accent: #b8943f;
    --accent-hover: #9a7a2f;
    --accent-dim: rgba(184, 148, 63, 0.12);
    --accent-on: #ffffff;
    --danger: #d64555;
    --header-bg: rgba(246, 246, 249, 0.92);
    --map-fallback-bg: rgba(246, 246, 249, 0.92);
    --shadow: 0 8px 32px rgba(26, 26, 36, 0.08);
    --input-bg: #ffffff;
    --marker-stroke: #ffffff;
}

/* Dark theme */
[data-theme="dark"] {
    --bg: #0d0d12;
    --bg-elevated: #16161f;
    --bg-card: #1c1c28;
    --border: #2a2a3a;
    --text: #f0f0f5;
    --text-muted: #9494a8;
    --accent: #c9a962;
    --accent-hover: #dbbe78;
    --accent-dim: rgba(201, 169, 98, 0.15);
    --accent-on: #0d0d12;
    --danger: #e85d6c;
    --header-bg: rgba(13, 13, 18, 0.92);
    --map-fallback-bg: rgba(13, 13, 18, 0.9);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --input-bg: #1c1c28;
    --marker-stroke: #0d0d12;
}

:root {
    --radius: 10px;
    --radius-sm: 6px;
    --font: 'Inter', system-ui, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --header-h: 56px;
    --touch-min: 44px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    padding: 0.75rem 1rem;
    background: var(--accent);
    color: var(--accent-on);
}
.skip-link:focus { left: 0; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background 0.2s, border-color 0.2s;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.logo:hover { color: var(--text); }

.logo-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), #8b7340);
    color: var(--accent-on);
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 1.2rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.site-nav { display: flex; gap: 0.15rem; align-items: center; }

.nav-link {
    padding: 0.5rem 0.75rem;
    min-height: var(--touch-min);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.is-active { color: var(--accent); background: var(--accent-dim); }
.nav-link.is-disabled { opacity: 0.4; pointer-events: none; cursor: default; }

.theme-toggle {
    width: var(--touch-min);
    height: var(--touch-min);
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; width: 18px; height: 18px; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.4rem;
    min-height: var(--touch-min);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, border-color 0.15s, color 0.15s;
    font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-on); }
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* Footer */
.site-footer {
    margin-top: auto;
    padding: 0.55rem 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.15rem 1rem;
}
.footer-inner p { margin: 0; }
.footer-note { margin: 0; }

/* WIP page */
.wip-hero {
    padding: 4rem 0 5rem;
    min-height: calc(100vh - var(--header-h) - 80px);
    display: flex;
    align-items: center;
}

.wip-content { max-width: 640px; }

.wip-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1.25rem;
}

.wip-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 2.75rem);
    line-height: 1.2;
    margin: 0 0 1rem;
    font-weight: 600;
}

.wip-lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0 0 2rem;
}

.wip-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.wip-feature {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.wip-feature strong { display: block; margin-bottom: 0.2rem; }
.wip-feature p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.wip-feature-icon { font-size: 1.5rem; line-height: 1; }

.wip-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }
.wip-note { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

/* WIP banner on map */
.wip-banner {
    padding: 0.6rem 1.25rem;
    background: var(--accent-dim);
    color: var(--accent);
    text-align: center;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.wip-banner span { font-weight: 700; }

/* Map page */
.page-map main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.map-page {
    display: grid;
    grid-template-columns: 360px 1fr;
    flex: 1;
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100dvh - var(--header-h));
    position: relative;
    overflow: hidden;
}

.map-page.is-sidebar-collapsed {
    grid-template-columns: 0 1fr;
}

.map-sidebar {
    position: relative;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: transform 0.28s ease, background 0.2s, border-color 0.2s;
    z-index: 20;
}

.map-sidebar.is-collapsed {
    transform: translateX(-100%);
}

.map-sidebar-toggle {
    display: none;
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translate(100%, -50%);
    z-index: 25;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 56px;
    padding: 0;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.06);
}
.map-sidebar-toggle:hover { color: var(--accent); }
.map-sidebar-toggle .icon-collapse {
    transition: transform 0.2s ease;
}
.map-sidebar.is-collapsed .map-sidebar-toggle .icon-collapse {
    transform: rotate(180deg);
}

.map-filters-reopen {
    display: none;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.75rem 0.65rem 0.5rem;
    min-height: var(--touch-min);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--bg-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.map-filters-reopen:hover { color: var(--accent); }
.map-filters-reopen:not([hidden]) { display: flex; }

.map-sidebar-header {
    position: relative;
}
.map-sidebar-header h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin: 0 0 0.35rem;
    padding-right: 2rem;
}
.map-sidebar-header p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

.map-panel-close {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: var(--touch-min);
    height: var(--touch-min);
    border: none;
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.map-panel-close:hover { color: var(--text); }

.map-panel-handle {
    display: none;
    justify-content: center;
    padding: 0.65rem 0 0.25rem;
    cursor: grab;
}
.map-panel-handle .handle-bar {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
}

.map-panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.45);
}
.map-panel-backdrop:not([hidden]) { display: block; }

.map-fab {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(1rem + var(--safe-bottom));
    transform: translateX(-50%);
    z-index: 10;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    min-height: var(--touch-min);
    border: none;
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    cursor: pointer;
}
.map-fab:active { transform: translateX(-50%) scale(0.97); }
.map-fab-count {
    background: var(--accent);
    color: var(--accent-on);
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.75rem;
    display: grid;
    place-items: center;
}
.map-fab-count:empty,
.map-fab-count[data-count="0"] { display: none; }

.map-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.map-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.breadcrumbs li:not(:last-child)::after { content: '/'; margin-left: 0.25rem; opacity: 0.5; }
.breadcrumbs a,
.breadcrumbs button.breadcrumb-link {
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}
.breadcrumbs a:hover,
.breadcrumbs button.breadcrumb-link:hover { color: var(--accent); }

.map-filters { display: flex; flex-direction: column; gap: 0.75rem; }

.field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field select,
.field input,
.field textarea {
    width: 100%;
    padding: 0.75rem 0.85rem;
    min-height: var(--touch-min);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s, background 0.2s;
}
.field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b6b7b'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}
.field select:disabled { opacity: 0.5; cursor: not-allowed; }
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.profile-list h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}
.profile-list .count {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
}

.profile-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    min-height: var(--touch-min);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
    font-size: inherit;
    text-decoration: none;
}
a.profile-card:hover,
a.profile-card:focus {
    color: var(--text);
}
.profile-card-age {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.profile-card:hover,
.profile-card.is-active {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.profile-card img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
}
.profile-card-info { display: flex; flex-direction: column; gap: 0.15rem; }
.profile-card-info strong { font-size: 0.95rem; }
.tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
}

.map-canvas-wrap {
    position: relative;
    min-height: 400px;
    height: 100%;
}

#map-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: var(--bg-card);
}

.map-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 2rem;
    background: var(--map-fallback-bg);
    z-index: 10;
}
.map-fallback code {
    background: var(--bg-card);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.map-loading {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    background: var(--map-fallback-bg);
    z-index: 5;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.map-loading.is-visible { display: grid; }

/* Error page */
.error-page {
    padding: 5rem 0;
    text-align: center;
}
.error-page h1 {
    font-family: var(--font-display);
    font-size: 5rem;
    margin: 0;
    color: var(--accent);
}
.error-page p { color: var(--text-muted); margin-bottom: 1.5rem; }
.error-page .btn { margin: 0 0.35rem; }

/* Auth modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 420px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s;
}
.modal-overlay.is-open .modal { transform: translateY(0) scale(1); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0;
}
.modal-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.35rem;
}
.modal-close {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: none;
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 1rem 1.25rem 0;
    border-bottom: 1px solid var(--border);
}
.modal-tab {
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
}
.modal-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.modal-tab:hover { color: var(--text); }

.modal-body { padding: 1.25rem; }

.auth-panel { display: none; }
.auth-panel.is-active { display: block; }

.auth-panel form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-panel .field { margin: 0; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0.25rem 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-switch {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0;
}
.auth-switch button {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}
.auth-switch button:hover { color: var(--accent-hover); }

.auth-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    text-align: center;
}

/* Info window (Google Maps) */
.gm-style .eskortia-infowin {
    padding: 0.25rem;
    min-width: 140px;
}
.gm-style .eskortia-infowin strong { display: block; font-size: 0.95rem; }
.gm-style .eskortia-infowin .tag { margin-top: 0.25rem; }

@media (max-width: 900px) {
    :root { --header-h: 52px; }

    .container { padding: 0 1rem; }

    .page-map .site-footer { display: none; }

    .page-map main {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .map-page {
        display: flex;
        flex-direction: column;
        position: relative;
        flex: 1;
        min-height: 0;
        height: auto;
    }

    .wip-banner {
        flex-shrink: 0;
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
        line-height: 1.3;
    }

    .map-canvas-wrap {
        flex: 1 1 auto;
        min-height: 0;
        order: 1;
        width: 100%;
    }

    .map-sidebar {
        order: 2;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 90;
        max-height: min(78dvh, 560px);
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
        transform: translateY(100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        overflow: hidden;
    }

    .map-sidebar.is-collapsed {
        transform: translateY(100%);
    }

    .map-sidebar.is-open {
        transform: translateY(0);
    }

    .map-sidebar-toggle { display: none !important; }
    .map-filters-reopen { display: none !important; }

    .map-fab { display: flex; }

    .map-page:has(.map-sidebar.is-open) .map-fab {
        display: none;
    }

    .map-panel-handle { display: flex; }

    .map-panel-close { display: grid; place-items: center; }

    .map-panel-inner {
        overflow-y: auto;
        max-height: calc(min(78dvh, 560px) - 2rem);
        padding: 0 1rem calc(1rem + var(--safe-bottom));
        -webkit-overflow-scrolling: touch;
    }

    .map-sidebar-header { padding-top: 0.25rem; }

    .map-filters-grid {
        grid-template-columns: 1fr;
    }

    .profile-cards {
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 0.65rem;
        padding-bottom: 0.35rem;
        scrollbar-width: none;
    }
    .profile-cards::-webkit-scrollbar { display: none; }

    .profile-cards li {
        flex: 0 0 auto;
        scroll-snap-align: start;
        width: min(78vw, 260px);
    }

    .profile-card {
        height: 100%;
    }

    .wip-hero {
        padding: 2rem 0 3rem;
        min-height: auto;
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        max-width: none;
        border-radius: 16px 16px 0 0;
        max-height: 92dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-body {
        padding-bottom: calc(1.25rem + var(--safe-bottom));
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 580px) {
    .logo-text { display: none; }

    .site-nav .nav-link {
        padding: 0.5rem 0.6rem;
        font-size: 0.82rem;
    }

    .header-actions .nav-link.hide-mobile { display: none; }

    .wip-actions { flex-direction: column; }
    .wip-actions .btn { width: 100%; }

    .wip-lead { font-size: 1rem; }

    .map-sidebar-header h1 { font-size: 1.25rem; }

    .error-page h1 { font-size: 3.5rem; }
    .error-page { padding: 3rem 0; }

    .field select,
    .field input,
    .field textarea {
        font-size: 16px;
    }

    .modal-tabs {
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .modal-tabs::-webkit-scrollbar { display: none; }
    .modal-tab { white-space: nowrap; flex-shrink: 0; }
}

@media (min-width: 901px) {
    .map-filters-grid {
        grid-template-columns: 1fr;
    }

    .map-sidebar-toggle {
        display: flex;
    }

    .map-panel-close {
        display: grid;
        place-items: center;
    }
}

/* Gallery */
.page-gallery .site-footer { margin-top: 0; }

.gallery-header {
    padding: 1.25rem 0 0.75rem;
}
.gallery-header h1 {
    font-family: var(--font-display);
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
}
.gallery-header p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0;
    width: 100%;
}
@media (min-width: 600px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (min-width: 1200px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

.gallery-card { margin: 0; }
.gallery-card-trigger {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    cursor: pointer;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--bg-card);
    font-family: inherit;
}
.gallery-card-trigger img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease, opacity 0.25s ease;
}
.gallery-card-media {
    position: absolute;
    inset: 0;
}
.gallery-card-media img,
.gallery-card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-card-video {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.gallery-card-poster { position: relative; z-index: 0; }
.gallery-card.is-playing .gallery-card-poster { opacity: 0; }
.gallery-video-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 3;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    pointer-events: none;
}
.gallery-card-trigger:hover img { transform: scale(1.04); }
.gallery-card.is-playing .gallery-card-trigger:hover img { transform: none; }

.gallery-card-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 2rem 0.65rem 0.65rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
    color: #fff;
    text-align: left;
}
.gallery-card-name {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
}
.gallery-card-meta {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.gallery-flag { font-size: 1rem; line-height: 1; }
.gallery-card-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-hover);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gallery-card-link:hover { color: #fff; }

/* Profile page */
.profile-page { padding-bottom: 2rem; }
.profile-hero {
    display: grid;
    grid-template-columns: minmax(200px, 360px) 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
    align-items: end;
}
.profile-hero-trigger {
    padding: 0;
    border: none;
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    aspect-ratio: 2 / 3;
}
.profile-hero-trigger img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.profile-hero-info h1 {
    font-family: var(--font-display);
    margin: 0 0 0.5rem;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}
.profile-meta {
    color: var(--text-muted);
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.profile-share {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 1rem 0 0;
}
.profile-body { padding: 0 1.25rem 2rem; max-width: 1000px; }
.profile-thumbs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    -webkit-overflow-scrolling: touch;
}
.profile-thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 108px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: none;
}
.profile-thumb:hover,
.profile-thumb:focus { border-color: var(--accent); }
.profile-thumb img { width: 100%; height: 100%; object-fit: cover; }
.profile-description h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}
.profile-description p { margin: 0; line-height: 1.7; }
.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0;
}
.slug-check-demo {
    margin-top: 2rem;
    padding: 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.slug-check-demo h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.slug-check-note { margin: 0 0 0.75rem; font-size: 0.85rem; color: var(--text-muted); }
.slug-check-row { display: flex; gap: 0.5rem; }
.slug-check-row input { flex: 1; }
.slug-check-result { margin: 0.5rem 0 0; font-size: 0.9rem; }
.slug-check-result.is-available { color: #2d8a4e; }
.slug-check-result.is-taken { color: var(--danger); }

/* Photo lightbox */
.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.photo-lightbox.is-open { opacity: 1; visibility: visible; }
.photo-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}
.photo-lightbox-close {
    position: absolute;
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    right: 0.75rem;
    z-index: 2;
    width: var(--touch-min);
    height: var(--touch-min);
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}
.photo-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: var(--touch-min);
    height: var(--touch-min);
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.photo-lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.photo-lightbox-prev { left: 0.75rem; }
.photo-lightbox-next { right: 0.75rem; }
.photo-lightbox-stage {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 720px);
    max-height: 85dvh;
    text-align: center;
}
.photo-lightbox-stage img {
    max-width: 100%;
    max-height: 78dvh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
}
.photo-lightbox-caption {
    color: #fff;
    margin: 0.75rem 0 0.25rem;
    font-weight: 600;
}
.photo-lightbox-counter {
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    font-size: 0.85rem;
}

@media (max-width: 700px) {
    .profile-hero {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    .profile-hero-trigger { max-width: 280px; margin: 0 auto; }
    .profile-hero-info { text-align: center; }
    .profile-meta { justify-content: center; }
    .slug-check-row { flex-direction: column; }
}

/* Auth account type */
.account-type-grid {
    display: grid;
    gap: 0.5rem;
}
.account-type-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
}
.account-type-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.account-type-option input { margin-top: 0.2rem; }
.account-type-option strong { display: block; font-size: 0.9rem; }
.account-type-option small { color: var(--text-muted); font-size: 0.78rem; }
.field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-feedback.is-error { color: var(--danger) !important; }

/* Admin panel */
.page-admin-login {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    background: var(--bg);
}
.admin-login-wrap {
    width: min(100%, 400px);
    padding: 1.5rem;
}
.admin-login-brand,
.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 1.25rem;
}
.admin-login-brand:hover,
.admin-brand:hover { color: var(--text); }
.admin-login-lead {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 1rem;
}
.admin-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.admin-card h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.admin-card p { margin: 0 0 1rem; color: var(--text-muted); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.admin-notice { border-color: var(--accent); background: var(--accent-dim); }

.admin-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100dvh;
}
.admin-sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.admin-user-chip {
    margin: 0;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.admin-user-chip strong { display: block; margin-bottom: 0.35rem; }
.admin-nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.admin-nav-link {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}
.admin-nav-link:hover,
.admin-nav-link.is-active { color: var(--text); background: var(--bg-card); }
.admin-nav-link.is-active { color: var(--accent); }
.admin-sidebar-foot {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}
.admin-logout-btn { color: var(--danger); }
.admin-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
}
.admin-menu-toggle {
    display: none;
    width: var(--touch-min);
    height: var(--touch-min);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
}
.admin-page-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.admin-content {
    padding: 1.25rem;
    flex: 1;
}
.admin-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.45);
}
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.admin-stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.admin-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}
.admin-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-toolbar { margin-bottom: 0.75rem; }
.admin-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.admin-filter {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
    text-decoration: none;
}
.admin-filter.is-active,
.admin-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}
.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.admin-table th,
.admin-table td {
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.admin-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.role-badge,
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.role-admin { background: rgba(214, 69, 85, 0.15); color: var(--danger); }
.role-merchant { background: var(--accent-dim); color: var(--accent); }
.role-client { background: var(--bg-card); color: var(--text-muted); }
.status-badge.is-active { background: rgba(46, 160, 87, 0.15); color: #2ea057; }
.status-badge.is-pending { background: rgba(201, 169, 98, 0.15); color: var(--accent); }
.admin-role-select {
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
}
.admin-dl {
    margin: 0;
    display: grid;
    gap: 0.85rem;
}
.admin-dl dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}
.admin-dl dd { margin: 0; font-weight: 500; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(280px, 88vw);
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: var(--shadow);
    }
    .admin-shell.is-menu-open .admin-sidebar { transform: translateX(0); }
    .admin-shell.is-menu-open .admin-backdrop { display: block; }
    .admin-menu-toggle { display: grid; place-items: center; }
    .admin-content { padding: 1rem; }
    .admin-table { font-size: 0.82rem; }
}

.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0.5rem 1rem;
    background: var(--accent-dim);
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    position: sticky;
    top: 0;
    z-index: 110;
}
.impersonation-banner strong { color: var(--text); }
.admin-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.admin-row-actions a { font-size: 0.82rem; white-space: nowrap; }
.admin-enter-as { margin-left: 0.15rem; }
.admin-video-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}
.admin-video-preview {
    margin-bottom: 1rem;
    max-width: 320px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.admin-video-preview video {
    width: 100%;
    display: block;
    background: #000;
}
.admin-video-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.admin-video-preview-grid figure {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
}
.admin-video-preview-grid img,
.admin-video-preview-grid video {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    background: #000;
}
.admin-video-preview-grid figcaption {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}
.admin-video-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.field-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.auth-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0.5rem 0 0.75rem;
}
