:root {
    color-scheme: light;
    --accent: #673ab7;
    --accent-dark: #5b32a3;
    --background: #f0ebf8;
    --card: #ffffff;
    --text: #202124;
    --muted: #5f6368;
    --border: #dadce0;
    --error: #d93025;
    --shadow: 0 1px 2px rgba(60, 64, 67, 0.14), 0 1px 3px rgba(60, 64, 67, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(126, 87, 194, 0.08), transparent 28rem),
        var(--background);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.page-shell {
    width: min(100% - 32px, 720px);
    margin: 0 auto;
    padding: 24px 0 48px;
}

.page-shell.queue-page {
    width: min(100% - 32px, 1280px);
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-bottom: 12px;
    gap: 8px;
}

.queue-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent-dark);
    background: #fff;
    box-shadow: var(--shadow);
    font-weight: 600;
    text-decoration: none;
}

.queue-link:hover {
    background: #f6f1fc;
}

.queue-link.is-current {
    color: #fff;
    background: var(--accent);
}

.queue-link:focus-visible {
    outline: 3px solid rgba(103, 58, 183, 0.3);
    outline-offset: 3px;
}

.title-card,
.question-card,
.global-error {
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.title-card {
    padding: 30px 24px 18px;
}

.queue-title p {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.queue-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 18px;
    color: var(--muted);
    gap: 8px 20px;
}

.queue-meta .refresh-link {
    margin-left: auto;
    padding: 4px 0;
}

.queue-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.queue-table-wrap {
    overflow-x: auto;
}

.queue-table {
    width: 100%;
    min-width: 1080px;
    border-collapse: collapse;
    font-size: 13px;
}

.queue-table th,
.queue-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.queue-table th {
    position: sticky;
    top: 0;
    color: #3c4043;
    background: #f8f5fc;
    font-size: 12px;
    letter-spacing: 0.25px;
    white-space: nowrap;
}

.queue-table tbody tr:nth-child(even) {
    background: #fcfbfd;
}

.queue-table tbody tr:last-child td {
    border-bottom: 0;
}

.queue-table th:first-child,
.queue-table td:first-child {
    width: 54px;
    text-align: center;
}

.duration-cell,
.plate-cell {
    font-weight: 600;
    white-space: nowrap;
}

.queue-empty p {
    margin: 0;
    color: var(--muted);
    text-align: center;
}

.title-accent {
    position: absolute;
    inset: 0 0 auto;
    height: 10px;
    background: var(--accent);
}

h1 {
    margin: 0;
    font-size: clamp(25px, 4vw, 32px);
    font-weight: 400;
    letter-spacing: -0.4px;
    line-height: 1.25;
}

.divider {
    height: 1px;
    margin: 18px -24px 12px;
    background: var(--border);
}

.required-note,
.field-error,
.required {
    color: var(--error);
}

.required-note {
    margin: 0;
    font-size: 13px;
}

.question-card {
    min-width: 0;
    margin-inline: 0;
    padding: 24px;
    overflow: visible;
}

fieldset.question-card {
    width: 100%;
}

.question-card.has-error {
    border-left: 5px solid var(--error);
    padding-left: 20px;
}

.question-title {
    display: block;
    margin: 0 0 20px;
    padding: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

legend.question-title {
    float: left;
    width: 100%;
}

legend.question-title + * {
    clear: both;
}

.select-wrap {
    position: relative;
    display: inline-block;
    width: min(100%, 280px);
}

.select-wrap.wide {
    width: min(100%, 430px);
}

.exit-search-input {
    display: block;
    width: min(100%, 430px);
    min-height: 44px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    color: var(--text);
    background: #fff;
    font: inherit;
}

.exit-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.exit-search-input::placeholder {
    color: #70757a;
    opacity: 1;
}

.searchable-select {
    position: relative;
    width: min(100%, 430px);
}

.combobox-input {
    display: none;
}

.searchable-select.is-enhanced .combobox-input {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 8px 38px 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    color: var(--text);
    background: #fff;
    font: inherit;
}

.searchable-select.is-enhanced::after {
    position: absolute;
    top: 21px;
    right: 14px;
    width: 0;
    height: 0;
    border-top: 6px solid #5f6368;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    content: '';
    pointer-events: none;
}

.combobox-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.searchable-select.is-enhanced .select-wrap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}

.search-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    display: none;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(60, 64, 67, 0.2);
}

.searchable-select.is-enhanced .search-results:not([hidden]) {
    display: block;
}

.search-result {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 0;
    color: var(--text);
    background: #fff;
    text-align: left;
    font: inherit;
    font-weight: 400;
}

.search-result:hover,
.search-result:focus {
    outline: none;
    background: #f3eefb;
}

.search-empty {
    margin: 0;
    padding: 12px;
    color: var(--muted);
}

.select-wrap::after {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 0;
    height: 0;
    border-top: 6px solid #5f6368;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    content: '';
    pointer-events: none;
    transform: translateY(-25%);
}

select {
    width: 100%;
    min-height: 48px;
    padding: 0 44px 0 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    color: var(--text);
    background: #fff;
    font: inherit;
    appearance: none;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.radio-list {
    display: grid;
    gap: 14px;
}

.choice {
    display: flex;
    align-items: flex-start;
    width: fit-content;
    max-width: 100%;
    cursor: pointer;
    gap: 12px;
}

.choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.custom-radio {
    position: relative;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border: 2px solid #5f6368;
    border-radius: 50%;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.choice input:checked + .custom-radio {
    border-color: var(--accent);
}

.choice input:checked + .custom-radio::after {
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--accent);
    content: '';
}

.choice input:focus-visible + .custom-radio {
    outline: 3px solid rgba(103, 58, 183, 0.24);
    outline-offset: 3px;
}

.text-input {
    display: block;
    width: min(100%, 360px);
    padding: 8px 0 7px;
    border: 0;
    border-bottom: 1px solid #9aa0a6;
    border-radius: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font: inherit;
    transition: border-color 120ms ease, border-width 120ms ease;
}

.text-input:focus {
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent);
}

.text-input::placeholder {
    color: #70757a;
    opacity: 1;
}

.exit-quantity {
    margin-top: 24px;
}

.exit-quantity .question-title {
    margin-bottom: 12px;
}

.field-error {
    margin: 12px 0 0;
    font-size: 13px;
}

.client-error {
    display: none;
}

.client-error.visible {
    display: block;
}

.global-error {
    padding: 14px 18px;
    border-color: #f1aea9;
    color: #8c1d18;
    background: #fce8e6;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    gap: 16px;
}

button,
.text-link {
    border: 0;
    border-radius: 4px;
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
}

button[type='submit'] {
    min-width: 88px;
    padding: 10px 22px;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

button[type='submit']:hover {
    background: var(--accent-dark);
}

.clear-button {
    padding: 10px 8px;
    color: var(--accent);
    background: transparent;
}

button:focus-visible,
.text-link:focus-visible {
    outline: 3px solid rgba(103, 58, 183, 0.3);
    outline-offset: 3px;
}

.privacy-note {
    margin: 24px 6px 0;
    color: var(--muted);
    font-size: 12px;
}

.trap {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.confirmation {
    margin-top: 8vh;
    padding-bottom: 28px;
}

.confirmation-icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin: 8px 0 20px;
    border-radius: 50%;
    color: #fff;
    background: #188038;
    font-size: 27px;
    place-items: center;
}

.confirmation p {
    margin: 18px 0 22px;
    font-size: 16px;
}

.text-link {
    display: inline-block;
    padding: 8px 0;
    color: var(--accent);
    text-decoration: none;
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 20px, 720px);
        padding-top: 12px;
    }

    .title-card,
    .question-card {
        padding-right: 20px;
        padding-left: 20px;
    }

    .question-card.has-error {
        padding-left: 16px;
    }

    .divider {
        margin-right: -20px;
        margin-left: -20px;
    }

    .queue-meta .refresh-link {
        width: 100%;
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

[hidden] {
    display: none !important;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
