:root {
    /* Colors */
    --color-primary: #3498db;
    --color-primary-dark: #2980b9;
    --color-secondary: #2c3e50;
    --color-text: #333;
    --color-text-light: #666;
    --color-text-lighter: #7f8c8d;
    --color-text-muted: #888;
    --color-text-hint: #999;

    --color-bg-main: #f5f5f5;
    --color-bg-white: white;
    --color-bg-card: #fafafa;
    --color-bg-group: #f8f9fa;
    --color-bg-header: #ecf0f1;
    --color-bg-submit: #f8f9fa;

    --color-status-ok: #27ae60;
    --color-status-ok-bg: #f0f8f4;
    --color-status-warn: #f39c12;
    --color-status-warn-bg: #fff9c4;
    --color-status-crit: #c62828;
    --color-status-crit-bg: #ffebee;

    --color-border: #e0e0e0;
    --color-border-light: rgba(255, 255, 255, 0.2);

    /* Admin sidebar — colors for text on the dark secondary background */
    --color-secondary-light: #34495e;
    --color-nav-text: #bdc3c7;
    --color-nav-text-muted: #95a5a6;

    /* Slider gradient */
    --color-slider-low: #ffebee;
    --color-slider-mid: #fff9c4;
    --color-slider-high: #7ee182;

    /* Spacing */
    --space-mm: 0.125rem;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.25rem;
    --space-2xl: 1.5rem;
    --space-3xl: 2rem;
    --space-4xl: 2.5rem;

    /* Font sizes */
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-base: 1rem;
    --font-md: 1.125rem;
    --font-lg: 1.25rem;
    --font-xl: 1.5rem;
    --font-2xl: 2rem;
    --font-3xl: 2.5rem;
    --font-4xl: 3.5rem;

    /* Font weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Shadows */
    --shadow-sm: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
    --shadow-btn: 0 0.125rem 0.15rem rgba(0, 0, 0, 0.3);
    --shadow-slider: 0 0.125rem 0.25rem rgba(52, 152, 219, 0.3);

    /* Slider dimensions */
    --slider-track-height: 0.75rem;
    --slider-thumb-size: 2rem;
    --slider-container-height: 2.75rem;

    /* Transitions */
    --transition-base: 0.3s;
}

*,
*:before,
*:after {
    box-sizing: border-box;
}
* {
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
img {
    max-width: 100%;
    display: block;
}
h1,
h2,
h3,
h4,
h5,
h6 {
    text-wrap: balance;
}
body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg-main);
    line-height: 1.5;
}

.container {
    max-width: 37.5rem;
    margin: auto auto 60dvh;
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.cursor-pointer {
    cursor: pointer;
}

.flex {
    display: flex;
}
.flex-1 {
    flex: 1;
}
.hidden {
    display: none !important;
}
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.p-xs {
    padding: var(--space-xs);
}
.p-xl {
    padding: var(--space-xl);
}
.relative {
    position: relative;
}
.space-y-sm > :not(:last-child) {
    margin-bottom: var(--space-sm);
}
.space-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.text-center {
    text-align: center;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--font-lg);
}

/* Header */
.header {
    /* background: var(--color-bg-header); */
    padding: var(--space-xl);
    color: var(--color-text);
    border-bottom: 0.125rem solid var(--color-border);
}

.event-name {
    color: var(--color-primary-dark);
    font-size: var(--font-3xl);
    font-weight: var(--weight-bold);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}
.time {
    .original {
        display: block;
        font-size: var(--font-sm);
        text-decoration: line-through;
        color: var(--color-text-lighter);
    }

    .new {
        display: block;
        color: var(--color-status-warn);
    }
}

.event-date {
    font-size: var(--font-md);
    color: var(--color-text-light);
}
.event-location {
    font-size: var(--font-md);
    color: var(--color-text-lighter);
    margin-top: var(--space-xs);
}
.event-info {
    font-size: var(--font-sm);
    color: var(--color-text-light);
    margin: var(--space-sm) 0;
}

/* Contestant Card */
.contestant-card {
    border-bottom: 0.0625rem solid var(--color-border);
}

.speech-title {
    font-size: var(--font-sm);
    color: var(--color-text-lighter);
    font-weight: var(--weight-normal);
    font-style: italic;
}
.contestant-header {
    display: flex;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg-header);
    cursor: pointer;
    user-select: none;
    color: var(--color-secondary);
    font-size: var(--font-2xl);
    .flex-1 {
        display: flex;
        flex-direction: column;
    }
    .speech-title {
        font-size: var(--font-base);
        padding-left: var(--space-3xl);
    }
}

.contestant-name {
    font-weight: var(--weight-bold);
}

.contestant-total {
    color: var(--color-primary);
    font-weight: var(--weight-semibold);
}

.expand-icon {
    color: var(--color-text-lighter);
    margin-left: var(--space-md);
    transition: transform 0.3s ease;
}

/* Contestant Content */
.contestant-content {
    max-height: 0;
    overflow: hidden;
    transition:
        max-height 0.35s ease,
        background-color 0.4s ease;
}
.contestant-card.open .contestant-content {
    max-height: 2000px;
    padding: var(--space-lg) 0;
}

.contestant-card.open .expand-icon {
    transform: rotate(180deg);
}
.contestant-card.open .contestant-header {
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* Criteria Group */
.criteria-group {
    padding-bottom: var(--space-xs);
    border-left: 0.25rem solid var(--color-primary);
    border-bottom: 0.125rem solid var(--color-border);
    border-radius: var(--radius-md);
    position: relative;
}

.group-title {
    text-align: center;
    font-size: var(--font-md);
    font-weight: var(--weight-bold);
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.03125rem;
}

/* Criterion */
.criterion {
    padding: 0 var(--space-md) 0 var(--space-sm);
    margin-bottom: var(--space-xl);
}

.criterion-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-xs);
    font-size: var(--font-xl);
    font-weight: var(--weight-bold);
}

.criterion-name {
    color: var(--color-text);
}

.criterion-value {
    color: var(--color-primary);
    font-size: var(--font-2xl);
    white-space: nowrap;
}

.criterion-hint {
    font-size: var(--font-xs);
    font-weight: var(--weight-normal);
    color: var(--color-text-light);
    line-height: 1.4;
}

/* Slider */
.slider-container {
    position: relative;
    height: var(--slider-container-height);
    padding: var(--space-sm) 0;
    font-size: var(--font-xs);
    .marks span,
    .marks span::before,
    .labels span {
        position: absolute;
        transform: translateX(-50%);
        top: 0;
        left: calc(
            var(--slider-thumb-size) / 2 + (var(--value) / var(--max)) *
                (100% - var(--slider-thumb-size))
        );
        color: var(--color-text-muted);
    }

    .marks span::before {
        content: "";
        top: var(--space-2xl);
        left: 50%;
        width: var(--space-mm);
        height: var(--slider-track-height);
        background: var(--color-primary);
    }
    .labels span {
        top: calc(var(--space-3xl) + var(--slider-track-height));
        transition: all 0.2s ease;
    }

    .labels span.active {
        color: var(--color-primary);
        font-weight: var(--weight-semibold);
    }
    .track {
        position: absolute;
        top: var(--space-2xl);
        left: calc(var(--slider-thumb-size) / 2);
        right: calc(var(--slider-thumb-size) / 2);
        height: var(--slider-track-height);
        background: linear-gradient(
            to right,
            var(--color-slider-low) 0%,
            var(--color-slider-mid) 40%,
            var(--color-slider-mid) 60%,
            var(--color-slider-high) 100%
        );
    }
}

input[type="range"] {
    -webkit-appearance: none;
    pointer-events: none;
    width: 100%;
    height: var(--slider-container-height);
    background: transparent;
    position: relative;
    margin: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: var(--slider-thumb-size);
    height: var(--slider-thumb-size);
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    box-shadow: var(--shadow-slider);
}

input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: var(--slider-thumb-size);
    height: var(--slider-thumb-size);
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-slider);
}

input:where([type="number"]) {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    border: none;
    background-color: inherit;
    width: 100%;
    font-size: var(--font-xl);
    text-align: right;
}
input:where([type="number"]):focus {
    text-align: left;
}
input:where([type="checkbox"][role="switch"]) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    background-color: var(--color-border);
    width: 2em;
    height: 1em;
    border-radius: 1em;
    vertical-align: text-bottom;
    cursor: pointer;
    font-size: var(--font-xl);
}

input:where([type="checkbox"][role="switch"])::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(0, -50%);
    box-sizing: border-box;
    width: 0.7em;
    height: 0.7em;
    margin: 0 0.15em;
    border-radius: 50%;
    background: var(--color-primary);
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

input:where([type="checkbox"][role="switch"]):checked::before {
    left: 1em;
}

/* Submit Button */
.button {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: var(--space-sm);
    font-size: var(--font-xl);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-md);
    cursor: pointer;
    width: 100%;
    box-shadow: var(--shadow-btn);
    transition:
        background var(--transition-base),
        transform 0.05s ease,
        box-shadow 0.05s ease;
}
button:active,
button.pressed {
    transform: translateY(3px);
    box-shadow: 0 0 0 #aa0000;
}

.button:disabled {
    cursor: not-allowed;
}
.button:hover:disabled {
    background: var(--color-border);
}
label.button:has(:checked) {
    transform: translateY(3px);
    background: var(--color-primary-dark);
    box-shadow: 0 0 0 #aa0000;
}

.btn-secondary {
    background: #777;
    color: white;
}
/* Form */
.form {
    background: var(--color-bg-card);
}
.form-group {
    margin-bottom: var(--space-xl);
    label {
        display: block;
        font-size: var(--font-sm);
        font-weight: var(--weight-medium);
        color: var(--color-text-light);
        margin-bottom: var(--space-xs);
    }

    input {
        width: 100%;
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-base);
        border-radius: var(--radius-sm);
        border: 1px solid var(--color-border);
        background: var(--color-bg-white);
        color: var(--color-text);
        transition:
            border-color var(--transition-base),
            box-shadow var(--transition-base);
    }

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

    input:focus {
        outline: none;
        border-color: var(--color-primary);
        box-shadow: var(--shadow-sm);
    }

    select {
        width: 100%;
        padding: var(--space-sm) var(--space-md);
        color: var(--color-text);
        cursor: pointer;
        text-transform: revert;
        transition:
            border-color var(--transition-base),
            box-shadow var(--transition-base);
    }
    /* Error states */
    .form-error {
        margin: 0 var(--space-xs);
        font-size: var(--font-sm);
        color: var(--color-status-crit);
        line-height: 1.4;
    }
    input:invalid {
        border-color: #e74c3c;
    }
}
.card {
    text-align: center;
    background: var(--color-bg-card);
    animation: popin 0.4s ease-out;

    .title {
        font-size: var(--font-xl);
        font-weight: var(--weight-semibold);
        color: var(--color-text);
        margin-bottom: var(--space-sm);
    }

    p {
        font-size: var(--font-base);
        color: var(--color-text-light);
    }
}

.success {
    background: #eafaf1;
    color: var(--color-status-ok);
}
.icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto var(--space-md);
    border-radius: 50%;
    font-size: var(--font-3xl);
    font-weight: var(--weight-bold);
}

/* Links */
.link {
    display: inline-block;
    margin-top: var(--space-md);
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    font-size: var(--font-md);
    text-align: center;
    width: 100%;
}
.message {
    padding: var(--space-xl);
    border-radius: var(--radius-md);
}
.message.success {
    background: #c8e6c9;
    color: #2e7d32;
}
.message.error {
    background: var(--color-slider-low);
    border-left: 0.2rem solid #c40000;
    color: var(--color-status-crit);
}
.message.info {
    background: #f3faff;
    border-left: 0.2rem solid #4c8bf5;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin: 24px 0;
    padding: 16px;
    background: #f5f5f5;
    border-radius: var(--radius-md);
}
.stat {
    text-align: center;
}
.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #2196f3;
}
.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-top: 4px;
}
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10;

    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-xs); /* padding for mobile */

    .content {
        width: 100%;
        max-width: 500px;
        background: #fff;
        border-radius: var(--radius-md);
        padding: var(--space-lg);
        position: relative;
        box-shadow: var(--shadow-sm);
        animation: popin 0.25s ease;

        display: flex;
        flex-direction: column;
        gap: var(--space-sm);

        .title {
            text-align: center;
            font-size: var(--font-xl);
            font-weight: var(--weight-bold);

            & + p {
                text-align: center;
                font-size: var(--font-lg);
            }
        }
    }
}

@keyframes popin {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ranking-list {
    font-size: var(--font-lg);
    li {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        padding: var(--space-sm) 0;
        border-bottom: 1px dashed var(--color-border);
    }

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

    li::before {
        content: counter(list-item);
        counter-increment: list-item;
        width: 2rem;
        height: 2rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--color-bg-card);
        border: 2px solid var(--color-primary);
        border-radius: 50%;
        font-weight: var(--weight-bold);
        color: var(--color-primary);
    }
}
.ballot-summary {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}
select {
    padding: 0.125rem var(--space-sm);
    font-size: var(--font-base);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-white);
    text-transform: uppercase;
    letter-spacing: 0.03rem;
}

.status-list {
    padding: 0;
    list-style-position: inside;

    li {
        padding: var(--space-sm) var(--space-md);
        border-bottom: 1px solid var(--color-border);

        span:first-child {
            font-weight: var(--weight-semibold);
            color: var(--color-status-warn);
            min-width: 3.5rem;
        }
        &.ready span:first-child {
            color: var(--color-status-ok);
        }

        small {
            background: var(--color-bg-group);
            padding: 0.125rem var(--space-sm);
            margin: 0 var(--space-xs);
            border-radius: var(--radius-sm);
            text-transform: uppercase;
            font-size: var(--font-xs);
            letter-spacing: 0.03rem;
            text-align: center;
            display: inline-block;
        }

        select {
            width: 8rem;
        }

        input[type="text"] {
            flex: 1;
            padding: var(--space-xs) var(--space-sm);
            font-size: var(--font-base);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-sm);
        }

        form {
            display: inline;
        }
    }

    /* Hide edit controls by default */
    .edit-only {
        display: none;
    }
}
/* Show/hide based on editable class */
.editable {
    li {
        display: flex;
        gap: var(--space-sm);
        align-items: center;
        small,
        .name {
            display: none;
        }
    }

    .edit-only {
        display: inline-block;
    }

    select.edit-only {
        display: block;
    }
}
/* Auto-completer */
.autocomplete-items {
    position: absolute;
    border-width: 1px;
    background: var(--color-bg-white);
    left: 0;
    right: 0;
}
.autocomplete-item {
    padding: var(--space-xs);
    cursor: pointer;
    &:hover {
        background: var(--color-bg-card);
    }
}
.autocomplete-item.active {
    font-weight: var(--weight-bold);
    color: white;
    background: var(--color-primary);
}
footer {
    margin-top: var(--space-2xl);
    padding-bottom: var(--space-xs);
    text-align: center;
    font-size: var(--font-sm);
    color: var(--color-text-light);
    a {
        color: var(--color-primary);
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }
    }

    .footer-nav {
        display: flex;
        justify-content: center;
        margin-bottom: var(--space-lg);
        border: 1px solid var(--color-border);
        overflow: hidden;

        a {
            padding: var(--space-sm) var(--space-md);
            border-right: 1px solid var(--color-border);

            &:last-child {
                border-right: none;
            }

            &:hover {
                background: var(--color-bg-card);
            }
        }
    }

    .privacy-note {
        margin: var(--space-sm) 0;
        font-size: var(--font-xs);
        color: var(--color-text-lighter);
    }
}

.contest-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);

    .empty-state {
        text-align: center;
        padding: var(--space-3xl) var(--space-xl);
        color: var(--color-text-light);

        p:first-child {
            font-size: var(--font-lg);
            margin-bottom: var(--space-sm);
        }
    }

    .contest-item {
        display: flex;
        gap: var(--space-md);
        padding: var(--space-md) var(--space-lg);
        background: var(--color-bg-card);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-sm);
        text-decoration: none;
        color: var(--color-text);
        transition: all var(--transition-base);

        &:hover {
            background: var(--color-bg-header);
            box-shadow: var(--shadow-sm);
        }

        .time {
            font-size: var(--font-lg);
            font-weight: var(--weight-bold);
            color: var(--color-text-light);
            min-width: 4rem;
        }

        .details {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: var(--space-xs);
        }

        .name {
            font-size: var(--font-base);
            font-weight: var(--weight-semibold);
        }

        .badge {
            font-size: var(--font-xs);
            text-transform: uppercase;
            letter-spacing: 0.03rem;
            color: var(--color-text-lighter);
        }
        small {
            background: #dfbef2;
            padding: var(--space-mm) var(--space-sm);
            margin: 0 var(--space-xs);
            border-radius: var(--radius-sm);
            text-transform: uppercase;
            font-size: var(--font-xs);
            font-weight: var(--weight-semibold);
            letter-spacing: 0.03rem;
            &.audience {
                opacity: 0.3;
            }
        }

        &.in-progress,
        &.concluded {
            border-color: var(--color-status-ok);
            background: var(--color-status-ok-bg);

            .badge {
                color: var(--color-status-ok);
                font-weight: var(--weight-bold);
            }
        }

        &.delayed {
            border-color: var(--color-status-warn);

            .badge {
                color: var(--color-status-warn);
                font-weight: var(--weight-bold);
            }
        }

        &.cancelled {
            opacity: 0.6;

            .name {
                text-decoration: line-through;
            }

            .badge {
                color: var(--color-status-crit);
            }
        }

        &.concluded {
            opacity: 0.8;
        }
    }
}

/* Time display */
.time-display {
    font-size: var(--font-4xl);
    font-weight: var(--weight-bold);
    font-family: monospace;
    text-align: center;
    letter-spacing: 0.08em;
    padding: var(--space-2xl) 0;
    height: 50svh;
    color: var(--color-secondary);
    border: none;
    width: 100%;
    background: transparent;
    pointer-events: none;
}
.time-input:not([readonly]) {
    pointer-events: auto;
    border-bottom: 1px dashed currentColor;
    cursor: text;
}
.time-input.error {
    border-bottom: 2px solid var(--color-status-crit);
    color: var(--color-status-crit);
}

/* Actions */
.action-buttons {
    display: flex;
    margin: var(--space-sm) var(--space-3xl);
    gap: var(--space-md);
    justify-content: center;
    .button {
        padding: var(--space-lg);
    }
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-light);
}

/* Silence countdown bar */
.silence-bar {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: var(--space-lg);
    padding: var(--space-sm) var(--space-md);
    overflow: hidden;
    gap: var(--space-sm);
}
.silence-fill {
    position: absolute;
    inset: 0;
    right: auto;
    width: 100%;
    height: inherit !important;
}
.silence-fill.countdown {
    width: 0%;
    transition: width 60s linear;
}
.silence-label {
    position: relative;
    font-size: var(--font-lg);
    font-style: italic;
    color: var(--color-text-light);
    margin: 0 auto;
}

/* Status colors */
.status-neutral {
    background: var(--color-bg-group);
}

.status-ok {
    background: rgb(from var(--color-status-ok) r g b / 50%);
}

.status-warn {
    background: rgb(from var(--color-status-warn) r g b / 50%);
}

.status-crit {
    background: rgb(from var(--color-status-crit) r g b / 70%);
}

.judging-guide {
    margin: var(--space-lg) 0;
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);

    summary {
        font-weight: var(--weight-semibold);
        cursor: pointer;
        user-select: none;
        color: var(--color-primary);

        &:hover {
            color: var(--color-primary-dark);
        }
    }

    .guide-content {
        margin-top: var(--space-lg);

        h3 {
            color: var(--color-primary-dark);
            font-size: var(--font-lg);
            margin: var(--space-lg) 0;
            text-transform: uppercase;
            letter-spacing: 0.03rem;
        }

        h4 {
            color: var(--color-text);
            font-size: var(--font-base);
            font-weight: var(--weight-semibold);
            margin-top: var(--space-lg);
            margin-bottom: var(--space-xs);
        }

        p {
            color: var(--color-text-light);
            font-size: var(--font-sm);
            line-height: 1.6;
            margin-bottom: var(--space-md);
        }
    }
}

.status-control {
    display: flex;
    gap: var(--space-sm);
    margin: var(--space-sm) 0;
    align-items: stretch;
    .button {
        width: revert;
    }
    input[type="time"] {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-base);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-sm);
    }
    select {
        padding: var(--space-sm) var(--space-md);
        font-weight: var(--weight-medium);
    }
    .delayed {
        border-color: var(--color-status-warn);
        background: var(--color-status-warn-bg);
    }

    .in-progress,
    .concluded {
        border-color: var(--color-status-ok);
        background: var(--color-status-ok-bg);
    }

    .cancelled {
        border-color: var(--color-status-crit);
        background: var(--color-status-crit-bg);
    }
}
.text-sm {
    font-size: var(--font-sm);
}
.text-xs {
    font-size: var(--font-xs);
}
.text-light {
    color: var(--color-text-light);
}
.font-normal {
    font-weight: var(--weight-normal);
}
/* Disqualification Events */
.protest-item {
    background: var(--color-bg-card);
    border-left: 0.25rem solid;
    padding: var(--space-md);

    .protest-header {
        font-size: var(--font-lg);
    }
    .protest-type {
        text-align: right;
        padding: var(--space-xs);
        font-size: var(--font-xs);
        color: var(--color-text-light);
        font-weight: var(--weight-bold);
        text-transform: uppercase;
        letter-spacing: 0.03rem;
    }
    .protest-notes {
        padding: 0 var(--space-md);
        font-size: var(--font-md);
        margin-bottom: var(--space-md);
        line-height: 1.6;
    }
    &.pending {
        border-left-color: var(--color-status-warn);
    }
    &.upheld {
        border-left-color: var(--color-status-crit);
        .protest-type {
            background: var(--color-status-crit-bg);
            color: var(--color-status-crit);
        }
    }
    &.dismissed {
        border-left-color: var(--color-status-ok);
        .protest-type {
            background: var(--color-status-ok-bg);
            color: var(--color-status-ok);
        }
    }
    &.upheld,
    &.dismissed {
        opacity: 0.6;
        .protest-header {
            font-size: var(--font-base);
            margin-bottom: var(--space-xs);
        }
        .protest-notes {
            font-size: var(--font-sm);
            color: var(--color-text-light);
            margin-bottom: 0;
        }
    }
}

textarea {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    font-family: inherit;
    resize: vertical;
    min-height: 5.5rem;
}

.btn-crit {
    background: var(--color-status-crit);
}

.btn-ok {
    background: var(--color-status-ok);
}

.overflow-hidden {
    overflow: hidden;
}

.rounded {
    border-radius: var(--radius-sm);
}
.progress-slot {
    background-color: var(--color-border);
}
.progress-bar {
    height: var(--space-lg);
    background-color: var(--color-slider-high);
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.35) 25%,
        rgba(255, 255, 255, 0) 25%,
        rgba(255, 255, 255, 0) 50%,
        rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0.35) 75%,
        rgba(255, 255, 255, 0) 75%,
        rgba(255, 255, 255, 0)
    );
    background-repeat: repeat-x;
    background-size: 3rem 3rem;
}

.progress-bar.indeterminate {
    position: relative;
    animation: progress-indeterminate 5s linear infinite;
}

@keyframes progress-indeterminate {
    from {
        left: -35%;
        width: 35%;
    }
    to {
        left: 100%;
        width: 25%;
    }
}

table {
    border-collapse: collapse;
    font-size: var(--font-lg);
    margin-top: var(--space-md);
    th,
    td {
        padding: var(--space-sm);
        text-align: left;
        border: 1px solid var(--color-border);
    }
    td:has(input) {
        padding: var(--space-xs);
    }
    th {
        font-weight: var(--weight-semibold);
        color: var(--color-text-light);
        text-align: center;
        border-bottom: 3px solid var(--color-border);
    }
    tr:hover {
        background: var(--color-bg-card);
    }
}

table.vertical {
    td {
        text-align: center;
    }
    /* First column (labels) */
    td:first-child,
    th:first-child {
        background: #fff;
        left: 0;
        min-width: 7rem;
        position: sticky;
        text-align: right;
        z-index: 2;
    }
    th:first-child {
        vertical-align: bottom;
    }
    th:not(:first-child) {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        text-align: left;
        white-space: nowrap;
        &.judging-hint {
            font-size: var(--font-sm);
        }
    }
    tr:last-child {
        font-weight: var(--weight-semibold);
        color: var(--color-text);
    }
}
.contest-status {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: var(--space-sm);
    row-gap: var(--space-xs);

    font-size: var(--font-sm);
    color: var(--color-text);
    dt {
        font-weight: var(--weight-bold);
        text-transform: uppercase;
    }
    dd {
        color: var(--color-text-light);
    }
}
/* admin view */
.admin-container {
    display: flex;
    height: 100vh;

    /* Left Menu */
    nav {
        width: 220px;
        background: var(--color-secondary);
        padding: var(--space-xl);
        overflow-y: auto;

        strong {
            display: block;
            color: var(--color-bg-white);
            margin-bottom: var(--space-2xl);
            font-size: var(--font-md);
        }

        a {
            display: block;
            color: var(--color-nav-text);
            text-decoration: none;
            padding: var(--space-sm) 0 var(--space-sm) var(--space-md);
        }

        a:hover {
            color: var(--color-bg-white);
            background: var(--color-secondary-light);
        }

        a.active {
            color: var(--color-bg-white);
            font-weight: var(--weight-bold);
            border-left-color: var(--color-bg-white);
        }

        .nav-section {
            margin-top: var(--space-2xl);
        }

        small {
            display: block;
            color: var(--color-nav-text-muted);
            padding: var(--space-xs) 0;
            text-transform: uppercase;
            font-size: var(--font-xs);
            letter-spacing: 0.05em;
        }
    }

    /* Right Content */
    main {
        flex: 1;
        padding: var(--space-4xl);
        overflow-y: auto;
    }

    /* Compact buttons — admin is desktop-only; no need for full-width touch targets */
    .button {
        width: auto;
        font-size: var(--font-sm);
        padding: var(--space-xs) var(--space-md);
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
    }

    /* Editable table cells: inputs and selects blend with the row, reveal border on focus */
    td input,
    td select {
        min-width: fit-content;
        width: 100%;
        background: transparent;
        border: none;
        font-size: var(--font-base);
        font-family: inherit;

        &:hover,
        &:focus {
            background: var(--color-bg-white);
            outline: none;
        }
    }

    /* Status-colored selects mirror the contest-status-switcher palette */
    td select.delayed {
        border: 1px solid var(--color-status-warn);
        background: var(--color-status-warn-bg);
    }
    td select.in-progress,
    td select.concluded {
        border: 1px solid var(--color-status-ok);
        background: var(--color-status-ok-bg);
    }
    td select.cancelled {
        border: 1px solid var(--color-status-crit);
        background: var(--color-status-crit-bg);
    }

    td.actions {
        white-space: nowrap;
    }
}

/* Utility: make a <form> flow inline (e.g. icon-button forms inside a td) */
.form-inline {
    display: inline;
}

/* Utility: snap a flex/grid child to the end of the cross axis */
.align-end {
    align-self: flex-end;
}

/* RESULTS PRINT */
.page {
    padding: 2rem;
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media print {
    .page {
        page-break-after: always;
        padding: 0;
        /* border: 1px solid; */
        .logo {
            height: 3cm;
        }
    }
    @page {
        size: A4 landscape;
        margin: 2cm;
    }
}
