/*
 * Giggly - Event Discovery App
 *
 * Structure:
 * 1. Reset & Base Styles
 * 2. Theme Variables
 * 3. Landing Page
 * 4. App Layout (Header, Tabs, Events)
 * 5. Search Overlay
 * 6. Bottom Navigation
 * 7. Modals
 * 8. Responsive
 */

/* ==========================================================================
   1. Reset & Base Styles
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* iOS Safari fixes */
body {
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* Fix iOS input zoom */
input,
select,
textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
}

/* Fix iOS button appearance */
button,
input[type="submit"],
input[type="button"] {
    -webkit-appearance: none;
    appearance: none;
}

/* Fix iOS sticky hover states */
@media (hover: none) {
    .filter-button:hover,
    .star-button:hover,
    .ticket-button:hover {
        transform: none;
    }
}

/* ==========================================================================
   2. Theme Variables
   ========================================================================== */

:root {
    --bg: #ffffff;
    --bg-gradient-start: #f8f9fa;
    --bg-gradient-end: #e9ecef;
    --text: #212529;
    --text-secondary: #6c757d;
    --accent-pink: #EC4899;
    --accent-purple: #8B5CF6;
    --accent-blue: #6B9FFF;
    --border: #dee2e6;
    --tag-bg: rgba(107, 159, 255, 0.1);
    --tag-border: rgba(107, 159, 255, 0.3);
    --footer-text: #adb5bd;
}

[data-theme="dark"] {
    --bg: #1a0f2e;
    --bg-gradient-start: #1a0f2e;
    --bg-gradient-end: #2a1f3d;
    --text: #E8E4ED;
    --text-secondary: #B8B0C4;
    --border: #3d2f52;
    --tag-bg: rgba(107, 159, 255, 0.1);
    --tag-border: rgba(107, 159, 255, 0.3);
    --footer-text: #3d2f52;
}

/*
 * PWA / home-screen: fill the webview. body.app-mode must NOT be position:fixed — on iOS
 * WebKit, nested position:fixed (.bottom-bar, .controls-bar) then anchor to that box instead
 * of the viewport, leaving a white band under Bar D.
 */
html.giggly-app-active {
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    min-height: 100lvh;
    overflow-x: hidden;
}

@supports (-webkit-touch-callout: none) {
    html.giggly-app-active {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

body.modal-open,
body.app-mode.modal-open {
    overflow: hidden !important;
}

/*
 * The calendar list scrolls inside #eventsContainer, not on body. Locking body overflow alone
 * leaves that region scrollable, so pans/wheel chain to the events behind modals. This showed
 * up most clearly with the legacy edit modal: the list behind appeared to scroll instead of
 * the dialog. Same rule helps add/view/edit/settings while any modal is open.
 */
body.modal-open #eventsContainer {
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
}

/*
 * Search-keyboard mode pins header/tabs/controls at z-index ~2147482xxx. Active modals must sit
 * above that layer so the overlay receives taps and in-modal scrolling.
 */
body.modal-open .modal.active {
    z-index: 2147483000;
}

/* Flyer picker stacks above add/edit sheet */
body.modal-open .event-flyer-pick-modal-root.active {
    z-index: 2147483100;
}

/* Phase 2 (touch only): search field focused, keyboard up — Bar C above keyboard, Bar D hidden */
@media (hover: none) {
    body.search-bar-keyboard-mode .bottom-bar {
        display: none !important;
    }

    /*
     * Pin Bars A/B to the viewport while the keyboard is up. Otherwise iOS can pan the layout
     * viewport when the list scrolls, so flex chrome slides with the events layer.
     * --search-kb-header-h / --search-kb-tabs-h are set in JS when mode activates.
     */
    body.search-bar-keyboard-mode .app-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        max-width: 840px;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
        z-index: 2147482600;
    }

    body.search-bar-keyboard-mode .filter-tabs {
        position: fixed;
        top: calc(var(--search-kb-header-h, 72px) + 4px);
        left: 0;
        right: 0;
        max-width: 840px;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
        margin-top: 0;
        z-index: 2147482500;
    }

    body.search-bar-keyboard-mode #eventsApp {
        overscroll-behavior: none;
    }

    /* Extra top inset replaces in-flow chrome; bottom room for Bar C + keyboard */
    body.search-bar-keyboard-mode .events-container {
        padding-top: calc(20px + var(--search-kb-header-h, 0px) + 4px + var(--search-kb-tabs-h, 0px));
        /*
         * Short lists need a tall scrollable tail so max scrollTop clears Bar C (~60px) + margin.
         * Fixed 280px was too little when clientHeight is large vs one short card.
         */
        padding-bottom: calc(max(340px, 128px + 42dvh) + env(safe-area-inset-bottom));
        scroll-padding-bottom: 88px;
        overscroll-behavior: contain;
    }

    /*
     * iOS: a pan starting on Bar C (filter / search) can chain to the layout viewport and
     * drag the fixed bar with the "background". Lock browser pan/zoom from this layer only;
     * touches on #eventsContainer still scroll the list.
     */
    body.search-bar-keyboard-mode .controls-bar,
    body.search-bar-keyboard-mode .controls-bar * {
        touch-action: none;
    }

    /* Pin Bar C from the bottom: top-based --bar-c-kb-top collapsed to ~0 in standalone PWA + keyboard */
    body.search-bar-keyboard-mode .controls-bar {
        top: auto !important;
        bottom: var(--bar-c-kb-bottom, 0px) !important;
        z-index: 2147482000;
        isolation: isolate;
        overscroll-behavior: none;
    }

    body.app-mode.search-bar-keyboard-mode {
        overscroll-behavior-y: none;
    }
}

/* ==========================================================================
   3. Landing Page
   ========================================================================== */

.container {
    text-align: center;
    max-width: 500px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    width: 180px;
    height: 180px;
    margin: 0 auto 40px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

h1 {
    font-size: 72px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 50%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

p {
    font-size: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 40px;
}

.tags {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    color: var(--accent-blue);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.beta-badge {
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text);
    padding: 0;
    margin-left: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    vertical-align: middle;
}

.theme-toggle:hover {
    transform: scale(1.2);
}

.theme-toggle:active {
    transform: scale(0.9);
}

.auth-box {
    width: 100%;
    max-width: 320px;
    margin: 0 auto 30px;
    padding: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: border-color 0.2s ease;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.auth-input::placeholder {
    color: var(--text-secondary);
}

.auth-button {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.auth-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.auth-button:active:not(:disabled) {
    transform: translateY(0);
}

.auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-button-secondary {
    width: 100%;
    padding: 12px 16px;
    margin-top: 8px;
    font-size: 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.status-message {
    display: none;
    padding: 12px;
    margin-top: 12px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.status-message.success {
    background: rgba(107, 159, 255, 0.1);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.status-message.error {
    background: rgba(236, 72, 153, 0.1);
    border: 1px solid var(--accent-pink);
    color: var(--accent-pink);
}

.footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--footer-text);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

body.app-mode .footer {
    display: none;
}

.back-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 14px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text);
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.auth-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   4. App Layout (Header, Tabs, Events)
   ========================================================================== */

.app-container {
    width: 100%;
    max-width: 100%;
    position: relative;
    z-index: 0;
    isolation: isolate;
}

body.app-mode {
    position: relative;
    width: 100%;
    max-width: 100vw;
    /*
     * Definite height for flex + list scroll. Do NOT max-height with dvh/fill-available on iOS
     * standalone — it often caps the layout shorter than the physical display, so position:fixed
     * bottom:0 leaves a large white band under Bars C/D (~15–20% of the screen).
     * 100lvh tracks the largest viewport height; min-* still guarantees at least fill-available.
     */
    height: 100vh;
    height: 100dvh;
    height: 100lvh;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100lvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    background: var(--bg);
    overflow: hidden;
    box-sizing: border-box;
}

@supports (-webkit-touch-callout: none) {
    body.app-mode {
        min-height: -webkit-fill-available;
    }
}

/*
 * Fill body: list scrolls in #eventsContainer. Avoid overflow:hidden on #eventsApp — on iOS,
 * fixed Bars C/D inside that ancestor pin to the wrong box and sit above the real bottom.
 * body.app-mode keeps overflow:hidden; horizontal spill is clipped by children / max-width.
 */
body.app-mode #eventsApp {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
    width: 100%;
    max-width: 100%;
}

.app-header {
    background: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 12px 20px;
    padding-top: calc(8px + env(safe-area-inset-top));
    max-width: 840px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 110;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    display: none;
}

.app-header h1 {
    font-size: 24px;
    margin: 0;
    line-height: 1.2;
}

/* Filter tabs — flex below Bar A; list scrolls in #eventsContainer */
.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 0 20px 8px 20px;
    max-width: 840px;
    margin: 0 auto;
    margin-top: 4px; /* gap between Bar A and Bar B */
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: none;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 105;
}

:root[data-theme="dark"] .filter-tabs {
    background: rgba(26, 15, 46, 0.72);
}

.filter-tab {
    flex: 1;
    padding: 10px 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.filter-tab.active {
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    color: white;
    border-color: transparent;
}

.tab-count {
    font-size: 13px;
    opacity: 0.75;
    font-weight: 400;
}

.filter-tab:hover:not(.active) {
    border-color: var(--accent-blue);
    color: var(--text);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.icon-button {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    color: var(--text);
    text-decoration: none;
    transition: transform 0.2s ease;
}

.icon-button:hover {
    transform: scale(1.1);
}

/* Profile avatar */
.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%);
    background-color: #8B5CF6;
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

.profile-avatar:hover {
    transform: scale(1.05);
}

.profile-avatar:active {
    transform: scale(0.95);
}

/* Old filter/search bars - removed, using tabs + expandable search now */

/* ==========================================================================
   5. Bottom Bars and Controls
   ========================================================================== */

/* Controls bar - search and filter buttons */
.controls-bar {
    position: fixed;
    top: auto;
    bottom: calc(70px + max(env(safe-area-inset-bottom, 0px), 8px));
    left: 0;
    right: 0;
    height: 60px;
    background: transparent;
    border-top: none;
    display: none; /* Hidden by default, shown after app loads */
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 12px;
    --controls-pad: 20px;
    --controls-gap: 12px;
    --controls-btn: 48px;
    z-index: 1000;
    max-width: 840px;
    margin: 0 auto;
}

.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
    border-color: var(--accent-purple);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Hide search button when search is active — remove from layout/stack so taps don't pass
   through to the page below (iOS would fire document click and collapse search). */
#navSearch.hidden {
    display: none;
}

/* Search container - slides out from search button (iOS style with frosted glass) */
.search-container {
    position: absolute;
    left: calc(var(--controls-pad) + var(--controls-btn) + var(--controls-gap));
    right: calc(var(--controls-pad) + var(--controls-btn) + var(--controls-gap));
    width: auto; /* filled by left/right */
    height: 48px; /* Match filter button height */
    overflow: hidden;
    display: flex;
    align-items: center;
    flex-direction: row; /* Icon left, input middle, close right */
    gap: 8px;
    background: rgba(255, 255, 255, 0.95); /* Higher opacity for more contrast */
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 24px; /* Pill shape - half of height (48px / 2) */
    border: 1px solid rgba(0, 0, 0, 0.08); /* More visible border */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Stronger drop shadow */
    transform: scaleX(0);
    transform-origin: right center;
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.18s ease, padding 0.28s ease, box-shadow 0.28s ease;
    pointer-events: none;
}

:root[data-theme="dark"] .search-container {
    background: rgba(26, 15, 46, 0.85); /* Higher opacity for dark mode */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); /* Stronger dark mode shadow */
}

.search-container.active {
    /* When active, expand to cover where the search button was */
    right: var(--controls-pad);
    padding: 0 10px;
    pointer-events: auto;
    z-index: 2;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); /* Slightly stronger when active */
    transform: scaleX(1);
    opacity: 1;
}

:root[data-theme="dark"] .search-container.active {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.search-input-slide {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 17px;
    font-weight: 400;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

.search-input-slide::selection {
    background: rgba(139, 92, 246, 0.25);
}

.search-input-slide::-webkit-selection {
    background: rgba(139, 92, 246, 0.25);
}

.search-input-slide::-moz-selection {
    background: rgba(139, 92, 246, 0.25);
}

.search-input-slide {
    caret-color: var(--accent-purple);
}

.search-input-slide::placeholder {
    color: rgba(60, 60, 67, 0.6); /* iOS placeholder grey */
}

:root[data-theme="dark"] .search-input-slide::placeholder {
    color: rgba(235, 235, 245, 0.6); /* iOS dark placeholder */
}

.close-search-btn {
    background: rgba(120, 120, 128, 0.16); /* iOS circle background */
    border: none;
    outline: none;
    color: rgba(60, 60, 67, 0.6);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto; /* keep ✕ pinned to the right edge */
    flex-shrink: 0;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.close-search-btn svg {
    display: block;
}

:root[data-theme="dark"] .close-search-btn {
    background: rgba(118, 118, 128, 0.24);
    color: rgba(235, 235, 245, 0.6);
}

.close-search-btn:active {
    transform: scale(0.9);
    background: rgba(120, 120, 128, 0.24);
}

/* Bottom bar with Add button */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    /* Paint into home-indicator zone; min 8px below FAB when env() is 0 (less dead space than 20px). */
    min-height: calc(70px + max(env(safe-area-inset-bottom, 0px), 8px));
    height: calc(70px + max(env(safe-area-inset-bottom, 0px), 8px));
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
    background: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: none; /* Hidden by default, shown after app loads */
    align-items: center;
    justify-content: center;
    z-index: 999;
}

:root[data-theme="dark"] .bottom-bar {
    background: rgba(26, 15, 46, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.add-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.add-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}

.add-btn:active {
    transform: scale(0.95);
}

/* OLD STYLES - IGNORE */
.floating-control-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: fixed;
    bottom: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
}

.floating-control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-purple);
}

.floating-control-btn:active {
    transform: scale(0.95);
}

#filterSortBtn {
    left: 20px;
    pointer-events: auto; /* Make button clickable */
}

#navSearch {
    right: 20px;
    pointer-events: auto; /* Make button clickable */
}

/* Centred FAB Add button - coloured gradient */
.fab-add-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
    position: fixed;
    bottom: 52px;
    bottom: calc(52px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto; /* Make button clickable */
}

.fab-add-btn:hover {
    transform: translateX(-50%) scale(1.08);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}

.fab-add-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* Floating panels - appear above controls bar */
.floating-panel {
    display: none;
    position: fixed;
    bottom: 128px;
    bottom: calc(128px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    padding: 16px;
    min-width: 200px;
    border: 1px solid var(--border);
}

:root[data-theme="dark"] .floating-panel {
    background: rgba(26, 15, 46, 0.95);
}

.floating-panel.active {
    display: block;
    animation: slideIn 0.3s ease;
}

/*
 * Filter panel: align with centered 840px controls rail — inner left to inner right (same
 * right edge as the search button). max() keeps correct insets when the bar is full-width vs centered.
 */
#filterSortPanel.filter-sort-panel {
    left: max(20px, calc(50% - 400px));
    right: max(20px, calc(50% - 400px));
    min-width: 0;
    width: auto;
    max-width: none;
}

/* Ticket swap: anchored under the card icon (top/left/width set in JS). */
#ticketSwapPanel.floating-panel.ticket-swap-panel {
    left: auto;
    right: auto;
    bottom: auto;
    top: 120px;
    width: calc(100vw - 24px);
    max-width: none;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    max-height: min(72vh, calc(100dvh - 80px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 1002;
    will-change: transform;
}

/* Filter / sort sheet — header matches add-event modal; sort uses field label + native select */
.filter-sort-panel.floating-panel {
    padding: 0;
    overflow: hidden;
    bottom: 134px;
    bottom: calc(134px + env(safe-area-inset-bottom));
}

.filter-sort-panel .filter-sort-panel__header.add-event-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px 8px 20px;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

:root[data-theme='dark'] .filter-sort-panel .filter-sort-panel__header.add-event-modal__header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.filter-sort-panel .add-event-modal__head-text {
    flex: 1;
    min-width: 0;
    padding-top: 0;
}

.filter-sort-panel .filter-sort-panel__title.add-event-modal__title {
    font-size: 22px;
    margin: 0;
    line-height: 1.2;
}

.filter-sort-panel .filter-sort-panel__close.add-event-modal__close {
    flex-shrink: 0;
    align-self: center;
    margin: 0;
    margin-right: 0;
}

.filter-sort-panel__body {
    padding: 10px 20px 14px;
}

.ticket-swap-panel__copy {
    margin: 0 0 14px;
}

.ticket-swap-panel__copy p {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.ticket-swap-panel__copy p:last-child {
    margin-bottom: 0;
}

.ticket-swap-panel__sell {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 16px;
}

.ticket-swap-panel__sellers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket-swap-seller-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid var(--border);
    box-sizing: border-box;
}

:root[data-theme='dark'] .ticket-swap-seller-row {
    background: rgba(255, 255, 255, 0.06);
}

.ticket-swap-seller-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    background-color: #8b5cf6;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.ticket-swap-seller-matrix {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) auto minmax(72px, auto);
    gap: 8px 14px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.ticket-swap-name-cell {
    grid-column: 1;
    justify-self: start;
    align-self: start;
    min-width: 0;
}

.ticket-swap-name-cell .ticket-swap-seller-name {
    white-space: normal;
    word-break: break-word;
}

.ticket-swap-matrix-num {
    grid-column: 2;
    text-align: right;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.ticket-swap-matrix-state {
    grid-column: 3;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: capitalize;
    white-space: nowrap;
}

button.ticket-swap-matrix-buy {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    color: var(--accent-blue);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    -webkit-tap-highlight-color: transparent;
}

.ticket-swap-seller-name {
    display: block;
    width: 100%;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

button.ticket-swap-seller-name--edit {
    appearance: none;
    -webkit-appearance: none;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: var(--accent-purple);
    text-underline-offset: 3px;
    white-space: normal;
    word-break: break-word;
    -webkit-tap-highlight-color: transparent;
}

button.ticket-swap-seller-name--action {
    appearance: none;
    -webkit-appearance: none;
    padding: 0;
    margin: 0 0 6px;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--accent-blue);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    -webkit-tap-highlight-color: transparent;
}

button.ticket-swap-seller-name--action:disabled {
    color: var(--text-secondary);
    cursor: default;
    text-decoration: none;
}

.ticket-swap-buy-select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    margin-bottom: 16px;
    cursor: pointer;
}

.ticket-swap-buy-actions {
    display: flex;
    justify-content: stretch;
}

.ticket-swap-buy-actions .auth-button {
    width: 100%;
}

.ticket-swap-buy-step2 {
    padding-top: 4px;
}

.ticket-swap-buy-success {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
}

.ticket-swap-seller-qty {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--accent-blue);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
}

.ticket-swap-seller-qty:hover {
    border-color: var(--accent-purple);
}

.ticket-swap-seller-qty:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

span.ticket-swap-seller-qty--readonly {
    border: 1px solid var(--border);
    cursor: default;
    color: var(--text);
    font-weight: 600;
}

/* Quantity sheet (nested over feed) */
.ticket-swap-qty-root {
    position: fixed;
    inset: 0;
    z-index: 1105;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

@media (min-width: 841px) {
    .ticket-swap-qty-root {
        left: 50% !important;
        right: 50% !important;
        transform: translateX(-50%);
        max-width: 840px;
    }
}

.ticket-swap-qty-root.is-open {
    display: flex;
}

.ticket-swap-qty-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    -webkit-tap-highlight-color: transparent;
}

.ticket-swap-qty-sheet__card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 320px;
    border-radius: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    padding: 16px 18px 18px;
    box-sizing: border-box;
}

.ticket-swap-qty-sheet__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.ticket-swap-qty-sheet__close:hover {
    color: var(--text);
    background: rgba(15, 23, 42, 0.06);
}

:root[data-theme='dark'] .ticket-swap-qty-sheet__close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ticket-swap-qty-sheet__title {
    margin: 0 40px 14px 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.ticket-swap-qty-sheet__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ticket-swap-qty-sheet__input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    margin-bottom: 18px;
}

.ticket-swap-qty-sheet__input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.ticket-swap-qty-wheel-clip {
    position: relative;
    height: 168px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    margin-bottom: 16px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Fixed band behind the centred row so the selected value reads clearly in light and dark. */
.ticket-swap-qty-wheel-clip::before {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    top: 50%;
    height: 48px;
    margin-top: -24px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.11);
    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.14),
        0 1px 2px rgba(15, 23, 42, 0.06);
    pointer-events: none;
    z-index: 0;
}

:root[data-theme='dark'] .ticket-swap-qty-wheel-clip::before {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.ticket-swap-qty-wheel {
    position: relative;
    z-index: 1;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    outline: none;
}

.ticket-swap-qty-wheel:focus-visible {
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.ticket-swap-qty-wheel-pad {
    scroll-snap-align: none;
    pointer-events: none;
}

.ticket-swap-qty-wheel-item {
    height: 48px;
    line-height: 48px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    scroll-snap-align: center;
    flex-shrink: 0;
}

.ticket-swap-qty-sheet__footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.ticket-swap-qty-sheet__confirm {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 0;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 55%, var(--accent-blue) 100%);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
    -webkit-tap-highlight-color: transparent;
}

.ticket-swap-qty-sheet__confirm:active {
    transform: scale(0.96);
}

.filter-sort-panel__sort-label {
    display: block;
    margin-bottom: 8px;
}

.filter-sort-panel__sort-label .add-event-label__main {
    color: var(--text);
}

.filter-sort-panel__select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.3;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

:root[data-theme='dark'] .filter-sort-panel__select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.filter-sort-panel__select:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.filter-sort-panel__category-block {
    margin-top: 16px;
}

.filter-sort-panel__category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-sort-panel__category-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition:
        opacity 0.15s ease,
        transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.filter-sort-panel__category-pill:active {
    transform: scale(0.97);
}

.filter-sort-panel__category-pill.is-dimmed {
    opacity: 0.5;
}

.filter-sort-panel__category-pill:not(.is-dimmed) {
    opacity: 1;
}

.filter-sort-panel__category-pill--all {
    background: var(--bg);
    color: var(--text);
}

.control-btn.is-filter-sort-active {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.control-btn.is-filter-sort-active svg {
    color: var(--accent-blue);
}

.control-btn.is-filter-sort-active svg line {
    stroke: var(--accent-blue);
}

#searchBarExpandable {
    left: 20px;
    right: 20px;
    border-radius: 12px;
}

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

.floating-panel-content {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.close-panel-btn {
    background: none;
    border: none;
    outline: none;
    color: var(--text-secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 8px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.close-panel-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

:root[data-theme="dark"] .close-panel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-size: 17px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.panel-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.panel-option:hover {
    background: rgba(139, 92, 246, 0.1);
}

.panel-option svg {
    flex-shrink: 0;
}

/* ==========================================================================
   6. Bottom Navigation
   ========================================================================== */

/* Bottom bar - visual element beneath FAB */
.bottom-bar-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    height: calc(70px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.04);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 999;
    pointer-events: none;
}

/* Dark mode frosted glass */
:root[data-theme="dark"] .app-header {
    background: rgba(26, 15, 46, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .bottom-bar-container {
    background: rgba(26, 15, 46, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Constrain bars to content width on desktop */
@media (min-width: 880px) {
    .controls-bar,
    .bottom-bar {
        left: calc(50% - 420px);
        right: calc(50% - 420px);
        width: 840px;
    }

    #searchBarExpandable {
        left: calc(50% - 400px);
        right: calc(50% - 400px);
    }
}

/* Sort menu dropdown */
.filter-menu {
    position: fixed;
    bottom: 153px;
    bottom: calc(153px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    padding: 8px;
    min-width: 200px;
    z-index: 1000;
}

.filter-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.filter-menu-item:hover {
    background: var(--border);
}

.filter-menu-item.active {
    color: var(--accent-purple);
    font-weight: 600;
}

.filter-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.events-container {
    position: relative;
    z-index: 1;
    flex: 1 1 0%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
    padding: 20px 20px 138px;
    padding-bottom: calc(138px + env(safe-area-inset-bottom));
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    overflow-anchor: none; /* Reduce scroll jumps when search hides cards (iOS / Chromium) */
}

.event-card {
    background: #f5f7fa;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

:root[data-theme="dark"] .event-card {
    background: rgba(255, 255, 255, 0.05);
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* —— V2 event cards (modal v2 stored description) —— */
.event-card.event-card--v2 {
    position: relative;
    overflow: visible;
    background: #f5f7fa;
    border-radius: 16px;
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
    border: 1px solid #c5cad3;
}

:root[data-theme="dark"] .event-card.event-card--v2 {
    border-color: #5c4a78;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

/* Flyer above details: no outer padding, no seam; same subtle border as flyer-less v2 cards */
.event-card.event-card--v2:has(.event-card-v2__flyer) {
    padding: 0;
    overflow: hidden;
}

.event-card.event-card--v2:has(.event-card-v2__flyer) .event-card-v2__details {
    padding: 16px;
}

/* Feed list cards only (/ index). View event page uses .view-event-page__flyer-hero. */
.event-card-v2__flyer {
    width: 100%;
    margin: 0;
    padding: 0;
    line-height: 0;
    background: rgba(15, 23, 42, 0.06);
}

:root[data-theme="dark"] .event-card-v2__flyer {
    background: rgba(0, 0, 0, 0.25);
}

/* Legacy list flyers (base64): reserve height while /api/events/:id hydrates to limit layout jump */
.event-card-v2__flyer[data-flyer-pending='1'] {
    min-height: min(56vw, 280px);
}

/* Full card width; height follows aspect ratio (entire image visible, no letterboxing). */
.event-card-v2__flyer-img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: unset;
    object-position: center top;
    display: block;
}

.event-card-v2__flyer-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-blue);
    line-height: 1.35;
    text-align: center;
    box-sizing: border-box;
}

.event-card-v2__flyer-pdf:hover {
    text-decoration: underline;
}

/* Top row: set times (optional) + star count + star — flush right */
.event-card-v2__header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 10px;
    margin: -4px 0 10px 0;
    min-height: 32px;
}

.event-card-v2__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 0;
}

.event-card-v2__footer-pills .event-card-v2__pills {
    margin-bottom: 0;
}

.event-card-v2__pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 32px;
    height: 32px;
    padding: 0 16px;
    border-radius: 999px;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.2;
}

.event-card-v2__pill--type {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    opacity: 0.5;
}

:root[data-theme="dark"] .event-card-v2__pill--type {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.event-card-v2__pill--category {
    opacity: 0.5;
}

/* Match legacy event cards (.event-title / .event-artists); tight gap between title and artists */
.event-title.event-card-v2__title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 2px 0;
    color: var(--text);
}

.event-card-v2__artists {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text);
    line-height: 1.4;
}

/* Hide set times when event status does not allow editing (Save The Date, Cancelled, etc.) */
.add-event-section--status-hidden {
    display: none !important;
}

.event-card-v2__time {
    margin-top: 4px;
    margin-bottom: 0;
}

/* Title-only v2 cards: same gap above datetime as when an artists row sits above it
   (artists use margin-bottom 8px; collapsed with time margin-top gives 8px). */
.event-title.event-card-v2__title + .event-time.event-card-v2__time {
    margin-top: 8px;
}

/* Pin + link share a row; pull pin left so it lines up with plain date/time text above */
.event-card--v2 .event-card-v2__location {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.2em;
    margin-top: 4px;
}

.event-card--v2 .event-card-v2__location-pin {
    flex-shrink: 0;
    line-height: inherit;
    margin-left: -0.28em;
    margin-top: 0.02em;
}

/* No flex-grow — flex:1 made the <a> fill the row so taps hit empty space right of the text. */
.event-card--v2 .event-card-v2__location .location-link {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    word-break: break-word;
}

.event-card-v2__description {
    margin-top: 10px;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    word-break: break-word;
}

.event-card-v2__footer {
    --event-v2-footer-chip-height: 28px;
    --event-v2-footer-chip-font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 14px;
    min-width: 0;
}

.event-card-v2__footer-pills {
    flex: 1 1 0;
    min-width: 0;
}

.event-card-v2__footer .event-card-v2__pills {
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
    width: 100%;
}

.event-card-v2__footer-status {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
}

/* Type/category pills + status: shared chip metrics; ticket weight locked in footer (see rules below) */
.event-card-v2__footer .event-card-v2__pill,
.event-card-v2__footer .ticket-button {
    box-sizing: border-box;
    height: var(--event-v2-footer-chip-height);
    min-height: var(--event-v2-footer-chip-height);
    max-height: var(--event-v2-footer-chip-height);
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: var(--event-v2-footer-chip-font-size);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-card-v2__footer a.ticket-button {
    text-decoration: none;
}

.event-card-v2__footer .ticket-button:hover {
    transform: none;
}

/* Same font metrics for <a> (inherits global 600) vs span static (global 400): keeps chip height stable */
.event-card-v2__footer a.ticket-button,
.event-card-v2__footer .ticket-button.ticket-button--static {
    font-weight: 600;
    overflow: hidden;
}

.event-card-v2__heart {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    font: inherit;
}

.event-card-v2__heart:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: 8px;
}

.event-card-v2__heart-disc {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #f1f5f9;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

:root[data-theme="dark"] .event-card-v2__heart-disc {
    background: rgba(255, 255, 255, 0.08);
}

/* Unstarred: outline star, ring only — no fill inside the circle */
.event-card-v2__heart:not(.is-hearted) .event-card-v2__heart-disc {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px rgba(15, 23, 42, 0.22);
}

:root[data-theme="dark"] .event-card-v2__heart:not(.is-hearted) .event-card-v2__heart-disc {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.28);
}

/* Starred: filled gold star + yellow disc (same on All / My Calendar / modal count row) */
.event-card-v2__heart.is-hearted .event-card-v2__heart-disc {
    background: #fef9c3;
    box-shadow: none;
}

:root[data-theme="dark"] .event-card-v2__heart.is-hearted .event-card-v2__heart-disc {
    background: rgba(250, 204, 21, 0.25);
    box-shadow: none;
}

.event-card-v2__heart-glyph {
    font-size: 15px;
    line-height: 1;
    color: #e2e8f0;
}

:root[data-theme="dark"] .event-card-v2__heart-glyph {
    color: rgba(255, 255, 255, 0.35);
}

.event-card-v2__heart:not(.is-hearted) .event-card-v2__heart-glyph {
    color: #94a3b8;
}

:root[data-theme="dark"] .event-card-v2__heart:not(.is-hearted) .event-card-v2__heart-glyph {
    color: #64748b;
}

.event-card-v2__heart.is-hearted .event-card-v2__heart-glyph {
    color: #ca8a04;
}

:root[data-theme="dark"] .event-card-v2__heart.is-hearted .event-card-v2__heart-glyph {
    color: #facc15;
}

.event-card-v2__heart-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 1em;
    text-align: right;
}

/* No visible button chrome: hit target is exactly the 32×32 SVG. */
.event-card-v2__clock {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    vertical-align: middle;
    flex-shrink: 0;
    cursor: default;
    color: inherit;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

.event-card-v2__clock:focus {
    outline: none;
}

.event-card-v2__clock.is-active {
    cursor: pointer;
}

.event-card-v2__clock.is-active:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 3px;
    border-radius: 50%;
}

.event-card-v2__clock:disabled {
    opacity: 0.42;
    cursor: default;
}

/* Ticket swap: same 32×32 hit target as set-times clock; icon is black line art. */
.event-card-v2__ticket-swap {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    vertical-align: middle;
    flex-shrink: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.event-card-v2__ticket-swap-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-blue);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    pointer-events: none;
}

.event-card-v2__ticket-swap:focus {
    outline: none;
}

.event-card-v2__ticket-swap:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 3px;
    border-radius: 6px;
}

.event-card-v2__ticket-swap-img {
    display: block;
    width: 32px;
    height: 32px;
    object-fit: contain;
    pointer-events: none;
    flex-shrink: 0;
}

/* Black line art (default). */
.event-card-v2__ticket-swap:not(.event-card-v2__ticket-swap--listed) .event-card-v2__ticket-swap-img {
    filter: none;
}

/* Listed / activity: accent blue. */
.event-card-v2__ticket-swap--listed .event-card-v2__ticket-swap-img {
    filter: brightness(0) saturate(100%) invert(42%) sepia(98%) saturate(2000%) hue-rotate(212deg) brightness(98%)
        contrast(96%);
}

:root[data-theme='dark'] .event-card-v2__ticket-swap:not(.event-card-v2__ticket-swap--listed) .event-card-v2__ticket-swap-img {
    filter: brightness(0) invert(1);
    opacity: 0.88;
}

:root[data-theme='dark'] .event-card-v2__ticket-swap--listed .event-card-v2__ticket-swap-img {
    filter: brightness(0) saturate(100%) invert(55%) sepia(85%) saturate(900%) hue-rotate(195deg) brightness(103%)
        contrast(95%);
    opacity: 1;
}

.event-card-v2__clock-svg {
    display: block;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    pointer-events: none;
}

.event-card-v2__clock-ring,
.event-card-v2__clock-hands {
    stroke: #94a3b8;
}

:root[data-theme="dark"] .event-card-v2__clock-ring,
:root[data-theme="dark"] .event-card-v2__clock-hands {
    stroke: rgba(255, 255, 255, 0.45);
}

.event-card-v2__clock.is-active .event-card-v2__clock-ring,
.event-card-v2__clock.is-active .event-card-v2__clock-hands {
    stroke: var(--accent-blue);
}

/* Header: undo .modal-content h2 bottom margin so title and × align on one row */
.set-times-popover .modal-header {
    align-items: center;
}

.set-times-popover .modal-header h2 {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.set-times-popover .modal-close {
    margin: 0;
}

.set-times-popover .set-times-popover__body {
    white-space: pre-wrap;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    padding-bottom: 8px;
    max-height: min(60vh, 320px);
    overflow-y: auto;
}

.event-date {
    display: none;
}

.event-day {
    display: none;
}

.event-month {
    display: none;
}

.event-end-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-pink);
    margin-top: 4px;
}

.event-details {
    flex: 1;
    min-width: 0;
}

.event-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text);
}

.event-title--artists {
    white-space: pre-line;
}

.event-artists {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text);
    line-height: 1.4;
}

.view-event-artists {
    margin-top: 0;
    margin-bottom: 10px;
}

#viewEventTitle.event-title--artists {
    white-space: pre-line;
}

.event-location {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
}

.location-link {
    color: var(--accent-blue);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.location-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.event-time {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.event-time.event-card-v2__time {
    color: var(--text);
}

.event-description {
    font-size: 14px;
    color: var(--text);
    margin: 4px 0 0 0;
    line-height: 1.5;
}

/* V2 body: muted like legacy date/time; beats .event-description alone */
.event-description.event-card-v2__description {
    color: var(--text-secondary);
}

.event-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.ticket-button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    background: var(--accent-blue);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ticket-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.ticket-button.ticket-button--alert-status {
    background: #e0736f;
    color: #fff;
}

.ticket-button.ticket-button--alert-status:hover {
    background: #c85f5b;
    color: #fff;
}

.ticket-button.ticket-button--free-event {
    background: #d8edc4;
    color: #1e4620;
}

.ticket-button.ticket-button--free-event:hover {
    background: #c8e4ae;
    color: #163518;
}

.ticket-button.ticket-button--save-the-date {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.14);
}

.ticket-button.ticket-button--save-the-date:hover {
    background: #f1f5f9;
    color: #0f172a;
}

:root[data-theme="dark"] .ticket-button.ticket-button--save-the-date {
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.2);
}

:root[data-theme="dark"] .ticket-button.ticket-button--save-the-date:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.event-card-v2__footer .ticket-button.ticket-button--save-the-date:hover {
    transform: none;
}

span.ticket-button.ticket-button--static {
    display: inline-block;
    cursor: default;
    pointer-events: none;
    font-weight: 400;
}

span.ticket-button.ticket-button--static:hover {
    opacity: 1;
    transform: none;
}

/* Footer chips: beat global span.ticket-button--static (inline-block) so height matches type pills */
.event-card-v2__footer span.ticket-button.ticket-button--static {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: var(--event-v2-footer-chip-height);
    min-height: var(--event-v2-footer-chip-height);
    max-height: var(--event-v2-footer-chip-height);
    padding: 0 10px;
    line-height: 1;
    vertical-align: middle;
}

.star-button {
    padding: 8px 12px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    min-width: 70px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 20px;
    margin-right: auto;
}

.star-button:focus {
    outline: none;
}

.star-button:hover {
    transform: scale(1.05);
}

.star-button.hearted {
    color: #ca8a04;
    border-color: rgba(202, 138, 4, 0.45);
    background: #fef9c3;
}

:root[data-theme="dark"] .star-button.hearted {
    color: #facc15;
    border-color: rgba(250, 204, 21, 0.35);
    background: rgba(250, 204, 21, 0.15);
}

.star-button span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    min-width: 20px;
    text-align: left;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-hint {
    color: var(--accent-blue);
    font-size: 14px;
}

.error {
    text-align: center;
    padding: 40px;
    color: var(--accent-pink);
}

/* Navigation items */
.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.nav-item:hover {
    background: var(--border);
    color: var(--text);
}

.nav-item:active {
    transform: scale(0.95);
}

.nav-add {
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.nav-add:hover {
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

.nav-add:active {
    transform: scale(0.95);
}

/* ==========================================================================
   7. Modals
   ========================================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    color: var(--text);
    flex: 1;
    min-width: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text);
}

/* Compact notice dialog (e.g. missing event category) — message + grey × one row, text wraps */
.app-message-modal .modal-content.app-message-modal__content {
    padding: 18px 20px 20px;
    max-width: min(400px, calc(100vw - 40px));
}

.app-message-modal__row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

/* Match description field placeholder: same size, weight, grey as add-event textarea hint */
.app-message-modal__body {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 2px 0 0;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.45;
    color: #9ca3af;
}

:root[data-theme="dark"] .app-message-modal__body {
    color: #71717a;
}

.app-message-modal__close.modal-close {
    flex-shrink: 0;
    margin: -2px -4px 0 0;
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: var(--text);
}

.event-detail {
    margin: 12px 0;
    color: var(--text);
    line-height: 1.6;
}

.event-detail:empty {
    display: none;
}

.event-detail a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.event-detail a:hover {
    text-decoration: underline;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

.modal-actions button.full-width {
    width: 100%;
}

/* -------------------------------------------------------------------------
   Add Event modal (sheet layout — design reference mockup)
   ------------------------------------------------------------------------- */
.modal.add-event-modal {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: rgba(0, 0, 0, 0.45);
    overflow-x: hidden;
    overflow-y: hidden;
    touch-action: pan-y;
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
}

.modal.add-event-modal.active {
    display: flex;
}

.add-event-modal__sheet {
    --add-event-label: #6b7280;
    --add-event-placeholder: #9ca3af;
    --add-event-row-border: rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: min(520px, 100%);
    max-height: min(92vh, 900px);
    margin: 0 auto;
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
    min-height: 0;
}

:root[data-theme="dark"] .add-event-modal__sheet {
    --add-event-label: #a1a1aa;
    --add-event-placeholder: #71717a;
    --add-event-row-border: rgba(255, 255, 255, 0.1);
}

@media (min-width: 540px) {
    .modal.add-event-modal {
        align-items: center;
        padding: 20px;
    }

    .add-event-modal__sheet {
        border-radius: 20px;
        max-height: 90vh;
    }
}

/* Event flyer upload (create + edit v2) */
.add-event-field--flyer {
    width: 100%;
    max-width: 100%;
}

/* Tight layout under flyer preview: less dead space before Event Type / Category */
.add-event-field--flyer:has(.event-flyer-dropzone--has-preview) {
    padding-bottom: 6px;
}

.event-flyer-field-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.event-flyer-field-head__label {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.event-flyer-header-edit {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--add-event-placeholder, #9ca3af);
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s ease, background 0.15s ease;
}

/* [hidden] must win over display:flex (otherwise edit shows before a flyer exists) */
.event-flyer-header-edit[hidden] {
    display: none !important;
}

.event-flyer-header-edit:hover {
    opacity: 1;
    background: rgba(120, 120, 128, 0.1);
}

.event-flyer-header-edit:active {
    opacity: 1;
}

:root[data-theme="dark"] .event-flyer-header-edit {
    color: var(--add-event-placeholder, #71717a);
}

:root[data-theme="dark"] .event-flyer-header-edit:hover {
    background: rgba(255, 255, 255, 0.08);
}

.event-flyer-dropzone {
    width: 100%;
    box-sizing: border-box;
    min-height: calc(1.45em * 5 + 48px);
    padding: 14px 16px 16px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: rgba(120, 120, 128, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.event-flyer-dropzone--has-preview {
    min-height: 0;
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    text-align: left;
    overflow: hidden;
    border-color: transparent;
    background: transparent;
}

:root[data-theme="dark"] .event-flyer-dropzone--has-preview {
    background: transparent;
}

:root[data-theme="dark"] .event-flyer-dropzone {
    background: rgba(255, 255, 255, 0.04);
}

.event-flyer-dropzone__hint {
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
    color: var(--add-event-placeholder, #9ca3af);
    max-width: 22rem;
}

.event-flyer-dropzone__status {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.event-flyer-upload-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--add-event-placeholder, #9ca3af);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.event-flyer-upload-icon:hover {
    color: var(--text-secondary);
    background: rgba(120, 120, 128, 0.08);
}

.event-flyer-upload-icon:active {
    transform: scale(0.96);
}

/* [hidden] must win over display:flex (same as header edit) */
.event-flyer-upload-icon[hidden] {
    display: none !important;
}

:root[data-theme="dark"] .event-flyer-upload-icon {
    color: var(--add-event-placeholder, #71717a);
}

:root[data-theme="dark"] .event-flyer-upload-icon:hover {
    background: rgba(255, 255, 255, 0.06);
}

.event-flyer-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    line-height: 0;
}

.event-flyer-dropzone--has-preview .event-flyer-preview {
    max-height: min(38vh, 260px);
    overflow: hidden;
}

.event-flyer-dropzone--has-preview .event-flyer-preview__img {
    width: 100%;
    height: auto;
    max-height: min(38vh, 260px);
    display: block;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
}

.event-flyer-preview__img {
    max-width: 100%;
    width: auto;
    height: auto;
}

.event-flyer-dropzone--has-preview .event-flyer-preview__pdf-frame {
    display: block;
    width: 100%;
    height: min(38vh, 260px);
    min-height: 0;
    max-height: min(38vh, 260px);
    border: none;
    background: transparent;
    box-sizing: border-box;
}

/* Centered flyer picker (not full-width sheet) */
.modal.event-flyer-pick-modal-root {
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}

.event-flyer-pick-dialog.modal-content {
    padding: 0;
    max-width: min(400px, calc(100vw - 40px));
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-self: center;
    margin: auto 0;
}

.event-flyer-pick-dialog__header.add-event-modal__header {
    padding-bottom: 10px;
}

.event-flyer-pick-body {
    padding: 0 20px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
}

.event-flyer-pick-intro {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: left;
    flex-shrink: 0;
}

.event-flyer-pick-sheet[hidden] {
    display: none !important;
}

/* iOS: intro + Select Image (system sheet follows) */
.event-flyer-pick-ios-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.event-flyer-pick-ios-actions[hidden] {
    display: none !important;
}

.event-flyer-pick-ios-btn.auth-button {
    margin: 0;
    background: #6164fd;
    color: #fff;
}

.event-flyer-pick-ios-btn.auth-button:hover:not(:disabled) {
    background: #5356e8;
}

.event-flyer-pick-ios-btn.auth-button:active:not(:disabled) {
    background: #474adf;
}

/* iOS-style grouped action rows with leading icons, left-aligned labels */
.event-flyer-pick-sheet {
    border-radius: 12px;
    overflow: hidden;
    background: rgba(120, 120, 128, 0.1);
    flex-shrink: 0;
}

:root[data-theme="dark"] .event-flyer-pick-sheet {
    background: rgba(255, 255, 255, 0.08);
}

.event-flyer-pick-sheet__row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 14px 16px;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--bg);
    font-size: 17px;
    font-weight: 400;
    font-family: inherit;
    line-height: 1.3;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s ease;
}

.event-flyer-pick-sheet__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    opacity: 0.88;
}

.event-flyer-pick-sheet__icon svg {
    width: 26px;
    height: 26px;
}

.event-flyer-pick-sheet__label {
    flex: 1;
    min-width: 0;
    text-align: left;
}

:root[data-theme="dark"] .event-flyer-pick-sheet__row {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.event-flyer-pick-sheet__row:hover {
    background: rgba(120, 120, 128, 0.06);
}

.event-flyer-pick-sheet__row:active {
    background: rgba(120, 120, 128, 0.12);
}

.event-flyer-pick-sheet__row--last,
.event-flyer-pick-sheet__row:last-child {
    border-bottom: none;
}

.view-event-flyer {
    margin-bottom: 16px;
}

.view-event-flyer__img {
    width: 100%;
    max-height: min(50vh, 320px);
    object-fit: contain;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
}

.view-event-flyer__pdf {
    display: inline-block;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 4px;
}

.edit-event-modal-actions {
    flex-shrink: 0;
    align-self: stretch;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 20px 16px;
    margin-top: 16px;
    gap: 8px;
}

/*
 * .auth-button is width:100% globally — in a 2-button row each child was
 * sizing to the full sheet width and overflowing. Share space with flex.
 */
.edit-event-modal-actions .auth-button,
.edit-event-modal-actions .danger-button {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: 100%;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

/* Create button: sibling of scrollable form (same pattern as edit v2 footer) */
.add-event-modal-actions {
    flex-shrink: 0;
    align-self: stretch;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 20px 16px;
    margin-top: 8px;
}

.add-event-modal-actions .auth-button.full-width {
    width: 100%;
    flex: 1 1 auto;
}

.add-event-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 20px 12px;
    flex-shrink: 0;
    overflow-x: hidden;
    touch-action: pan-y;
}

.add-event-modal__eyebrow {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--add-event-label);
    text-transform: uppercase;
}

.add-event-modal__title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.15;
}

.add-event-modal__close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(120, 120, 128, 0.12);
    color: var(--text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.add-event-modal__close:hover {
    background: rgba(120, 120, 128, 0.2);
    color: var(--text);
}

.add-event-form {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 20px 8px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
    scroll-padding-top: 12px;
    scroll-padding-bottom: min(max(140px, 38vh), 360px);
}

/* Keep focused fields clear of the software keyboard when the form scrolls */
.add-event-form :is(input:not([type='hidden']):not([type='button']):not([type='submit']):not([type='checkbox']):not([type='radio']), textarea, select) {
    scroll-margin-bottom: min(40vh, 320px);
    scroll-margin-top: 8px;
}

.add-event-form .add-event-custom-select__trigger {
    scroll-margin-bottom: min(40vh, 320px);
    scroll-margin-top: 8px;
}

/* Room above keyboard when the browser scrolls the focused control into view */
#eventSetTimes,
#editEvtSetTimes {
    scroll-margin-bottom: min(280px, 48vh);
}

/* Personal (private) mode: remove sections from layout (flex + [hidden] edge cases) */
.add-event-form .add-event-personal-hidden {
    display: none !important;
}

.add-event-form[data-add-event-type="personal"] #addEventStatusTicketSection,
.add-event-form[data-add-event-type="personal"] #addEventArtistsSection,
#addEventModal[data-add-event-type="personal"] #addEventStatusTicketSection,
#addEventModal[data-add-event-type="personal"] #addEventArtistsSection {
    display: none !important;
}

.add-event-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 0;
    width: 100%;
    box-sizing: border-box;
}

.add-event-row--2 .add-event-field {
    flex: 1;
    min-width: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Event Type + Event Category: equal halves (row follows flyer + divider, not :first-child of form) */
.add-event-form > .add-event-field--flyer + .add-event-divider + .add-event-row--2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    padding-top: 8px;
}

.add-event-form > .add-event-field--flyer + .add-event-divider + .add-event-row--2 > .add-event-field {
    flex: unset;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

/* Date/time block: cap width so equal columns are not stretched to full sheet */
.add-event-form .add-event-datetime-stack {
    width: 100%;
    max-width: min(100%, 22rem);
    /* Horizontal inset: sized for date text (widest); time pills reuse the same padding */
    --add-event-datetime-pill-pad-x: 12px;
    /* Fixed total width for time pills so start/end match (includes same pad-x) */
    --add-event-time-pill-width: 6.35rem;
}

/* Date/time pills: equal columns, visible gap between */
.add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime {
    gap: 10px 14px;
    align-items: start;
    justify-items: stretch;
    width: 100%;
}

.add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime > .add-event-field {
    flex: unset;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* flex + width: date shrink-wraps; time uses fixed width (see [type="time"] below) */
.add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime .add-event-input--date {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime .add-event-input--date[type="date"] {
    width: max-content;
}

.add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime .add-event-input--date[type="time"] {
    width: min(100%, var(--add-event-time-pill-width));
}

@supports (grid-template-columns: subgrid) {
    .add-event-datetime-stack {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        column-gap: 14px;
    }

    .add-event-datetime-stack > .add-event-row--2.add-event-row--datetime {
        display: grid;
        grid-template-columns: subgrid;
        grid-column: 1 / -1;
        column-gap: 14px;
    }

    #addEventEndDateBlock {
        display: contents;
    }

    #addEventEndDateBlock[hidden] {
        display: none !important;
    }

    .add-event-datetime-stack > .add-event-divider {
        grid-column: 1 / -1;
    }
}

@supports not (grid-template-columns: subgrid) {
    .add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        justify-content: stretch;
        column-gap: 14px;
    }
}

.add-event-row--toggle {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.add-event-field--grow {
    flex: 1;
}

.add-event-divider {
    height: 1px;
    background: var(--add-event-row-border);
    margin: 0;
}

.add-event-field {
    padding: 14px 0;
}

.add-event-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.add-event-label--stacked {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 8px;
}

.add-event-label__main {
    display: block;
    line-height: 1.25;
}

.add-event-label--wrap {
    margin-bottom: 6px;
}

/* Required field marker (add / edit v2 modals) */
.add-event-req {
    font-weight: 700;
    color: #dc2626;
    text-decoration: none;
    margin-left: 0.2em;
    cursor: help;
}

:root[data-theme="dark"] .add-event-req {
    color: #f87171;
}

.add-event-hint {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--add-event-label);
}

.add-event-field--event-name > .add-event-label {
    margin-bottom: 2px;
}

.add-event-field--event-name > .add-event-hint {
    margin: 0 0 6px;
}

.add-event-input,
.add-event-textarea,
.add-event-select {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.45;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
}

.add-event-input::placeholder,
.add-event-textarea::placeholder {
    color: var(--add-event-placeholder);
    opacity: 1;
}

.add-event-input--date {
    border-radius: 999px;
    /* Flex on the input: WebKit gives the datetime edit intrinsic height; align-items centres it in the pill (iOS Safari). */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    max-width: 100%;
    min-height: 40px;
    height: 40px;
    /* Default pad when outside stack; in stack, datetime-stack variables apply */
    padding: 0 var(--add-event-datetime-pill-pad-x, 12px);
    font-size: 16px;
    line-height: normal;
    text-align: center;
    background: rgba(120, 120, 128, 0.08);
    border-color: transparent;
}

/* Time pills: identical width (start vs end); padding matches date via --add-event-datetime-pill-pad-x on stack */
.add-event-input--date[type="time"] {
    width: min(100%, var(--add-event-time-pill-width, 6.35rem));
}

.add-event-input--date::placeholder {
    color: var(--add-event-placeholder);
    opacity: 1;
}

/* Validation: missing / invalid required fields (add + edit v2) — single hairline, softer than border+shadow stack */
.add-event-field--error .add-event-input:not(.add-event-input--date),
.add-event-field--error .add-event-textarea,
.add-event-field--error .add-event-custom-select__trigger {
    border-color: rgba(220, 38, 38, 0.5) !important;
    box-shadow: none;
}

.add-event-field--error .add-event-input--date {
    border-color: transparent !important;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.45);
}

/* Artists: error ring on the composer shell (matches other bordered fields), not the inner borderless input */
.add-event-field--error .add-event-artist-composer {
    border-color: rgba(220, 38, 38, 0.5) !important;
    box-shadow: none;
}

.add-event-field--error .add-event-artist-composer:focus-within {
    border-color: rgba(220, 38, 38, 0.5) !important;
    box-shadow: none;
}

:root[data-theme="dark"] .add-event-field--error .add-event-input:not(.add-event-input--date),
:root[data-theme="dark"] .add-event-field--error .add-event-textarea,
:root[data-theme="dark"] .add-event-field--error .add-event-custom-select__trigger {
    border-color: rgba(248, 113, 113, 0.5) !important;
    box-shadow: none;
}

:root[data-theme="dark"] .add-event-field--error .add-event-input--date {
    border-color: transparent !important;
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.42);
}

:root[data-theme="dark"] .add-event-field--error .add-event-artist-composer {
    border-color: rgba(248, 113, 113, 0.5) !important;
    box-shadow: none;
}

:root[data-theme="dark"] .add-event-field--error .add-event-artist-composer:focus-within {
    border-color: rgba(248, 113, 113, 0.5) !important;
    box-shadow: none;
}

/* WebKit: do not stretch edit to full pill height (that pins text to the top on iOS); inner flex centres segments */
.add-event-input--date::-webkit-datetime-edit {
    padding: 0;
    margin: 0;
}

.add-event-input--date::-webkit-datetime-edit-fields-wrapper {
    box-sizing: border-box;
    padding: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.add-event-input--date::-webkit-calendar-picker-indicator {
    margin-inline-start: -1px;
    padding: 0;
    margin-right: 0;
    opacity: 0.75;
}

/* Narrow viewports: subgrid + max-content can overflow/overlap on iOS; use equal fr columns instead */
@media (max-width: 480px) {
    .add-event-datetime-stack {
        display: block !important;
    }

    #addEventEndDateBlock {
        display: block !important;
    }

    #addEventEndDateBlock[hidden] {
        display: none !important;
    }

    .add-event-datetime-stack {
        max-width: min(100%, 22rem) !important;
    }

    .add-event-datetime-stack > .add-event-row--2.add-event-row--datetime {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        grid-column: auto !important;
        width: 100%;
        max-width: 100%;
        column-gap: 12px !important;
        gap: 10px 12px !important;
    }

    .add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime > .add-event-field {
        min-width: 0;
        max-width: 100%;
    }

    .add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime .add-event-input--date[type="date"] {
        width: max-content;
        max-width: 100%;
        min-width: 0;
    }

    .add-event-form .add-event-datetime-stack .add-event-row--2.add-event-row--datetime .add-event-input--date[type="time"] {
        width: min(100%, var(--add-event-time-pill-width, 6.35rem));
        max-width: 100%;
        min-width: 0;
    }
}

:root[data-theme="dark"] .add-event-input--date {
    background: rgba(255, 255, 255, 0.06);
}

.add-event-input:focus,
.add-event-textarea:focus,
.add-event-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(107, 159, 255, 0.2);
}

.add-event-textarea {
    resize: vertical;
    min-height: 88px;
}

.add-event-textarea--single {
    min-height: 56px;
}

.add-event-artist-composer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    padding: 6px 10px;
    font-size: 16px;
    line-height: 1.45;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: text;
}

.add-event-artist-composer:focus-within {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(107, 159, 255, 0.2);
}

.add-event-artist-pills {
    display: contents;
}

.add-event-artist-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
    padding: 2px 3px 2px 10px;
    border-radius: 999px;
    background: rgba(107, 159, 255, 0.12);
    border: 1px solid rgba(107, 159, 255, 0.35);
    color: var(--text);
    font-size: 14px;
    font-weight: 400;
}

.add-event-artist-pill-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.add-event-artist-pill-remove {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.add-event-artist-pill-remove:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

:root[data-theme="dark"] .add-event-artist-pill-remove:hover {
    background: rgba(255, 255, 255, 0.08);
}

.add-event-artist-entry {
    flex: 1 1 140px;
    min-width: 100px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    line-height: 1.45;
    font-family: inherit;
    color: var(--text);
    padding: 4px;
}

.add-event-artist-entry::placeholder {
    color: var(--add-event-placeholder);
    opacity: 1;
}

/* WebKit: native placeholder can paint over typed text in narrow flex chip inputs */
.add-event-artist-entry:not(:placeholder-shown)::placeholder {
    opacity: 0;
}

.add-event-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8 .5 0h11z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    color: var(--text);
    font-weight: 400;
}

.add-event-select::placeholder {
    color: var(--add-event-placeholder);
    opacity: 1;
}

:root[data-theme="dark"] .add-event-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a1a1aa' d='M6 8 .5 0h11z'/%3E%3C/svg%3E");
}

/* Event Type: custom dropdown (full width of column; list matches trigger type) */
.add-event-custom-select {
    --add-event-custom-select-font-size: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
}

.add-event-custom-select.is-open {
    z-index: 30;
}

.add-event-custom-select__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    font-size: var(--add-event-custom-select-font-size);
    font-weight: 400;
    font-family: inherit;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    padding-right: 36px;
    cursor: pointer;
    text-align: left;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8 .5 0h11z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

:root[data-theme="dark"] .add-event-custom-select__trigger {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a1a1aa' d='M6 8 .5 0h11z'/%3E%3C/svg%3E");
}

.add-event-custom-select__trigger:focus {
    outline: none;
}

.add-event-custom-select__trigger:focus-visible {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(107, 159, 255, 0.2);
}

.add-event-custom-select__trigger--placeholder .add-event-custom-select__value {
    color: var(--add-event-placeholder);
    font-weight: 400;
}

.add-event-custom-select__value {
    flex: 1;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
}

.add-event-custom-select__list {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    width: 100%;
    min-width: 100%;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    box-sizing: border-box;
    font-size: var(--add-event-custom-select-font-size);
    font-weight: 400;
    line-height: 1.45;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] .add-event-custom-select__list {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.add-event-custom-select__option {
    padding: 12px 14px;
    color: var(--add-event-placeholder);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.add-event-custom-select__option:hover,
.add-event-custom-select__option:active {
    background: rgba(107, 159, 255, 0.12);
}

.add-event-custom-select__option.is-selected {
    color: var(--text);
    font-weight: 500;
}

.add-event-inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 10px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.add-event-inline-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

/* Toggle switch (Multiple nights) */
.add-event-switch {
    position: relative;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
    cursor: pointer;
}

.add-event-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.add-event-switch__slider {
    position: absolute;
    inset: 0;
    background: #e5e5ea;
    border-radius: 31px;
    transition: background 0.2s ease;
}

.add-event-switch__slider::after {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.add-event-switch input:checked + .add-event-switch__slider {
    background: #34c759;
}

.add-event-switch input:checked + .add-event-switch__slider::after {
    transform: translateX(20px);
}

:root[data-theme="dark"] .add-event-switch__slider {
    background: #3a3a3c;
}

/* Settings */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text);
}

.settings-item {
    margin-bottom: 16px;
}

.settings-item label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.settings-value {
    font-size: 16px;
    color: var(--text);
    margin: 0;
}

.danger-button {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    background: var(--accent-pink);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.danger-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.danger-button:active {
    transform: translateY(0);
}

/* ==========================================================================
   8. Responsive (Mobile)
   ========================================================================== */

@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    .container {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    h1 {
        font-size: 48px;
    }

    .logo {
        width: 120px;
        height: 120px;
        margin-bottom: 24px;
    }

    p {
        font-size: 16px;
        margin-bottom: 24px;
    }

    .auth-box {
        max-width: 100%;
        padding: 16px;
        margin-bottom: 20px;
    }

    .auth-input {
        font-size: 16px;
    }

    .auth-button {
        font-size: 16px;
    }

    .theme-toggle {
        font-size: 14px;
    }

    .app-header h1 {
        font-size: 20px;
    }

    .filter-button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .event-card {
        flex-direction: column;
    }

    .event-date {
        width: auto;
        display: flex;
        gap: 12px;
        align-items: center;
    }

    .event-day {
        font-size: 28px;
    }

    .event-header {
        align-items: flex-start;
    }

    .event-title {
        font-size: 16px;
        line-height: 1.3;
    }

    .event-title.event-card-v2__title {
        font-size: 16px;
        line-height: 1.3;
    }

    .heart-button {
        margin-top: -4px;
    }
}

.search-icon {
    color: rgba(60, 60, 67, 0.6);
    flex-shrink: 0;
    margin-left: 4px;
}

:root[data-theme="dark"] .search-icon {
    color: rgba(235, 235, 245, 0.6);
}

/* Full-screen flyer processing (resize / compress / save) */
.flyer-processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.flyer-processing-overlay[hidden] {
    display: none !important;
}

.flyer-processing-overlay__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 28px 32px;
    max-width: 300px;
    text-align: center;
    border-radius: 16px;
    background: var(--bg);
    color: var(--text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.flyer-processing-overlay__spinner {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--accent-purple);
    animation: flyer-processing-spin 0.75s linear infinite;
}

:root[data-theme="dark"] .flyer-processing-overlay__spinner {
    border-color: rgba(255, 255, 255, 0.14);
    border-top-color: var(--accent-purple);
}

@keyframes flyer-processing-spin {
    to {
        transform: rotate(360deg);
    }
}

.flyer-processing-overlay__text {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
    color: var(--text-secondary);
}

/* —— Dedicated event detail page (/event.html) —— */
html:has(.view-event-page) {
    height: 100%;
    height: 100dvh;
    min-height: 100dvh;
    background: var(--bg);
    overscroll-behavior: none;
    overflow: hidden;
}

/* Event page h1 uses #eventPageTitle reset; keep any other h1 margins tidy if added later. */
.view-event-page h1 {
    margin-block-start: 0;
    margin-block-end: 0;
}

.view-event-page {
    --ve-header-pad-y: 8px;
    --ve-header-row: 36px;
    /* Fallback for main padding-top only; sticky uses top:0 (scrollport already sits under fixed header). */
    --view-event-header-offset: calc(
        env(safe-area-inset-top, 0px) + var(--ve-header-pad-y) + var(--ve-header-row) + var(--ve-header-pad-y) + 1px
    );
    --ve-footer-pad-top: 12px;
    --ve-footer-btn-area: 48px;
    --ve-footer-pad-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    --view-event-footer-offset: calc(
        var(--ve-footer-pad-top) + var(--ve-footer-btn-area) + var(--ve-footer-pad-bottom)
    );
    margin: 0;
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overscroll-behavior: none;
    overflow: hidden;
    touch-action: pan-y;
}

.view-event-page__header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 30;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.view-event-page__header-inner {
    max-width: 560px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: var(--ve-header-pad-y) 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

:root[data-theme='dark'] .view-event-page__header {
    background: rgba(26, 15, 46, 0.88);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.view-event-page__back {
    color: var(--accent-purple);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
}

.view-event-page__back:hover {
    text-decoration: underline;
}

.view-event-page__logo {
    border-radius: 8px;
    flex-shrink: 0;
}

.view-event-page__main {
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 32px;
    /* Single source of truth: content (and scrollport) starts below fixed header — do not also margin the flyer or use sticky top: same value (that doubled the gap on iOS). */
    padding-top: var(--view-event-nav-bottom, var(--view-event-header-offset));
    box-sizing: border-box;
    /* Hero flyer is full-bleed; clipping here cropped ~5–10px per side. */
    overflow-x: visible;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Hero flyer: edge-to-edge horizontal only; keep same padding-top as normal main. */
.view-event-page__main.view-event-page__main--with-hero-flyer {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

.view-event-page__main.view-event-page__main--with-hero-flyer .view-event-page__article {
    max-width: none;
    width: 100%;
    /* overflow:visible so position:sticky works reliably on iOS; main clips horizontal overflow. */
    overflow: visible;
}

.view-event-page__main.view-event-page__main--with-hero-flyer .view-event-page__scroll-region {
    padding-top: 0;
    width: 100%;
    overflow-x: visible;
    touch-action: pan-y;
}

/* Flyer: flush to title below; 100% width (scroll region matches full-bleed main — avoids 100vw + overflow clip). */
.view-event-page__main.view-event-page__main--with-hero-flyer .view-event-page__flyer-hero {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    display: block;
}

.view-event-page__main.view-event-page__main--with-hero-flyer #eventPageFlyer.view-event-page__flyer-hero {
    margin-bottom: 0 !important;
    padding: 0 !important;
}

/* Breathing room between full-bleed flyer and sticky title (only when hero flyer is shown). */
.view-event-page__main.view-event-page__main--with-hero-flyer .view-event-page__sticky-head {
    padding-top: 8px;
}

.view-event-page__main.view-event-page__main--with-hero-flyer .view-event-page__description,
.view-event-page__main.view-event-page__main--with-hero-flyer .view-event-page__creator,
.view-event-page__main.view-event-page__main--with-hero-flyer .view-event-page__actions-row {
    max-width: 560px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, calc(40px + env(safe-area-inset-right, 0px)));
    box-sizing: border-box;
}

/*
 * Full viewport height: padding-top already clears the fixed header. Do NOT subtract the header
 * from height — that left a band of empty space at the bottom and broke fixed footer anchoring.
 */
.view-event-page__main:has(.view-event-page__article:not([hidden])) {
    padding-bottom: 0;
}

.view-event-page__loading,
.view-event-page__error {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
}

.view-event-page__error {
    color: var(--accent-pink);
}

.view-event-page__article {
    animation: view-event-fade-in 0.25s ease-out;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
    /* No transform here — it creates a containing block and breaks position:fixed footer vs viewport. */
}

/* Title + meta: sticky top:0 — scrollport already begins under nav (main padding-top). */
.view-event-page__sticky-head {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--bg);
    padding: 0 0 10px;
    margin: 0;
    margin-top: 0 !important;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    overscroll-behavior: none;
    /* Contain margin collapse with flyer sibling so no phantom gap. */
    padding-top: 0;
    isolation: isolate;
}

.view-event-page__sticky-head-inner {
    max-width: 560px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

.view-event-page__main.view-event-page__main--with-hero-flyer .view-event-page__sticky-head-inner {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/*
 * Strip landing-page h1 (72px / huge line box). Title sits in the scroll region so touch/scroll
 * must work normally (no touch-action: none).
 */
#eventPageTitle.view-event-page__title {
    all: unset;
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 8px;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    background-image: linear-gradient(
        135deg,
        var(--accent-pink) 0%,
        var(--accent-purple) 50%,
        var(--accent-blue) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    -webkit-tap-highlight-color: transparent;
}

/* Collapse global .event-detail top margin against title so the block hugs the nav. */
.view-event-page__sticky-head-inner h1 + .event-detail {
    margin-top: 0;
}

/* Global .event-detail { margin: 12px 0 } would add a band above the block after the flyer. */
.view-event-page__sticky-head-inner > .event-detail {
    margin-top: 0 !important;
}

:root[data-theme='dark'] .view-event-page__sticky-head {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.view-event-page__sticky-head .view-event-page__meta-row {
    margin-bottom: 0;
}

.view-event-page__scroll-region {
    flex: 1;
    min-height: 0;
    /* Block flow: column flex was stretching/shifting sticky vs flyer on iOS WebKit. */
    overflow-x: visible;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    padding-top: 0;
    padding-bottom: calc(16px + var(--view-event-footer-offset));
    box-sizing: border-box;
    touch-action: pan-y;
}

/* Inset for body text / actions (flyer is full-bleed above). */
.view-event-page__scroll-region > .view-event-page__description,
.view-event-page__scroll-region > .view-event-page__creator,
.view-event-page__scroll-region > .view-event-page__actions-row {
    padding-right: calc(40px + env(safe-area-inset-right, 0px));
    box-sizing: border-box;
}

@keyframes view-event-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Hero flyer: spans scroll region; line-height/font-size 0 removes stray inline gaps below the image. */
.view-event-page__flyer-hero {
    width: 100%;
    max-width: none;
    position: relative;
    left: auto;
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
}

.view-event-page__flyer-hero > * {
    font-size: initial;
}

.view-event-page__flyer-hero .view-event-flyer__img {
    width: 100%;
    height: auto;
    display: block;
    max-width: none;
    max-height: none;
    object-fit: unset;
    object-position: top center;
    border-radius: 0;
    background: transparent !important;
    vertical-align: top;
}

/* Hero has both img + iframe; the unused one stays [hidden]. Some engines still honour
   author height/display on iframe and leave a huge band under the image — force out of flow. */
.view-event-page__flyer-hero .view-event-flyer__img[hidden],
.view-event-page__flyer-hero .view-event-flyer__pdf-frame[hidden] {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

:root[data-theme='dark'] .view-event-page__flyer-hero .view-event-flyer__img {
    background: transparent !important;
}

/* Inline PDF: tall viewport only when actually shown (not when [hidden] swaps to image). */
.view-event-page__flyer-hero .view-event-flyer__pdf-frame:not([hidden]) {
    width: 100%;
    height: min(88vh, 1200px);
    border: 0;
    display: block;
    background: var(--bg);
    vertical-align: top;
}

:root[data-theme='dark'] .view-event-page__flyer-hero .view-event-flyer__pdf-frame:not([hidden]) {
    background: var(--bg);
}

/* Legacy class kept on same node for JS; non-hero rules not used on view page. */
.view-event-page__flyer:not(.view-event-page__flyer-hero) {
    margin-bottom: 20px;
}

.view-event-page__meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.view-event-page__meta-row .view-event-page__meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.view-event-page__meta-row .event-card-v2__clock {
    flex-shrink: 0;
    margin-left: auto;
}

/* Meta-row chips: explicit capsule (feed uses 999px; reinforce for view page). */
.view-event-page__meta-row .event-card-v2__pill {
    border-radius: 999px;
    overflow: hidden;
}

/* Match feed footer type chip (transparent border) at event-page pill size (32px / 14px). */
.view-event-page__meta-row .event-card-v2__pill--type {
    border: 1px solid transparent;
}

/* Status / ticket control: feed footer uses pill radius; global .ticket-button is 8px. */
.view-event-page__pill-slot .ticket-button {
    white-space: nowrap;
    border-radius: 999px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    min-height: 32px;
    height: 32px;
    max-height: 32px;
    padding: 0 16px !important;
    font-size: 14px;
    /* Match box height so static <span> labels center like <a> (avoids baseline/line-box drift on WebKit). */
    line-height: 32px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-weight: 600;
    flex-shrink: 0;
}

/* Beat global span.ticket-button--static { display: inline-block; font-weight: 400 }. */
.view-event-page__pill-slot span.ticket-button.ticket-button--static {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 600 !important;
    vertical-align: middle;
    line-height: 32px !important;
}

.view-event-page__pill-slot a.ticket-button:hover {
    transform: none;
}

.view-event-page__artists {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px !important;
}

.view-event-page__time {
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 8px !important;
}

.view-event-page__location {
    margin-bottom: 16px !important;
}

.view-event-page__description {
    font-size: 16px;
    line-height: 1.5;
    margin-top: 8px !important;
}

.view-event-page__creator {
    font-size: 14px;
    margin-top: 20px !important;
}

.view-event-page__actions-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

:root[data-theme='dark'] .view-event-page__actions-row {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Group-of-people icon: neutral when no stars; blue when heart_count > 0 (not a second star control). */
.view-event-page__stars-group {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    padding: 2px;
    margin: 0;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 10px;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.view-event-page__stars-group:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.view-event-page__stars-group:disabled {
    cursor: default;
    opacity: 1;
}

.view-event-page__stars-group:disabled:focus-visible {
    outline: none;
}

.view-event-page__stars-group--active {
    color: var(--accent-blue);
}

:root[data-theme='dark'] .view-event-page__stars-group {
    color: rgba(255, 255, 255, 0.38);
}

:root[data-theme='dark'] .view-event-page__stars-group--active {
    color: var(--accent-blue);
}

/* No extra horizontal padding — list aligns with .modal-header h2 (both use .modal-content padding only). */
.view-event-page__stars-modal-body {
    padding: 0 0 16px;
    max-height: min(50vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.view-event-page__stars-modal-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.view-event-page__stars-modal-list li {
    padding: 3px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 16px;
    line-height: 1.35;
    color: var(--text);
}

.view-event-page__stars-modal-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

:root[data-theme='dark'] .view-event-page__stars-modal-list li {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.view-event-page__stars-modal-empty,
.view-event-page__stars-modal-error {
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.view-event-page__stars-modal-error {
    color: var(--accent-pink);
}

.view-event-page__pill-slot {
    margin-left: auto;
}


.view-event-page__footer-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 25;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--ve-footer-pad-top) max(16px, env(safe-area-inset-left, 0px))
        max(var(--ve-footer-pad-bottom), env(safe-area-inset-bottom, 0px))
        max(16px, env(safe-area-inset-right, 0px));
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* WebKit: frosted layer sometimes leaves a bare strip above the home indicator; paint solid page colour there. */
.view-event-page__footer-actions::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: env(safe-area-inset-bottom, 0px);
    background: var(--bg);
    pointer-events: none;
    z-index: 0;
}

:root[data-theme='dark'] .view-event-page__footer-actions {
    background: rgba(26, 15, 46, 0.88);
    border-top-color: rgba(255, 255, 255, 0.08);
}

.view-event-page__footer-actions .auth-button.view-event-page__edit {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    border-radius: 20px;
}

/* [hidden] alone loses to display:flex below in some engines; keep import row actually hidden. */
.view-event-page__moderation-row[hidden] {
    display: none !important;
}

.view-event-page__moderation-row:not([hidden]) {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.view-event-page__moderation-row .auth-button {
    width: 100%;
    box-sizing: border-box;
    border-radius: 20px;
    text-align: center;
}

.view-event-page__reject {
    background: transparent;
    border: 1.5px solid var(--text);
    color: var(--text);
}

:root[data-theme='dark'] .view-event-page__reject {
    border-color: rgba(232, 228, 237, 0.55);
    color: var(--text);
}

.event-card-v2__approve-wrap {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

:root[data-theme='dark'] .event-card-v2__approve-wrap {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.event-card-v2__approve-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 16px;
    font-size: 0.95rem;
    border-radius: 14px;
    cursor: pointer;
    border: none;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    color: #fff;
    font-weight: 600;
}

.event-card-v2__approve-btn:hover {
    filter: brightness(1.05);
}

