:root {
    --bg: #f7f7f8;
    --surface: #ffffff;
    --text: #1b1c1e;
    --muted: #5c6169;
    --border: #d9dce1;
    --brand: #1f5eff;
    --brand-ink: #ffffff;
    --ok: #1a7f37;
    --warn: #9a6700;
    --danger: #b42318;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--brand); }
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 3px solid #ffbf47;
    outline-offset: 1px;
}

.container { width: min(1080px, 92vw); margin: 0 auto; }

header.site {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
header.site .inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0; gap: 16px; flex-wrap: wrap;
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.15rem; }
nav.site a { margin-right: 14px; text-decoration: none; color: var(--muted); }
nav.site a:hover { color: var(--brand); }

main { padding: 28px 0 60px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

h1 { font-size: 1.7rem; margin: 0 0 10px; }
h2 { font-size: 1.25rem; margin: 0 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 6px; }
p.lead { font-size: 1.08rem; color: var(--muted); }

.btn {
    display: inline-block;
    background: var(--brand); color: var(--brand-ink);
    border: 1px solid var(--brand); border-radius: 8px;
    padding: 9px 15px; text-decoration: none; cursor: pointer;
    font-size: 0.95rem; font-weight: 600;
}
.btn:hover { filter: brightness(0.95); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
    width: 100%; padding: 9px 10px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 0.95rem; background: #fff;
}
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { background: #f0f1f3; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; border: 1px solid var(--border); background: #f0f1f3; }
.badge.ok { color: var(--ok); border-color: #b7dfc2; background: #eaf7ed; }
.badge.warn { color: var(--warn); border-color: #f0d999; background: #fdf6e3; }
.badge.danger { color: var(--danger); border-color: #f0b6b0; background: #fdecea; }
.badge.info { color: #0b4bbd; border-color: #b9cdfb; background: #eaf1ff; }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.status { background: #eaf7ed; border-color: #b7dfc2; color: var(--ok); }
.flash.error { background: #fdecea; border-color: #f0b6b0; color: var(--danger); }

.errors { margin: 0 0 14px; padding-left: 18px; color: var(--danger); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

footer.site {
    border-top: 1px solid var(--border); background: var(--surface);
    padding: 18px 0; color: var(--muted); font-size: 0.85rem;
}

/* Historical library */
.legacy-content { font-family: Georgia, "Times New Roman", serif; line-height: 1.65; }
.legacy-content p { margin: 0 0 0.9em; }
.legacy-content p.legacy-section { margin-bottom: 0.6em; }
.legacy-content { max-width: 70ch; }

/* Score sheet print helpers */
.sheet-table th, .sheet-table td { border: 1px solid #000; }
.print-only { display: none; }
@media print { .no-print { display: none !important; } .print-only { display: block; } }

dt { font-weight: 600; color: var(--muted); margin-top: 6px; }
dd { margin: 0 0 2px; }
dl { margin: 8px 0; }
