:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #17212b;
    background: #f3f5f6;
    letter-spacing: 0;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f3f5f6;
}

button,
a {
    font: inherit;
}

.report-bar {
    color: #ffffff;
    background: #143642;
    border-bottom: 4px solid #16a085;
}

.report-bar-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.report-bar a {
    color: #ffffff;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}

.report-bar button {
    min-height: 36px;
    padding: 0 14px;
    color: #143642;
    background: #ffffff;
    border: 0;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto 60px;
}

.report-title {
    padding-bottom: 24px;
    border-bottom: 1px solid #cfd8dc;
}

.report-title span,
.section-heading span,
.club-heading span {
    color: #5f747c;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

.report-title h1 {
    margin-top: 6px;
    font-size: 30px;
    line-height: 1.2;
}

.report-title p {
    margin-top: 8px;
    color: #60727a;
    font-size: 13px;
}

.totals {
    margin: 24px 0 32px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    background: #ffffff;
    border: 1px solid #d8e0e3;
    border-radius: 7px;
}

.totals div {
    min-height: 92px;
    padding: 17px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid #e2e7e9;
}

.totals div:last-child {
    border-right: 0;
}

.totals span {
    color: #687981;
    font-size: 11px;
    font-weight: 700;
}

.totals strong {
    margin-top: 5px;
    font-size: 24px;
}

.summary-section,
.club-section,
.unmatched-section {
    margin-top: 26px;
    background: #ffffff;
    border: 1px solid #d8e0e3;
    border-radius: 7px;
    overflow: hidden;
}

.section-heading,
.club-heading {
    min-height: 76px;
    padding: 17px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid #e1e7e9;
}

.section-heading h2,
.club-heading h2,
.unmatched-section h2 {
    margin-top: 4px;
    font-size: 17px;
}

.club-heading p {
    color: #5f727a;
    font-size: 12px;
    white-space: nowrap;
}

.table-scroll {
    overflow-x: auto;
}

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

th,
td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid #e8ecee;
    vertical-align: middle;
}

thead th {
    color: #60727a;
    background: #f6f8f9;
    font-size: 10px;
    text-transform: uppercase;
    white-space: nowrap;
}

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

tfoot th {
    color: #23343c;
    background: #eaf1f2;
    border-top: 2px solid #cad7db;
    border-bottom: 0;
}

.summary-table th:not(:first-child),
.summary-table td:not(:first-child) {
    text-align: right;
}

.summary-table a {
    color: #176f63;
    font-weight: 750;
    text-decoration: none;
}

td small {
    margin-top: 2px;
    display: block;
    color: #74858c;
    font-size: 10px;
}

.results-table th:nth-child(1) { width: 88px; }
.results-table th:nth-child(3) { width: 54px; }
.results-table th:nth-child(6) { width: 94px; }

.open-water-results {
    min-width: 820px;
}

.medal {
    display: inline-block;
    min-width: 54px;
    padding: 4px 7px;
    border-left: 4px solid;
    font-size: 10px;
    font-weight: 800;
}

.medal-1 {
    color: #604d00;
    background: #fff7cc;
    border-color: #c69b00;
}

.medal-2 {
    color: #46545a;
    background: #eef2f3;
    border-color: #89989e;
}

.medal-3 {
    color: #70401f;
    background: #f8e8dc;
    border-color: #ad6532;
}

.general-place {
    display: inline-block;
    min-width: 54px;
    padding: 4px 7px;
    color: #435860;
    background: #eef2f3;
    border-left: 4px solid #b8c4c8;
    font-size: 10px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.result-time {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.empty-state {
    padding: 28px 20px;
    color: #687981;
    font-size: 13px;
}

.unmatched-section {
    padding: 20px;
    color: #6e3e1b;
    background: #fff8ef;
    border-color: #efd4b5;
}

.unmatched-section p {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.6;
}

.upload-error {
    max-width: 680px;
    padding: 28px;
    color: #721c24;
    background: #fff1f2;
    border: 1px solid #efc5c9;
    border-radius: 7px;
}

.upload-error h1 {
    font-size: 22px;
}

.upload-error p {
    margin-top: 10px;
    line-height: 1.55;
}

.upload-error a {
    margin-top: 18px;
    display: inline-block;
    color: #176f63;
    font-weight: 750;
}

@media (max-width: 820px) {
    .totals {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .totals div:nth-child(3) {
        border-right: 0;
    }

    .totals div:nth-child(-n+3) {
        border-bottom: 1px solid #e2e7e9;
    }
}

@media (max-width: 560px) {
    main {
        width: min(100% - 20px, 1180px);
        margin-top: 20px;
    }

    .report-title h1 {
        font-size: 23px;
    }

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

    .totals div:nth-child(2n) {
        border-right: 0;
    }

    .totals div:nth-child(-n+4) {
        border-bottom: 1px solid #e2e7e9;
    }

    .club-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media print {
    body {
        background: #ffffff;
    }

    .report-bar {
        display: none;
    }

    main {
        width: 100%;
        margin: 0;
    }

    .summary-section,
    .club-section {
        break-inside: avoid;
        box-shadow: none;
    }
}
