/* ── Caribbean Design System ──────────────────────────────────── */
:root {
    --font-base: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Dark — deep ocean night */
    --color-bg: #04111E;
    --color-surface: rgba(255, 255, 255, 0.05);
    --color-surface-solid: #0B2340;
    --color-surface-muted: rgba(255, 255, 255, 0.07);
    --color-text: #E8F5FA;
    --color-text-muted: #7DC0D8;

    /* Caribbean sea — bright turquoise */
    --color-primary: #06B6D4;
    --color-primary-dim: rgba(6, 182, 212, 0.15);
    --color-primary-contrast: #04111E;
    --color-primary-hover: #0891B2;

    /* Golden sun & sand */
    --color-accent: #D97706;
    --color-accent-dim: rgba(217, 119, 6, 0.15);

    --color-warning: #f59e0b;

    --border-radius: 14px;
    --border-color: rgba(6, 182, 212, 0.12);
    --card-bg: rgba(11, 35, 64, 0.70);

    --glass-bg: rgba(4, 17, 30, 0.85);
    --glass-blur: blur(16px);

    --shadow-card: 0 4px 32px rgba(0, 0, 0, 0.55);
    --shadow-teal: 0 0 36px rgba(6, 182, 212, 0.14);
}


/* ── Light theme — warm sand & tropical sky ───────────────── */
[data-theme="light"] {
    --color-bg: #F3EFE4;
    --color-surface: rgba(0, 0, 0, 0.03);
    --color-surface-solid: #FFFDF5;
    --color-surface-muted: rgba(0, 0, 0, 0.045);
    --color-text: #0A1F2E;
    --color-text-muted: #3D5A6A;

    --border-color: rgba(6, 100, 140, 0.13);
    --card-bg: rgba(255, 253, 245, 0.96);

    --glass-bg: rgba(243, 239, 228, 0.92);

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.10);
    --shadow-teal: 0 0 24px rgba(6, 182, 212, 0.12);
}

[data-theme="light"] .hero-text h1 {
    color: var(--color-text);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-base);
    font-size: 16px;
    line-height: 1.65;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: #7DD3FC;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* ── App shell ───────────────────────────────────────────────── */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 3.75rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header nav,
.app-header .app-nav-inline {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

/* Drawer is rendered at root level only when open; on desktop it's not rendered. */
.app-nav-drawer { display: none; }
.app-nav-drawer-actions { display: none; }

/* Hamburger button — hidden on desktop, shown when the drawer is in play */
.app-nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    padding: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.app-nav-toggle:hover {
    background: var(--color-surface-muted);
    border-color: rgba(6,182,212,0.35);
}
.app-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.18s, opacity 0.18s;
}
.app-nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.app-nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.app-nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.app-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 17, 30, 0.55);
    backdrop-filter: blur(3px);
    border: 0;
    padding: 0;
    margin: 0;
    z-index: 199;
    cursor: pointer;
    animation: app-nav-fade-in 0.18s ease-out;
}
@keyframes app-nav-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes app-nav-slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.app-header nav a,
.app-nav-drawer a {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    transition: color 0.15s, background 0.15s;
}

.app-header nav a,
.app-nav-drawer a:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.app-header nav a.active,
.app-nav-drawer a.active {
    color: var(--color-primary);
    background: var(--color-primary-dim);
    box-shadow: inset 0 -2px 0 var(--color-primary);
}

.logo {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--color-text);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
}

.logo::before {
    content: "◈";
    color: var(--color-accent);
    font-size: 1rem;
}

.logo:hover {
    color: var(--color-text);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.user-pill {
    padding: 0.3rem 0.85rem;
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--color-text);
    transition: background 0.15s;
    cursor: pointer;
}

.user-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    text-decoration: none;
}

.user-pill-caret {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-left: 2px;
}

.user-menu-wrap {
    position: relative;
}

.user-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    background: var(--color-surface-solid, #fff);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    z-index: 999;
    overflow: hidden;
    padding: 4px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem 1rem;
    font-size: .875rem;
    color: var(--color-text);
    text-decoration: none;
    transition: background .12s;
    white-space: nowrap;
}

.user-menu-item:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
    text-decoration: none;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

main {
    flex: 1;
}

.content {
    padding: 2.5rem clamp(1rem, 5vw, 3rem);
    max-width: 1200px;
    margin: 0 auto;
    min-width: 0;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

/* ── Typography helpers ──────────────────────────────────────── */
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.7rem;
    color: var(--color-accent);
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.subtitle {
    color: var(--color-text-muted);
    max-width: 44rem;
    line-height: 1.65;
}

/* ── Sections spacing ────────────────────────────────────────── */
.hero,
.feature-grid,
.showcase,
.grid,
.card,
section {
    margin-bottom: 2.75rem;
}

/* ── Hero section ────────────────────────────────────────────── */
.hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    align-items: center;
    position: relative;
}

.hero-text h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin: 0.5rem 0 1rem;
    color: var(--color-text);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.75rem;
}

.hero-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.75rem;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: rgba(6, 182, 212, 0.2);
    box-shadow: var(--shadow-teal);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.subtle-text {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.45;
}

/* ── Grids ───────────────────────────────────────────────────── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.feature-grid article {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.showcase .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.grid.two-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.grid.three-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ── Form elements ───────────────────────────────────────────── */
.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid .checkbox,
.card .checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.form-grid button,
.form-inline button,
.card form button {
    margin-top: 0.5rem;
}

.card > button {
    margin-top: 0.75rem;
}

.form-inline {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

label {
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.88rem;
}

label > span {
    margin-right: 0.5rem;
}

.auth-card .remember {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    margin-top: 0.75rem;
}

input,
select,
textarea {
    padding: 0.7rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(6, 182, 212, 0.45);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.08);
}

input::placeholder {
    color: var(--color-text-muted);
}

select option {
    background: var(--color-surface-solid);
    color: var(--color-text);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.primary,
.ghost,
.link {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    white-space: nowrap;
}

.primary {
    background: var(--color-primary);
    color: var(--color-primary-contrast);
    box-shadow: none;
}

.primary:hover {
    background: var(--color-primary-hover);
    box-shadow: none;
    transform: none;
    text-decoration: none;
    color: var(--color-primary-contrast);
}

.ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-text-muted);
}

.ghost.danger {
    border-color: #dc2626;
    color: #dc2626;
}

.ghost.danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

.primary.danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.primary.danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
}

.ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--color-text);
    text-decoration: none;
}

.admin-back-button {
    position: relative;
    overflow: hidden;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding-inline: 1rem 1.15rem;
    gap: 0.45rem;
    border-color: color-mix(in srgb, var(--color-primary) 32%, var(--border-color));
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--color-primary) 12%, var(--color-surface-solid)),
        color-mix(in srgb, var(--color-accent) 10%, var(--color-surface-solid))
    );
    color: var(--color-text);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.admin-back-button:hover {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--color-primary) 18%, var(--color-surface-solid)),
        color-mix(in srgb, var(--color-accent) 14%, var(--color-surface-solid))
    );
    border-color: color-mix(in srgb, var(--color-primary) 48%, var(--border-color));
    color: var(--color-text);
    transform: translateY(-1px);
    text-decoration: none;
}

.admin-back-button::before {
    content: "←";
    font-size: 1rem;
    line-height: 1;
    color: var(--color-primary);
    margin-right: 0.1rem;
}

.admin-back-label {
    display: inline-block;
}

@media (max-width: 720px) {
    .admin-back-button {
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        justify-content: center;
    }

    .admin-back-button::before {
        margin-right: 0;
    }

    .admin-back-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

.link {
    background: none;
    color: var(--color-primary);
    padding: 0;
    font-size: inherit;
}

.link:hover {
    color: #7DD3FC;
    text-decoration: none;
}

.primary:disabled,
.ghost:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--color-primary, #06B6D4);
    font-size: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

button.small,
a.small {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
}

/* ── Status chips ────────────────────────────────────────────── */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background: var(--color-primary-dim);
    color: var(--color-primary);
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.status-chip.outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
}

/* ── Animated LIVE badge ─────────────────────────────────────── */
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

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

.badge.live::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: live-pulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.07);
    color: var(--color-text-muted);
}

.badge.live {
    background: rgba(16, 185, 129, 0.14);
    color: #10b981;
}

.badge.closed,
.badge.warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

/* ── Busy indicator ──────────────────────────────────────────── */
.busy-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.2rem;
    border-radius: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    font-size: 0.86rem;
    color: var(--color-text-muted);
}

.busy-indicator .spinner,
.boot-screen .spinner {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    border: 2px solid rgba(6, 182, 212, 0.2);
    border-top-color: var(--color-primary);
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

.boot-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 5rem 1rem;
    color: var(--color-text-muted);
}

/* ── Event hero ────────────────────────────────────────────── */
.event-hero {
    border-radius: var(--border-radius);
    overflow: hidden;
    min-height: 280px;
    border: 1px solid var(--border-color);
    background-size: cover;
    background-position: center;
}

.event-hero .overlay {
    background: linear-gradient(125deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.22) 100%);
    color: #fff;
    padding: 2.5rem;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hero-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.hero-meta small {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    display: block;
}

.hero-meta strong {
    font-size: 1rem;
    display: block;
    margin-top: 0.2rem;
}

.event-hero .eyebrow {
    color: #FCD34D;
}

.event-hero .subtitle {
    color: rgba(255, 255, 255, 0.82);
}

/* No hero image — blend into the page, use theme colours */
.event-hero-blank .overlay {
    background: none;
    color: var(--color-text);
}

.event-hero-blank .eyebrow {
    color: var(--color-accent);
}

.event-hero-blank .subtitle {
    color: var(--color-text-muted);
}

.event-hero-blank .hero-meta small {
    color: var(--color-text-muted);
}

.event-hero-blank .hero-meta strong {
    color: var(--color-text);
}

.event-hero-blank h1 {
    color: var(--color-text);
}

/* Status chips over a hero image — frosted dark pill so they're always legible
   regardless of what colours or patterns are in the photo behind them           */
.event-hero:not(.event-hero-blank) .status-chip {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.event-hero:not(.event-hero-blank) .status-chip.outline {
    background: rgba(0, 0, 0, 0.40);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
}

/* Blank hero (no image) — chips stay on-theme using CSS variables */
.event-hero-blank .status-chip {
    background: var(--color-primary-dim);
    color: var(--color-primary);
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.event-hero-blank .status-chip.outline {
    background: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

.event-hero .hero-actions {
    margin-top: 0;
}

.event-hero .hero-actions .share-button {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 0.65rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s ease;
}

.event-hero .hero-actions .share-button:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ── Overview card ───────────────────────────────────────────── */
.overview-card dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin: 1rem 0 0;
}

.overview-card dl div {
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.overview-card dt {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.overview-card dd {
    margin: 0.35rem 0 0;
    font-weight: 600;
    color: var(--color-text);
}

/* ── Accordion ───────────────────────────────────────────────── */
.assignment-group {
    margin-bottom: 1rem;
}

.accordion-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    color: var(--color-text);
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    /* Prevent long event names from overflowing the card on mobile */
    min-width: 0;
    overflow: hidden;
}

/* The event name span must be allowed to shrink and truncate */
.accordion-header > span:first-child {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.accordion-header .caret {
    font-size: 1rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.assignment-group .list {
    margin-top: 0;
}

.accordion-panel {
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem 0.5rem;
}

.accordion-body {
    padding: 0 0.5rem 0.5rem;
}

/* ── Metric parent groups (judge dashboard nested accordion) ──── */
.metric-parent-group {
    margin-bottom: 0.25rem;
}

.metric-parent-header {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--color-primary-dim);
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}

.metric-parent-label {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-parent-header:hover {
    background: rgba(6, 182, 212, 0.22);
}

.metric-parent-header .caret {
    font-size: 1rem;
    color: var(--color-primary);
}

.metric-child-list {
    padding-left: 0.75rem;
    border-left: 2px solid var(--color-primary-dim);
    margin-left: 0.5rem;
}

.metric-child-list li.selected button {
    color: var(--color-primary);
}

.metric-parent-context {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

/* ── Metric nav items (sidebar list) ─────────────────────────── */
.metric-nav-item {
    border-radius: 0.5rem;
    transition: background 0.15s;
}

.metric-nav-item button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    border-radius: 0.5rem;
}

.metric-nav-item button:hover {
    background: var(--color-surface-muted);
}

.metric-nav-item.active button {
    background: var(--color-primary-dim);
}

.metric-nav-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    flex: 1;
}

.metric-nav-item.active .metric-nav-name {
    color: var(--color-primary);
    font-weight: 600;
}

/* ── Submission pill ─────────────────────────────────────────── */
.submission-pill {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    white-space: nowrap;
}

.submission-pill.none {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
}

.submission-pill.partial {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.submission-pill.complete {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

[data-theme="light"] .submission-pill.complete {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

/* ── Score entry cards (right pane) ──────────────────────────── */
.score-entries {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.score-entry {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--color-surface-muted);
}

.score-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.score-entry-header > div {
    flex: 1 1 0;
    min-width: 0;
}

.score-entry-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.score-entry-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.score-entry-controls input[type="number"] {
    width: 6rem;
    flex-shrink: 0;
}

.score-feedback {
    display: block;
    margin-top: 0.75rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.score-entry.locked {
    opacity: 0.7;
    background: var(--color-surface);
}

.score-entry-locked-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin: 0;
}

/* ── Metric description in right pane ────────────────────────── */
.metric-description {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.score-range {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.score-range-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

/* ── Metric checkboxes ───────────────────────────────────────── */
.metric-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    padding-left: 0.5rem;
}

.metric-checkboxes .checkbox {
    flex-direction: row;
    gap: 0.35rem;
    font-weight: 500;
}

/* ── Judge metric blocks ─────────────────────────────────────── */
.judge-metric-block {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.judge-metric-block:first-of-type {
    margin-top: 0.5rem;
    padding-top: 0;
    border-top: none;
}

.judge-metric-block h4 {
    margin-bottom: 0.75rem;
}

/* ── Score actions ───────────────────────────────────────────── */
.score-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.score-status {
    display: inline-flex;
    margin-top: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.score-status.draft {
    color: var(--color-primary);
}

.score-status.submitted {
    color: #10b981;
}

/* ── Checkboxes ──────────────────────────────────────────────── */
.checkbox input[type="checkbox"] {
    appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 0.35rem;
    border: 2px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.checkbox input[type="checkbox"]::after {
    content: "";
    width: 0.45rem;
    height: 0.8rem;
    border-right: 2px solid var(--color-primary-contrast);
    border-bottom: 2px solid var(--color-primary-contrast);
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.15s;
}

.checkbox input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.checkbox input[type="checkbox"]:checked::after {
    opacity: 1;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    table-layout: fixed;
}

th,
td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.02);
    font-weight: 600;
}

[data-theme="light"] th {
    background: rgba(0, 0, 0, 0.03);
}

.table-wrapper tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background 0.1s;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

[data-theme="light"] tbody tr:hover {
    background: rgba(0, 0, 0, 0.04);
}

table select {
    max-width: 140px;
    width: 100%;
}

td.wrap {
    white-space: normal;
    overflow: visible;
}

input[type="file"] {
    max-width: 100%;
    width: 100%;
}

/* ── Filters ─────────────────────────────────────────────────── */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
}

.icon-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.alert.info {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.25);
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.2);
}

.alert.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.2);
}

/* ── Personal votes comparison ───────────────────────────────── */
.personal-votes-section {
    margin-top: 2rem;
}

.personal-votes-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.comparison-cell {
    white-space: normal !important;
}

.official-score {
    display: block;
    font-weight: 500;
}

.my-score {
    display: block;
    font-size: 0.78rem;
    color: var(--color-primary);
    margin-top: 0.15rem;
}

.personal-votes-empty {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--color-surface-muted);
    border-radius: var(--border-radius);
    color: var(--color-text-muted);
    font-size: 0.88rem;
}

.personal-votes-empty .material-symbols-outlined {
    font-size: 1.4rem;
    flex-shrink: 0;
    color: var(--color-primary);
}

/* ── Scoreboard Hub ──────────────────────────────────────────── */
.scoreboard-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.scoreboard-hub-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.scoreboard-hub-card:hover {
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: var(--shadow-teal);
}

.scoreboard-hub-card h3 {
    margin: 0.25rem 0 0;
    font-size: 1.05rem;
}

.scoreboard-hub-card a.primary {
    margin-top: 1rem;
    align-self: flex-start;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #ef4444;
    text-transform: uppercase;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.45; transform: scale(0.75); }
}

.scoreboard-hub-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--color-text-muted);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
}

.scoreboard-hub-empty .material-symbols-outlined {
    font-size: 2.5rem;
    opacity: 0.4;
}

.scoreboard-hub-empty h3 {
    margin: 0;
    color: var(--color-text);
}

/* ── Radzen DataGrid overrides ───────────────────────────────── */
.rz-admin-grid {
    --rz-grid-header-background-color: transparent;
    --rz-grid-row-background-color: transparent;
    --rz-grid-row-hover-background-color: rgba(255, 255, 255, 0.03);
    --rz-grid-row-selected-background-color: rgba(6, 182, 212, 0.08);
    --rz-text-color: var(--color-text);
    --rz-text-secondary-color: var(--color-text-muted);
    --rz-border-color: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
}

.rz-admin-grid .rz-datatable-thead th {
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .rz-admin-grid .rz-datatable-thead th {
    background: rgba(0, 0, 0, 0.03);
}

.rz-admin-grid .rz-data-row td {
    border-bottom: 1px solid var(--border-color);
    color: var(--color-text);
}

[data-theme="light"] .rz-admin-grid .rz-data-row:hover td {
    background: rgba(0, 0, 0, 0.03);
}

.rz-admin-grid .rz-pager {
    background: transparent;
    border-top: 1px solid var(--border-color);
    color: var(--color-text-muted);
}

/* Keep wide admin tables usable on desktop by allowing horizontal scroll
   instead of clipping right-most columns (e.g., Actions). */
.admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}

.admin-table-wrapper .rz-admin-grid {
    min-width: 1220px;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    border-radius: var(--border-radius);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    color: var(--color-text-muted);
}

/* ── Theme toggle ────────────────────────────────────────────── */
.theme-toggle select {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    font-size: 0.8rem;
}

.theme-toggle .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Auth card ───────────────────────────────────────────────── */
.auth-card {
    max-width: 27rem;
    margin: 3.5rem auto;
    padding: 2.25rem;
    border-radius: var(--border-radius);
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--color-primary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-card), var(--shadow-teal);
}

.auth-card h1 {
    margin: 0 0 0.3rem;
    font-size: 1.45rem;
    font-weight: 700;
}

.auth-card > p {
    color: var(--color-text-muted);
    font-size: 0.88rem;
    margin: 0 0 1.5rem;
    line-height: 1.55;
}

.auth-card form,
.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alt-action {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.86rem;
    color: var(--color-text-muted);
}

/* ── SSO buttons ─────────────────────────────────────────────── */
.sso-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.sso-divider::before,
.sso-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.sso-buttons {
    display: flex;
    gap: 0.75rem;
}

.sso-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: transparent;
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.sso-btn:hover {
    background: var(--color-primary-dim);
    border-color: var(--color-primary);
}

.sso-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}

/* ── Connected accounts ──────────────────────────────────────── */
.connected-account-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-color);
}

.connected-account-row:last-of-type {
    border-bottom: none;
}

.connected-account-name {
    flex: 1;
    font-weight: 500;
}

.connected-account-status {
    font-size: 0.8rem;
    color: #34A853;
}

.account-card-provider {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-right: 0.25rem;
}

/* ── Token display ───────────────────────────────────────────── */
.token-display {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    margin: 0.75rem 0;
}

.token-display code {
    font-family: "SF Mono", "Fira Code", "Fira Mono", monospace;
    font-size: 0.82rem;
    color: var(--color-primary);
    word-break: break-all;
}

/* ── Lists ───────────────────────────────────────────────────── */
.list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.list li {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.list li:last-child {
    border-bottom: none;
}

/* ── Judge breakdown ─────────────────────────────────────────── */
/* legacy, kept for safety */
.judge-breakdown {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.judge-breakdown li {
    display: flex;
    justify-content: space-between;
}

/* ── Scoreboard sub-metric drill-down list ───────────────────── */
.submetric-list {
    list-style: none;
    padding: 0;
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
}

.submetric-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.4rem;
    border-radius: 5px;
    transition: background 0.12s;
}

.submetric-row.drillable {
    cursor: pointer;
}

.submetric-row.drillable:hover {
    background: var(--color-surface-muted);
}

.submetric-name {
    flex: 1;
    color: var(--color-text);
    font-weight: 500;
}

.submetric-score {
    font-weight: 600;
    color: var(--color-text);
    min-width: 2rem;
    text-align: right;
    max-width: min(100%, 10rem);
    white-space: normal;
}

.poll-placement-block {
    margin-top: 0.2rem;
}

.poll-placement-inline {
    margin-left: 0.2rem;
    white-space: nowrap;
}

.submetric-chevron {
    font-size: 0.9rem !important;
    opacity: 0.5;
    flex-shrink: 0;
}

.judge-score-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.4rem 0.2rem 1.2rem;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.judge-score-name {
    flex: 1;
}

.judge-score-value {
    font-weight: 600;
    color: var(--color-text);
    min-width: 2rem;
    text-align: right;
}

.badge-xs {
    font-size: 0.65rem !important;
    padding: 0.1rem 0.4rem !important;
}

/* ── Scoreboard ──────────────────────────────────────────────── */
.scoreboard .table-wrapper {
    margin-top: 1rem;
}

.scoreboard-row td {
    transition: background 0.15s;
}

.scoreboard-row.expanded td,
.scoreboard-row:hover td {
    background: rgba(6, 182, 212, 0.04);
}

.scoreboard-row .rank {
    color: var(--color-text-muted);
    font-weight: 600;
    text-align: center;
}

.scoreboard-row .expand-toggle {
    text-align: center;
}

.scoreboard-detail-row td {
    padding: 0 !important;
    border-bottom: 1px solid var(--border-color);
}

.judge-totals-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem 0.6rem 3rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--color-surface-muted);
}

.judge-total-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.8rem;
}

.judge-total-name {
    color: var(--color-text-muted);
}

.judge-total-score {
    font-weight: 700;
    color: var(--color-text);
}

.judge-total-avg {
    border-color: var(--color-primary, #06B6D4);
    background: rgba(6, 182, 212, 0.06);
}

.judge-total-avg .judge-total-name,
.judge-total-avg .judge-total-score {
    color: var(--color-primary, #06B6D4);
}

.scoreboard-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 0.85rem 1rem 1rem 3rem;
    background: var(--card-bg);
}

.detail-metric {
    min-width: 180px;
    flex: 1 1 180px;
}

.detail-metric-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.detail-metric-overview {
    display: grid;
    gap: 0.85rem;
    margin-top: 0.8rem;
}

.detail-metric-parent {
    border: 1px solid var(--border-color);
    border-radius: 0.9rem;
    background: color-mix(in srgb, var(--color-surface-solid) 92%, white 8%);
    padding: 0.85rem 0.95rem;
}

.detail-metric-parent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.detail-metric-parent h4 {
    margin: 0 0 0.35rem;
}

.detail-metric-parent-desc {
    margin: 0 0 0.55rem;
    color: var(--color-text-muted);
}

.detail-submetric-block {
    margin-top: 0.65rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border-color);
}

.detail-submetric-block-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.45rem;
}

.detail-submetric-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.detail-submetric-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 0.7rem;
    padding: 0.45rem 0.65rem;
    background: color-mix(in srgb, var(--color-bg) 78%, white 22%);
}

/* ── Share link ──────────────────────────────────────────────── */
.share-link {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.85rem;
}

.share-link input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
}

/* ── Invitation item ─────────────────────────────────────────── */
.invitation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.invitation-item .hero-actions {
    margin-top: 0;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: var(--color-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), var(--shadow-teal);
    padding: 1.75rem;
    width: min(440px, 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Evaluation/legacy modals use `.modal` instead of `.modal-card` */
.modal {
    background: var(--color-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), var(--shadow-teal);
    padding: 1.75rem;
    width: min(440px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.modal-card form label {
    display: block;
    margin-top: 0.5rem;
}

.modal-card form input[type="email"] {
    width: 100%;
    margin-top: 0.25rem;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.export-selection-modal {
    width: min(640px, 100%);
    max-height: 90vh;
}

.export-selection-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.export-selection-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.export-selection-list {
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow-y: auto;
    max-height: min(52vh, 420px);
}

.export-selection-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.export-selection-item:last-child {
    border-bottom: none;
}

.export-selection-item input[type="checkbox"] {
    margin: 0;
}

.export-selection-name {
    min-width: 0;
    word-break: break-word;
}

.export-selection-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: right;
}

.export-judge-scores-option {
    margin-top: 0.25rem;
}

.poll-qr-modal {
    width: min(460px, 100%);
    max-height: 90vh;
}

.poll-qr-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.poll-qr-image {
    width: min(320px, 100%);
    aspect-ratio: 1;
    object-fit: contain;
    background: #fff;
    border-radius: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}

.poll-qr-link-row {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.poll-qr-link-row input {
    width: 100%;
    min-width: 0;
}

/* ── Large modal ─────────────────────────────────────────────── */
.modal-card.modal-large {
    width: min(880px, 100%);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.modal-header > div {
    flex: 1;
    min-width: 0;
}

.modal-tabs {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.tab {
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text);
}

.tab.active {
    background: var(--color-primary);
    color: var(--color-primary-contrast);
    border-color: var(--color-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding-top: 1.25rem;
}

.edit-flow-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 14px;
}

.edit-steps-card {
    position: sticky;
    top: 0;
    align-self: start;
}

.step-link {
    all: unset;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: .55rem;
    align-items: start;
    cursor: pointer;
    width: 100%;
}

.step-link span:last-child {
    display: block;
}

.edit-step-content {
    min-width: 0;
}

.modal-section {
    margin-bottom: 2rem;
}

.modal-section h4 {
    margin: 0 0 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
}

.modal-section.two-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.modal-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem 1rem;
    margin-bottom: 1rem;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modal-field.full-width {
    grid-column: 1 / -1;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
}

.modal-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem 1rem;
}

.modal-check-row {
    display: grid;
    grid-template-columns: 1.1rem 1fr;
    align-items: start;
    column-gap: 0.6rem;
    row-gap: 0.1rem;
    margin: 0;
}

.modal-check-row .rz-checkbox {
    margin: 0;
    margin-top: 0.15rem; /* align with first text line */
}

.modal-check-text {
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.3;
}

/* Description line beneath a checkbox label */
.setting-hint {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    line-height: 1.55;
    text-align: center;
}

/* Inside the modal check grid, the hint must span both grid columns
   (checkbox col + label col) or it collapses to the 1.1rem checkbox column */
.modal-check-row .setting-hint {
    grid-column: 1 / -1;
    text-align: left;
}

.toggle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-align: center;
}

.modal-inline-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.modal-section .rz-textbox,
.modal-section .rz-dropdown,
.modal-section .rz-datepicker,
.modal-section .rz-numeric,
.modal-section .rz-textarea {
    width: 100%;
}

.modal-section .rz-dropdown-label,
.modal-section .rz-inputtext {
    font-size: 1.05rem;
}

.modal-section .rz-dropdown-trigger,
.modal-section .rz-datepicker-trigger {
    border-radius: 0.6rem;
}

/* ── Radzen component theme integration ──────────────────────── */

/* Map Radzen's primary color to Caribbean teal */
:root {
    --rz-primary-color:         #06B6D4;
    --rz-primary-lighter-color: rgba(6, 182, 212, 0.10);
    --rz-primary-light-color:   rgba(6, 182, 212, 0.20);
    --rz-primary-dark-color:    #0891B2;
    --rz-on-primary-color:      #ffffff;
    --rz-border-radius-base:    10px;
    --rz-border-radius:         10px;
}

/* Filled primary buttons */
.rz-button.rz-variant-filled.rz-primary,
.rz-button.rz-shade-default.rz-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-primary-contrast);
    text-transform: none;
    font-weight: 600;
    letter-spacing: normal;
    border-radius: 999px;
    box-shadow: none;
}

.rz-button.rz-variant-filled.rz-primary:hover,
.rz-button.rz-shade-default.rz-primary:hover {
    background: #d97706;
    border-color: #d97706;
}

/* Text/outline buttons */
.rz-button.rz-variant-text,
.rz-button.rz-variant-outlined {
    text-transform: none;
    letter-spacing: normal;
}

/* Input fields */
.rz-inputtext,
.rz-textbox,
.rz-textarea {
    background: var(--color-surface) !important;
    border-color: var(--border-color) !important;
    color: var(--color-text) !important;
    border-radius: 10px !important;
}

.rz-inputtext:focus,
.rz-textbox:focus,
.rz-textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15) !important;
    outline: none !important;
}

/* Dropdowns */
.rz-dropdown,
.rz-select {
    background: var(--color-surface) !important;
    border-color: var(--border-color) !important;
    border-radius: 10px !important;
}

.rz-dropdown.rz-state-focused,
.rz-dropdown:focus-within {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15) !important;
}

.rz-dropdown-label {
    color: var(--color-text) !important;
    background: transparent !important;
}

.rz-dropdown-panel {
    background: var(--color-surface-solid) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow-card) !important;
}

.rz-dropdown-item:hover,
.rz-listbox-item:hover {
    background: var(--color-primary-dim) !important;
    color: var(--color-text) !important;
}

.rz-dropdown-item.rz-state-active,
.rz-listbox-item.rz-state-active {
    background: var(--color-primary-dim) !important;
    color: var(--color-primary) !important;
}

/* Numeric input */
.rz-numeric .rz-inputtext {
    border-radius: 10px !important;
}

/* Date picker */
.rz-datepicker .rz-inputtext {
    border-radius: 10px !important;
}

.rz-calendar .rz-state-active {
    background: var(--color-primary) !important;
    color: var(--color-primary-contrast) !important;
}

/* Checkboxes */
.rz-checkbox-box {
    border-color: var(--border-color) !important;
    background: var(--color-surface) !important;
    border-radius: 5px !important;
}

.rz-checkbox-box.rz-state-active {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

/* Light mode: keep white input surfaces */
[data-theme="light"] .rz-inputtext,
[data-theme="light"] .rz-textbox,
[data-theme="light"] .rz-textarea,
[data-theme="light"] .rz-dropdown,
[data-theme="light"] .rz-checkbox-box {
    background: #ffffff !important;
}

/* Dark mode: dark input surfaces */
[data-theme="dark"] .rz-inputtext,
[data-theme="dark"] .rz-textbox,
[data-theme="dark"] .rz-textarea,
[data-theme="dark"] .rz-dropdown {
    background: var(--color-surface-solid) !important;
}

/* ── Modal section dividers ──────────────────────────────────── */
.modal-body .modal-section + .modal-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.75rem;
}

/* Access tab second h4 needs extra top margin */
.modal-section h4 + h4,
.modal-section table + h4 {
    margin-top: 1.5rem;
}

/* ── Settings / window grids ─────────────────────────────────── */
.settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stacked-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.panel-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.25rem;
}

[data-theme="light"] .panel-card {
    background: rgba(0, 0, 0, 0.025);
}

.panel-card h4 {
    margin: 0 0 1rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    font-weight: 600;
}

.item-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.item-actions button {
    font-size: 0.8rem;
    padding: 0.25rem 0.7rem;
}

.window-form-grid {
    display: grid;
    gap: 0.9rem;
}

.window-datetime-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 0.9rem 1rem;
}

.window-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 0.65rem 1rem;
}

.window-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-weight: 500;
}

.window-check input[type="checkbox"] {
    margin: 0;
}

.toggle-grid {
    display: grid;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

/* ── Event table ───────────────────────────────────────────── */
.actions {
    text-align: right;
    white-space: nowrap;
}

.event-view-action {
    margin-right: 0.5rem;
}

.icon-button {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.25rem 0.55rem;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 1.1rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text);
}

.dropdown-fixed {
    position: fixed;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    min-width: 170px;
    z-index: 9000;
    overflow: hidden;
}

.dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 8999;
}

.menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.65rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--color-text);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.1s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.menu-item + .menu-item {
    border-top: 1px solid var(--border-color);
}

.event-table header {
    margin-bottom: 1rem;
}

.event-name {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* ── Quick-actions bar ───────────────────────────────────────── */
.quick-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.quick-status-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Live scoring list ───────────────────────────────────────── */
.contestant-scoring-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.contestant-scoring-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.025);
    flex-wrap: wrap;
}

.contestant-scoring-list li.live {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.05);
}

.contestant-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

img.contestant-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

div.contestant-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--color-accent, #06B6D4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.68rem;
    flex-shrink: 0;
    user-select: none;
    letter-spacing: 0.02em;
}

.contestant-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.window-input {
    width: 80px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

/* ── Showcase headers ────────────────────────────────────────── */
.showcase-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.showcase-header h2 {
    margin: 0;
}

.follow-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.follow-bar .error-text {
    color: #fca5a5;
    font-size: 0.82rem;
}

/* ── Blazor reconnect modal ──────────────────────────────────── */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

#components-reconnect-modal > div {
    background: var(--surface-card, #ffffff);
    color: var(--text-primary, #111827);
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

[data-theme="dark"] #components-reconnect-modal > div {
    background: #1f2937;
    color: #f9fafb;
}

/* ── Blazor error UI ─────────────────────────────────────────── */
#blazor-error-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #dc2626;
    color: white;
    padding: 0.5rem 1rem;
    display: none;
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    margin-left: 1rem;
    color: white;
    font-weight: 600;
}

/* ── Responsive: top nav becomes a slide-in drawer ─────────────── */
@media (max-width: 960px) {
    .app-header {
        padding: 0 1rem;
        height: 3.5rem;
        gap: 0.5rem;
        /* CRITICAL: Both backdrop-filter AND position:sticky (with z-index)
           establish a containing block / stacking context that traps the drawer
           and the hamburger inside the header. Strip all of that on mobile so
           drawer (z:200) and hamburger (z:201) can stack against the root
           viewport correctly. The header doesn't need to be sticky on mobile —
           the drawer takes over the surface anyway. */
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: var(--color-bg);
        position: relative;
        z-index: auto;
    }

    /* Show hamburger, push it to the right edge.
       z-index: 201 keeps it visible above the drawer (200) so the user can
       click it to close — the lines animate into an × via aria-expanded. */
    .app-nav-toggle {
        display: inline-flex;
        margin-left: auto;
        order: 3;
        position: relative;
        z-index: 201;
    }

    /* Hide the desktop inline nav on mobile — it lives in the drawer. */
    .app-header .app-nav-inline { display: none; }

    /* Header actions: hide everything except the notification bell, which keeps
       its unread badge visible at the top right at all sizes. */
    .app-header .header-actions { gap: 0.25rem; }
    .app-header .header-actions > *:not(.notification-bell) { display: none; }

    /* Mobile drawer (rendered at root level by MainLayout when _isNavOpen is true) */
    .app-nav-drawer {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(320px, 88%);
        max-width: 100vw;
        background: var(--color-surface-solid);
        border-left: 1px solid var(--border-color);
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
        z-index: 200;
        padding: 4.5rem 1rem 1.5rem;
        overflow-y: auto;
        animation: app-nav-slide-in 0.22s ease-out;
    }

    .app-nav-drawer a {
        padding: 0.7rem 0.95rem;
        border-radius: 10px;
        font-size: 0.95rem;
        text-align: left;
    }
    .app-nav-drawer a.active {
        box-shadow: inset 3px 0 0 var(--color-primary);
    }

    .app-nav-backdrop { display: block; }

    /* Drawer-only action block: theme toggle, sign out, etc. */
    .app-nav-drawer-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
    }
    .app-nav-drawer-actions .user-pill {
        padding: 0.55rem 0.95rem;
        text-align: left;
    }
    .app-nav-drawer-actions button,
    .app-nav-drawer-actions a {
        width: 100%;
        text-align: left;
        justify-content: flex-start;
    }
    /* Labelled theme toggle inside the drawer: icon + text on one row */
    .app-nav-drawer-actions .theme-toggle-with-label {
        display: inline-flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.55rem 0.95rem;
    }
    .app-nav-drawer-actions .theme-toggle-label {
        font-size: 0.92rem;
    }

    /* Lock body scroll when drawer is open so background can't scroll behind */
    .app-shell-nav-open { overflow: hidden; height: 100vh; }

    .page-header {
        flex-direction: column;
    }

    .form-inline {
        flex-direction: column;
    }

    .feature-grid {
        display: none;
    }

    .admin-table-wrapper {
        display: none;
    }

    .admin-mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 0.625rem;
    }
}

/* ── Account picker ──────────────────────────────────────── */
.account-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--color-text);
}

.account-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .account-card:hover {
    background: rgba(0, 0, 0, 0.04);
}

.account-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--color-accent, #06B6D4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    user-select: none;
}

.account-avatar.large {
    width: 3rem;
    height: 3rem;
    font-size: 1.2rem;
}

.account-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.account-card-name {
    font-weight: 500;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-card-email {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-card-chevron {
    color: var(--color-text-muted);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.selected-account-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

[data-theme="light"] .selected-account-header {
    background: rgba(0, 0, 0, 0.03);
}

/* ── Admin mobile cards ──────────────────────────────────── */
.admin-mobile-cards {
    display: none;
}

.admin-record-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.875rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.admin-record-card:hover {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .admin-record-card:hover {
    background: rgba(0, 0, 0, 0.03);
}

.admin-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.admin-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-card-sub {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-card-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex-shrink: 0;
}

.admin-card-chevron {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-left: 0.25rem;
    flex-shrink: 0;
}

/* ── Admin user detail page ──────────────────────────────── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1.25rem;
    margin: 0;
    font-size: 0.9rem;
}

.detail-list dt {
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
    padding-top: 0.1rem;
}

.detail-list dd {
    margin: 0;
    word-break: break-word;
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-action-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.detail-action-row select,
.detail-action-row .rz-dropdown {
    flex: 1;
}

@media (max-width: 960px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .modal-check-grid {
        grid-template-columns: 1fr;
    }

    .window-datetime-grid,
    .window-options-grid {
        grid-template-columns: 1fr;
    }

    .stacked-panels {
        grid-template-columns: 1fr;
    }
}

/* ── Image uploads ─────────────────────────────────────── */
.avatar-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    margin-bottom: 0.5rem;
    display: block;
}

.hero-preview {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    cursor: zoom-in;
}

/* ── Lightbox ─────────────────────────────────────────── */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
    animation: lbFadeIn 0.15s ease;
}

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

.lightbox-content {
    position: relative;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    padding: 0;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-image {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

/* ── Audit ────────────────────────────────────────────── */
.badge.success {
    background: rgba(16, 185, 129, 0.14);
    color: #10b981;
}

.scoreboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.scoreboard-header h3 {
    margin: 0;
}

.audit-comment {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin: 0.25rem 0 0;
}

.audit-action-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.audit-action-panel textarea {
    width: 100%;
    max-width: 100%;
    font-size: 0.85rem;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--color-surface);
    color: var(--color-text);
    resize: vertical;
}

tr.row-approved td {
    background: rgba(16, 185, 129, 0.04);
}

tr.row-queried td {
    background: rgba(245, 158, 11, 0.05);
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0;
}

.release-results-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.25);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.alert.success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #10b981;
}

/* ── Sub-metrics ─────────────────────────────────────────────── */
.sub-metrics-section {
    padding: 0.5rem 0;
}

.sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.sub-table th,
.sub-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.sub-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.form-grid.compact {
    gap: 0.5rem;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 0.75rem 0;
}

.metric-total {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

/* ── Choice voting ────────────────────────────────────────────── */
.choice-vote-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
}

.choice-vote-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}

.choice-vote-option:has(input:checked) {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

.choice-vote-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-vote-option input {
    accent-color: var(--color-primary);
}

/* ── Audit Dashboard ──────────────────────────────────────────── */

.audit-event-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.audit-event-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
}

.audit-event-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.audit-event-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.audit-score-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.audit-count-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

.chip-none    { background: var(--color-surface-muted); color: var(--color-text-muted); border-color: var(--border-color); }
.chip-pending { background: rgba(99,102,241,0.14); color: #6366f1; border-color: rgba(99,102,241,0.35); }
.chip-queried { background: rgba(239,68,68,0.14);  color: #ef4444; border-color: rgba(239,68,68,0.35); }
.chip-approved{ background: rgba(22,163,74,0.12);  color: #16a34a; border-color: rgba(22,163,74,0.35); }

[data-theme="dark"] .chip-pending { color: #a5b4fc; border-color: rgba(99,102,241,0.4); }
[data-theme="dark"] .chip-queried { color: #fca5a5; border-color: rgba(239,68,68,0.4); }
[data-theme="dark"] .chip-approved{ color: #86efac; border-color: rgba(34,197,94,0.4); }

/* ── Audit Review layout ──────────────────────────────────────── */

.audit-layout {
    align-items: flex-start;
}

.audit-sidebar {
    padding: 0.75rem 0;
    position: sticky;
    top: 1rem;
}

.audit-sidebar h4.sidebar-section-label {
    padding: 0.5rem 1rem 0.75rem;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0;
}

.audit-judge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    text-align: left;
    cursor: pointer;
    color: var(--color-text);
    gap: 0.5rem;
    transition: background 0.12s, border-color 0.12s;
}

.audit-judge-item:hover {
    background: rgba(255,255,255,0.04);
}

.audit-judge-item.selected {
    background: rgba(245,158,11,0.08);
    border-left-color: var(--color-primary);
}

.audit-judge-name {
    font-size: 0.9rem;
    font-weight: 500;
    flex: 1;
}

.audit-judge-pills {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.mini-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
}

.pill-pending  { background: rgba(99,102,241,0.14); color: #6366f1; border: 1px solid rgba(99,102,241,0.35); }
.pill-queried  { background: rgba(239,68,68,0.14);  color: #ef4444; border: 1px solid rgba(239,68,68,0.35); }
.pill-approved { background: rgba(22,163,74,0.12);  color: #16a34a; border: 1px solid rgba(22,163,74,0.35); }

[data-theme="dark"] .pill-pending { color: #a5b4fc; border-color: rgba(99,102,241,0.4); }
[data-theme="dark"] .pill-queried { color: #fca5a5; border-color: rgba(239,68,68,0.4); }
[data-theme="dark"] .pill-approved{ color: #86efac; border-color: rgba(34,197,94,0.4); }

/* ── Audit score panel ────────────────────────────────────────── */

.audit-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.audit-empty-state {
    color: var(--color-text-muted);
    text-align: center;
    padding: 2rem;
}

.audit-summary-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.audit-summary-chip {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.audit-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: rgba(245,158,11,0.07);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.audit-metric-group {
    padding: 1rem 1.25rem;
}

.audit-metric-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.audit-score-row {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

/* The top stripe: score info on the left, actions on the right */
.audit-score-row-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.audit-score-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.audit-score-row.audit-row-approved {
    opacity: 0.7;
}

.audit-score-row.audit-row-queried {
    background: rgba(239,68,68,0.04);
    margin: 0 -1.25rem;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
}

.audit-score-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.audit-sub-metric-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.audit-contestant-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.audit-score-value {
    font-size: 0.85rem;
    color: var(--color-text);
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.audit-score-value strong {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
}

.audit-score-max {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.audit-score-range {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    opacity: 0.75;
}

.audit-submitted-at {
    font-size: 0.75rem;
    opacity: 0.7;
}

.audit-comment-display {
    margin-top: 0.35rem;
    padding: 0.4rem 0.6rem;
    background: rgba(239,68,68,0.08);
    border-left: 3px solid rgba(239,68,68,0.5);
    border-radius: 4px;
    font-size: 0.8rem;
    color: #fca5a5;
}

.audit-comment-icon {
    margin-right: 0.35rem;
}

.audit-comment-by {
    opacity: 0.7;
    font-style: italic;
}

.audit-score-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    flex-shrink: 0;
}

.audit-action-panel {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
    min-width: 0;
}

.audit-comment-input {
    width: 100%;
    max-width: 100%;
    padding: 0.4rem 0.6rem;
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 0.82rem;
    resize: vertical;
}

.audit-action-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.audit-reopen-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin: 0;
}

button.warning {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.3);
}

button.warning:hover:not(:disabled) {
    background: rgba(239,68,68,0.25);
}

.badge.muted {
    background: rgba(255,255,255,0.06);
    color: var(--color-text-muted);
}

/* ── Incomplete Scores Modal ────────────────────────────────────────────── */

.incomplete-scores-modal {
    max-width: 520px;
    width: 100%;
}

.incomplete-scores-body {
    padding: 1rem 0;
    max-height: 340px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.incomplete-judge-block {
    padding: 0.75rem 1rem;
    background: var(--color-surface-muted);
    border-radius: 8px;
    border-left: 3px solid var(--color-warning, #f59e0b);
}

.incomplete-judge-name {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.incomplete-missing-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.incomplete-missing-list li {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.incomplete-contestant {
    font-weight: 500;
    color: var(--color-text);
}

.incomplete-sep {
    opacity: 0.4;
}

.incomplete-metric {
    color: var(--color-text-muted);
}

.incomplete-reminder-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.6rem 0;
    flex-wrap: wrap;
}

.incomplete-reminder-sent {
    font-size: 0.82rem;
    color: var(--color-success, #22c55e);
    font-weight: 500;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

/* ── Notification Bell ──────────────────────────────────────────────────── */

.notification-bell {
    position: relative;
}

.notification-trigger {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

.notification-pane {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    max-height: 480px;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
}

.notification-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.notification-pane-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.notification-pane-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.notification-pane-empty .material-symbols-outlined {
    font-size: 2rem;
    opacity: 0.5;
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
}

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

.notification-item:hover {
    background: var(--color-surface-alt, rgba(255,255,255,0.04));
}

.notification-item.unread {
    background: rgba(var(--color-primary-rgb, 99,102,241), 0.08);
}

.notification-item.unread:hover {
    background: rgba(var(--color-primary-rgb, 99,102,241), 0.14);
}

.notification-item-body {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 0.84rem;
    font-weight: 600;
    margin: 0 0 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item-message {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin: 0 0 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item-time {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    opacity: 0.7;
    margin: 0;
}

.notification-item-chevron {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
    align-self: center;
}

.notification-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, calc(100vw - 2rem));
    text-align: left;
    background: var(--color-surface-solid);
    color: var(--color-text);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--color-primary, #06B6D4);
    border-radius: 12px;
    box-shadow: 0 16px 34px rgba(0,0,0,0.35);
    padding: 0.75rem 0.9rem;
    z-index: 1200;
    cursor: pointer;
}

.notification-toast-title {
    font-weight: 700;
    font-size: 0.86rem;
    margin-bottom: 0.15rem;
}

.notification-toast-message {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@media (max-width: 480px) {
    .notification-pane {
        position: fixed;
        top: 60px;
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
    }
}

@media (max-width: 768px) {
    .submetric-score {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.12rem;
    }

    .poll-placement-inline {
        margin-left: 0;
        font-size: 0.72rem;
    }
}

/* ── Audit Overview tab ───────────────────────────────────────── */

.audit-overview {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.audit-ov-card {
    background: var(--color-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}

.audit-ov-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.audit-ov-header:hover {
    background: rgba(255,255,255,0.03);
}

.audit-ov-name {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 10rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audit-discrepancy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
}

.audit-discrepancy-dot {
    color: #f59e0b;
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

.audit-ov-judges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 1;
}

.audit-ov-judge-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    font-size: 0.78rem;
    line-height: 1.3;
    min-width: 5rem;
}

.audit-ov-judge-chip.chip-avg {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.25);
}

.audit-ov-judge-chip.chip-high {
    background: rgba(34, 197, 94, 0.10);
    border-color: rgba(34, 197, 94, 0.35);
}

.audit-ov-judge-chip.chip-low {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.35);
}

.audit-ov-judge-name {
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

.audit-ov-judge-score {
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

.audit-ov-judge-pct {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-text);
}

.audit-ov-chevron {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* Metric comparison grid inside expanded card */
.audit-ov-metric-group {
    border-top: 1px solid var(--border-color);
    padding: 0.4rem 0;
}

.audit-ov-metric-group-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: 0.3rem 1rem 0.2rem;
}

.audit-ov-metric-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.25rem 1rem;
    font-size: 0.82rem;
}

.audit-ov-metric-row:hover {
    background: rgba(255,255,255,0.025);
}

.audit-ov-col-headers {
    border-top: 1px solid var(--border-color);
    padding-top: 0.6rem;
    padding-bottom: 0.35rem;
    background: rgba(255,255,255,0.02);
}

.audit-ov-metric-name {
    flex: 0 0 12rem;
    font-size: 0.82rem;
    color: var(--color-text);
    padding-right: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.audit-ov-metric-cell {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.4rem;
    border-radius: 0.35rem;
    font-size: 0.82rem;
    min-width: 0;
    flex-wrap: wrap;
}

.audit-ov-metric-cell.cell-high {
    background: rgba(34, 197, 94, 0.10);
    color: #22c55e;
}

.audit-ov-metric-cell.cell-low {
    background: rgba(239, 68, 68, 0.10);
    color: #ef4444;
}

.audit-ov-avg-cell {
    background: rgba(245,158,11,0.06);
    color: var(--color-primary);
    font-weight: 600;
}

.audit-ov-col-label {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    background: none !important;
}

.audit-ov-max {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.audit-ov-missing {
    color: var(--color-text-muted);
    opacity: 0.5;
}

[data-theme="light"] .audit-ov-header:hover {
    background: rgba(0,0,0,0.025);
}
[data-theme="light"] .audit-ov-metric-row:hover {
    background: rgba(0,0,0,0.02);
}
[data-theme="light"] .audit-ov-col-headers {
    background: rgba(0,0,0,0.02);
}

/* ── Overview judge filter chips ─────────────────────────────── */

/* All judge chips are clickable toggles */
.audit-ov-judge-chip[role="button"] {
    cursor: pointer;
    position: relative;
    transition: opacity 0.15s, filter 0.15s, outline 0.12s;
    user-select: none;
}

.audit-ov-judge-chip[role="button"]:hover {
    outline: 2px solid rgba(6, 182, 212, 0.45);
    outline-offset: 1px;
}

/* Active (included in comparison table) */
.audit-ov-judge-chip.judge-chip-on {
    opacity: 1;
}

/* Deselected (hidden from comparison table) */
.audit-ov-judge-chip.judge-chip-off {
    opacity: 0.35;
    filter: grayscale(0.85);
}

.audit-ov-judge-chip.judge-chip-off:hover {
    opacity: 0.6;
    filter: grayscale(0.4);
}

/* Discrepancy flag inside chip name */
.audit-ov-chip-disc {
    font-size: 0.68rem;
    color: #f59e0b;
    margin-left: 0.2rem;
    vertical-align: middle;
}

/* Small ✓ / + toggle indicator at bottom of chip */
.audit-ov-chip-toggle {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-text-muted);
    opacity: 0.6;
    margin-top: 0.1rem;
}

.judge-chip-on .audit-ov-chip-toggle {
    color: #22c55e;
    opacity: 0.8;
}

.judge-chip-off .audit-ov-chip-toggle {
    color: var(--color-text-muted);
    opacity: 0.5;
}

/* "N hidden" hint shown in the metric name column when filter is active */
.audit-ov-filter-hint {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    opacity: 0.75;
}

[data-theme="light"] .audit-ov-filter-hint {
    background: rgba(0,0,0,0.05);
}

/* ── Overview inline query ────────────────────────────────────── */

/* Queryable cells get a pointer + subtle hover affordance */
.ov-cell-queryable {
    cursor: pointer;
    position: relative;
    transition: background 0.12s, outline 0.12s;
    border-radius: 0.35rem;
}

.ov-cell-queryable:hover {
    background: rgba(6, 182, 212, 0.10) !important;
    outline: 1px solid rgba(6, 182, 212, 0.30);
}

/* "query" hint text — hidden by default, shown on hover */
.ov-query-hint {
    display: none;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-left: 0.3rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ov-cell-queryable:hover .ov-query-hint,
.ov-cell-active .ov-query-hint {
    display: inline;
}

/* Active (selected for query) cell */
.ov-cell-active {
    background: rgba(6, 182, 212, 0.14) !important;
    outline: 2px solid rgba(6, 182, 212, 0.50) !important;
    border-radius: 0.35rem;
}

/* Query panel that slides in below the metric row */
.audit-ov-query-panel {
    margin: 0.25rem 1rem 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface-solid);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-left: 3px solid var(--color-primary);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.audit-ov-query-context {
    font-size: 0.82rem;
    color: var(--color-text);
    line-height: 1.4;
}

.audit-ov-query-context strong {
    color: var(--color-text);
}

.audit-ov-query-context em {
    color: var(--color-text-muted);
}

.audit-ov-query-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Submission pill: queried / reopened states ──────────────── */
.submission-pill.queried {
    background: rgba(6, 182, 212, 0.18);
    color: #b45309;
}

.submission-pill.reopened {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* ── Score progress lock (one-contestant-at-a-time) ─────────── */
.score-progress-lock-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0.5rem;
    margin-bottom: 0.65rem;
    font-size: 0.875rem;
    color: var(--color-text);
}

.score-entry-progress-locked {
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
    background: var(--color-surface);
}

.score-entry-progress-lock-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: 0;
    font-style: italic;
}

/* ── Score entry: queried banner ─────────────────────────────── */
.score-entry-queried-banner {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.65rem 0.85rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 3px solid #d97706;
    border-radius: 0.5rem;
    margin-bottom: 0.65rem;
    font-size: 0.875rem;
}

.score-entry-queried-banner .queried-icon {
    font-size: 1rem;
    margin-right: 0.35rem;
}

.queried-comment {
    margin: 0.3rem 0 0;
    font-style: italic;
    color: var(--color-text);
    font-size: 0.85rem;
}

.queried-hint {
    margin: 0.25rem 0 0;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* ── Score entry: reopened (action required) banner ──────────── */
.score-entry-reopened {
    border-color: rgba(239, 68, 68, 0.35);
}

.score-entry-reopen-banner {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.65rem 0.85rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-left: 3px solid #dc2626;
    border-radius: 0.5rem;
    margin-bottom: 0.65rem;
    font-size: 0.875rem;
}

.score-entry-reopen-banner .reopen-icon {
    font-size: 1rem;
    margin-right: 0.35rem;
}

/* Judge response comment textarea */
.judge-comment-input {
    width: 100%;
    min-height: 4rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--color-surface);
    color: var(--color-text);
    resize: vertical;
    font-family: inherit;
}

/* ── Audit correspondence thread ─────────────────────────────── */
.audit-thread {
    margin-top: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    overflow: hidden;
    width: 100%;
}

.thread-loading,
.thread-empty {
    padding: 0.75rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.thread-message {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.thread-message:last-of-type {
    border-bottom: none;
}

.thread-message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.thread-author {
    font-weight: 600;
    font-size: 0.875rem;
}

.thread-role-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.thread-message.thread-auditor .thread-role-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #4f46e5;
}

.thread-message.thread-manager .thread-role-badge {
    background: rgba(6, 182, 212, 0.15);
    color: #b45309;
}

.thread-message.thread-judge .thread-role-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.thread-action-label {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.thread-time {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.thread-body {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.thread-comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface-muted);
    border-top: 1px solid var(--border-color);
}

.thread-comment-form .audit-comment-input {
    width: 100%;
    min-height: 5rem;
}

/* Audit reopen panel: secondary button (for "Approve as-is") */
button.secondary {
    background: var(--color-surface-muted);
    color: var(--color-text);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

button.secondary:hover:not(:disabled) {
    background: var(--border-color);
}

button.secondary.small {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE STYLES — phones & small tablets (≤ 768px)
   Desktop rules above are untouched.
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Content padding ─── */
    article.content {
        padding: 1rem;
    }

    .grid, .card, section {
        margin-bottom: 1.5rem;
    }

    /* ── Header — tighten action row ─── */
    .header-actions {
        gap: 0.35rem;
        /* allow actions to shrink on very narrow screens */
        flex-wrap: wrap;
        max-width: calc(100vw - 2rem);  /* never wider than the viewport */
    }

    .user-pill {
        font-size: 0.78rem;
        padding: 0.28rem 0.6rem;
        /* truncate long display names instead of expanding width */
        max-width: 7rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* ── Page header — already column, fix alignment ─── */
    .page-header {
        align-items: flex-start;
        gap: 0.6rem;
    }

    .page-header h1 {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }

    /* ── Grids → single column ─── */
    .grid.two-columns,
    .grid.three-columns {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* ── Card padding ─── */
    .card {
        padding: 1rem;
    }

    .panel-card {
        padding: 0.875rem;
    }

    /* ── Admin mobile cards — show instead of table ─── */
    /* Base rule (.admin-mobile-cards { display:none }) appears after the old
       media query in the file, so it was overriding it. This block is last,
       so it wins correctly. */
    .admin-mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 0.625rem;
    }

    .admin-table-wrapper {
        display: none;
    }

    /* ── Filters — labels full width, icon buttons stay compact ─── */
    .filters > label {
        flex: 1 1 100%;
        width: 100%;
    }

    .filters > .icon-btn {
        flex: 0 0 auto;
        align-self: flex-end;
    }

    /* ── Event table → card layout ─── */
    .event-table .table-wrapper {
        border: none;
        background: transparent;
        border-radius: 0;
        overflow-x: visible;
    }

    .event-table table {
        display: block;
        table-layout: unset;
    }

    .event-table thead {
        display: none;
    }

    .event-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.625rem;
    }

    .event-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.4rem 0.75rem;
        padding: 0.9rem 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        background: var(--card-bg);
        transition: background 0.15s;
    }

    .event-table tbody tr:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    [data-theme="light"] .event-table tbody tr:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    .event-table tbody td {
        display: block;
        padding: 0;
        border: none;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    /* Event name — full row */
    .event-table tbody td:first-child {
        flex: 0 0 100%;
        width: 100%;
    }

    /* Date + location — small muted text */
    .event-table tbody td:nth-child(2),
    .event-table tbody td:nth-child(3) {
        font-size: 0.82rem;
        color: var(--color-text-muted);
    }

    /* Status chip — fills remaining space */
    .event-table tbody td:nth-child(4) {
        flex: 1;
    }

    /* Action button — pushed right */
    .event-table tbody td:nth-child(5) {
        margin-left: auto;
    }

    /* ── Scoreboard — hide per-metric columns, keep rank/name/total ─── */
    .scoreboard thead th:nth-child(n+4):not(:last-child),
    .scoreboard tbody td:nth-child(n+4):not(:last-child) {
        display: none;
    }

    /* Expanded detail — remove left indent from rank column */
    .judge-totals-bar {
        padding-left: 1rem;
    }

    .scoreboard-detail {
        padding-left: 1rem;
        gap: 0.75rem;
    }

    /* Metric detail blocks — each full width */
    .detail-metric {
        min-width: 100%;
        flex: 1 1 100%;
    }

    /* ── Event hero ─── */
    .event-hero {
        min-height: 200px;
    }

    .event-hero .overlay {
        min-height: 200px;
        padding: 1.25rem;
    }

    .hero-meta {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin: 0.85rem 0;
    }

    .event-hero .hero-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* ── Quick actions bar ─── */
    .quick-actions-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .quick-status-actions {
        width: 100%;
    }

    /* ── Contestant live scoring list ─── */
    .contestant-scoring-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .contestant-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .contestant-controls button {
        flex: 1;
    }

    /* ── Follow bar ─── */
    .follow-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .follow-bar button {
        width: 100%;
    }

    /* ── Release results bar ─── */
    .release-results-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* ── Sub-metrics table → list ─── */
    .sub-table {
        font-size: 0.82rem;
    }

    .sub-table thead {
        display: none;
    }

    .sub-table table {
        display: block;
    }

    .sub-table tbody {
        display: block;
    }

    .sub-table tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem 0.75rem;
        padding: 0.5rem 0.25rem;
        border-bottom: 1px solid var(--border-color);
    }

    .sub-table td {
        display: block;
        padding: 0;
        border: none;
        white-space: normal;
        overflow: visible;
    }

    /* ── Modals → bottom sheet on mobile ─── */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 1.25rem 1.25rem 0 0;
        overflow-y: auto;
        padding: 1.25rem;
    }

    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 1.25rem 1.25rem 0 0;
        overflow-y: auto;
        padding: 1.25rem;
    }

    .modal-card.modal-large {
        width: 100%;
        max-width: 100%;
        /* always fill at least 70 % of the viewport so short-content tabs
           (Windows / Auditors / Access) behave as a proper bottom sheet
           rather than a tiny floating card mid-screen */
        min-height: 70vh;
        max-height: 92vh;
        border-radius: 1.25rem 1.25rem 0 0;
        /* respect iPhone home-indicator so bottom content isn't clipped */
        padding-bottom: env(safe-area-inset-bottom, 1rem);
    }

    .export-selection-modal {
        width: 100%;
        max-width: 100%;
    }

    .export-selection-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .export-selection-meta {
        grid-column: 2;
        text-align: left;
        margin-top: -0.2rem;
    }

    .poll-qr-link-row {
        grid-template-columns: 1fr;
    }

    /* make modal-body fill the remaining card height so content is
       top-aligned inside the sheet, not centred in a short flex child */
    .modal-card.modal-large .modal-body {
        flex: 1;
        min-height: 0;         /* required for flex children to shrink/scroll */
        overflow-y: auto;
    }

    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    .edit-flow-layout {
        grid-template-columns: 1fr;
    }

    .edit-steps-card {
        position: static;
    }

    .modal-section.two-columns {
        grid-template-columns: 1fr;
    }

    .modal-footer,
    .modal-actions {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

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

    /* ── Form submit buttons — full width on mobile ─── */
    .auth-card form button.primary,
    .card > button.primary,
    .card > button.ghost {
        width: 100%;
    }

    /* ── Judge dashboard — sidebar stacks above scoring ─── */
    .grid.two-columns .card:first-child {
        order: 2;
    }

    .score-entry-header {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* ── Audit dashboard ─── */
    .audit-panel {
        padding: 0.75rem;
    }

    .audit-score-row-top {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .audit-action-buttons {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .audit-action-buttons button {
        flex: 1;
    }

    /* ── Audit overview ─── */
    .audit-ov-judges {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    /* ── Thread comments ─── */
    .thread-message-header {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    /* ── Item actions ─── */
    .item-actions {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* ── Section divider ─── */
    .section-divider {
        margin: 1rem 0;
    }

    /* ── Home hero ─── */
    .hero-actions {
        flex-direction: column;
        gap: 0.6rem;
    }

    .hero-actions a,
    .hero-actions button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* ── Judge scoring table → stacked rows ─── */
    .judge-metric-block table thead,
    .score-table thead { display: none; }

    .judge-metric-block table tbody tr,
    .score-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.35rem 0.5rem;
        padding: 0.7rem 0;
        border-bottom: 1px solid var(--border-color);
        align-items: center;
    }

    .judge-metric-block table td,
    .score-table td {
        padding: 0;
        border: none;
        white-space: normal;
    }

    /* Contestant name spans full width */
    .judge-metric-block table td:nth-child(1),
    .score-table td:nth-child(1) {
        grid-column: 1 / -1;
        font-weight: 600;
        font-size: 0.9rem;
    }

    /* Score input takes the flex space */
    .judge-metric-block table td:nth-child(2) input[type="number"],
    .score-table td:nth-child(2) input[type="number"] {
        width: 100%;
        min-width: 0;
    }

    /* ── Metrics list table → flex rows ─── */
    .metrics-table thead { display: none; }
    .metrics-table tbody { display: block; }

    .metrics-table tbody tr {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.6rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .metrics-table td {
        padding: 0;
        border: none;
        white-space: normal;
    }

    .metrics-table td:nth-child(1) { flex: 1; min-width: 0; font-weight: 500; }

    .metrics-table td:nth-child(2) {
        font-size: 0.8rem;
        color: var(--color-text-muted);
        white-space: nowrap;
    }

    .metrics-table td.actions {
        display: flex;
        gap: 0.25rem;
        align-items: center;
        flex-shrink: 0;
    }

    .detail-metric-parent-header,
    .detail-submetric-block-header,
    .detail-submetric-list li {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ── Assignments table → 2-column grid cards ─── */
    .assignments-table thead { display: none; }
    .assignments-table tbody { display: block; }

    .assignments-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.2rem 0.5rem;
        padding: 0.65rem 0;
        border-bottom: 1px solid var(--border-color);
        align-items: center;
    }

    .assignments-table td { padding: 0; border: none; white-space: normal; }
    .assignments-table td:nth-child(1) { font-weight: 500; font-size: 0.9rem; }
    .assignments-table td:nth-child(2) { color: var(--color-text-muted); font-size: 0.85rem; }

    .assignments-table td:nth-child(3) {
        font-size: 0.78rem;
        color: var(--color-text-muted);
    }

    .assignments-table td.actions { justify-self: end; }

    /* ── Scoring windows table → stacked cards ─── */
    .windows-table thead { display: none; }
    .windows-table tbody { display: block; }

    .windows-table tbody tr {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .windows-table td {
        display: block;
        padding: 0.1rem 0;
        border: none;
        white-space: normal;
    }

    .windows-table td:nth-child(1) { font-weight: 600; font-size: 0.9rem; }
    .windows-table td:nth-child(2) { font-size: 0.8rem; color: var(--color-text-muted); }
    .windows-table td:nth-child(3) { font-size: 0.78rem; color: var(--color-text-muted); }

    .windows-table td.actions {
        display: flex;
        gap: 0.4rem;
        margin-top: 0.4rem;
    }

    /* ── Shared-users table → stacked cards ─── */
    .shared-users-table thead { display: none; }
    .shared-users-table tbody { display: block; }

    .shared-users-table tbody tr {
        display: block;
        padding: 0.65rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .shared-users-table td {
        display: block;
        padding: 0.1rem 0;
        border: none;
    }

    .shared-users-table td:nth-child(1) { font-weight: 600; }
    .shared-users-table td:nth-child(2) { font-size: 0.82rem; color: var(--color-text-muted); }
    .shared-users-table td:nth-child(3) { font-size: 0.82rem; }

    .shared-users-table td.actions { margin-top: 0.35rem; }
}

/* ── Mobile infinite scroll indicator ────────────────────────── */
#mobile-scroll-sentinel {
    height: 20px;
    pointer-events: none;
}

.mobile-load-more-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    gap: 0.5rem;
}

/* ── Scoring countdown timer chip ────────────────────────────── */
.scoring-timer {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--color-bg-subtle, #f0f4f8);
    color: var(--color-text-secondary, #4a5568);
    border: 1px solid var(--color-border, #e2e8f0);
    white-space: nowrap;
}

.scoring-timer.urgent {
    background: #fff5f5;
    color: #c53030;
    border-color: #fed7d7;
}

.scoring-timer.expired {
    background: var(--color-bg-subtle, #f7fafc);
    color: var(--color-text-muted, #a0aec0);
    border-color: var(--color-border, #e2e8f0);
    font-weight: 400;
    text-decoration: line-through;
    text-decoration-color: var(--color-text-muted, #a0aec0);
}

/* ── Live auto-refresh indicator dot ─────────────────────────── */
.live-poll-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38a169;
    margin-left: 0.4rem;
    vertical-align: middle;
    animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ═══════════════════════════════════════════════════════════════
   SMALL PHONES (≤ 480px) — tighten further
═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    article.content {
        padding: 0.75rem;
    }

    /* Auth card */
    .auth-card {
        padding: 1.25rem;
        border-radius: 1rem;
    }

    /* Page title */
    .page-header h1 {
        font-size: 1.4rem;
    }

    /* Hero meta → single column */
    .hero-meta {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    /* Event hero */
    .event-hero {
        min-height: 160px;
    }

    .event-hero .overlay {
        min-height: 160px;
        padding: 0.85rem;
    }

    /* Scoreboard expanded detail */
    .scoreboard-detail {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .judge-totals-bar {
        padding: 0.5rem;
        gap: 0.35rem;
    }

    .judge-total-chip {
        font-size: 0.75rem;
        padding: 0.15rem 0.5rem;
    }

    /* Status chip */
    .status-chip {
        font-size: 0.68rem;
        padding: 0.15rem 0.55rem;
    }

    /* Modal */
    .modal-card {
        max-height: 96vh;
        padding: 1rem;
    }

    /* Card */
    .card {
        padding: 0.875rem;
    }

    /* Score entry controls tighter */
    .score-entry {
        padding: 0.75rem;
    }
}


/* ── Event type badge ──────────────────────────────────────── */
.event-type-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--color-primary-dim);
    color: var(--color-primary);
    border: 1px solid color-mix(in srgb, var(--color-primary) 30%, transparent);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* ── Tag chips ───────────────────────────────────────────────── */
.event-meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tag-chip {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

/* Pin button active state */
.active-pin {
    background: var(--color-primary-dim);
    color: var(--color-primary);
    border-color: color-mix(in srgb, var(--color-primary) 30%, transparent);
}

/* field-hint inline label */
.field-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin-left: 0.35rem;
}

/* ── Public Directory ─────────────────────────────────────────── */

/* Hero */
.directory-hero {
    background: var(--color-surface-solid);
    border-bottom: 1px solid var(--border-color);
    padding: 4rem 1.5rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.directory-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(6, 182, 212, 0.14) 0%, transparent 70%);
    pointer-events: none;
}

.directory-hero-inner {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.directory-hero .eyebrow {
    margin-bottom: 0.6rem;
}

.directory-hero h1 {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 0.75rem;
    color: var(--color-text);
}

.directory-hero-sub {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0 0 1.75rem;
}

/* Search row */
.directory-search-row {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--color-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.3rem 0.3rem 0.3rem 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.directory-search-row:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.10);
}

.directory-search-icon {
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 0.6rem;
}

.directory-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-size: 0.975rem;
    outline: none;
    padding: 0.35rem 0;
}

.directory-search-row .primary {
    border-radius: calc(var(--border-radius) - 4px);
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Filter bar */
.directory-filters {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem clamp(1rem, 5vw, 3rem);
    position: sticky;
    top: 3.75rem;
    z-index: 50;
}

.directory-filter-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

.directory-filter-row select {
    padding: 0.4rem 2.2rem 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--color-surface-solid);
    color: var(--color-text);
    font-size: 0.845rem;
    font-weight: 500;
}

.directory-tag-input {
    flex: 1;
    min-width: 140px;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--color-surface-solid);
    color: var(--color-text);
    font-size: 0.845rem;
}

/* Results area */
.directory-results {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem clamp(1rem, 5vw, 3rem) 4rem;
}

/* Empty state */
.directory-empty {
    text-align: center;
    padding: 5rem 1rem;
}

.directory-empty-icon {
    font-size: 3rem;
    color: var(--color-primary);
    opacity: 0.35;
    margin-bottom: 1rem;
    line-height: 1;
}

.directory-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 0.4rem;
}

.directory-empty-sub {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* Card grid */
.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.1rem;
}

.directory-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
    cursor: pointer;
    overflow: hidden;
}

.directory-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
    color: inherit;
    text-decoration: none;
}

.directory-card-top {
    padding: 1.2rem 1.2rem 1rem;
    flex: 1;
}

.directory-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.directory-card-name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.35;
    color: var(--color-text);
}

.directory-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.directory-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.directory-card-meta svg {
    flex-shrink: 0;
    opacity: 0.65;
}

/* Card bottom strip */
.directory-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    border-top: 1px solid var(--border-color);
    background: var(--color-surface-muted);
    flex-wrap: wrap;
}

.directory-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
}

.directory-card-owner {
    font-size: 0.775rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Load more */
.directory-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2.5rem;
    flex-direction: column;
}

.directory-count {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 700px) {
    .directory-hero { padding: 2.5rem 1rem 2rem; }
    .directory-filters { padding: 0.6rem 1rem; top: 3.75rem; }
    .directory-filter-row { gap: 0.4rem; }
    .directory-grid { grid-template-columns: 1fr; }
    .directory-search-row { padding: 0.25rem 0.25rem 0.25rem 0.75rem; }
}

/* ── Event Analytics Panel ──────────────────────────────────────── */
.stats-panel {
    margin-bottom: 1.5rem;
}
.stats-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.stats-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.stats-loading {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
}
.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: var(--surface-2, var(--surface));
    border-radius: var(--radius);
    padding: 0.75rem 0.875rem;
    min-width: 0;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}
.stat-denom {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-approved { color: var(--success, #22c55e); }
.stat-pending  { color: var(--warning, #f59e0b); }
.stat-queried  { color: var(--danger, #ef4444); }

/* Sparkline */
.stats-sparkline {
    margin-top: 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--border);
}
.stats-sparkline-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}
.sparkline-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 48px;
}
.sparkline-bar-wrap {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
}
.sparkline-bar {
    width: 100%;
    min-height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.sparkline-bar-wrap:hover .sparkline-bar {
    opacity: 1;
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Admin Analytics ──────────────────────────────────────────── */
.admin-stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    margin-bottom: 1.5rem;
}
.admin-chart-card { margin-bottom: 1.5rem; }
.admin-chart-card h3 { margin: 0 0 1rem; font-size: 1rem; }
.admin-activity-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 120px;
    padding-bottom: 1.5rem;
    position: relative;
}
.admin-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 2px;
}
.admin-bar-stack {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 1px;
}
.admin-bar-segment {
    width: 100%;
    min-height: 1px;
    border-radius: 1px;
    transition: opacity 0.15s;
}
.admin-chart-col:hover .admin-bar-segment { opacity: 0.8; }
.bar-other  { background: var(--accent); opacity: 0.45; }
.bar-scores { background: var(--accent); opacity: 0.85; }
.bar-follows { background: var(--success, #22c55e); opacity: 0.75; }
.admin-chart-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1;
}
.admin-chart-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
}
.admin-analytics-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.admin-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.admin-top-row:last-child { border-bottom: none; }
.admin-top-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.admin-event-type { text-transform: capitalize; }
@media (max-width: 700px) {
    .admin-analytics-columns { grid-template-columns: 1fr; }
    .admin-activity-chart { height: 80px; }
}

/* ── GDPR Consent Banner ──────────────────────────────────────── */
.consent-banner {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2.5rem);
    max-width: 680px;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.28);
    padding: 1.25rem 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.consent-banner p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}
.consent-banner p a {
    color: var(--color-primary);
    text-decoration: underline;
}
.consent-banner-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 0.25rem;
}
.consent-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    align-items: center;
}
.consent-actions button {
    padding: 0.5rem 1.1rem;
    font-size: 0.82rem;
    border-radius: 999px;
}
.consent-detail {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.consent-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.consent-row input[type="checkbox"] {
    width: auto;
    margin-top: 0.2rem;
    flex-shrink: 0;
}
.consent-row-text strong {
    font-size: 0.82rem;
    display: block;
}
.consent-row-text span {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}
@media (max-width: 480px) {
    .consent-banner { bottom: 0; left: 0; transform: none; width: 100%; max-width: 100%; border-radius: var(--border-radius) var(--border-radius) 0 0; }
}

/* ════════════════════════════════════════════════════════════════════
   Admin: Billing console
   Uses real design tokens (--color-*, --card-bg, --border-color) so it
   adapts to both light and dark themes.
   ════════════════════════════════════════════════════════════════════ */

/* ── Status hero ───────────────────────────────────────────────────── */
.billing-hero {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem 1.75rem;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}
.billing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--color-primary-dim), transparent 60%);
    pointer-events: none;
}
.billing-hero-off::before {
    background: linear-gradient(135deg, rgba(125,192,216,0.10), transparent 60%);
}
.billing-hero-live::before {
    background: linear-gradient(135deg, rgba(34,197,94,0.18), transparent 60%);
}
.billing-hero-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}
.billing-hero-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    border: 1px solid var(--border-color);
}
.billing-hero-off .billing-hero-pill {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
}
.billing-hero-live .billing-hero-pill {
    background: rgba(34,197,94,0.18);
    color: #15803d;
    border-color: rgba(34,197,94,0.4);
}
[data-theme="dark"] .billing-hero-live .billing-hero-pill { color: #86efac; }
.billing-hero-text { flex: 1; min-width: 14rem; }
.billing-hero-text h2 { margin: 0 0 0.25rem; font-size: 1.35rem; }
.billing-hero-text p { margin: 0; color: var(--color-text-muted); line-height: 1.55; }
.billing-hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 1rem 1.5rem;
    margin: 0;
    position: relative;
    z-index: 1;
}
.billing-hero-stats > div { display: flex; flex-direction: column; gap: 0.15rem; }
.billing-hero-stats dt {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-muted);
    margin: 0;
}
.billing-hero-stats dd {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
}
.billing-hero-stats-sub {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}
.billing-hero-ok { color: #16a34a; }
.billing-hero-warn { color: var(--color-warning); }
[data-theme="dark"] .billing-hero-ok { color: #4ade80; }

/* ── Sub-nav (anchor jumps) ────────────────────────────────────────── */
.billing-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.4rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0.5rem;
    z-index: 5;
    backdrop-filter: var(--glass-blur);
}
.billing-subnav a,
.billing-subnav-link {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--border-radius) - 4px);
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: background 0.15s, color 0.15s;
}
.billing-subnav a:hover,
.billing-subnav-link:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

/* ── Section wrapper ───────────────────────────────────────────────── */
.billing-section {
    scroll-margin-top: 5rem;
}
.billing-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.billing-section-head h2 { margin: 0 0 0.35rem; }
.billing-section-head p { margin: 0; }
.billing-section-note { display: block; margin-top: 0.4rem; color: var(--color-text-muted); font-size: 0.85rem; }

/* ── Custom toggle switch (slider style) ───────────────────────────── */
.bswitch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.bswitch input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 24px;
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s;
    margin: 0;
    flex-shrink: 0;
}
.bswitch input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-text);
    transform: translateY(-50%);
    transition: left 0.18s, background 0.18s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.bswitch input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.bswitch input[type="checkbox"]:checked::before {
    left: 22px;
    background: var(--color-primary-contrast);
}
.bswitch input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.billing-hero-switch {
    margin-left: auto;
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ── Settings: secondary toggles ───────────────────────────────────── */
.billing-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}
.billing-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) - 4px);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.billing-toggle-row:hover {
    border-color: rgba(6, 182, 212, 0.3);
}
.billing-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.billing-toggle-text strong {
    font-size: 0.95rem;
    color: var(--color-text);
}
.billing-toggle-desc {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

/* ── Settings: form fields ─────────────────────────────────────────── */
.billing-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.billing-form-row-2 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.billing-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
.billing-form-field-flex { flex: 2; min-width: 16rem; }
.billing-form-field > span:first-child {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.85rem;
}
.billing-form-field input,
.billing-form-field select {
    width: 100%;
    box-sizing: border-box;
}
.billing-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.billing-callout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}
.billing-callout {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) - 4px);
    background: var(--color-surface-muted);
}
.billing-callout strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}
.billing-callout p {
    margin: 0;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ── Plans grid (cards, not table) ─────────────────────────────────── */
.billing-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.billing-plan-card {
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.billing-plan-card:hover {
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: var(--shadow-teal);
    transform: translateY(-1px);
}
.billing-plan-card > header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.billing-plan-head { display: flex; flex-direction: column; gap: 0.15rem; }
.billing-plan-head h3 { margin: 0; font-size: 1.1rem; }
.billing-plan-head code {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-family: ui-monospace, SF Mono, monospace;
}
.billing-plan-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.billing-plan-desc {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}
.billing-plan-prices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}
.billing-plan-currency h4 {
    margin: 0 0 0.45rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    font-weight: 700;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}
.billing-plan-currency-code {
    font-size: 0.95rem;
    color: var(--color-primary);
    letter-spacing: 0.04em;
}
.billing-plan-currency-region {
    font-size: 0.66rem;
    color: var(--color-text-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
}
.billing-plan-currency ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.billing-plan-currency li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.88rem;
}
.billing-plan-period { color: var(--color-text-muted); }
.billing-plan-price { font-weight: 600; color: var(--color-text); text-align: right; }
.billing-plan-price .muted { color: var(--color-text-muted); font-weight: 400; }
.billing-plan-card > footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}
.billing-plan-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.billing-plan-meta .dot { margin: 0 0.4rem; opacity: 0.5; }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-ok {
    background: rgba(34,197,94,0.18);
    color: #15803d;
    border: 1px solid rgba(34,197,94,0.35);
}
[data-theme="dark"] .badge-ok { color: #86efac; }
.badge-warn {
    background: rgba(245,158,11,0.18);
    color: #b45309;
    border: 1px solid rgba(245,158,11,0.4);
}
[data-theme="dark"] .badge-warn { color: #fcd34d; }
.badge-sale {
    background: rgba(217,119,6,0.18);
    color: #b45309;
    border: 1px solid rgba(217,119,6,0.4);
}
[data-theme="dark"] .badge-sale { color: #fdba74; }
.badge-sale-sm { font-size: 0.62rem; padding: 0.1rem 0.4rem; }

/* ── Edit-prices drawer ────────────────────────────────────────────── */
.billing-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 17, 30, 0.55);
    backdrop-filter: blur(4px);
    z-index: 100;
    animation: billing-fade-in 0.18s ease-out;
}
.billing-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(540px, 100%);
    background: var(--color-surface-solid);
    border-left: 1px solid var(--border-color);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
    z-index: 101;
    display: flex;
    flex-direction: column;
    animation: billing-slide-in 0.22s ease-out;
    overflow: hidden;
}
@keyframes billing-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes billing-slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
.billing-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.billing-drawer-head h3 {
    margin: 0;
    font-size: 1.15rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}
.billing-drawer-head h3 code {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 500;
}
.billing-drawer-body {
    overflow-y: auto;
    padding: 1rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
button.ghost.icon {
    padding: 0.4rem 0.65rem;
    font-size: 1.1rem;
    line-height: 1;
}

/* ── Drawer section header (for grouping Quotas / Prices etc.) ─────── */
.billing-drawer-section { margin-bottom: 0.25rem; }
.billing-drawer-section > header { margin-bottom: 0.6rem; }
.billing-drawer-section > header h4 {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-muted);
    font-weight: 700;
}
.billing-drawer-section > header p {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* ── Quota cards (per-plan limit editor) ───────────────────────────── */
.billing-quota-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.billing-quota-card {
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) - 2px);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.billing-quota-card > header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.billing-quota-name {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.92rem;
}
.billing-quota-key {
    font-family: ui-monospace, SF Mono, monospace;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}
.billing-quota-desc {
    margin: 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}
.billing-quota-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem;
    align-items: center;
}
.billing-quota-unlimited {
    font-size: 0.85rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
}
.billing-input-row-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* ── Boolean feature toggle rows (inside drawer) ───────────────────── */
.billing-feature-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}
.billing-feature-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}
.billing-feature-row:last-child {
    border-bottom: none;
}
.billing-feature-row:hover {
    background: var(--color-surface-muted);
}
.billing-feature-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.billing-feature-info strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.billing-feature-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* ── Edit-price card (inside drawer) ───────────────────────────────── */
.billing-edit-card {
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) - 2px);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.billing-edit-card-promo {
    border-color: rgba(217,119,6,0.5);
    box-shadow: 0 0 0 1px rgba(217,119,6,0.25);
}
.billing-edit-card > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.billing-edit-card h4 {
    margin: 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.billing-edit-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--color-primary-dim);
    color: var(--color-primary);
    font-weight: 700;
}
.billing-input-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
}
.billing-input-field > span:first-child {
    font-weight: 600;
    color: var(--color-text);
}
.billing-input-field em {
    font-style: normal;
    color: var(--color-text-muted);
    font-weight: 400;
    margin-left: 0.25rem;
}
.billing-input-row {
    display: flex;
    align-items: stretch;
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.billing-input-row:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-dim);
}
.billing-input-prefix {
    padding: 0 0.7rem;
    display: flex;
    align-items: center;
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-weight: 700;
    border-right: 1px solid var(--border-color);
}
.billing-input-row input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0.5rem 0.75rem;
    color: var(--color-text);
    font-size: 0.95rem;
    min-width: 0;
}
.billing-input-row input:focus { outline: 0; }
.billing-discount-section {
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}
.billing-discount-section[open] {
    padding: 0.5rem 0.75rem 0.85rem;
}
.billing-discount-section summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}
.billing-discount-section summary::-webkit-details-marker { display: none; }
.billing-discount-section summary::before {
    content: '▸';
    color: var(--color-text-muted);
    margin-right: 0.4rem;
    transition: transform 0.15s;
    display: inline-block;
}
.billing-discount-section[open] summary::before { transform: rotate(90deg); }
.billing-discount-section[open] > *:not(summary) { margin-top: 0.55rem; }
.billing-edit-actions { display: flex; justify-content: flex-end; }

/* ── Price strikethrough display (in plan cards) ───────────────────── */
.price-strike {
    text-decoration: line-through;
    color: var(--color-text-muted);
    margin-right: 0.4rem;
    font-weight: 400;
}
.price-discount { color: var(--color-accent); }

/* ── Feature flags ─────────────────────────────────────────────────── */
.billing-flag-filter {
    width: min(20rem, 100%);
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
}
.billing-flag-group {
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) - 2px);
    margin-bottom: 0.6rem;
    overflow: hidden;
}
.billing-flag-group > summary {
    cursor: pointer;
    list-style: none;
    padding: 0.7rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: var(--color-text);
    font-size: 0.95rem;
}
.billing-flag-group > summary::-webkit-details-marker { display: none; }
.billing-flag-group > summary::before {
    content: '▸';
    color: var(--color-text-muted);
    transition: transform 0.15s;
    display: inline-block;
}
.billing-flag-group[open] > summary::before { transform: rotate(90deg); }
.billing-flag-group-name { flex: 1; }
.billing-flag-group-count {
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
}
.billing-flag-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-color);
}
.billing-flag-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.billing-flag-row:last-child { border-bottom: 0; }
.billing-flag-row:hover { background: var(--color-surface); }
.billing-flag-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}
.billing-flag-info strong { font-size: 0.92rem; color: var(--color-text); }
.billing-flag-info code {
    font-family: ui-monospace, SF Mono, monospace;
    font-size: 0.74rem;
    color: var(--color-text-muted);
}
.billing-flag-desc {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

/* ── Feature flag segmented control ────────────────────────────────── */
.billing-flag-segments {
    display: inline-flex;
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}
.billing-flag-seg {
    background: transparent;
    border: 0;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.billing-flag-seg:hover { color: var(--color-text); }
.billing-flag-seg.active { background: var(--color-primary); color: var(--color-primary-contrast); }
.billing-flag-seg.active.billing-flag-seg-forceon { background: #16a34a; color: #fff; }
.billing-flag-seg.active.billing-flag-seg-forceoff { background: #dc2626; color: #fff; }
.billing-flag-seg:disabled { opacity: 0.5; cursor: not-allowed; }
.billing-empty {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem 1rem;
}

/* ── Stripe sync result panel ──────────────────────────────────────── */
.billing-sync-result { margin-top: 0.75rem; }
.billing-sync-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 1rem;
    background: var(--color-surface-muted);
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) - 2px);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.billing-sync-grid > div { display: flex; flex-direction: column; gap: 0.15rem; }
.billing-sync-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.1;
}
.billing-sync-lbl {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Buttons (small variant) ───────────────────────────────────────── */
button.ghost.small,
button.primary.small {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
}

/* ── Mobile tweaks ─────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .billing-hero {
        grid-template-columns: 1fr;
        padding: 1.25rem;
    }
    .billing-subnav { position: static; overflow-x: auto; flex-wrap: nowrap; }
    .billing-section-head { flex-direction: column; align-items: stretch; }
    .billing-flag-row { flex-direction: column; align-items: flex-start; }
    .billing-flag-segments { width: 100%; justify-content: space-between; }
    .billing-drawer { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════
   PRICING PAGE
   ══════════════════════════════════════════════════════════════════════ */

.pricing-banner {
    background: var(--color-primary);
    color: #fff;
    text-align: center;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
}

.pricing-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.pricing-currency-picker {
    display: flex;
    gap: 0.4rem;
}

.pricing-interval-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    width: fit-content;
    margin-inline: auto;
}

.pricing-tab {
    padding: 0.55rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--card-bg);
    color: var(--color-text);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

.pricing-tab:hover { background: var(--color-surface-muted); }

.pricing-tab.active {
    background: var(--color-primary);
    color: #fff;
}

.pricing-tab-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255,255,255,0.25);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
}

.pricing-tab.active .pricing-tab-badge { background: rgba(255,255,255,0.3); }

/* Plan grid */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.pricing-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.75rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
}

.pricing-card-featured {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary), 0 4px 24px rgba(0,0,0,0.08);
}

.pricing-card-badge {
    position: absolute;
    top: -0.7rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    white-space: nowrap;
}

.pricing-card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.pricing-card-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
}

.pricing-card-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pricing-amount {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    color: var(--color-text);
}

.pricing-amount-was {
    font-size: 1.1rem;
    text-decoration: line-through;
    color: var(--color-text-muted);
    align-self: flex-start;
    margin-top: 0.5rem;
}

.pricing-period {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    align-self: flex-end;
    margin-bottom: 0.25rem;
}

.pricing-equiv {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    width: 100%;
    margin-top: -0.5rem;
}

.pricing-sale-tag {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    align-self: center;
}

.pricing-trial {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: -0.5rem 0 0;
}

.pricing-card-cta .btn {
    display: block;
    text-align: center;
    width: 100%;
    padding: 0.7rem;
    font-size: 0.95rem;
}

.pricing-feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.87rem;
    flex: 1;
}

.pricing-feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.pricing-check {
    color: var(--color-primary);
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

/* Per-event section */
.pricing-perevent {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.pricing-perevent > div { flex: 1; min-width: 220px; }

.pricing-perevent-price {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.pricing-enterprise {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pricing-enterprise > div { flex: 1; min-width: 220px; }

.pricing-enterprise-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.pricing-error { margin-top: 1rem; }

/* ═══════════════════════════════════════════════════════════════════════
   ACCOUNT BILLING PAGE
   ══════════════════════════════════════════════════════════════════════ */

.acct-billing-free-card {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 2rem;
}

.acct-billing-plan-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.acct-billing-plan-card { margin-bottom: 1.25rem; }

.acct-billing-plan-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.acct-billing-plan-head h2 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}

.acct-billing-plan-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

.acct-billing-trial-warn {
    color: #f59e0b;
    font-weight: 600;
}

.acct-billing-plan-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.acct-billing-features-card h3 {
    margin: 0 0 1.25rem;
}

.acct-billing-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.acct-billing-feature-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: calc(var(--border-radius) - 2px);
    background: var(--color-surface-muted);
    font-size: 0.87rem;
}

.acct-billing-feature-off { opacity: 0.5; }

.acct-billing-feature-icon {
    font-weight: 700;
    flex-shrink: 0;
    color: var(--color-primary);
    min-width: 1rem;
}

.acct-billing-feature-off .acct-billing-feature-icon { color: var(--color-text-muted); }

.acct-billing-feature-name { display: block; font-weight: 500; }

.acct-billing-feature-desc {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

.acct-billing-upgrade-hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    text-align: right;
}

.acct-billing-upgrade-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 1.5rem;
    margin-top: 1.25rem;
}

.acct-billing-upgrade-card > div { flex: 1; min-width: 220px; }

.acct-billing-upgrade-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   BILLING RESULT PAGES (Success / Cancel)
   ══════════════════════════════════════════════════════════════════════ */

.billing-result-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    padding: 4rem 1.5rem;
    max-width: 520px;
    margin: 0 auto;
}

.billing-result-icon {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
}

.billing-result-icon-ok {
    background: color-mix(in srgb, var(--color-primary) 15%, transparent);
    color: var(--color-primary);
}

.billing-result-icon-cancel {
    background: color-mix(in srgb, #ef4444 12%, transparent);
    color: #ef4444;
}

.billing-result-page h1 { font-size: 1.75rem; margin: 0; }
.billing-result-page .subtitle { color: var(--color-text-muted); margin: 0; }

.billing-result-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 640px) {
    .pricing-grid { grid-template-columns: 1fr; }
    .acct-billing-plan-head { flex-direction: column; }
    .acct-billing-plan-actions { width: 100%; }
    .acct-billing-feature-grid { grid-template-columns: 1fr; }
    .pricing-perevent { flex-direction: column; }
}

/* ── Upgrade prompt (quota hit in event detail) ─────────────────── */
.upgrade-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
}
.upgrade-prompt strong { display: block; margin-bottom: 2px; color: #92400e; }
.upgrade-prompt p { margin: 0; font-size: 0.85rem; color: #78350f; }

/* ── Trial expiry banner ──────────────────────────────────────────── */
/* ── Scoreboard embed page ───────────────────────────────────────────── */
.embed-shell { padding: 1rem; font-family: inherit; }
.embed-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.75rem; gap: 0.5rem; }
.embed-header strong { font-size: 1rem; }
.embed-header small { color: var(--color-muted, #6b7280); font-size: 0.75rem; }
.embed-loading, .embed-error, .embed-upgrade { text-align: center; padding: 2rem; color: var(--color-muted, #6b7280); }
.embed-upgrade a { display: inline-block; margin-top: 0.5rem; font-size: 0.875rem; }
.scoreboard-powered-by { text-align: center; margin-top: 1rem; font-size: 0.75rem; color: var(--color-muted, #9ca3af); }
.scoreboard-powered-by a { color: inherit; text-decoration: underline; }
.embed-code-block { background: var(--color-surface, #f3f4f6); border-radius: 6px; padding: 0.6rem 0.75rem; font-size: 0.75rem; font-family: monospace; word-break: break-all; margin-bottom: 0.5rem; border: 1px solid var(--border-color, #e5e7eb); }

/* ── Site-wide announcement banner ──────────────────────────────────── */
.announcement-banner {
    position: sticky;
    top: 0;
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: #f59e0b;
    color: #1c1917;
    padding: 9px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}
.announcement-banner button { flex-shrink: 0; }

.announcement-banner.tenant-notice-banner {
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e293b;
    border-bottom: 1px solid rgba(59, 130, 246, 0.25);
}
.announcement-banner.tenant-notice-banner button {
    color: #1e293b;
    border-color: rgba(30, 41, 59, 0.25);
}

.trial-expiry-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: #1d1d2b;
    color: #f9fafb;
    padding: 10px 20px;
    font-size: 0.875rem;
}
.trial-expiry-banner strong { color: #f59e0b; }
.trial-expiry-banner-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ── Admin subscriber table ──────────────────────────────────────── */
.billing-sub-table-wrap { overflow-x: auto; margin-top: 1rem; }
.billing-sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.billing-sub-table th,
.billing-sub-table td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    white-space: nowrap;
}
.billing-sub-table th { color: var(--color-text-muted, #6b7280); font-weight: 600; }
.billing-sub-table tbody tr:hover { background: var(--surface-1, #f9fafb); }

.billing-sub-status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.billing-sub-status-active   { background: #d1fae5; color: #065f46; }
.billing-sub-status-trialing { background: #dbeafe; color: #1e40af; }
.billing-sub-status-canceled { background: #f3f4f6; color: #374151; }
.billing-sub-status-pastdue  { background: #fee2e2; color: #991b1b; }
.billing-sub-status-expired  { background: #f3f4f6; color: #9ca3af; }

.billing-sub-pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.upload-message {
    display: block;
    margin-top: 0.4rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ── User profile page ───────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface, #fff);
  border: 1px solid #dce4ef;
  border-radius: 16px;
  margin-bottom: 1.5rem;
}

.profile-main {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  min-width: 80px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}

.profile-avatar-fallback {
  display: grid;
  place-items: center;
  background: #d9e6ff;
  color: #1f4f96;
  font-weight: 700;
  font-size: 1.75rem;
}

.profile-meta h1 {
  margin: 0 0 .2rem;
  font-size: 1.2rem;
  color: #0f1724;
}

.profile-meta .stat-line {
  font-size: .85rem;
  color: #596478;
  margin: 0;
}

.profile-meta .stat-link {
  color: #0fb4d5;
  text-decoration: none;
  font-weight: 500;
}

.profile-meta .stat-link:hover {
  text-decoration: underline;
}

.profile-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.profile-controls .tabs {
  display: flex;
  gap: .25rem;
  background: #f0f4fa;
  border-radius: 999px;
  padding: .2rem;
  border-bottom: none;
}

.profile-controls .tab {
  border: none;
  border-radius: 999px;
  padding: .4rem 1rem;
  background: transparent;
  color: #596478;
  font-weight: 500;
  font-size: .875rem;
  cursor: pointer;
  white-space: nowrap;
}

.profile-controls .tab:hover { background: #e4eaf5; }

.profile-controls .tab.active {
  background: #fff;
  color: #0f1724;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.filter-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-row input  { width: 180px; min-width: 0; }
.filter-row select { width: 150px; min-width: 0; }

/* Cards */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}

.feed-card {
  border: 1px solid #dce4ef;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #0f1724;
  transition: box-shadow .18s, transform .18s;
}

.feed-card:hover {
  box-shadow: 0 8px 24px rgba(7,34,71,.10);
  transform: translateY(-2px);
}

.feed-card .card-banner {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.feed-card .card-banner-placeholder {
  width: 100%;
  height: 130px;
  background: linear-gradient(135deg, #e8f0fe 0%, #d2e3ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 2.25rem;
}

.feed-card .card-body {
  padding: .9rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.feed-card .card-row {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: stretch;
  margin-bottom: .1rem;
}

.feed-card .card-row h3 {
  margin: 0;
  font-size: .95rem;
  font-weight: 600;
  color: #0f1724;
  line-height: 1.35;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.feed-card .card-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.feed-card .card-meta {
  font-size: .8rem;
  color: #596478;
  margin: 0;
}

.feed-card .chip {
  font-size: .68rem;
  font-weight: 600;
  border: 1px solid #d0d7e2;
  padding: .18rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  background: #f8fafc;
  color: #475569;
}

.feed-card .chip.open     { border-color: #bbf7d0; color: #15803d; background: #f0fdf4; }
.feed-card .chip.scoring  { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
.feed-card .chip.inreview { border-color: #fde68a; color: #92400e; background: #fffbeb; }
.feed-card .chip.closed   { border-color: #cbd5e1; color: #475569; background: #f8fafc; }
.feed-card .chip.draft    { border-color: #e2e8f0; color: #64748b; background: #f1f5f9; }

.feed-card .card-footer {
  padding: .55rem .9rem .7rem;
  border-top: 1px solid #f0f4fa;
  display: flex;
  justify-content: flex-end;
}

.feed-card .card-open-link {
  font-size: .8rem;
  font-weight: 600;
  color: #0fb4d5;
  text-decoration: none;
}

@media (max-width: 560px) {
  .profile-controls { flex-direction: column; align-items: flex-start; }
  .filter-row input, .filter-row select { width: 100%; }
  .feed-grid { grid-template-columns: 1fr; }
}

/* ── Following list page ─────────────────────────────────────────────────── */
.following-page { max-width: 640px; }

.following-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.following-header h1 { margin: 0; font-size: 1.4rem; }

.back-link { font-size: .875rem; color: #596478; text-decoration: none; white-space: nowrap; }
.back-link:hover { color: #0f1724; }

.following-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }

.following-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem 1rem;
  background: #fff;
  border: 1px solid #dce4ef;
  border-radius: 12px;
  transition: box-shadow .15s;
}

.following-item:hover { box-shadow: 0 2px 10px rgba(7,34,71,.07); }

.following-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}

.following-avatar-fallback {
  display: grid;
  place-items: center;
  background: #d9e6ff;
  color: #1f4f96;
  font-weight: 700;
  font-size: 1.1rem;
}

.following-name { flex: 1; font-weight: 500; color: #0f1724; font-size: .95rem; }

.following-actions { display: flex; gap: .5rem; align-items: center; }

.following-empty { padding: 2rem 0; color: #596478; }
.following-empty p { margin: 0 0 .25rem; }

/* ── Shared feed cards (Profile, Events/Index, etc.) ───────────────────── */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}

.feed-card {
  border: 1px solid #dce4ef;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  color: #0f1724;
  transition: box-shadow .18s, transform .18s;
}

.feed-card:hover {
  box-shadow: 0 8px 24px rgba(7,34,71,.10);
  transform: translateY(-2px);
}

.card-banner {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.card-banner-placeholder {
  width: 100%;
  height: 130px;
  background: linear-gradient(135deg, #e8f0fe 0%, #d2e3ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 2.25rem;
}

.card-body {
  padding: .9rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.card-row {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: stretch;
  margin-bottom: .1rem;
}

.card-row h3 {
  margin: 0;
  font-size: .95rem;
  font-weight: 600;
  color: #0f1724;
  line-height: 1.35;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.card-meta {
  font-size: .8rem;
  color: #596478;
  margin: 0;
}

.card-footer {
  padding: .55rem .9rem .7rem;
  border-top: 1px solid #f0f4fa;
  display: flex;
  justify-content: flex-end;
}

.card-open-link-btn {
  font-size: .8rem;
  font-weight: 600;
  color: #0fb4d5;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.card-menu-btn {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #475569;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15,23,36,.06);
  flex-shrink: 0;
}

.card-menu-btn:hover { background: #f3f6fb; }

a.feed-card { text-decoration: none; }

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .1rem;
}

.tag-chip {
  font-size: .68rem;
  font-weight: 500;
  background: #f0f4fa;
  color: #475569;
  border: 1px solid #dce4ef;
  border-radius: 999px;
  padding: .15rem .5rem;
  white-space: nowrap;
}

/* ── Status chips ─────────────────────────────────────────────────────────── */
.chip {
  font-size: .68rem;
  font-weight: 600;
  border: 1px solid #d0d7e2;
  padding: .18rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  color: #475569;
  background: #f8fafc;
}

.chip.open     { border-color: #bbf7d0; color: #15803d; background: #f0fdf4; }
.chip.scoring  { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
.chip.inreview { border-color: #fde68a; color: #92400e; background: #fffbeb; }
.chip.closed   { border-color: #cbd5e1; color: #475569; background: #f8fafc; }
.chip.draft    { border-color: #e2e8f0; color: #64748b; background: #f1f5f9; }
.chip.hidden   { border-color: #e2e8f0; color: #64748b; background: #f1f5f9; }

/* ── About page ──────────────────────────────────────────────────────────── */
.about-body {
  max-width: 1080px;
  margin: 0 auto;
}

.about-intro {
  margin-bottom: 1.5rem;
  padding: 1.1rem 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background:
    radial-gradient(circle at 90% -20%, rgba(66, 232, 224, 0.16), transparent 44%),
    var(--card-bg);
  box-shadow: var(--shadow-card);
}

.about-intro p {
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--color-text);
  margin: 0;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.05rem;
  margin-bottom: 1.75rem;
}

.about-card {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    var(--card-bg);
  border: 1px solid color-mix(in oklab, var(--border-color) 80%, var(--color-primary) 20%);
  border-radius: 16px;
  padding: 1.15rem 1.15rem 1.1rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(4px);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.about-card:hover {
  transform: translateY(-2px);
  border-color: rgba(66, 232, 224, 0.45);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(66, 232, 224, 0.12) inset;
}

.about-card-icon {
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: .7rem;
  background: rgba(66, 232, 224, 0.12);
  border: 1px solid rgba(66, 232, 224, 0.24);
}

.about-card h3 {
  margin: 0 0 .5rem;
  font-family: "Sora", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--color-text);
}

.about-card p {
  margin: 0;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-size: .9rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

.about-cta {
  background:
    radial-gradient(circle at 8% 16%, rgba(66, 232, 224, 0.22), transparent 30%),
    linear-gradient(145deg, rgba(7, 35, 65, 0.95), rgba(6, 20, 38, 0.95));
  border: 1px solid rgba(66, 232, 224, 0.3);
  border-radius: 16px;
  padding: 1.6rem 1.5rem 1.35rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-teal);
}

.about-cta h2 {
  margin: 0 0 .3rem;
  font-family: "Sora", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1.28rem;
  color: var(--color-text);
}

.about-cta p {
  margin: 0 0 1.1rem;
  font-size: .9rem;
  color: var(--color-text-muted);
}

.about-cta-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

[data-theme="light"] .about-intro,
[data-theme="light"] .about-card {
  box-shadow: 0 10px 22px rgba(17, 48, 77, 0.08);
}

[data-theme="light"] .about-card {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(246, 251, 255, 0.95));
}

[data-theme="light"] .about-card p,
[data-theme="light"] .about-cta p {
  color: #476173;
}

[data-theme="light"] .about-cta {
  background:
    radial-gradient(circle at 10% 12%, rgba(66, 232, 224, 0.18), transparent 30%),
    linear-gradient(135deg, #e8f5fb 0%, #e9f2fd 100%);
  border-color: rgba(18, 126, 163, 0.2);
}

@media (max-width: 920px) {
  .about-body {
    max-width: 100%;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Mode toggle (Events / Evaluations) — used in Directory & feed pages ─ */
.directory-mode-bar {
  display: flex;
  justify-content: center;
  padding: 1.25rem 0 .5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: .25rem;
}

.discovery-toggle {
  display: flex;
  gap: .15rem;
  align-items: center;
}

.feed-toggle-btn {
  all: unset;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: .88rem;
  padding: .4rem .85rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: color .15s, background .15s;
}

.feed-toggle-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.06);
}

.feed-toggle-btn.active {
  color: var(--color-primary);
  background: var(--color-primary-dim);
  box-shadow: inset 0 -2px 0 var(--color-primary);
}

/* ── Event discovery section ───────────────────────────────────────────── */
.discovery-section .directory-card-banner--placeholder {
  background: linear-gradient(135deg, #e8f0fe 0%, #d2e3ff 100%);
  font-size: 2.25rem;
}

.discovery-filters {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.discovery-filters input { width: 240px; min-width: 0; flex: none; }
.discovery-filters select { width: 160px; min-width: 0; flex: none; }

/* ── Card action popover menu ────────────────────────────────────────────── */
.card-menu-popover {
  position: fixed;
  min-width: 200px;
  border: 1px solid #dce4ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(7,34,71,.13), 0 2px 6px rgba(7,34,71,.07);
  padding: .3rem;
  display: flex;
  flex-direction: column;
  z-index: 10001;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 10000;
  cursor: default;
}

.menu-item-btn {
  all: unset;
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: .5rem .75rem;
  border-radius: 8px;
  color: #0f1724;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: background .12s;
}

.menu-item-btn:hover { background: #f3f6fb; }
.menu-item-btn:active { background: #e8eef8; }
.menu-item-btn:disabled { color: #94a3b8; cursor: default; }

.eval-public-hero {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--card-bg);
  padding: 1rem;
  margin-bottom: 1rem;
}

.eval-public-hero-image {
  width: 100%;
  height: 220px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.eval-public-hero-body h1 {
  margin: 0;
}

.eval-public-chips {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .6rem;
}

.eval-public-actions {
  margin-top: .8rem;
}

.eval-public-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

.eval-public-metric {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: .75rem;
  margin-top: .75rem;
  background: color-mix(in srgb, var(--card-bg) 85%, transparent);
}

.eval-public-metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.eval-public-submetrics {
  margin: .6rem 0 0;
  padding-left: 1rem;
}

.eval-public-submetrics li {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .35rem;
}

.eval-public-details {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  row-gap: .45rem;
  column-gap: .5rem;
}

.eval-public-details dt {
  color: var(--color-text-muted);
  font-size: .85rem;
}

.eval-public-details dd {
  margin: 0;
}

.eval-public-docs {
  list-style: none;
  padding: 0;
  margin: .4rem 0 0;
}

.eval-public-docs li {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  align-items: center;
  padding: .45rem 0;
  border-bottom: 1px solid var(--border-color);
}

@media (max-width: 980px) {
  .eval-public-layout {
    grid-template-columns: 1fr;
  }

  .eval-public-hero {
    grid-template-columns: 1fr;
  }
}

/* Reimagined layout */
:root {
  --font-base: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --sidebar-width: 272px;
  --shell-radius: 16px;
  --bg-midnight: #07111f;
  --bg-navy: #081b30;
  --bg-surface: #10243a;
  --text-primary: #eaf2f8;
  --text-secondary: #afc3d6;
  --brand-cyan: #42e8e0;
}

[data-theme="light"] {
  --color-bg: #f3f6fb;
  --color-surface-solid: #ffffff;
  --color-surface-muted: #edf3f9;
  --color-text: #0f2239;
  --color-text-muted: #5f7287;
  --border-color: #dbe6f1;
  --card-bg: #ffffff;
  --glass-bg: rgba(255,255,255,0.92);
  --input-bg: #ffffff;
  --color-primary: #0ea6cf;
  --color-primary-hover: #098db0;
  --color-primary-dim: rgba(14, 166, 207, 0.14);
}

[data-theme="dark"],
:root:not([data-theme="light"]) {
  --color-bg: radial-gradient(80% 70% at 50% 0%, #0c2d47 0%, #07111f 55%, #060c18 100%);
  --color-surface-solid: rgba(8, 27, 48, 0.8);
  --color-surface-muted: rgba(15, 44, 72, 0.75);
  --color-text: var(--text-primary);
  --color-text-muted: var(--text-secondary);
  --border-color: rgba(66, 232, 224, 0.16);
  --card-bg: rgba(8, 27, 48, 0.78);
  --glass-bg: rgba(8, 27, 48, 0.85);
  --input-bg: rgba(15, 44, 72, 0.92);
  --color-primary: var(--brand-cyan);
  --color-primary-hover: #34d8d1;
  --color-primary-dim: rgba(66, 232, 224, 0.16);
}

body {
  background: var(--color-bg);
}

.app-shell {
  max-width: 1480px;
  margin: 16px auto;
  min-height: calc(100vh - 32px);
  padding: 0 12px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
}

.app-sidebar {
  border: 1px solid var(--border-color);
  border-right: 0;
  border-radius: var(--shell-radius) 0 0 var(--shell-radius);
  background: var(--color-surface-solid);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-logo {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-top: 4px;
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-sidebar-nav a {
  color: var(--color-text-muted);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 600;
}

.app-sidebar-nav a.active,
.app-sidebar-nav a:hover {
  color: var(--color-text);
  background: var(--color-primary-dim);
}

.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  background: color-mix(in srgb, var(--color-primary) 20%, transparent);
  color: var(--color-text);
}

.sidebar-user-meta strong {
  display: block;
  font-size: .88rem;
}

.sidebar-user-meta span {
  font-size: .76rem;
  color: var(--color-text-muted);
}

.app-workspace {
  border: 1px solid var(--border-color);
  border-radius: 0 var(--shell-radius) var(--shell-radius) 0;
  background: var(--card-bg);
  overflow: hidden;
  min-height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mobile-logo { display: none; }

.app-header {
  padding: 0 24px;
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
}

.app-header .app-nav-inline a {
  border-radius: 0;
  border-bottom: 2px solid transparent;
}

.app-header .app-nav-inline a.active {
  box-shadow: none;
  border-bottom-color: var(--color-primary);
  background: transparent;
}

.content {
  max-width: none;
  padding: 24px;
  min-height: 100%;
  min-width: 0;
}

.app-workspace main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.app-workspace main > .content {
  flex: 1 1 auto;
  min-width: 0;
}

.directory-hero {
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.directory-filter-row select,
.directory-filter-row .directory-tag-input,
.directory-search-input {
  border-radius: 10px;
}

.feed-card {
  border-radius: 12px;
}

[data-theme="light"] .app-sidebar,
[data-theme="light"] .app-workspace,
[data-theme="light"] .directory-hero {
  box-shadow: 0 10px 24px rgba(17, 48, 77, 0.06);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 0 8px;
    margin: 8px auto;
  }

  .app-sidebar {
    display: none;
  }

  .app-workspace {
    border-radius: var(--shell-radius);
    /* Prevent any child from creating horizontal scroll */
    overflow-x: hidden;
    max-width: 100%;
  }

  .mobile-logo { display: inline-flex; }
}

@media (max-width: 600px) {
  /* Reduce content padding so cards have more room */
  .content {
    padding: 12px;
  }

  /* Tighter page-header padding on narrow screens */
  .events-dashboard-shell .events-page-header,
  .events-dashboard-shell .events-dashboard-panel {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Prevent any card overflowing the viewport */
  .judging-dashboard-shell,
  .judging-section-card,
  .judge-scoring-panel,
  .events-dashboard-shell {
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Wireframe page alignment */
.events-page-header,
.directory-hero,
.events-dashboard-panel,
.create-main-card,
.create-preview-card,
.create-steps-card {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--card-bg);
}

.events-dashboard-panel {
  padding: 12px;
  margin-bottom: 18px;
}

.events-dashboard-panel .event-table {
  margin: 0;
}

.events-dashboard-shell {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--card-bg);
  overflow: hidden;
}

.events-dashboard-shell .events-page-header {
  border: 0;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  margin: 0;
  padding: 22px 24px 20px;
}

.events-dashboard-shell .events-dashboard-panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 18px 24px 24px;
}

.events-dashboard-shell .event-table header {
  margin-bottom: 1.1rem;
}

.events-dashboard-shell .event-table h3 {
  font-size: 2rem;
}

.events-dashboard-shell .event-table .table-wrapper {
  border-radius: 12px;
}

.events-dashboard-shell .event-table table thead th {
  font-size: .73rem;
  letter-spacing: .12em;
}

.events-dashboard-shell .event-table tbody td {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.events-dashboard-shell .create-event-btn {
  border-radius: 10px;
  padding: .68rem 1.2rem;
}

.judging-dashboard-panel {
  display: grid;
  gap: 12px;
}

.judging-section-card {
  border: 1px solid color-mix(in oklab, var(--border-color) 85%, var(--color-primary) 15%);
  border-radius: 12px;
  padding: 14px;
  margin: 0;
  background: var(--card-bg);
}

.judging-section-card > h3 {
  margin: 0 0 10px;
}

.judging-dashboard-shell .judging-page-header {
  padding-top: 16px;
  padding-bottom: 14px;
  min-height: 148px;
}

.judging-dashboard-shell .judging-page-header .subtitle {
  max-width: 720px;
  margin-bottom: 0;
}

.judging-dashboard-shell .judging-page-header .ghost {
  min-height: 42px;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  border-color: var(--border-color-strong);
  font-weight: 600;
}

.judging-dashboard-shell .grid.two-columns > .card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
}

.judging-dashboard-shell .accordion-panel {
  background: transparent;
  border-color: var(--border-color);
  padding: 0.3rem 0.55rem;
}

.judging-dashboard-shell .accordion-body {
  padding: 0 0.45rem 0.45rem;
}

.judging-dashboard-shell .metric-nav-item button {
  min-height: 38px;
  padding: 0.55rem 0.65rem;
}

.judging-dashboard-shell .metric-nav-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.judging-dashboard-shell .submission-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.56rem;
}

.judging-dashboard-shell .score-range-hint,
.judging-dashboard-shell .score-range {
  color: var(--color-text-secondary);
}

.judging-dashboard-shell .score-entry {
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
}

.judging-dashboard-shell .score-entry-controls {
  align-items: stretch;
  gap: 0.5rem;
}

.judging-dashboard-shell .score-entry-controls input[type="number"] {
  min-height: 42px;
  border-radius: 10px;
}

.judging-dashboard-shell .score-entry-controls .ghost,
.judging-dashboard-shell .score-entry-controls .primary {
  min-height: 42px;
  border-radius: 10px;
  padding: 0.55rem 1rem;
}

.judging-dashboard-shell .score-entry-controls .primary {
  min-width: 112px;
}

.judging-dashboard-shell .score-entry-header .submission-pill {
  margin-left: auto;
}

.judging-dashboard-shell .live-poll-dot {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 3px rgba(18, 194, 133, 0.14);
}

/* ── Judge event selector ──────────────────────────────────────────── */
.judge-event-selector {
  margin-bottom: 1rem;
}

.judge-event-selector-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.judge-event-selector-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-width: 160px;
  flex: 1 1 160px;
  color: var(--color-text);
}

.judge-event-selector-item:hover {
  border-color: var(--color-primary);
}

.judge-event-selector-item.active {
  border-color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 8%, var(--card-bg));
}

.judge-event-selector-name {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
  word-break: break-word;
}

.judge-event-selector-summary {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* ── Judge scoring panel ───────────────────────────────────────────── */
.judge-scoring-panel {
  padding: 1rem;
}

/* Live header: event name + contestant name + status pill */
.judge-live-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.judge-live-header h4 {
  margin: 0;
  font-size: 1.1rem;
}

.judge-live-header .metric-parent-context {
  margin: 0 0 2px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  word-break: break-word;
}

/* Contestant tab switcher */
.judge-contestant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.75rem;
}

.judge-contestant-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
  color: var(--color-text);
}

.judge-contestant-tab:hover:not(:disabled) {
  border-color: var(--color-primary);
}

.judge-contestant-tab.active {
  border-color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 10%, var(--card-bg));
  font-weight: 600;
}

.judge-contestant-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Score form and metric rows */
.judge-score-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.judge-metric-parent {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 0.25rem 0 0.1rem;
  border-bottom: 1px solid var(--border-color);
}

.judge-metric-row {
  margin-top: 0.6rem;
}

.judge-metric-row input[type="number"] {
  width: 100%;
  max-width: 220px;
  font-size: 1.4rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: var(--input-bg);
  color: var(--color-text);
  text-align: center;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
  -webkit-text-fill-color: var(--color-text);
}

.judge-metric-row input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Remove browser spinner arrows */
.judge-metric-row input[type="number"]::-webkit-inner-spin-button,
.judge-metric-row input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
}

/* Submit / draft actions */
.judge-score-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.judge-score-actions button {
  flex: 1 1 140px;
  min-height: 44px;
}

/* Conflict summary bar */
.judge-conflict-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: color-mix(in oklab, var(--color-warning, #f59e0b) 10%, var(--card-bg));
  border: 1px solid color-mix(in oklab, var(--color-warning, #f59e0b) 30%, transparent);
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

/* Late submission warning */
.score-late-banner {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: color-mix(in oklab, #f59e0b 12%, var(--card-bg));
  border: 1px solid color-mix(in oklab, #f59e0b 40%, transparent);
  color: var(--color-text);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

/* ── Mobile overrides (≤ 600px) ────────────────────────────────────── */
@media (max-width: 600px) {
  .judging-dashboard-shell .judging-page-header {
    min-height: unset;
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .judging-section-card {
    padding: 12px;
  }

  .judge-event-selector-list {
    flex-direction: column;
  }

  .judge-event-selector-item {
    width: 100%;
    flex: unset;
  }

  .judge-scoring-panel {
    padding: 12px;
  }

  .judging-dashboard-shell,
  .judging-section-card,
  .judge-scoring-panel {
    overflow-x: clip;
  }

  .judge-live-header {
    flex-direction: column;
    gap: 6px;
  }

  .judge-live-header > div,
  .judge-event-selector-item,
  .judge-contestant-tab,
  .score-entry,
  .score-entry-header,
  .judge-conflict-summary,
  .judge-score-actions {
    min-width: 0;
  }

  .judge-event-selector-name,
  .judge-event-selector-summary,
  .judge-live-header h4,
  .judge-live-header .metric-parent-context,
  .metric-description,
  .score-range-hint,
  .score-range,
  .score-progress-lock-banner,
  .judge-conflict-summary small,
  .judge-contestant-tab span:first-child {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .judge-live-header .submission-pill {
    align-self: flex-start;
  }

  .judge-contestant-tabs {
    gap: 4px;
  }

  .judge-contestant-tab {
    flex: 1 1 calc(50% - 4px);
    justify-content: space-between;
    white-space: normal;
  }

  .judge-metric-row input[type="number"] {
    max-width: 100%;
    font-size: 1.6rem;
    min-height: 56px;
  }

  .judge-score-actions {
    flex-direction: column;
    gap: 8px;
  }

  .judge-score-actions button {
    flex: unset;
    width: 100%;
  }

  .score-progress-lock-banner {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }
}

.discover-pillars {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.discover-pillars article {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  background: var(--card-bg);
}

.discover-pillars h4 {
  margin: 0 0 6px;
  font-size: .98rem;
}

.discover-pillars p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: .85rem;
}

.event-create-layout {
  display: grid;
  grid-template-columns: minmax(200px, 220px) minmax(0, 1fr) minmax(220px, 260px);
  gap: 14px;
  margin-bottom: 14px;
}

.create-steps-card,
.create-preview-card {
  padding: 14px;
  align-self: start;
  position: sticky;
  top: 84px;
}

.create-steps-card h4,
.create-preview-card h4 {
  margin: 0 0 10px;
  font-size: .95rem;
}

.create-steps-card ol {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: .85rem;
}

.create-steps-card li.active {
  color: var(--color-primary);
  font-weight: 700;
}

.create-main-card {
  margin-bottom: 0;
}

.preview-art {
  height: 120px;
  border-radius: 10px;
  margin-bottom: 10px;
  background: radial-gradient(circle at 20% 30%, rgba(66, 232, 224, 0.35), transparent 42%), linear-gradient(135deg, #0a243a, #07111f);
}

.preview-art-image {
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--color-surface-muted);
}

.create-preview-card p,
.create-preview-card span {
  margin: 0 0 8px;
  display: block;
  font-size: .82rem;
  color: var(--color-text-muted);
}

.create-preview-card strong {
  display: block;
  margin-bottom: 8px;
  line-height: 1.3;
}

.create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 1160px) {
  .events-dashboard-shell .events-page-header,
  .events-dashboard-shell .events-dashboard-panel {
    padding-left: 14px;
    padding-right: 14px;
  }

  .event-create-layout {
    grid-template-columns: 1fr;
  }

  .create-steps-card,
  .create-preview-card {
    position: static;
  }

  .discover-pillars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Discover section wireframe fidelity */
.wireframe-filters {
  position: static;
  border-bottom: 0;
  background: transparent;
  padding: 14px 0 10px;
}

.wireframe-filters .directory-filter-row {
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.wireframe-filters .directory-filter-row select {
  width: 100%;
  min-width: 0;
  height: 44px;
  border-radius: 10px;
  background: var(--card-bg);
}

.wireframe-results {
  max-width: none;
  margin: 0;
  padding: 10px 0 0;
}

.wireframe-results .featured-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 14px;
}

.wireframe-results .featured-row h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.wireframe-results .featured-row a {
  font-size: .9rem;
  font-weight: 600;
}

.wireframe-results .feed-grid {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
}

.wireframe-results .feed-card {
  border-radius: 12px;
  border-color: var(--border-color);
  min-height: 380px;
}

.wireframe-results .feed-card .card-banner,
.wireframe-results .feed-card .card-banner-placeholder {
  height: 160px;
}

.wireframe-results .feed-card .card-body {
  padding: 12px;
}

.wireframe-results .feed-card .card-row h3 {
  font-size: 1.02rem;
}

.wireframe-results .feed-card .card-meta {
  font-size: .84rem;
}

@media (max-width: 1200px) {
  .wireframe-results .feed-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 760px) {
  .wireframe-filters .directory-filter-row {
    grid-template-columns: 1fr;
  }

  .wireframe-results .feed-grid {
    grid-template-columns: 1fr;
  }
}

/* Wireframe finish pass */
.create-event-btn span {
  font-weight: 700;
  margin-left: .25rem;
}

.event-name-rich {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: .75rem;
}

.event-thumb-wrap {
  flex: 0 0 auto;
}

.event-thumb {
  width: 64px;
  height: 64px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--border-color);
  display: block;
  flex-shrink: 0;
}

.event-thumb-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(66, 232, 224, 0.2), rgba(66, 232, 224, 0.05));
  color: var(--color-primary);
  font-weight: 700;
}

.event-name-meta {
  min-width: 0;
  display: grid;
  gap: .1rem;
}

.event-name-meta strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-name-meta small {
  font-size: .76rem;
}

.create-step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .8rem;
}

.create-step-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: .55rem;
  align-items: start;
  color: var(--color-text-muted);
}

.create-step-list li strong {
  display: block;
  font-size: .85rem;
  margin-bottom: .1rem;
}

.create-step-list li small {
  display: block;
  font-size: .74rem;
}

.step-index {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  display: grid;
  place-items: center;
  font-size: .7rem;
  font-weight: 700;
  margin-top: .05rem;
  background: var(--color-surface-muted);
}

.create-step-list li.active {
  color: var(--color-text);
}

.create-step-list li.active .step-index {
  border-color: color-mix(in srgb, var(--color-primary) 60%, transparent);
  background: var(--color-primary);
  color: #04212f;
}

.create-step-list li.complete {
  color: var(--color-text);
}

.create-step-list li.complete .step-index {
  border-color: color-mix(in srgb, var(--color-primary) 35%, transparent);
  background: color-mix(in srgb, var(--color-primary) 24%, transparent);
}

.create-steps-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--card-bg) 85%, var(--color-primary) 15%), var(--card-bg));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.create-step-list li {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: .4rem .45rem;
  transition: border-color .16s ease, background .16s ease;
}

.create-step-list li.active {
  border-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.create-step-list li.complete {
  border-color: color-mix(in srgb, var(--color-primary) 20%, transparent);
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}

.create-main-card {
  border-radius: 16px;
}

.evaluation-edit-layout .create-main-card {
  padding: 1rem;
}

.evaluation-edit-layout .create-main-card > .card {
  border-radius: 12px;
}

.evaluation-edit-layout .step-link {
  text-decoration: none;
  color: inherit;
}

.submetric-row td:first-child {
  position: relative;
  padding-left: 1.6rem;
}

.submetric-row td:first-child::before {
  content: "↳";
  position: absolute;
  left: .7rem;
  opacity: .65;
}

.discover-pillars {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.discover-pillars article {
  border: 0;
  border-right: 1px solid var(--border-color);
  border-radius: 0;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1.25rem 1rem;
}

.discover-pillars article:last-child {
  border-right: 0;
}

.pillar-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  background: var(--color-primary-dim);
  border: 1px solid color-mix(in srgb, var(--color-primary) 45%, transparent);
}

.wireframe-results .feed-card .card-row {
  align-items: flex-start;
}

.wireframe-results .feed-card .card-tags {
  margin-top: .35rem;
  margin-bottom: .2rem;
}

.wireframe-results .feed-card .card-footer {
  padding: 0 12px 12px;
}

[data-theme="dark"] .wireframe-results .feed-card,
[data-theme="dark"] .event-table .table-wrapper,
[data-theme="dark"] .events-dashboard-panel,
[data-theme="dark"] .create-main-card,
[data-theme="dark"] .create-preview-card,
[data-theme="dark"] .create-steps-card {
  box-shadow: inset 0 0 0 1px rgba(66, 232, 224, 0.08);
}

[data-theme="dark"] .feed-card,
[data-theme="dark"] .wireframe-results .feed-card,
:root:not([data-theme="light"]) .feed-card,
:root:not([data-theme="light"]) .wireframe-results .feed-card {
  background: linear-gradient(155deg, rgba(13, 35, 62, 0.96), rgba(9, 24, 45, 0.96));
  border-color: color-mix(in oklab, var(--border-color) 78%, var(--color-primary) 22%);
  color: var(--color-text);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(66, 232, 224, 0.05);
}

[data-theme="dark"] .feed-card:hover,
[data-theme="dark"] .wireframe-results .feed-card:hover,
:root:not([data-theme="light"]) .feed-card:hover,
:root:not([data-theme="light"]) .wireframe-results .feed-card:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(66, 232, 224, 0.18);
}

[data-theme="dark"] .feed-card .card-row h3,
[data-theme="dark"] .wireframe-results .feed-card .card-row h3,
:root:not([data-theme="light"]) .feed-card .card-row h3,
:root:not([data-theme="light"]) .wireframe-results .feed-card .card-row h3 {
  color: #eaf4ff;
}

[data-theme="dark"] .feed-card .card-meta,
[data-theme="dark"] .wireframe-results .feed-card .card-meta,
:root:not([data-theme="light"]) .feed-card .card-meta,
:root:not([data-theme="light"]) .wireframe-results .feed-card .card-meta {
  color: #9fbbcf;
}

[data-theme="dark"] .feed-card .card-footer,
[data-theme="dark"] .wireframe-results .feed-card .card-footer,
:root:not([data-theme="light"]) .feed-card .card-footer,
:root:not([data-theme="light"]) .wireframe-results .feed-card .card-footer {
  border-top-color: rgba(66, 232, 224, 0.13);
}

[data-theme="dark"] .feed-card .chip,
[data-theme="dark"] .wireframe-results .feed-card .chip,
:root:not([data-theme="light"]) .feed-card .chip,
:root:not([data-theme="light"]) .wireframe-results .feed-card .chip {
  border-color: rgba(137, 165, 193, 0.35);
  background: rgba(132, 165, 197, 0.16);
  color: #d4e7f8;
}

/* Profile page parity pass (light + dark) */
.profile-header {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

.profile-avatar-fallback {
  background: color-mix(in oklab, var(--color-primary) 18%, transparent);
  color: var(--color-primary);
  border: 1px solid color-mix(in oklab, var(--color-primary) 30%, transparent);
}

.profile-meta h1 {
  color: var(--color-text);
  font-family: "Sora", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.profile-meta .stat-line {
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-size: .92rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.profile-meta .stat-link {
  color: var(--color-primary);
}

.profile-controls .tabs {
  background: color-mix(in oklab, var(--color-surface-muted) 85%, transparent);
  border: 1px solid var(--border-color);
}

.profile-controls .tab {
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-size: .92rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.feed-card .card-row h3 {
  font-family: "Sora", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.005em;
}

.feed-card .card-meta {
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-size: .86rem;
  font-weight: 600;
}

.profile-controls .tab:hover {
  background: color-mix(in oklab, var(--color-surface-muted) 65%, transparent);
}

.profile-controls .tab.active {
  background: var(--card-bg);
  color: var(--color-text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.filter-row input,
.filter-row select {
  background: var(--card-bg);
  color: var(--color-text);
  border-color: var(--border-color);
}

.card-menu-btn {
  border-color: var(--border-color);
  background: var(--card-bg);
  color: var(--color-text-muted);
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 0.85;
}

.card-menu-btn:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.following-item {
  background: var(--card-bg);
  border-color: var(--border-color);
}

.following-name {
  color: var(--color-text);
}

.following-empty {
  color: var(--color-text-muted);
}

[data-theme="light"] .profile-header,
[data-theme="light"] .following-item {
  box-shadow: 0 8px 20px rgba(17, 48, 77, 0.08);
}

:root:not([data-theme="light"]) .profile-header,
:root:not([data-theme="light"]) .following-item,
:root:not([data-theme="light"]) .profile-controls .tab.active,
:root:not([data-theme="light"]) .card-menu-btn,
:root:not([data-theme="light"]) .filter-row input,
:root:not([data-theme="light"]) .filter-row select {
  box-shadow: inset 0 0 0 1px rgba(66, 232, 224, 0.06);
}

:root:not([data-theme="light"]) .profile-header {
  background: linear-gradient(160deg, rgba(11, 33, 58, 0.96), rgba(8, 24, 44, 0.94)) !important;
  border-color: rgba(66, 232, 224, 0.2) !important;
}

:root:not([data-theme="light"]) .profile-controls .tabs {
  background: rgba(14, 39, 67, 0.8);
}

:root:not([data-theme="light"]) .profile-controls .tab.active {
  background: rgba(18, 53, 88, 0.92);
}

:root:not([data-theme="light"]) .profile-meta h1 {
  color: #eef7ff !important;
}

:root:not([data-theme="light"]) .profile-controls .tab {
  color: #b8cce0 !important;
}

:root:not([data-theme="light"]) .profile-controls .tab.active {
  color: #eaf6ff !important;
}

:root:not([data-theme="light"]) .card-menu-btn {
  background: rgba(14, 39, 67, 0.92) !important;
  border-color: rgba(66, 232, 224, 0.24) !important;
  color: #d9ecfb !important;
  box-shadow: inset 0 0 0 1px rgba(66, 232, 224, 0.08) !important;
}

:root:not([data-theme="light"]) .card-menu-btn:hover {
  background: rgba(20, 52, 86, 0.95) !important;
  color: #f2f9ff !important;
}

/* Profile action menu polish */
.card-menu-popover {
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(66, 232, 224, 0.06);
  border-radius: 12px;
  padding: .35rem;
}

.menu-item-btn {
  color: var(--color-text);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 9px;
}

.menu-item-btn:hover {
  background: var(--color-surface-muted);
}

.menu-item-btn:active {
  background: color-mix(in oklab, var(--color-surface-muted) 72%, var(--color-primary) 28%);
}

[data-theme="light"] .card-menu-popover {
  box-shadow: 0 10px 24px rgba(17, 48, 77, 0.13);
}

:root:not([data-theme="light"]) .card-menu-popover {
  background: linear-gradient(155deg, rgba(13, 35, 62, 0.98), rgba(8, 24, 44, 0.98)) !important;
  border-color: rgba(66, 232, 224, 0.22) !important;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(66, 232, 224, 0.09) !important;
}

:root:not([data-theme="light"]) .menu-item-btn {
  color: #e7f4ff !important;
}

@media (max-width: 1160px) {
  .discover-pillars article {
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .discover-pillars article:last-child {
    border-bottom: 0;
  }
}

/* Event edit contestants table */
.contestants-edit-table table {
  table-layout: auto;
}

.contestants-edit-table th:nth-child(1),
.contestants-edit-table th:nth-child(2) {
  width: 40%;
}

.contestants-edit-table th:nth-child(3) {
  width: 20%;
}

.contestants-edit-table td {
  overflow: visible;
  text-overflow: clip;
}

.contestants-edit-table th,
.contestants-edit-table td {
  white-space: normal;
}

.contestants-edit-table td input[type="text"],
.contestants-edit-table td .form-control,
.contestants-edit-table td input:not([type]) {
  width: 100%;
  min-width: 0;
}

.contestant-row-actions-cell {
  white-space: normal;
}

.contestants-edit-table .contestant-row-actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 130px;
}

.judges-edit-table .judge-row-actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 130px;
  white-space: normal;
}

.row-menu-wrap {
  position: relative;
}

.row-menu-trigger {
  min-width: 42px;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

.row-menu-popover {
  position: absolute;
  right: 0;
  top: auto;
  bottom: calc(100% + 0.35rem);
  z-index: 6;
  min-width: 122px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 0.3rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.row-menu-item {
  width: 100%;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}

.row-menu-item:hover {
  background: var(--color-surface-muted);
}

.row-menu-item.danger {
  color: #ef4444;
}

@media (max-width: 900px) {
  .contestants-edit-table td input[type="text"],
  .contestants-edit-table td .form-control,
  .contestants-edit-table td input:not([type]) {
    min-width: 140px;
  }
}

.entity-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}

.entity-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  padding: 0.8rem 0.9rem;
}

.entity-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.entity-card-header h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  color: var(--color-text);
}

.entity-subtitle {
  margin: 0.2rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.entity-card-body p {
  margin: 0.35rem 0;
  color: var(--color-text);
  font-size: 0.92rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.metric-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.metric-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  padding: 0.9rem;
}

.metric-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.7rem;
}

.metric-card-header h4 {
  margin: 0;
  font-size: 1rem;
}

.metric-card-desc {
  margin: 0.45rem 0 0.65rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.submetric-stack {
  display: grid;
  gap: 0.5rem;
}

.submetric-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.6rem 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  background: color-mix(in oklab, var(--card-bg) 82%, white 18%);
}

.submetric-allocation-note {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.submetric-allocation-note.ok {
  color: var(--color-text-muted);
}

.submetric-allocation-note.warn {
  color: #d97706;
}

/* Event edit layout responsiveness */
@media (max-width: 1480px) {
  .event-create-layout {
    grid-template-columns: minmax(200px, 220px) minmax(0, 1fr);
  }

  .create-preview-card {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 1160px) {
  .event-create-layout {
    grid-template-columns: 1fr;
  }

  .create-steps-card,
  .create-preview-card {
    position: static;
  }
}

@media (max-width: 1280px) {
  .contestants-edit-table .contestant-row-actions-cell {
    min-width: 0;
    justify-content: flex-start;
  }

  .judges-edit-table .judge-row-actions-cell {
    min-width: 0;
    justify-content: flex-start;
  }

  .row-menu-popover {
    right: auto;
    left: 0;
  }
}

@media (max-width: 600px) {
  .create-preview-card {
    display: none;
  }

  .create-step-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: .4rem;
    padding-bottom: .25rem;
    scrollbar-width: none;
  }

  .create-step-list::-webkit-scrollbar {
    display: none;
  }

  .create-step-list li {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .35rem;
    padding: .3rem .5rem;
  }

  .create-step-list li small {
    display: none;
  }

  .create-step-list li strong {
    white-space: nowrap;
  }
}

/* Backend / tenant launch tiles — used by the main backend, the tenant portal,
   and the tenant backend. Defined globally so they style correctly on every
   host (previously these rules lived only in the main backend page's <style>
   block and were missing on the tenant portal). */
.backend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.backend-tile {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    text-decoration: none;
    color: inherit;
    background: var(--surface-2);
    transition: border-color 120ms ease, transform 120ms ease;
}

.backend-tile:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.backend-tile span {
    color: var(--muted);
    font-size: 0.93rem;
}
