:root {
    color-scheme: light;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7f8;
    color: #172026;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.wide-shell {
    width: min(1600px, calc(100% - 32px));
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin-bottom: 20px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.eyebrow {
    margin: 0 0 6px;
    color: #60707b;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 34px;
    line-height: 1.15;
}

h2 {
    font-size: 20px;
    margin-bottom: 14px;
}

.toolbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
}

label {
    font-weight: 700;
}

input,
select,
textarea {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #b8c5cc;
    border-radius: 6px;
    font: inherit;
    background: #ffffff;
}

input[type="date"] {
    min-height: 40px;
}

fieldset {
    margin: 0;
}

legend {
    font-weight: 700;
}

.phase-fieldset {
    display: grid;
    gap: 8px;
}

.phase-groom-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 10px;
    align-items: end;
}

.phase-assignment-row {
    grid-template-columns: minmax(170px, 220px) minmax(220px, 1fr) minmax(240px, 1.2fr);
    align-items: start;
    padding: 10px 0;
    border-top: 1px solid #d8e0e5;
}

.phase-groom-row > label:last-of-type {
    display: grid;
    gap: 5px;
    color: #42545c;
    font-size: 12px;
}

.phase-horse-picker {
    display: grid;
    gap: 5px;
    color: #42545c;
    font-size: 12px;
}

.phase-horse-picker strong {
    color: #172026;
    font-size: 12px;
}

button {
    padding: 10px 16px;
    border: 0;
    border-radius: 6px;
    background: #1f6f68;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.link-button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #e6f0ef;
    color: #184c48;
    font-weight: 700;
    text-decoration: none;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.secondary-button {
    border: 1px solid #b8c5cc;
    background: #f4f7f8;
    color: #173d3a;
}

.secondary-button:hover {
    background: #e8eef1;
}

.danger-button {
    background: #9f1d1d;
}

.danger-button:hover {
    background: #7f1515;
}

.danger-zone {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 2px solid #f0b8b8;
}

.danger-zone h2 {
    color: #8d1818;
}

.unsaved-indicator {
    display: inline-block;
    margin: 8px 0 0;
    padding: 6px 10px;
    border: 1px solid #d59b2d;
    border-radius: 6px;
    background: #fff6df;
    color: #6d4600;
    font-size: 13px;
    font-weight: 700;
}

.unsaved-indicator[hidden] {
    display: none;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 16px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid #b8d3cf;
    border-radius: 8px;
}

.action-bar strong {
    display: block;
    margin-bottom: 4px;
}

.action-bar p {
    color: #60707b;
    font-size: 14px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metrics article,
.panel,
.notice {
    background: #ffffff;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
}

.metrics article {
    padding: 16px;
}

.metrics span {
    display: block;
    font-size: 28px;
    font-weight: 800;
}

.metrics p {
    margin-top: 4px;
    color: #60707b;
    font-size: 13px;
    text-transform: capitalize;
}

.panel {
    padding: 18px;
    margin-top: 18px;
    overflow-x: auto;
}

.notice {
    padding: 16px;
    color: #7a1f1f;
    border-color: #e2b8b8;
}

.notice.success {
    color: #16543c;
    border-color: #a8d9c0;
    background: #f2fbf6;
}

.notice.warning-notice {
    color: #6b3b00;
    border-color: #e5bd65;
    background: #fff8e8;
}

.summary-band {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 16px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
}

.summary-band strong {
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
}

.summary-band p,
.muted {
    color: #60707b;
    font-size: 13px;
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 18px;
    margin-bottom: 12px;
}

.class-count {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: #eef4f5;
    color: #42545c;
    font-size: 13px;
    font-weight: 700;
}

.category-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tag {
    display: inline-flex;
    gap: 8px;
    align-items: baseline;
    padding: 5px 8px;
    border: 1px solid #cbd8dd;
    border-radius: 999px;
    background: #fafcfc;
    font-size: 13px;
    font-weight: 700;
}

.tag small {
    color: #60707b;
    font-size: 11px;
    font-weight: 400;
}

.admin-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.admin-dashboard-card {
    display: grid;
    gap: 8px;
    align-content: start;
    padding: 18px;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
    background: #ffffff;
}

.admin-dashboard-card h2 {
    margin-bottom: 6px;
}

.admin-dashboard-card a {
    display: block;
    padding: 8px 10px;
    border: 1px solid #d8e0e5;
    border-radius: 6px;
    background: #f7fafb;
    color: #184c48;
    font-weight: 700;
    text-decoration: none;
}

.admin-dashboard-card .disabled-dashboard-link {
    display: block;
    padding: 8px 10px;
    border: 1px solid #d8e0e5;
    border-radius: 6px;
    background: #f2f5f6;
    color: #8b99a2;
    font-weight: 700;
    cursor: not-allowed;
}

.phase-disabled {
    opacity: 0.48;
}

.admin-dashboard-card.phase-disabled {
    background: #f7f9fa;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 14px;
    margin-top: 8px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pause-duration-input {
    width: 5.5rem;
}

.warning-tag {
    margin: 0 6px 6px 0;
    border-color: #e3bd72;
    background: #fff8e8;
    color: #6b4a08;
}

.phase-edit {
    display: grid;
    gap: 7px;
    min-width: 190px;
}

.phase-edit label {
    display: grid;
    gap: 4px;
    color: #42545c;
    font-size: 12px;
}

.phase-edit input,
.phase-edit textarea {
    width: 100%;
    padding: 7px 8px;
}

.phase-edit textarea {
    min-height: 96px;
    resize: vertical;
}

.cell-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cell-save-button {
    padding: 7px 10px;
    font-size: 12px;
}

.cell-status {
    min-height: 16px;
}

.sharing-table th:first-child,
.sharing-table td:first-child {
    min-width: 220px;
}

.sharing-table th:nth-child(2),
.sharing-table td:nth-child(2) {
    min-width: 260px;
}

.groom-editor-table input {
    width: 100%;
    padding: 7px 8px;
}

.groom-editor-table th:last-child,
.groom-editor-table td:last-child {
    width: 120px;
}

.groom-editor-table th:nth-child(n+3):not(:last-child),
.groom-editor-table td:nth-child(n+3):not(:last-child) {
    min-width: 210px;
}

.config-check-table th:first-child,
.config-check-table td:first-child {
    width: 110px;
}

.config-check-table th:last-child,
.config-check-table td:last-child {
    width: 90px;
}

.config-status-pill {
    display: inline-block;
    min-width: 70px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.config-row-ok .config-status-pill,
.config-status-ok {
    color: #16543c;
    background: #f2fbf6;
}

.config-row-warning .config-status-pill,
.config-status-warning {
    color: #6b3b00;
    background: #fff8e8;
}

.config-row-missing .config-status-pill,
.config-status-missing {
    color: #7a1f1f;
    background: #fff1f1;
}

.config-row-missing td {
    border-bottom-color: #efc7c7;
}

.config-row-warning td {
    border-bottom-color: #ecd6a1;
}

.config-check-items {
    margin: 6px 0 0;
    padding-left: 18px;
    color: #60707b;
    font-size: 13px;
}

.config-check-items li + li {
    margin-top: 2px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-grid.single {
    grid-template-columns: 1fr;
}

.selector-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.score-selector-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 2fr) minmax(180px, 260px) auto;
    gap: 12px;
    align-items: end;
}

.score-selector-grid label {
    display: grid;
    gap: 6px;
    color: #42545c;
    font-size: 12px;
}

.event-list {
    display: grid;
    gap: 8px;
}

.event-list-item {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.event-list-item.active {
    border-color: #1f6f68;
    background: #eff8f6;
}

.event-list-item span {
    color: #60707b;
    font-size: 13px;
}

.form-grid {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.stacked-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: end;
}

.stacked-form-grid label {
    display: grid;
    gap: 6px;
    color: #42545c;
    font-size: 12px;
    font-weight: 700;
}

.stacked-form-grid .form-meta {
    grid-column: auto;
}

.stacked-form-grid .form-actions {
    grid-column: 1 / -1;
}

.stacked-form-grid .checkbox-line {
    align-self: center;
    min-height: 42px;
}

.form-meta {
    grid-column: 2;
    padding: 12px;
    background: #f7fafb;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
}

.form-actions {
    grid-column: 2;
}

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

.category-admin-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
    background: #fbfdfd;
}

.category-section-title {
    grid-column: 1 / -1;
    padding-top: 8px;
    border-top: 1px solid #d8e0e5;
    color: #1d2d35;
    font-size: 13px;
    font-weight: 800;
}

.category-admin-row label,
.checkbox-line,
.readonly-field {
    display: grid;
    gap: 5px;
    color: #42545c;
    font-size: 12px;
    font-weight: 700;
}

.readonly-field strong {
    min-height: 37px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid #d8e0e5;
    border-radius: 6px;
    background: #eef3f5;
    color: #1d2d35;
    font-size: 14px;
}

.obstacle-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-admin-row .obstacle-check {
    display: inline-block;
    justify-items: center;
    align-items: center;
    grid-template-columns: 1fr;
    gap: 4px;
    min-width: 42px;
    padding: 7px 8px;
    border: 1px solid #b9c8cf;
    border-radius: 6px;
    background: #ffffff;
    color: #263940;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.category-admin-row .obstacle-check input {
    min-width: auto;
    width: 16px;
    height: 16px;
    margin: 0;
}

.category-admin-row .obstacle-check:has(input:checked) {
    border-color: #1b6b64;
    background: #d9f0ec;
    color: #113f3a;
}

.checkbox-line {
    grid-template-columns: auto 1fr;
    align-items: center;
    padding-bottom: 10px;
}

.checkbox-line input {
    min-width: auto;
}

.inline-add-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(140px, 220px) auto;
    gap: 10px;
    margin-top: 16px;
    align-items: center;
}

.settings-grid,
.program-duration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.settings-grid label,
.program-duration-grid label {
    display: grid;
    gap: 6px;
    color: #42545c;
    font-size: 12px;
    font-weight: 700;
}

.start-list-table th:first-child,
.start-list-table td:first-child {
    width: 76px;
}

.break-row td {
    background: #fff8e8;
    color: #6b4a08;
}

.day-row td {
    background: #eaf3f7;
    color: #274454;
    font-weight: 700;
}

.sortable-row {
    cursor: grab;
}

.sortable-row.dragging {
    opacity: 0.45;
}

.drag-handle {
    width: 44px;
    color: #60707b;
    font-weight: 800;
    text-align: center;
}

.move-buttons {
    white-space: nowrap;
}

.move-buttons button {
    padding: 6px 9px;
    font-size: 12px;
}

.compact-field {
    display: grid;
    gap: 4px;
    max-width: 110px;
    color: #42545c;
    font-size: 12px;
    font-weight: 700;
}

.compact-field input {
    padding: 6px 8px;
}

.compact-number-input {
    width: 72px;
    padding: 7px 8px;
}

.dressage-setup-table {
    min-width: 1320px;
}

.dressage-setup-table th:first-child,
.dressage-setup-table td:first-child {
    width: 86px;
}

.dressage-setup-table th:nth-child(3),
.dressage-setup-table td:nth-child(3) {
    min-width: 260px;
}

.judge-cell {
    min-width: 160px;
}

.judge-cell label {
    display: grid;
    gap: 4px;
    margin-bottom: 7px;
    color: #42545c;
    font-size: 12px;
}

.judge-cell input,
.judge-count-input {
    width: 100%;
    padding: 7px 8px;
}

.movable-break-row {
    cursor: grab;
}

.compact-button {
    min-height: 30px;
    padding: 6px 10px;
    font-size: 12px;
}

.gap-line {
    margin-top: 4px;
    color: #7a1f1f;
    font-size: 13px;
    font-weight: 700;
}

.competitor-modal {
    width: min(1180px, calc(100% - 32px));
    height: min(820px, calc(100vh - 32px));
    padding: 0;
    border: 1px solid #b8c5cc;
    border-radius: 8px;
    background: #ffffff;
}

.competitor-modal::backdrop {
    background: rgba(23, 32, 38, 0.45);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #d8e0e5;
}

.competitor-modal iframe {
    width: 100%;
    height: calc(100% - 65px);
    border: 0;
}

.publish-textarea {
    width: 100%;
    min-height: 520px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.45;
}

.public-heading-row td {
    background: #eef4f5;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.score-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
}

.score-entry-table {
    width: auto;
    min-width: 220px;
}

.score-entry-panel {
    max-width: 520px;
    padding: 14px;
}

.score-entry-panel .class-header {
    gap: 10px;
    margin-bottom: 10px;
}

.score-entry-panel .class-header h2 {
    margin: 0 0 2px;
    font-size: 20px;
}

.score-entry-panel .class-header p {
    margin: 0;
    font-size: 12px;
}

.score-entry-panel .page-actions {
    gap: 7px;
}

.score-entry-panel .page-actions button,
.score-entry-panel .page-actions .tag {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

.score-entry-table th,
.score-entry-table td {
    padding: 3px 6px;
    line-height: 1.15;
}

.score-entry-table th:first-child,
.score-entry-table td:first-child {
    width: 44px;
    text-align: right;
}

.score-entry-table .mark-input {
    width: 66px;
    min-height: 30px;
    padding: 3px 6px;
    font-size: 17px;
    text-align: right;
}

.score-entry-table .mark-input.mark-editing {
    border-color: #d39b19;
    background: #fff9e8;
}

.score-entry-panel .field-error {
    min-height: 12px;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.1;
}

.score-entry-panel .score-footer {
    justify-content: flex-start;
    gap: 12px;
    margin-top: 8px;
}

.score-entry-panel .inline-score-field input {
    width: 64px;
    padding: 5px 6px;
}

.marathon-score-table {
    min-width: 1660px;
    font-size: 13px;
}

.marathon-startlist-table {
    min-width: 1500px;
    font-size: 13px;
}

.cones-startlist-table {
    min-width: 1250px;
    font-size: 13px;
}

.marathon-startlist-table .gap-adjustment-input,
.cones-startlist-table .gap-adjustment-input {
    width: 74px;
    min-width: 74px;
}

.obstacle-eta-cell {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.marathon-score-table th:first-child,
.marathon-score-table td:first-child {
    width: 82px;
}

.cones-score-layout {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.4fr) minmax(220px, 0.8fr);
    gap: 16px;
    align-items: start;
}

.score-entry-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
    background: #fff;
}

.live-score-root {
    display: grid;
    gap: 1rem;
}

.live-score-group h3 {
    margin-top: 0;
}

.live-dressage-table {
    min-width: 920px;
}

.live-dressage-table th,
.live-dressage-table td {
    white-space: nowrap;
    vertical-align: top;
}

.live-dressage-table th:nth-child(3),
.live-dressage-table td:nth-child(3) {
    min-width: 240px;
    white-space: normal;
}

.live-dressage-table .judge-column {
    text-align: center;
}

.judge-rank {
    color: #60707b;
    font-size: 12px;
}

.live-dressage-table tr.score-row-updated td,
.live-marathon-table tr.score-row-updated td,
.live-cones-table tr.score-row-updated td,
.live-ac-table tr.score-row-updated td,
.live-acb-table tr.score-row-updated td {
    box-shadow: inset 0 0 0 2px #f2c94c;
}

.live-dressage-table tr.score-row-updated.pulse td,
.live-marathon-table tr.score-row-updated.pulse td,
.live-cones-table tr.score-row-updated.pulse td,
.live-ac-table tr.score-row-updated.pulse td,
.live-acb-table tr.score-row-updated.pulse td {
    animation: score-row-flash 20s ease-out forwards;
}

@keyframes score-row-flash {
    0% {
        box-shadow: inset 0 0 0 3px #ffb000, 0 0 12px rgba(255, 176, 0, 0.65);
    }

    10% {
        box-shadow: inset 0 0 0 3px #ffd166, 0 0 8px rgba(255, 209, 102, 0.5);
    }

    20% {
        box-shadow: inset 0 0 0 3px #ffb000, 0 0 12px rgba(255, 176, 0, 0.65);
    }

    35% {
        box-shadow: inset 0 0 0 3px #ffd166, 0 0 8px rgba(255, 209, 102, 0.5);
    }

    50% {
        box-shadow: inset 0 0 0 3px #ffb000, 0 0 12px rgba(255, 176, 0, 0.65);
    }

    70% {
        box-shadow: inset 0 0 0 3px #ffd166, 0 0 8px rgba(255, 209, 102, 0.5);
    }

    100% {
        box-shadow: inset 0 0 0 2px #f2c94c;
    }
}

.cones-gate-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gate-button {
    min-width: 46px;
    padding: 7px 9px;
    border: 1px solid #bfd0d4;
    background: #ffffff;
    color: #173d3a;
}

.gate-button.passed {
    border-color: #2f855a;
    background: #def7e8;
    color: #23543d;
}

.gate-button.dropped {
    border-color: #9b2c2c;
    background: #ffe8e8;
    color: #7a1f1f;
}

.hidden {
    display: none !important;
}

.disabled-control {
    opacity: 0.55;
    cursor: not-allowed;
}

.quick-entry-layout {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(280px, 380px);
    gap: 16px;
    align-items: start;
}

.quick-entry-controls,
.quick-entry-review {
    display: grid;
    gap: 14px;
}

.quick-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 10px;
}

.quick-form-grid input,
.quick-form-grid select,
.quick-entry-controls input,
.quick-entry-controls select {
    font-size: 18px;
    min-height: 42px;
}

.segmented-control {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.segmented-control label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid #bfd0d4;
    border-radius: 8px;
    background: #ffffff;
}

.obstacle-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.obstacle-button-row .gate-button {
    min-width: 54px;
    min-height: 42px;
    font-size: 18px;
    font-weight: 700;
}

.quick-driver-card {
    min-height: 72px;
    padding: 12px;
    border: 1px solid #d8e0e5;
    border-radius: 8px;
    background: #ffffff;
}

.quick-current-values {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 7px 12px;
    margin: 0;
}

.quick-current-values dt {
    color: #5d7178;
    font-weight: 700;
}

.quick-current-values dd {
    margin: 0;
}

.quick-recent-list {
    min-height: 120px;
    margin: 0;
    padding-left: 22px;
}

.inline-score-field {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
}

.inline-score-field input {
    width: 82px;
}

.marathon-score-table th:nth-child(2),
.marathon-score-table td:nth-child(2) {
    min-width: 190px;
}

.marathon-score-table th:nth-child(3),
.marathon-score-table td:nth-child(3) {
    min-width: 150px;
}

.marathon-score-table th:nth-child(4),
.marathon-score-table td:nth-child(4) {
    min-width: 480px;
}

.marathon-score-cell {
    white-space: nowrap;
}

.marathon-section-cell .marathon-input-grid {
    grid-template-columns: minmax(84px, 1fr) minmax(84px, 1fr) minmax(92px, 1fr) minmax(70px, 0.8fr);
}

.marathon-obstacle-cell {
    min-width: 170px;
}

.received-value {
    min-height: 18px;
    margin-bottom: 8px;
    color: #184c48;
    font-size: 12px;
    font-weight: 700;
}

.marathon-input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.marathon-section-cell .marathon-input-grid label:nth-child(5),
.marathon-section-cell .marathon-input-grid label:nth-child(6) {
    grid-column: span 2;
}

.marathon-section-cell label,
.marathon-obstacle-cell label {
    display: grid;
    gap: 3px;
    margin-bottom: 6px;
    color: #42545c;
    font-size: 11px;
    font-weight: 700;
}

.marathon-section-cell input,
.marathon-section-cell select,
.marathon-obstacle-cell input,
.marathon-obstacle-cell select {
    width: 100%;
    padding: 6px 7px;
    font-size: 13px;
}

.inactive-cell {
    background: #f3f6f7;
    color: #8a9aa3;
    text-align: center;
}

.invalid-input {
    border-color: #b42318;
    background: #fff5f5;
}

.field-error {
    min-height: 16px;
    margin-top: 4px;
    color: #b42318;
    font-size: 12px;
    font-weight: 700;
}

@media print {
    .page-actions,
    .print-actions {
        display: none;
    }

    body {
        background: #ffffff;
    }

    .shell {
        width: 100%;
        padding: 0;
    }

    .panel,
    .summary-band {
        border: 0;
        padding: 0;
        margin-top: 12px;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 10px 8px;
    border-bottom: 1px solid #e6ecef;
    text-align: left;
    vertical-align: top;
}

th {
    color: #60707b;
    font-size: 12px;
    text-transform: uppercase;
}

.public-results {
    padding: 12px;
}

.public-results .class-header {
    margin-bottom: 8px;
}

.public-results .live-score-root {
    gap: 8px;
}

.public-results .score-entry-card {
    gap: 6px;
    padding: 10px;
}

.public-results .live-dressage-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 13px;
}

.public-results .live-marathon-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 13px;
}

.public-results .live-cones-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 13px;
}

.public-results .live-ac-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 13px;
}

.public-results .live-acb-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 13px;
}

.public-results table {
    border-collapse: collapse;
}

.public-results .live-dressage-table th,
.public-results .live-dressage-table td,
.public-results .live-marathon-table th,
.public-results .live-marathon-table td,
.public-results .live-cones-table th,
.public-results .live-cones-table td,
.public-results .live-ac-table th,
.public-results .live-ac-table td,
.public-results .live-acb-table th,
.public-results .live-acb-table td,
.public-results .public-basic-results-table th,
.public-results .public-basic-results-table td {
    border: 1px solid #dce3e8;
    padding: 6px 4px;
}

.public-results .live-dressage-table th:first-child,
.public-results .live-dressage-table td:first-child,
.public-results .live-marathon-table th:first-child,
.public-results .live-marathon-table td:first-child,
.public-results .live-cones-table th:first-child,
.public-results .live-cones-table td:first-child,
.public-results .live-ac-table th:first-child,
.public-results .live-ac-table td:first-child,
.public-results .live-acb-table th:first-child,
.public-results .live-acb-table td:first-child {
    width: 44px;
}

.public-results .live-dressage-table th:nth-child(2),
.public-results .live-dressage-table td:nth-child(2),
.public-results .live-marathon-table th:nth-child(2),
.public-results .live-marathon-table td:nth-child(2),
.public-results .live-cones-table th:nth-child(2),
.public-results .live-cones-table td:nth-child(2),
.public-results .live-ac-table th:nth-child(2),
.public-results .live-ac-table td:nth-child(2),
.public-results .live-acb-table th:nth-child(2),
.public-results .live-acb-table td:nth-child(2) {
    width: 42px;
}

.public-results .live-dressage-table th:nth-child(3),
.public-results .live-dressage-table td:nth-child(3),
.public-results .live-marathon-table th:nth-child(3),
.public-results .live-marathon-table td:nth-child(3),
.public-results .live-cones-table th:nth-child(3),
.public-results .live-cones-table td:nth-child(3),
.public-results .live-ac-table th:nth-child(3),
.public-results .live-ac-table td:nth-child(3),
.public-results .live-acb-table th:nth-child(3),
.public-results .live-acb-table td:nth-child(3) {
    min-width: 120px;
    width: 28%;
}

.public-results .judge-column {
    padding-left: 5px;
    padding-right: 5px;
}

.public-results .pen-column,
.public-results .rank-column {
    width: 32px;
    padding-left: 3px;
    padding-right: 3px;
    text-align: center;
}

.public-results .total-column {
    width: 48px;
    padding-left: 3px;
    padding-right: 3px;
    text-align: center;
}

.public-results .live-marathon-table th:nth-child(4),
.public-results .live-marathon-table td:nth-child(4) {
    width: 44px;
    text-align: center;
}

.public-results .marathon-section-column {
    width: 44px;
    text-align: center;
}

.public-results .marathon-obstacle-column {
    width: 54px;
    text-align: center;
}

.public-results .marathon-total-column {
    width: 52px;
    text-align: center;
}

.public-results .aft-seconds-column {
    width: 34px;
    min-width: 30px;
    text-align: center;
}

.public-results .acb-final-total-column {
    width: 58px;
    text-align: center;
}

.public-results .live-marathon-table th:first-child,
.public-results .live-marathon-table td:first-child,
.public-results .live-marathon-table th:nth-child(2),
.public-results .live-marathon-table td:nth-child(2),
.public-results .live-marathon-table th:nth-child(3),
.public-results .live-marathon-table td:nth-child(3),
.public-results .live-cones-table th:first-child,
.public-results .live-cones-table td:first-child,
.public-results .live-cones-table th:nth-child(2),
.public-results .live-cones-table td:nth-child(2),
.public-results .live-cones-table th:nth-child(3),
.public-results .live-cones-table td:nth-child(3),
.public-results .live-ac-table th:first-child,
.public-results .live-ac-table td:first-child,
.public-results .live-ac-table th:nth-child(2),
.public-results .live-ac-table td:nth-child(2),
.public-results .live-ac-table th:nth-child(3),
.public-results .live-ac-table td:nth-child(3),
.public-results .live-acb-table th:first-child,
.public-results .live-acb-table td:first-child,
.public-results .live-acb-table th:nth-child(2),
.public-results .live-acb-table td:nth-child(2),
.public-results .live-acb-table th:nth-child(3),
.public-results .live-acb-table td:nth-child(3) {
    text-align: left;
}

.public-results .live-cones-table th:nth-child(n+4),
.public-results .live-cones-table td:nth-child(n+4),
.public-results .live-ac-table th:nth-child(n+4),
.public-results .live-ac-table td:nth-child(n+4),
.public-results .live-acb-table th:nth-child(n+4),
.public-results .live-acb-table td:nth-child(n+4) {
    text-align: center;
}

.public-results .live-acb-table th:nth-child(4),
.public-results .live-acb-table td:nth-child(4),
.public-results .live-acb-table th:nth-child(5),
.public-results .live-acb-table td:nth-child(5) {
    width: 58px;
}

.public-results .live-cones-table th:nth-child(4),
.public-results .live-cones-table td:nth-child(4) {
    width: 54px;
}

.public-results .live-cones-table th:nth-child(5),
.public-results .live-cones-table td:nth-child(5) {
    width: 70px;
}

.public-results .live-cones-table th:nth-child(6),
.public-results .live-cones-table td:nth-child(6),
.public-results .live-cones-table th:nth-child(7),
.public-results .live-cones-table td:nth-child(7),
.public-results .live-cones-table th:nth-child(8),
.public-results .live-cones-table td:nth-child(8) {
    width: 50px;
}

.public-results .live-cones-table th:nth-child(9),
.public-results .live-cones-table td:nth-child(9) {
    width: 30px;
}

.public-results .live-ac-table th:nth-child(4),
.public-results .live-ac-table td:nth-child(4),
.public-results .live-ac-table th:nth-child(9),
.public-results .live-ac-table td:nth-child(9),
.public-results .live-ac-table th:nth-child(10),
.public-results .live-ac-table td:nth-child(10) {
    width: 58px;
}

.public-results .live-ac-table th:nth-child(5),
.public-results .live-ac-table td:nth-child(5) {
    width: 54px;
}

.public-results .live-ac-table th:nth-child(6),
.public-results .live-ac-table td:nth-child(6) {
    width: 70px;
}

.public-results .live-ac-table th:nth-child(7),
.public-results .live-ac-table td:nth-child(7),
.public-results .live-ac-table th:nth-child(8),
.public-results .live-ac-table td:nth-child(8) {
    width: 50px;
}

.public-results .cell-center,
.public-results .cell-split {
    display: block;
}

.public-results .cell-center {
    text-align: center;
}

.public-results .cell-split {
    align-items: center;
    display: flex;
    font-size: 0.92em;
    justify-content: space-between;
    min-height: 1.1em;
}

.public-results .marathon-obstacle-column.unavailable,
.public-results .aft-seconds-column.unavailable {
    color: #9aa3ad;
}

.public-results .empty-result-cell {
    background: #eef2f4;
}

.public-results .rank-cell-1 {
    background: #89ff00;
}

.public-results .rank-cell-2 {
    background: #c9ff8a;
}

.public-results .result-driver-cell {
    cursor: pointer;
}

.public-results .result-driver-cell strong,
.public-results .result-driver-cell .muted {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.public-results .result-driver-cell.name-expanded strong,
.public-results .result-driver-cell.name-expanded .muted {
    overflow: visible;
    white-space: normal;
}

@media (max-width: 640px) {
    .public-results-shell {
        padding: 10px 6px;
    }

    .public-results {
        padding: 6px;
    }

    .public-results .class-header h2,
    .public-results .live-score-group h3 {
        margin-bottom: 2px;
    }

    .public-results .score-entry-card {
        padding: 6px;
        border-radius: 6px;
    }

    .public-results .live-dressage-table {
        min-width: 430px;
    }

    .public-results .live-marathon-table {
        min-width: 0;
        table-layout: auto;
        width: max-content;
    }

    .public-results .live-cones-table {
        min-width: 0;
        table-layout: auto;
        width: max-content;
    }

    .public-results .live-ac-table {
        min-width: 0;
        table-layout: auto;
        width: max-content;
    }

    .public-results .live-acb-table {
        min-width: 0;
        table-layout: auto;
        width: max-content;
    }

    .public-results .live-dressage-table th,
    .public-results .live-dressage-table td,
    .public-results .live-marathon-table th,
    .public-results .live-marathon-table td,
    .public-results .live-cones-table th,
    .public-results .live-cones-table td,
    .public-results .live-ac-table th,
    .public-results .live-ac-table td,
    .public-results .live-acb-table th,
    .public-results .live-acb-table td {
        padding: 4px 2px;
    }

    .public-results .live-dressage-table th:first-child,
    .public-results .live-dressage-table td:first-child,
    .public-results .live-marathon-table th:first-child,
    .public-results .live-marathon-table td:first-child,
    .public-results .live-cones-table th:first-child,
    .public-results .live-cones-table td:first-child,
    .public-results .live-ac-table th:first-child,
    .public-results .live-ac-table td:first-child,
    .public-results .live-acb-table th:first-child,
    .public-results .live-acb-table td:first-child {
        width: 24px;
    }

    .public-results .live-dressage-table th:nth-child(2),
    .public-results .live-dressage-table td:nth-child(2),
    .public-results .live-marathon-table th:nth-child(2),
    .public-results .live-marathon-table td:nth-child(2),
    .public-results .live-cones-table th:nth-child(2),
    .public-results .live-cones-table td:nth-child(2),
    .public-results .live-ac-table th:nth-child(2),
    .public-results .live-ac-table td:nth-child(2),
    .public-results .live-acb-table th:nth-child(2),
    .public-results .live-acb-table td:nth-child(2) {
        width: 22px;
    }

    .public-results .live-dressage-table th:nth-child(3),
    .public-results .live-dressage-table td:nth-child(3),
    .public-results .live-marathon-table th:nth-child(3),
    .public-results .live-marathon-table td:nth-child(3),
    .public-results .live-cones-table th:nth-child(3),
    .public-results .live-cones-table td:nth-child(3),
    .public-results .live-ac-table th:nth-child(3),
    .public-results .live-ac-table td:nth-child(3),
    .public-results .live-acb-table th:nth-child(3),
    .public-results .live-acb-table td:nth-child(3) {
        min-width: 68px;
        width: 18%;
    }

    .public-results .judge-column {
        width: 36px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .public-results .pen-column,
    .public-results .rank-column {
        width: 24px;
        padding-left: 2px;
        padding-right: 2px;
    }

    .public-results .total-column {
        width: 38px;
        padding-left: 2px;
        padding-right: 2px;
    }

    .public-results .live-marathon-table th:nth-child(4),
    .public-results .live-marathon-table td:nth-child(4) {
        padding-left: 1px;
        padding-right: 1px;
        width: 16px;
    }

    .public-results .marathon-section-column {
        padding-left: 1px;
        padding-right: 1px;
        width: 16px;
    }

    .public-results .marathon-obstacle-column {
        padding-left: 1px;
        padding-right: 1px;
        width: 20px;
    }

    .public-results .aft-seconds-column {
        padding-left: 1px;
        padding-right: 1px;
        width: 28px;
        min-width: 26px;
    }

    .public-results .acb-final-total-column {
        width: 44px;
    }

    .public-results .live-cones-table th:nth-child(4),
    .public-results .live-cones-table td:nth-child(4) {
        width: 44px;
    }

    .public-results .live-cones-table th:nth-child(5),
    .public-results .live-cones-table td:nth-child(5) {
        width: 56px;
    }

    .public-results .live-cones-table th:nth-child(6),
    .public-results .live-cones-table td:nth-child(6),
    .public-results .live-cones-table th:nth-child(7),
    .public-results .live-cones-table td:nth-child(7),
    .public-results .live-cones-table th:nth-child(8),
    .public-results .live-cones-table td:nth-child(8) {
        width: 42px;
    }

    .public-results .live-cones-table th:nth-child(9),
    .public-results .live-cones-table td:nth-child(9) {
        width: 22px;
    }

    .public-results .live-ac-table th:nth-child(4),
    .public-results .live-ac-table td:nth-child(4),
    .public-results .live-ac-table th:nth-child(9),
    .public-results .live-ac-table td:nth-child(9),
    .public-results .live-ac-table th:nth-child(10),
    .public-results .live-ac-table td:nth-child(10) {
        width: 44px;
    }

    .public-results .live-ac-table th:nth-child(5),
    .public-results .live-ac-table td:nth-child(5) {
        width: 44px;
    }

    .public-results .live-ac-table th:nth-child(6),
    .public-results .live-ac-table td:nth-child(6) {
        width: 56px;
    }

    .public-results .live-ac-table th:nth-child(7),
    .public-results .live-ac-table td:nth-child(7),
    .public-results .live-ac-table th:nth-child(8),
    .public-results .live-ac-table td:nth-child(8) {
        width: 42px;
    }

    .public-results .live-acb-table th:nth-child(4),
    .public-results .live-acb-table td:nth-child(4),
    .public-results .live-acb-table th:nth-child(5),
    .public-results .live-acb-table td:nth-child(5) {
        width: 44px;
    }

    .public-results .judge-rank {
        font-size: 0.92em;
    }
}

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

    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .action-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .page-header,
    .class-header,
        .summary-band,
        .admin-grid,
        .form-grid,
        .quick-entry-layout,
        .phase-groom-row,
        .category-admin-row,
    .inline-add-form,
    .score-selector-grid,
    .selector-bar {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .form-meta,
    .form-actions {
        grid-column: auto;
    }

    .page-actions {
        justify-content: flex-start;
    }

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