a, a:hover, a:focus, a:active { text-decoration: none; }
/* Staff landing page: retain two columns and four rows on every screen size. */
.admin-dashboard {
    max-width: 760px;
    margin: 0 auto;
    color: var(--admin-button-color, #333333);
}
.admin-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.admin-dashboard-tile {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    min-height: 94px;
    padding: 1rem;
    border: 1px solid #e3e3e3;
    border-radius: 12px;
    background: #ffffff;
    color: inherit;
}
.admin-dashboard-tile[href]:hover {
    color: inherit;
    border-color: currentColor;
}
.admin-dashboard-tile[href]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}
.admin-dashboard-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 11px;
    background: #f0f0f0;
    color: inherit;
}
.admin-dashboard-icon svg {
    display: block;
    width: 32px;
    height: 32px;
}
.admin-dashboard-tile-copy {
    min-width: 0;
}
.admin-dashboard-tile-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.admin-dashboard-tile-note {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
}
.admin-dashboard-tile-disabled {
    background: #f8f8f8;
}
@media (max-width: 520px) {
    .admin-dashboard-grid {
        gap: 0.75rem;
    }
    .admin-dashboard-tile {
        flex-direction: column;
        justify-content: center;
        gap: 0.65rem;
        padding: 0.875rem 0.5rem;
        text-align: center;
    }
    .admin-dashboard-tile-label {
        font-size: 1rem;
    }
}
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        /* Reserve scrollbar space so layout doesn't shift on alternate page loads (e.g. iPad) */
        html {
            overflow-y: scroll;
            scrollbar-gutter: stable;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            background: #f5f5f5;
            color: #333;
            line-height: 1.6;
            overflow-x: hidden;
        }
        
        /* Desktop: Left Sidebar Layout */
        .app-wrapper {
            display: flex;
            min-height: 100vh;
        }
        
        .sidebar {
            width: 250px;
            min-width: 250px;
            max-width: 250px;
            flex-shrink: 0;
            flex: 0 0 250px;
            box-sizing: border-box;
            background: #e8e8e8;
            color: #333;
            position: fixed;
            left: 0;
            top: 0;
            height: 100vh;
            overflow-y: scroll;
            overflow-x: hidden;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            contain: layout size;
        }
        
        .sidebar-header {
            padding: 1.5rem 1rem;
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
            text-align: center;
            min-height: 100px;
        }

        /* Circular profile-style brand mark (sidebar, compact header, slide-out menu). */
        .brand-avatar {
            border-radius: 50%;
            object-fit: cover;
            object-position: center;
            background: #f4f4f4;
            box-shadow:
                0 0 0 2px rgba(255, 255, 255, 0.95),
                0 0 0 3px rgba(0, 0, 0, 0.08),
                0 3px 10px rgba(0, 0, 0, 0.12);
            flex-shrink: 0;
        }
        
        .sidebar-header img {
            width: 5.5rem;
            height: 5.5rem;
            max-width: 5.5rem;
            margin: 0 auto 0.85rem auto;
            display: block;
        }
        
        .sidebar-header h1 {
            font-size: 1.5rem;
            margin: 0;
            color: #333;
        }
        
        .sidebar-nav {
            flex: 1;
            padding: 1rem 0;
            min-width: 0;
        }
        
        .sidebar-nav ul {
            list-style: none;
            padding: 0;
            margin: 0;
            display: block !important;
            flex-direction: column !important;
        }
        
        .sidebar-nav ul li {
            margin: 0;
            display: block !important;
            width: 100%;
        }
        
        .sidebar-nav a,
        .sidebar-nav .admin-nav-logout {
            display: block !important;
            color: #333;
            text-decoration: none;
            padding: 0.48rem 1.5rem;
            transition: background 0.2s, border-color 0.2s;
            border-left: 3px solid transparent;
            width: 100%;
            font-size: 0.95rem;
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .sidebar-nav a:hover,
        .sidebar-nav .admin-nav-logout:hover {
            background: rgba(0, 0, 0, 0.05);
            border-left-color: #3498db;
        }
        
        .sidebar-nav a.active {
            background: rgba(52, 152, 219, 0.15);
            border-left-color: #3498db;
            font-weight: 500;
        }
        
        .sidebar-user-info {
            padding: 1rem 1.5rem;
            border-top: 1px solid rgba(0, 0, 0, 0.1);
            background: rgba(0, 0, 0, 0.05);
        }
        
        .sidebar-user-info .user-name {
            display: block;
            margin-bottom: 0.75rem;
            font-size: 0.9rem;
            color: #333;
        }
        
        .sidebar-user-info,
        .sidebar-header {
            flex-shrink: 0;
        }
        
        .sidebar-user-info .btn {
            width: 100%;
            text-align: center;
        }
        
        .main-content {
            flex: 1;
            margin-left: 250px;
            min-height: 100vh;
            min-width: 0;
        }
        
        /* Tablet-only logout bar (hidden on desktop and mobile) */
        .tablet-logout-bar {
            display: none;
        }
        
        .event-filter-banner {
            background: #3498db;
            color: white;
            padding: 0.75rem 0;
            border-bottom: 2px solid #2980b9;
        }
        
        .event-filter-banner .container {
            display: flex;
            align-items: center;
            justify-content: space-between;
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        
        /* Desktop: Hide compact header */
        header {
            display: none;
        }
        
        /* Phones and tablets: compact top header */
        @media (max-width: 1024px) {
            body {
                /* Clip horizontal overflow without creating a scroll container for the sticky header. */
                overflow-x: clip;
            }

            header {
                display: block;
                position: sticky;
                top: 0;
                z-index: 997;
                background: #e8e8e8;
                color: #333;
                padding: 0.5rem 0;
                padding-top: max(0.5rem, env(safe-area-inset-top));
                padding-left: env(safe-area-inset-left);
                padding-right: env(safe-area-inset-right);
                margin-bottom: 1rem;
            }
        }
        
        nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }
        
        nav h1 {
            font-size: 1.5rem;
            color: #333;
        }
        
        /* Only apply to header nav, not sidebar */
        header nav ul {
            list-style: none;
            display: flex;
            gap: 1.5rem;
        }
        
        header nav a {
            color: #333;
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 4px;
            transition: background 0.3s;
        }
        
        header nav a:hover {
            background: rgba(0, 0, 0, 0.05);
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        
        .card {
            background: white;
            border-radius: 8px;
            padding: 1.5rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            margin-bottom: 1.5rem;
        }
        
        .btn {
            font-family: inherit;
            line-height: 1.6;
            display: inline-block;
            padding: 0.5rem 1rem;
            background: #374151;
            color: white;
            text-decoration: none;
            border-radius: 4px;
            border: none;
            cursor: pointer;
            font-size: 0.9rem;
            transition: background 0.3s;
        }
        
        .btn:hover {
            background: #4b5563;
        }
        
        .btn-success {
            background: #374151;
            color: white;
        }
        
        .btn-success:hover {
            background: #4b5563;
        }
        
        .btn-danger {
            background: #374151;
            color: white;
        }
        
        .btn-danger:hover {
            background: #4b5563;
        }
        
        .btn-secondary {
            background: #374151;
            color: white;
        }
        
        .btn-secondary:hover {
            background: #4b5563;
        }
        
        /* Admin: standard mobile-style icon buttons (Edit, Copy, Delete, Add) — dark grey, white icon/text */
        .btn-icon {
            padding: 0.5rem;
            min-width: 44px;
            min-height: 44px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            border-radius: 4px;
            border: none;
            cursor: pointer;
            transition: background 0.3s;
            background: #374151;
            color: white;
        }
        .btn-icon:hover {
            background: #4b5563;
        }
        .btn-icon svg {
            width: 20px;
            height: 20px;
            flex-shrink: 0;
        }
        .btn-icon.btn-success { background: #374151; color: white; }
        .btn-icon.btn-success:hover { background: #4b5563; }
        .btn-icon.btn-danger { background: #374151; color: white; }
        .btn-icon.btn-danger:hover { background: #4b5563; }
        .admin-actions {
            display: flex;
            gap: 0.5rem;
            align-items: center;
            flex-wrap: wrap;
        }
        .admin-actions .btn-icon + .btn,
        .admin-actions .btn + .btn { margin-left: 0; }
        
        table {
            width: 100%;
            border-collapse: collapse;
            background: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        th, td {
            padding: 0.75rem;
            text-align: left;
            vertical-align: top;
            border-bottom: 1px solid #eee;
        }
        
        th {
            background: #e8e8e8;
            color: #333;
            font-weight: 600;
        }
        
        /* Row banding - pairs of rows (data + action buttons) get same color */
        tbody tr:nth-child(4n+1),
        tbody tr:nth-child(4n+2) {
            background: white;
        }
        
        tbody tr:nth-child(4n+3),
        tbody tr:nth-child(4n+4) {
            background: #f9f9f9;
        }
        
        tr:hover {
            background: #f8f9fa !important;
        }
        
        .form-group {
            margin-bottom: 1rem;
        }
        
        label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 500;
        }
        
        /* Shared "Filter by retailer" row (People, Event Registrations) — label + dropdown */
        .admin-filter-retailer-row {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-bottom: 1rem;
        }
        .admin-filter-retailer-row label {
            display: inline;
            margin-bottom: 0;
            font-size: 0.9rem;
            color: #555;
            white-space: nowrap;
            font-weight: 500;
        }
        .admin-filter-retailer-select {
            padding: 0.5rem 0.75rem;
            border-radius: 4px;
            border: 1px solid #ddd;
            font-size: 0.9rem;
            min-width: 8rem;
            max-width: 14rem;
            width: auto;
            background: #fff;
        }
        
        input[type="text"],
        input[type="email"],
        input[type="password"],
        input[type="number"],
        input[type="date"],
        input[type="time"],
        input[type="datetime-local"],
        input[type="url"],
        input[type="tel"],
        select,
        textarea {
            width: 100%;
            padding: 0.5rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 1rem;
        }
        
        .alert {
            padding: 1rem;
            border-radius: 4px;
            margin-bottom: 1rem;
        }
        
        .alert-success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        
        .alert-error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        
        .actions {
            display: flex;
            gap: 0.5rem;
        }
        
        .actions a, .actions button {
            padding: 0.25rem 0.5rem;
            font-size: 0.85rem;
        }
        
        /* Sortable table headers - header text is clickable for sorting, no icons */
        th.sortable {
            cursor: pointer;
            user-select: none;
        }
        
        th.sortable:hover {
            background: #d0d0d0;
        }
        
        /* Events list page: card layout and section blocks (desktop base) */
        .events-list-page .events-list-cards {
            display: flex;
            flex-direction: column;
            gap: 0;
        }
        .events-list-page .event-card {
            border: 1px solid #ddd;
            border-radius: 4px;
            margin-bottom: 1rem;
            overflow: hidden;
            background: #fff;
        }
        .events-list-page .event-card-main {
            padding: 0.75rem 1rem;
            border-bottom: 1px solid #eee;
        }
        .events-list-page .event-card-name {
            font-size: 1.2rem;
            margin-bottom: 0.25rem;
        }
        .events-list-page .event-card-date {
            font-size: 0.9rem;
            color: #666;
            margin-bottom: 0.25rem;
        }
        .events-list-page .event-card-description {
            font-size: 0.9rem;
            color: #555;
            line-height: 1.4;
            overflow-wrap: anywhere;
        }
        .events-list-page .event-card-description > :first-child {
            margin-top: 0;
        }
        .events-list-page .event-card-description > :last-child {
            margin-bottom: 0;
        }
        .events-list-page .event-card-description img {
            max-width: 100%;
            height: auto;
        }
        .events-list-page .event-card-details {
            padding: 0.75rem 1rem;
        }
        .events-list-page .events-list-section {
            margin-bottom: 1rem;
            padding: 0.75rem;
            background: #f8f9fa;
            border-radius: 4px;
        }
        .events-list-page .events-list-section-heading {
            display: block;
            margin-bottom: 0.5rem;
        }
        .events-list-page .events-list-section-empty {
            color: #666;
            font-size: 0.9rem;
            margin: 0;
        }
        .events-list-page .events-list-summary-line {
            color: #333;
            font-size: 0.9rem;
            margin: 0;
        }
        
        /* Autocomplete styles */
        .autocomplete-wrapper {
            position: relative;
            width: 100%;
        }
        
        .autocomplete-input {
            width: 100%;
            padding: 0.5rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 1rem;
        }
        
        .autocomplete-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 1px solid #ddd;
            border-top: none;
            border-radius: 0 0 4px 4px;
            max-height: 200px;
            overflow-y: auto;
            z-index: 1000;
            display: none;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        
        .autocomplete-dropdown.show {
            display: block;
        }
        
        .autocomplete-item {
            padding: 0.5rem;
            cursor: pointer;
            border-bottom: 1px solid #eee;
        }
        
        .autocomplete-item:hover,
        .autocomplete-item.selected {
            background: #f0f0f0;
        }
        
        .autocomplete-item:last-child {
            border-bottom: none;
        }
        
        .hidden-input {
            display: none;
        }
        
        /* Hamburger menu */
        .menu-toggle {
            display: none;
            background: none;
            border: none;
            color: #333;
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0.5rem;
            min-width: 44px;
            min-height: 44px;
        }
        
        .menu-toggle:focus {
            outline: 2px solid rgba(0, 0, 0, 0.3);
            outline-offset: 2px;
        }
        
        .menu-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 998;
        }
        
        .menu-overlay.active {
            display: block;
        }
        
        .mobile-nav {
            display: none;
            position: fixed;
            top: 0;
            left: -280px;
            width: 280px;
            height: 100vh;
            height: 100dvh;
            background: #e8e8e8;
            z-index: 999;
            transition: left 0.3s ease;
            box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
            flex-direction: column;
            align-items: stretch;
            overflow: hidden;
            padding-bottom: env(safe-area-inset-bottom);
        }
        
        .mobile-nav.active {
            display: flex !important;
            left: 0;
        }
        
        .mobile-nav-header {
            padding: 1rem;
            padding-right: 3rem;
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            position: relative;
            width: 100%;
            box-sizing: border-box;
        }
        
        .mobile-nav-header img {
            width: 4rem;
            height: 4rem;
            max-width: 4rem;
            margin-bottom: 0.75rem;
            display: block;
        }
        
        .mobile-nav-header h2 {
            color: #333;
            font-size: 1.2rem;
            margin: 0 0 0.5rem 0;
        }
        
        .mobile-nav-close {
            position: absolute;
            top: 1rem;
            right: 1rem;
        }
        
        .mobile-nav-close {
            background: none;
            border: none;
            color: #333;
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0.5rem;
            min-width: 44px;
            min-height: 44px;
        }
        
        .mobile-nav-user-info {
            flex-shrink: 0;
            padding: 0.8rem 1rem;
            border-top: 1px solid rgba(0, 0, 0, 0.1);
            background: rgba(0, 0, 0, 0.05);
            font-size: 0.9rem;
            overflow-wrap: anywhere;
        }

        .mobile-nav ul {
            list-style: none;
            padding: 0;
            padding-bottom: 60px;
            margin: 0;
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            height: 100%;
        }
        
        .mobile-nav ul li {
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            width: 100%;
        }
        
        .mobile-nav-logout {
            background: none;
            border: 0;
            border-radius: 0;
            font: inherit;
            text-align: left;
            cursor: pointer;
        }

        .mobile-nav ul li a,
        .mobile-nav ul li .mobile-nav-logout {
            padding: 0.64rem 1rem;
            color: #333 !important;
            text-decoration: none;
            min-height: 44px;
            display: flex !important;
            align-items: center;
            width: 100%;
            visibility: visible !important;
            opacity: 1 !important;
        }
        
        .mobile-nav ul li a:hover,
        .mobile-nav ul li a:active,
        .mobile-nav ul li .mobile-nav-logout:hover,
        .mobile-nav ul li .mobile-nav-logout:active,
        .mobile-nav ul li a.active {
            background: rgba(52, 152, 219, 0.15);
        }
        
        .mobile-nav ul li a.active {
            font-weight: 600;
            border-left: 3px solid #3498db;
        }
        
        .mobile-nav-header {
            flex-shrink: 0;
        }
        
        /* Tablets use the compact hamburger chrome below (max-width: 1024px). */
        
        /* Compact (phones and tablets) */
        @media (max-width: 1024px) {
            /* Hide sidebar on compact viewports */
            .sidebar {
                display: none;
            }
            
            .main-content {
                margin-left: 0;
            }
            
            .event-filter-banner .container {
                padding: 0 10px;
                flex-direction: column;
                align-items: flex-start;
                gap: 0.5rem;
            }
            
            .event-filter-banner .btn {
                margin-left: 0 !important;
                width: 100%;
            }
            
            .container {
                padding: 10px;
            }
            
            header {
                display: block;
                padding: 0.5rem 0;
                padding-top: max(0.5rem, env(safe-area-inset-top));
                margin-bottom: 1rem;
            }
            
            header nav {
                flex-direction: row;
                align-items: center;
                gap: 0.5rem;
                padding: 0 10px;
                position: relative;
            }

            header .header-logo {
                display: block;
                width: 2.35rem;
                height: 2.35rem;
                max-width: 2.35rem;
                margin: 0;
            }
            
            header nav h1 {
                font-size: 1.1rem;
                flex: 1;
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            
            .menu-toggle {
                display: block;
            }
            
            header nav ul {
                display: none !important;
            }
            
            header .user-info {
                display: none !important;
            }
            
            /* Show mobile nav when active */
            .mobile-nav.active {
                display: flex !important;
            }
            
            .mobile-nav ul {
                display: block !important;
            }
            
            .mobile-nav ul li {
                display: block !important;
            }
            
            .mobile-nav ul li a {
                display: flex !important;
                visibility: visible !important;
            }
            
            .card {
                padding: 1rem;
                margin-bottom: 1rem;
            }
            
            .card h2 {
                font-size: 1.3rem;
            }
            
            /* Table responsive - horizontal scroll */
            .table-wrapper {
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                margin: 0 -1rem;
                padding: 0 1rem;
            }
            
            table {
                min-width: 600px;
                font-size: 0.85rem;
            }
            
            th, td {
                padding: 0.5rem 0.25rem;
                font-size: 0.85rem;
            }
            
            th {
                font-size: 0.8rem;
                white-space: nowrap;
            }
            
            /* Form improvements */
            .form-group {
                margin-bottom: 1.25rem;
            }
            
            label {
                font-size: 0.95rem;
                margin-bottom: 0.75rem;
            }
            
            input[type="text"],
            input[type="email"],
            input[type="password"],
            input[type="number"],
            input[type="date"],
            input[type="time"],
            input[type="datetime-local"],
            input[type="url"],
            input[type="tel"],
            select,
            textarea {
                font-size: 16px !important; /* Prevents zoom on iOS */
                padding: 0.75rem !important;
                min-height: 44px !important; /* Apple's recommended touch target */
                -webkit-appearance: none;
                border-radius: 4px;
            }
            
            .autocomplete-input {
                font-size: 16px !important;
                padding: 0.75rem !important;
                min-height: 44px !important;
            }
            
            /* Buttons */
            .btn {
                padding: 0.75rem 1.5rem !important;
                font-size: 1rem !important;
                min-height: 44px !important;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                -webkit-tap-highlight-color: transparent;
            }
            
            /* Stack actions vertically in cards/forms */
            .card > div:first-child .actions,
            .form-group .actions {
                flex-direction: column;
                gap: 0.5rem;
            }
            
            /* Keep table action buttons horizontal */
            tbody .actions {
                flex-direction: row !important;
                flex-wrap: wrap;
                gap: 0.5rem;
            }
            
            .card > div:first-child .actions a,
            .card > div:first-child .actions button,
            .form-group .actions a,
            .form-group .actions button {
                width: 100% !important;
                padding: 0.75rem !important;
                font-size: 0.9rem !important;
                min-height: 44px !important;
            }
            
            /* Table action buttons stay horizontal */
            tbody .actions a,
            tbody .actions button {
                width: auto !important;
                padding: 0.5rem 0.75rem !important;
                font-size: 0.85rem !important;
                min-height: 44px !important;
            }

            .producer-wine-chip {
                min-height: 44px;
            }

            /* Events list: card layout; name + sections all same font size on mobile */
            .events-list-page .events-list-cards {
                max-width: 100%;
                box-sizing: border-box;
            }
            .events-list-page .event-card-main,
            .events-list-page .event-card-details {
                padding: 0.5rem 0.75rem;
                max-width: 100%;
                box-sizing: border-box;
            }
            .events-list-page .event-card-date,
            .events-list-page .event-card-description {
                font-size: 0.9rem !important;
                line-height: 1.4;
                word-wrap: break-word;
                overflow-wrap: break-word;
            }
            .events-list-page .event-card-name {
                font-size: 1.1rem !important;
                font-weight: 600;
                line-height: 1.4;
                word-wrap: break-word;
                overflow-wrap: break-word;
            }
            .events-list-page .event-card-date,
            .events-list-page .event-card-description {
                color: #555;
            }
            .events-list-page .events-list-section {
                margin-bottom: 0.75rem;
                padding: 0.5rem 0.75rem;
                max-width: 100%;
                box-sizing: border-box;
            }
            .events-list-page .events-list-section-heading,
            .events-list-page .events-list-section-empty,
            .events-list-page .events-list-summary-line,
            .events-list-page .events-list-summary-line strong {
                font-size: 0.9rem !important;
                font-weight: 500;
                margin-bottom: 0.35rem;
            }
            .events-list-page .events-list-section-empty,
            .events-list-page .events-list-summary-line {
                margin: 0;
            }
            .events-list-page .event-wines-list {
                flex-direction: column;
                gap: 0.35rem;
            }
            .events-list-page .event-wine-chip,
            .events-list-page .event-retailer-chip {
                display: block !important;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
                font-size: 0.9rem !important;
                padding: 0.2rem 0.4rem !important;
                word-break: break-word;
                overflow-wrap: break-word;
            }
            .events-list-page .event-retailers-list {
                flex-direction: column;
                gap: 0.35rem;
            }
            .events-list-page .actions.admin-actions.event-card-actions {
                margin-top: 0.5rem;
                display: flex;
                flex-wrap: wrap;
                align-items: stretch;
                gap: 0.5rem;
            }
            .events-list-page .event-card-actions .btn,
            .events-list-page .event-card-actions .btn-icon {
                min-height: 44px;
            }
            .events-list-page .event-copy-link-btn {
                box-sizing: border-box;
                height: calc(1.5rem + 1.6 * 1rem);
                width: calc(1.5rem + 1.6 * 1rem);
                padding: 0;
            }
            .events-list-page .event-card-delete-btn {
                display: inline-flex;
                align-items: center;
                justify-content: center;
            }

            /* Manage event: entire page and all sections fit on mobile; no horizontal scroll */
            .manage-event-page {
                overflow-x: hidden;
                max-width: 100%;
                box-sizing: border-box;
            }
            .manage-event-page .card {
                max-width: 100%;
                min-width: 0;
                box-sizing: border-box;
            }
            .manage-event-page h2,
            .manage-event-page h3,
            .manage-event-page h4,
            .manage-event-page p,
            .manage-event-page .alert {
                word-wrap: break-word;
                overflow-wrap: break-word;
                max-width: 100%;
            }
            .manage-event-page .form-group,
            .manage-event-page form {
                max-width: 100%;
                box-sizing: border-box;
            }
            .manage-event-page input[type="text"],
            .manage-event-page input[type="number"],
            .manage-event-page select {
                max-width: 100%;
                box-sizing: border-box;
            }
            .manage-event-page .manage-event-wines-wrap,
            .manage-event-page .manage-event-retailers-wrap,
            .manage-event-page .manage-event-registrations-wrap {
                overflow-x: hidden;
                max-width: 100%;
            }
            .manage-event-page .manage-event-wines-table,
            .manage-event-page .manage-event-retailers-table,
            .manage-event-page .manage-event-registrations-table {
                display: block;
                min-width: 0 !important;
                width: 100% !important;
            }
            .manage-event-page .manage-event-wines-table thead,
            .manage-event-page .manage-event-retailers-table thead,
            .manage-event-page .manage-event-registrations-table thead {
                display: none;
            }
            .manage-event-page .manage-event-wines-table tbody,
            .manage-event-page .manage-event-retailers-table tbody,
            .manage-event-page .manage-event-registrations-table tbody {
                display: block;
            }
            .manage-event-page .manage-event-wines-table tbody tr,
            .manage-event-page .manage-event-retailers-table tbody tr,
            .manage-event-page .manage-event-registrations-table tbody tr {
                display: block;
                border: 1px solid #ddd;
                border-radius: 8px;
                margin-bottom: 1rem;
                padding: 0.75rem;
                background: #f9f9f9;
                box-sizing: border-box;
                max-width: 100%;
                min-width: 0;
            }
            .manage-event-page .manage-event-wines-table tbody td,
            .manage-event-page .manage-event-retailers-table tbody td,
            .manage-event-page .manage-event-registrations-table tbody td {
                display: block;
                padding: 0.35rem 0;
                border: none;
                font-size: 0.9rem;
                box-sizing: border-box;
                max-width: 100%;
                min-width: 0;
                word-wrap: break-word;
                overflow-wrap: break-word;
                word-break: break-word;
            }
            .manage-event-page .manage-event-wines-table tbody td[data-label="Wine"],
            .manage-event-page .manage-event-retailers-table tbody td[data-label="Retailer"],
            .manage-event-page .manage-event-registrations-table tbody td[data-label="Person"] {
                word-break: break-word;
            }
            .manage-event-page .manage-event-wines-table tbody td form,
            .manage-event-page .manage-event-wines-table tbody td form > div {
                max-width: 100%;
                min-width: 0;
            }
            .manage-event-page .manage-event-wines-table tbody td form > div[style*="flex"] {
                flex-wrap: wrap !important;
            }
            .manage-event-page .manage-event-wines-table .manage-event-inventory-form {
                display: grid !important;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                align-items: end;
                column-gap: 0.75rem !important;
            }
            .manage-event-page .manage-event-wines-table tbody td:empty,
            .manage-event-page .manage-event-retailers-table tbody td:empty,
            .manage-event-page .manage-event-registrations-table tbody td:empty {
                display: none;
            }
            .manage-event-page .manage-event-wines-table tbody td::before,
            .manage-event-page .manage-event-retailers-table tbody td::before,
            .manage-event-page .manage-event-registrations-table tbody td::before {
                content: attr(data-label);
                font-weight: 600;
                display: inline-block;
                margin-right: 0.5rem;
                min-width: 8em;
                color: #555;
            }
            .manage-event-page .manage-event-wines-table tbody td[data-label="Wine"]::before {
                display: block;
                margin-bottom: 0.15rem;
            }
            .manage-event-page .manage-event-wines-table tbody td[data-label="Actions"],
            .manage-event-page .manage-event-retailers-table tbody td[data-label="Actions"],
            .manage-event-page .manage-event-registrations-table tbody td[data-label="Actions"] {
                margin-top: 0.5rem;
                padding-top: 0.75rem;
                border-top: 1px solid #eee;
            }
            .manage-event-page .manage-event-wines-table tbody td[data-label="Actions"]::before,
            .manage-event-page .manage-event-retailers-table tbody td[data-label="Actions"]::before,
            .manage-event-page .manage-event-registrations-table tbody td[data-label="Actions"]::before {
                display: block;
                margin-bottom: 0.35rem;
            }
            
            /* Card header with actions */
            .card > div:first-child {
                flex-direction: column;
                align-items: stretch;
                gap: 1rem;
            }
            
            .card > div:first-child h2 {
                margin: 0;
            }
            
            .card > div:first-child .btn {
                width: 100% !important;
            }
            
            /* Inline grids stack on narrow screens */
            div[style*="grid"] {
                grid-template-columns: 1fr !important;
                gap: 1rem !important;
            }
            
            /* Autocomplete dropdown */
            .autocomplete-dropdown {
                max-height: 200px;
                font-size: 16px;
            }
            
            .autocomplete-item {
                padding: 0.75rem !important;
                min-height: 44px !important;
                font-size: 16px;
            }
            
            /* Alert messages */
            .alert {
                padding: 0.75rem;
                font-size: 0.9rem;
            }
            
            /* Login page specific */
            div[style*="max-width: 400px"] {
                max-width: 100% !important;
                margin: 50px auto !important;
                padding: 0 1rem;
            }

            .admin-filter-retailer-row {
                flex-direction: column;
                align-items: stretch;
            }
            .admin-filter-retailer-select {
                max-width: none;
                width: 100%;
                min-height: 44px;
                font-size: 16px;
            }

            .admin-page-toolbar {
                flex-direction: column;
                align-items: stretch;
            }
            .admin-page-toolbar-actions {
                width: 100%;
            }
            .admin-page-toolbar-actions .btn,
            .admin-page-toolbar-actions .btn-icon,
            .wine-page-toolbar-actions .btn,
            .wine-page-toolbar-actions .btn-icon {
                min-height: 44px;
                min-width: 44px;
            }
            /* Match the enlarged .btn padding (0.75rem) and font-size (1rem). */
            .admin-page-toolbar-actions .btn-icon,
            .wine-page-toolbar-actions .btn-icon {
                box-sizing: border-box;
                height: calc(1.5rem + 1.6 * 1rem);
                width: calc(1.5rem + 1.6 * 1rem);
                min-height: 0;
                min-width: 0;
                padding: 0;
            }
            .wine-scan-form {
                width: 100%;
            }
            .wine-scan-form label.btn {
                width: 100%;
                text-align: center;
            }

            .people-type-filter-btn,
            .reg-status-filter-btn {
                min-height: 44px;
                padding: 0.5rem 0.85rem;
            }

            .btn-icon {
                min-width: 44px;
                min-height: 44px;
            }

            /* Stack form footers (Create / Back) */
            form > div:last-child {
                flex-direction: column;
            }
            form > div:last-child .btn {
                width: 100%;
            }
        }
        
        @media (max-width: 480px) {
            nav h1 {
                font-size: 1rem;
            }
            
            .mobile-nav {
                width: 100%;
                left: -100%;
            }
            
            .card {
                padding: 0.75rem;
            }
            
            .card h2 {
                font-size: 1.1rem;
            }
            
            table {
                font-size: 0.75rem;
            }
            
            th, td {
                padding: 0.4rem 0.2rem;
            }
        }

/* Shared section navigation for Events, Field Orders, and Settings. */
.admin-ui .admin-section-tabs-card {
    margin-bottom: 1rem;
    border: 1px solid #e1e7e3;
    border-radius: 14px;
    box-shadow: 0 2px 8px #243f2f08;
    min-width: 0;
    overflow-wrap: anywhere;
}
.admin-section-tabs-card h2 {
    margin-top: 0;
}
.admin-ui .admin-section-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: .4rem;
    margin: 1rem 0 0;
    padding: 0;
    background: transparent;
}
.admin-section-tabs a {
    padding: .65rem .9rem;
    border-radius: 8px;
    color: #39473e;
    text-decoration: none;
    font-size: .9rem;
}
.admin-section-tabs a[aria-current] {
    background: #e8f0eb;
    color: #214f3c;
    font-weight: 700;
}
.admin-section-tabs a:focus-visible {
    outline: 3px solid #88b19a;
    outline-offset: 2px;
}
@media (max-width: 600px) {
    .admin-ui .admin-section-tabs-card { padding: 1rem; }
    .admin-ui .admin-section-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-left: -.25rem;
        margin-right: -.25rem;
    }
    .admin-section-tabs a { white-space: nowrap; }
}

.admin-ui .event-orders-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: .4rem;
    margin: 1rem 0;
    padding: 0;
    background: transparent;
}
.event-orders-tabs a {
    padding: .65rem .9rem;
    border-radius: 8px;
    color: #39473e;
    text-decoration: none;
    font-size: .9rem;
}
.event-orders-tabs a[aria-current] {
    background: #e8f0eb;
    color: #214f3c;
    font-weight: 700;
}
.event-orders-tabs a:focus-visible {
    outline: 3px solid #88b19a;
    outline-offset: 2px;
}

.admin-ui .settings-tabs {
    margin-bottom: 1.25rem;
}
.settings-tab-panel {
    padding-top: 0.25rem;
}
.settings-color-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.settings-color-row .js-settings-color-hex {
    width: 100%;
    max-width: 160px;
    padding: 0.5rem;
    font-size: 1rem;
}
.settings-color-picker {
    -webkit-appearance: none;
    appearance: none;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid #bbb;
    border-radius: 50%;
    cursor: pointer;
    background: #fff;
    overflow: hidden;
    flex-shrink: 0;
}
.settings-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}
.settings-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}
.settings-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}
@media (max-width: 640px) {
    .settings-color-picker {
        width: 2.75rem;
        height: 2.75rem;
        min-width: 44px;
        min-height: 44px;
    }
}

.admin-page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.admin-page-toolbar-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}
.admin-page-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
/* Desktop text buttons size from padding + line-height; icon buttons use a 44px minimum and sit taller. */
@media (min-width: 1025px) {
    .admin-page-toolbar-actions .btn-icon {
        box-sizing: border-box;
        height: calc(1rem + 1.6 * 0.9rem);
        width: calc(1rem + 1.6 * 0.9rem);
        min-height: 0;
        min-width: 0;
        padding: 0;
    }
}

.order-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.order-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.order-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}
.order-card-title {
    font-size: 1rem;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.order-card-row {
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.order-label {
    color: #666;
    margin-right: 0.35rem;
    font-size: 0.85rem;
}
.order-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.orders-store-header,
.orders-wine-header {
    flex-wrap: wrap;
    gap: 0.75rem;
}
.orders-group-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.orders-group-actions .btn,
.orders-group-actions .btn-icon {
    height: 2.1rem;
    min-height: 2.1rem;
}

.tenants-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
}
.tenant-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.tenant-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    word-wrap: break-word;
}
.tenant-card-row {
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.tenant-label {
    color: #666;
    margin-right: 0.35rem;
    font-size: 0.85rem;
}
.tenant-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.tenant-create-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.tenant-create-form > div {
    flex: 1;
    min-width: 220px;
}

.tasting-card-actions .btn,
.tasting-card-actions .btn-icon {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1024px) {
    .orders-store-header,
    .orders-wine-header {
        flex-direction: column;
        align-items: stretch !important;
    }
    .orders-group-actions {
        width: 100%;
    }
    .orders-group-actions .btn {
        width: 100%;
    }
    .orders-group-actions .btn,
    .orders-group-actions .btn-icon {
        min-height: 44px;
    }
    .tenant-create-form {
        flex-direction: column;
        align-items: stretch;
    }
    .tenant-create-form > div {
        min-width: 0;
        width: 100%;
    }
    .tenant-card-actions .btn,
    .tenant-card-actions .btn-icon {
        min-height: 44px;
    }
}

.joyous-license-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.joyous-license-modal[hidden] {
    display: none !important;
}
.joyous-license-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.joyous-license-modal-panel {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.wine-scan-busy {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.wine-scan-busy[hidden] {
    display: none !important;
}
.wine-scan-busy-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.wine-scan-busy-panel {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}
.wine-scan-busy-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid #e0e0e0;
    border-top-color: #27ae60;
    border-radius: 50%;
    animation: wine-scan-spin 0.8s linear infinite;
}
@keyframes wine-scan-spin {
    to { transform: rotate(360deg); }
}
.wine-scan-busy-title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
}
.wine-scan-busy-sub {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.wine-edit-photo-panel {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}
.wine-photo-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.75rem;
    cursor: pointer;
    text-align: center;
}
#wine-photo-file {
    display: none !important;
}
.wine-photo-file-name {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.875rem;
    color: #666;
}

/* Shared confirmations for order updates and outgoing admin email. */
.admin-email-dialog {
    margin: auto;
    width: min(560px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 28px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .25);
    color: #2c3e50;
}
.admin-email-dialog::backdrop { background: rgba(15, 23, 42, .5); }
.admin-arrival-progress progress { display: block; width: 100%; height: 12px; accent-color: #3498db; }
.admin-email-dialog h2 { margin: 0 0 12px; font-size: 1.3rem; }
.admin-email-dialog p { margin: 0 0 24px; line-height: 1.6; overflow-wrap: anywhere; }
.admin-email-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.admin-email-actions [hidden] { display: none; }
#sample-data-dialog [hidden] { display: none !important; }
.sample-data-blockers[hidden] { display: none !important; }
.sample-data-blockers { margin: 1rem 0; overflow-wrap: anywhere; }
.sample-data-blockers h4, .sample-data-blockers h5 { margin: 1rem 0 .5rem; }
.sample-data-blockers ul { padding-left: 1.25rem; }
.sample-data-blockers li { margin: .5rem 0; }
.sample-data-blockers a { text-decoration: underline; }
.admin-email-actions .btn-secondary { background: #fff !important; color: #334155 !important; border: 1px solid #cbd5e1; }
.admin-email-actions .btn:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
@media (max-width: 520px) {
    .admin-email-dialog { padding: 20px; }
    .admin-email-actions { flex-direction: column; }
    .admin-email-actions .btn { width: 100%; }
}

        /* A blank entry separates account actions from the alphabetical menu. */
        .sidebar-nav .admin-nav-spacer {
            height: calc(0.95rem * 1.6 + 0.96rem);
        }

        .mobile-nav ul li.admin-nav-spacer {
            height: calc(max(44px, 1em * 1.6 + 1.28rem) + 1px);
            border-bottom: 0;
        }

        header nav .admin-nav-spacer {
            width: 3rem;
        }

/* Manage-event sections use the same compact disclosure affordance as order groups. */
.manage-event-section > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.65rem; }
.manage-event-section > summary::-webkit-details-marker { display: none; }
.manage-event-section > summary::before { content: '▶'; font-size: 0.8rem; }
.manage-event-section[open] > summary::before { content: '▼'; }
.manage-event-section > summary h2 { margin: 0; }
.manage-event-section[open] > summary { margin-bottom: 1rem; }

.event-read-only-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.event-read-only-fields :disabled { opacity: 1; color: #555; -webkit-text-fill-color: #555; }

/* One tenant color for admin actions, including page-specific and inline styles.
   Navigation controls retain their link styling; embedded editors own their UI. */
body.admin-ui :is(.btn, .btn-icon, button, input[type="submit"], input[type="button"], input[type="reset"]):not(:where(.sidebar *, header *, .mobile-nav *, .tablet-logout-bar *, .tox *, .mce-container *)) {
    background: var(--admin-button-color, #333333) !important;
    border-color: var(--admin-button-color, #333333) !important;
    color: var(--admin-button-text-color, #ffffff) !important;
}
body.admin-ui :is(.btn, .btn-icon, button, input[type="submit"], input[type="button"], input[type="reset"]):not(:where(.sidebar *, header *, .mobile-nav *, .tablet-logout-bar *, .tox *, .mce-container *)):hover:not(:disabled) {
    background: color-mix(in srgb, var(--admin-button-color, #333333) 85%, var(--admin-button-text-color, #ffffff)) !important;
}
body.admin-ui button[aria-pressed="false"]:not(:where(.sidebar *, header *, .mobile-nav *, .tablet-logout-bar *, .tox *, .mce-container *)) {
    opacity: 0.6;
}

/* Shared Field Orders select appearance. Override legacy inline cosmetics while
   leaving page-specific widths intact and embedded editors in control of their UI. */
body.admin-ui select:not(:where(.tox *, .mce-container *)) {
    box-sizing: border-box;
    min-height: 44px !important;
    max-width: 100%;
    padding: .65rem .75rem !important;
    border: 1px solid #cbd5cd !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    background-color: #fff !important;
    color: #24392d;
}
body.admin-ui select:not([multiple]):not([size]):not(:where(.tox *, .mce-container *)),
body.admin-ui select[size="1"]:not([multiple]):not(:where(.tox *, .mce-container *)) {
    -webkit-appearance: none;
    appearance: none;
    height: 44px;
    padding-right: 2.5rem !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%2324392d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right .75rem center !important;
    background-size: 16px 16px !important;
}
body.admin-ui select:not(:where(.tox *, .mce-container *)):focus-visible {
    outline: 3px solid #88b19a;
    outline-offset: 2px;
}
@media (forced-colors: active) {
    body.admin-ui select:not(:where(.tox *, .mce-container *)) {
        -webkit-appearance: auto;
        appearance: auto;
        background-image: none !important;
    }
}
