:root {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #5f6b7a;
    --border: #d5dbe2;
    --accent: #0b6bcb;
    --accent-text: #ffffff;
    --error-bg: #fdecea;
    --error-text: #8a1c12;
    --success-bg: #e6f4ea;
    --success-text: #1e5b2e;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12161b;
        --surface: #1b2128;
        --text: #e3e8ee;
        --muted: #9aa5b1;
        --border: #313a45;
        --accent: #4c9ee8;
        --accent-text: #0b1520;
        --error-bg: #3b1c1a;
        --error-text: #f4b4ad;
        --success-bg: #1a3322;
        --success-text: #a8dcb5;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); }

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-title { font-weight: 600; text-decoration: none; color: var(--text); }

.file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.file-actions form { margin: 0; }
.file-name { color: var(--muted); font-size: 14px; }

main { max-width: 900px; margin: 0 auto; padding: 16px; }

h1 { margin: 8px 0; font-size: 26px; }
h2 { margin: 28px 0 8px; font-size: 20px; }
.meta, .hint { color: var(--muted); }
.hint { font-size: 14px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.button {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
}
.button.secondary { background: transparent; color: var(--accent); }

input, select {
    font: inherit;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

input.time { width: 7em; font-variant-numeric: tabular-nums; }
.filter { width: 100%; max-width: 360px; margin-bottom: 12px; }

.flash { padding: 10px 14px; border-radius: 6px; }
.flash.error { background: var(--error-bg); color: var(--error-text); }
.flash.success { background: var(--success-bg); color: var(--success-text); }

.list { width: 100%; border-collapse: collapse; }
.list th, .list td { padding: 8px; text-align: left; border-bottom: 1px solid var(--border); }
.list th { font-size: 14px; color: var(--muted); font-weight: 600; }
#swimmers { background: var(--surface); }

.add-entry { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.add-entry label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }

@media (max-width: 600px) {
    .list th, .list td { padding: 6px 4px; }
    #swimmers th:nth-child(4), #swimmers td:nth-child(4) { display: none; }
}

.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.upload label { font-weight: 600; }
.documents { background: var(--surface); }
.documents form { margin: 0; }

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--error-text);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.list tr.conflict td { background: var(--error-bg); }
.conflict-note { margin-top: 4px; font-size: 14px; color: var(--error-text); }

.account { display: flex; align-items: center; gap: 8px; margin: 0; }
.link-button.muted { color: var(--muted); }

.login { display: flex; flex-direction: column; gap: 12px; max-width: 360px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.login .button { align-self: flex-start; }

#swimmers td.no-time { color: var(--error-text); font-weight: 600; }
