/* ASPTT Courses — light, high-contrast theme built for readability on phones */

:root {
	color-scheme: light;

	--bg: #f3f6f8;
	--surface: #ffffff;
	--surface-soft: #f7f9fb;
	--line: #dbe3e8;
	--line-strong: #b9c7d0;

	--text: #102631;
	--text-soft: #44596a;
	--text-faint: #6a7d8b;

	--brand: #1b4d63;
	--brand-strong: #133a4b;
	--brand-soft: #e3eef3;

	--success: #17693f;
	--success-soft: #e2f3e9;
	--warning: #8a5300;
	--warning-soft: #fff1d6;
	--danger: #b42318;
	--danger-soft: #fdecea;
	--star: #c98a00;

	--radius: 16px;
	--radius-sm: 10px;
	--shadow: 0 1px 2px rgba(16, 38, 49, .06), 0 4px 16px rgba(16, 38, 49, .06);
	--tap: 52px;

	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
	font-size: 112.5%; /* 18px: comfortable reading for every age */
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }

h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--text); }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }

:focus-visible {
	outline: 3px solid #4a9cc4;
	outline-offset: 2px;
}

[hidden] { display: none !important; }

.visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.icon { width: 1.25em; height: 1.25em; flex: none; }

/* ── Layout ─────────────────────────────────────────────── */

.page {
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	padding: 1.25rem 16px 2rem;
}

.page-narrow { max-width: 560px; }

.stack > * + * { margin-top: 1rem; }

/* ── Top bar ────────────────────────────────────────────── */

.topbar {
	position: sticky;
	top: 0;
	z-index: 30;
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}

.topbar-inner {
	max-width: 960px;
	margin: 0 auto;
	padding: .5rem 16px;
	display: flex;
	align-items: center;
	gap: 1rem;
	min-height: 64px;
}

.brand {
	display: flex;
	align-items: center;
	gap: .6rem;
	text-decoration: none;
	color: var(--text);
	margin-right: auto;
}

.brand img { width: 52px; height: auto; }
.brand-name { font-weight: 800; font-size: 1.1rem; line-height: 1.1; }
.brand-name small { display: block; font-weight: 500; font-size: .8rem; color: var(--text-soft); }

.topnav { display: flex; align-items: center; gap: .25rem; }

.topnav a, .topnav button {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	min-height: 44px;
	padding: 0 .9rem;
	border-radius: 999px;
	border: 0;
	background: none;
	font: inherit;
	font-size: .95rem;
	font-weight: 600;
	color: var(--text-soft);
	text-decoration: none;
	cursor: pointer;
}

.topnav a:hover, .topnav button:hover { background: var(--surface-soft); color: var(--text); }
.topnav a.is-active { background: var(--brand-soft); color: var(--brand-strong); }
.topnav form { margin: 0; }

.count-badge {
	display: inline-grid;
	place-items: center;
	min-width: 1.5rem;
	height: 1.5rem;
	padding: 0 .4rem;
	border-radius: 999px;
	background: var(--danger);
	color: #fff;
	font-size: .8rem;
	font-weight: 700;
	line-height: 1;
}

/* Phone: bottom tab bar, like the apps everyone already knows */
.tabbar { display: none; }

@media (max-width: 760px) {
	.topnav { display: none; }
	.topbar-inner { min-height: 56px; }
	.brand img { width: 44px; }

	.tabbar {
		display: flex;
		position: fixed;
		left: 0; right: 0; bottom: 0;
		z-index: 30;
		background: var(--surface);
		border-top: 1px solid var(--line);
		padding-bottom: env(safe-area-inset-bottom);
		box-shadow: 0 -4px 16px rgba(16, 38, 49, .06);
	}

	.tabbar a {
		flex: 1;
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: .15rem;
		min-height: 64px;
		font-size: .8rem;
		font-weight: 600;
		color: var(--text-soft);
		text-decoration: none;
	}

	.tabbar a .icon { width: 26px; height: 26px; }
	.tabbar a.is-active { color: var(--brand); }
	.tabbar a.is-active::before {
		content: "";
		position: absolute;
		top: 0; left: 25%; right: 25%;
		height: 3px;
		border-radius: 0 0 3px 3px;
		background: var(--brand);
	}

	.tabbar .count-badge {
		position: absolute;
		top: 6px;
		left: calc(50% + 6px);
		min-width: 1.3rem;
		height: 1.3rem;
		font-size: .7rem;
	}

	body.has-tabbar .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
	body.has-tabbar .toast-zone { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* ── Messages ───────────────────────────────────────────── */

.flash-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }

.flash {
	display: flex;
	gap: .6rem;
	align-items: flex-start;
	padding: .85rem 1rem;
	border-radius: var(--radius-sm);
	background: var(--success-soft);
	color: var(--success);
	font-weight: 600;
	border: 1px solid #bfe2cd;
}

.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #f5c6c1; }
.flash-info { background: var(--brand-soft); color: var(--brand-strong); border-color: #c4dbe5; }

.toast-zone {
	position: fixed;
	left: 16px; right: 16px;
	bottom: 24px;
	z-index: 50;
	display: grid;
	justify-items: center;
	pointer-events: none;
}

.toast {
	max-width: 520px;
	padding: .9rem 1.2rem;
	border-radius: var(--radius-sm);
	background: var(--text);
	color: #fff;
	font-weight: 600;
	box-shadow: 0 8px 30px rgba(16, 38, 49, .25);
	animation: toast-in .2s ease-out;
}

.toast.is-error { background: var(--danger); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Buttons ────────────────────────────────────────────── */

.btn, button[type="submit"]:not(.btn):not(.link-btn), input[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	min-height: var(--tap);
	padding: 0 1.25rem;
	border-radius: 12px;
	border: 2px solid var(--brand);
	background: var(--brand);
	color: #fff;
	font: inherit;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.1;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background .15s, border-color .15s, color .15s;
	-webkit-tap-highlight-color: transparent;
}

.btn:hover, button[type="submit"]:not(.btn):not(.link-btn):hover, input[type="submit"]:hover {
	background: var(--brand-strong);
	border-color: var(--brand-strong);
	color: #fff;
}

.btn:disabled, button:disabled { opacity: .55; cursor: wait; }

.btn-secondary { background: var(--surface); color: var(--brand); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand); }

.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #0f4f2e; border-color: #0f4f2e; }

.btn-danger { background: var(--surface); color: var(--danger); border-color: #eab0aa; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #8f1c13; border-color: #8f1c13; }

.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 1rem; font-size: .92rem; }

.link-btn {
	border: 0;
	background: none;
	padding: .25rem 0;
	font: inherit;
	font-weight: 600;
	color: var(--brand);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* ── Forms ──────────────────────────────────────────────── */

form { margin: 0; }

label, .label {
	display: block;
	margin-bottom: .35rem;
	font-weight: 700;
	font-size: .95rem;
	color: var(--text);
}

.label-hint { font-weight: 500; color: var(--text-faint); }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
	width: 100%;
	min-height: var(--tap);
	padding: .6rem .9rem;
	border: 2px solid var(--line-strong);
	border-radius: 12px;
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 1rem; /* never under 16px: iOS would zoom in */
	transition: border-color .15s, box-shadow .15s;
}

select {
	appearance: none;
	padding-right: 2.6rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2344596a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right .8rem center;
	background-size: 1.2rem;
}

input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--brand);
	box-shadow: 0 0 0 4px rgba(27, 77, 99, .15);
}

input[readonly] { background: var(--surface-soft); color: var(--text-soft); }

.field + .field { margin-top: 1rem; }
.field-help { margin-top: .35rem; font-size: .88rem; color: var(--text-faint); }

.field-grid { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.field-grid .field + .field { margin-top: 0; }
.field-grid .span-2 { grid-column: 1 / -1; }

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

.password-wrap { position: relative; }
.password-wrap input { padding-right: 6.5rem; }
.password-toggle {
	position: absolute;
	right: 6px; top: 50%;
	transform: translateY(-50%);
	min-height: 40px;
	padding: 0 .8rem;
	border: 0;
	border-radius: 8px;
	background: var(--surface-soft);
	color: var(--brand);
	font: inherit;
	font-size: .88rem;
	font-weight: 700;
	cursor: pointer;
}

/* Big checkbox rows */
.check {
	display: flex;
	align-items: center;
	gap: .75rem;
	min-height: var(--tap);
	margin: 0;
	font-weight: 600;
	cursor: pointer;
}

.check input {
	width: 26px; height: 26px;
	flex: none;
	margin: 0;
	accent-color: var(--brand);
}

/* Choice chips (filters, categories) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }

.chip-choice { position: relative; margin: 0; }
.chip-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }

.chip-choice span {
	display: inline-flex;
	align-items: center;
	gap: .35rem;
	min-height: 46px;
	padding: 0 1rem;
	border: 2px solid var(--line-strong);
	border-radius: 999px;
	background: var(--surface);
	color: var(--text-soft);
	font-weight: 600;
	font-size: .95rem;
	transition: all .12s;
	user-select: none;
}

.chip-choice input:checked + span {
	border-color: var(--brand);
	background: var(--brand);
	color: #fff;
}

.chip-choice input:checked + span::before { content: "✓"; font-weight: 800; }
.chip-choice input:focus-visible + span { outline: 3px solid #4a9cc4; outline-offset: 2px; }
.chip-choice input:disabled + span { opacity: .5; }

/* Range */
input[type="range"] {
	width: 100%;
	height: 44px;
	margin: 0;
	accent-color: var(--brand);
	background: transparent;
}

/* ── Cards & sections ───────────────────────────────────── */

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 1.25rem;
}

.card-title { margin-bottom: .25rem; }
.card-lead { color: var(--text-soft); margin-bottom: 1rem; }

.section-title {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: .75rem;
	margin: 1.75rem 0 .75rem;
}

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head p { color: var(--text-soft); margin-top: .2rem; }

.muted { color: var(--text-soft); }
.small { font-size: .88rem; }

.empty {
	text-align: center;
	padding: 2.5rem 1.25rem;
	background: var(--surface);
	border: 2px dashed var(--line);
	border-radius: var(--radius);
	color: var(--text-soft);
}

.empty strong { display: block; font-size: 1.15rem; color: var(--text); margin-bottom: .35rem; }
.empty .btn { margin-top: 1rem; }

/* Disclosure blocks */
details.disclosure > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	min-height: var(--tap);
	cursor: pointer;
	list-style: none;
	font-weight: 700;
}

details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after {
	content: "";
	width: .7rem; height: .7rem;
	border-right: 3px solid currentColor;
	border-bottom: 3px solid currentColor;
	transform: translateY(-25%) rotate(45deg);
	margin-right: .25rem;
	transition: transform .15s;
	flex: none;
	color: var(--text-faint);
}
details.disclosure[open] > summary::after { transform: translateY(25%) rotate(-135deg); }

/* Status badges */
.badge {
	display: inline-flex;
	align-items: center;
	gap: .35rem;
	padding: .3rem .75rem;
	border-radius: 999px;
	font-size: .88rem;
	font-weight: 700;
	background: var(--surface-soft);
	color: var(--text-soft);
	border: 1px solid var(--line);
}

.badge-validated { background: var(--success-soft); color: var(--success); border-color: #bfe2cd; }
.badge-pending { background: var(--warning-soft); color: var(--warning); border-color: #f3d79f; }
.badge-interested { background: #fff8e1; color: #7a5600; border-color: #f1dc9c; }
.badge-cancelled { background: var(--danger-soft); color: var(--danger); border-color: #f5c6c1; }
.badge-admin { background: var(--brand-soft); color: var(--brand-strong); border-color: #c4dbe5; }

.tag {
	display: inline-block;
	padding: .1rem .55rem;
	border-radius: 6px;
	background: var(--surface-soft);
	border: 1px solid var(--line);
	font-size: .85rem;
	font-weight: 600;
	color: var(--text-soft);
}

/* ── Auth pages ─────────────────────────────────────────── */

.auth {
	min-height: 100vh;
	min-height: 100dvh;
	display: grid;
	place-items: center;
	padding: 1.5rem 16px 3rem;
	background:
		radial-gradient(900px 400px at 50% -10%, #dbe9f0, transparent 70%),
		var(--bg);
}

.auth-card {
	width: 100%;
	max-width: 460px;
}

.auth-logo { width: 120px; margin: 0 auto .5rem; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-head h1 { font-size: 1.6rem; }
.auth-head p { color: var(--text-soft); margin-top: .35rem; }

.auth-card .card { padding: 1.5rem; }
.auth-card .btn-block { margin-top: 1.5rem; }
.auth-foot { margin-top: 1.25rem; text-align: center; color: var(--text-soft); display: grid; gap: .6rem; }
.auth-card .flash-list { margin-bottom: 1rem; }

/* ── Calendar ───────────────────────────────────────────── */

.view-switch {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	padding: 4px;
	border-radius: 14px;
	background: #e4eaee;
	margin-bottom: 1rem;
}

.view-switch a {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .4rem;
	min-height: 48px;
	border-radius: 11px;
	font-weight: 700;
	color: var(--text-soft);
	text-decoration: none;
}

.view-switch a.is-active { background: var(--surface); color: var(--brand-strong); box-shadow: 0 1px 4px rgba(16, 38, 49, .12); }

.month-nav {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: .5rem;
	margin-bottom: .75rem;
}

.month-nav h1 { text-align: center; font-size: 1.5rem; }

.month-btn {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	min-height: var(--tap);
	padding: 0 .9rem;
	border: 2px solid var(--line-strong);
	border-radius: 12px;
	background: var(--surface);
	color: var(--brand);
	font-weight: 700;
	font-size: .92rem;
	text-decoration: none;
}

.month-btn:hover { border-color: var(--brand); background: var(--brand-soft); }

@media (max-width: 420px) {
	.month-btn .month-btn-label { display: none; }
	.month-btn { width: var(--tap); justify-content: center; padding: 0; }
}

.filters {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	margin-bottom: 1rem;
}

.filters > summary { padding: 0 1rem; }
.filters-summary { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.filters-summary .icon { color: var(--brand); }
.filters-active { font-weight: 500; color: var(--text-soft); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.filters-body { padding: .25rem 1rem 1rem; border-top: 1px solid var(--line); }
.filter-group { margin-top: 1rem; }
.filter-group > .label { margin-bottom: .5rem; }
.filter-actions { display: grid; grid-template-columns: 1fr auto; gap: .6rem; margin-top: 1.25rem; }

.distance-row { display: flex; align-items: center; gap: 1rem; }
.distance-row output { min-width: 4.5rem; text-align: right; font-weight: 700; }

.list-count { color: var(--text-soft); font-weight: 600; margin-bottom: .5rem; }

/* Races: one dense row each, as many races fit on a screen in full season */
.race-list {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}

.race { border-left: 5px solid transparent; scroll-margin-top: 80px; }
.race + .race { border-top: 1px solid var(--line); }
.race.is-validated { border-left-color: var(--success); }
.race.is-pending { border-left-color: #e3a32b; }
.race.is-interested { border-left-color: var(--star); }
.race.is-cancelled { border-left-color: var(--danger); }
.race.is-past .race-row { opacity: .6; }
.race[open] { background: var(--surface-soft); }

.race-row {
	display: grid;
	grid-template-columns: 2.6rem minmax(0, 1fr) auto 1rem;
	align-items: center;
	gap: .75rem;
	min-height: 60px;
	padding: .45rem .75rem .45rem .6rem;
	cursor: pointer;
	list-style: none;
	-webkit-tap-highlight-color: transparent;
}

.race-row::-webkit-details-marker { display: none; }
.race-row:hover { background: var(--surface-soft); }

.race-date { display: flex; flex-direction: column; align-items: center; line-height: 1.05; color: var(--brand-strong); }
.race-date .dow, .race-date .mon { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--text-soft); }
.race-date .day { font-size: 1.35rem; font-weight: 800; }

.race-main { display: flex; flex-direction: column; min-width: 0; }
.race-title { font-weight: 700; font-size: 1.02rem; line-height: 1.25; overflow-wrap: break-word; }

.race-meta {
	display: block;
	font-size: .85rem;
	color: var(--text-soft);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.race-meta .icon { display: inline-block; width: .95rem; height: .95rem; vertical-align: -2px; margin-right: .1rem; }
.race-meta .st { font-weight: 700; }
.st-validated { color: var(--success); }
.st-pending { color: var(--warning); }
.st-cancelled { color: var(--danger); }
.st-interested { color: var(--star); }
.race-row:focus-visible { outline-offset: -3px; }

.race-side { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; }
.race-side .btn-star { padding: 0 .75rem; gap: .35rem; }
.race-side .btn-star .star { font-size: 1.25rem; line-height: 1; color: var(--star); }
.race-side .btn-star.is-on { background: #fff8e1; border-color: #f1dc9c; color: #7a5600; }
.race-meta .club { color: var(--brand); font-weight: 700; }
.race-meta .meta-closed { display: none; font-weight: 700; }
.star-label-short { display: none; }

/* Tells that the row opens: names of the club mates, categories, other actions */
.race-chevron {
	width: .6rem; height: .6rem;
	justify-self: center;
	border-right: 2.5px solid var(--text-faint);
	border-bottom: 2.5px solid var(--text-faint);
	transform: translateY(-25%) rotate(45deg);
	transition: transform .15s;
}
.race[open] .race-chevron { transform: translateY(25%) rotate(-135deg); }
.race-side .btn-sm { min-height: 44px; padding: 0 .9rem; }
.race-side .badge { padding: .25rem .6rem; font-size: .82rem; }
.race-side .badge .icon { width: 1rem; height: 1rem; }
.race-side .closed { font-size: .85rem; color: var(--text-faint); font-weight: 600; }

.race-more { padding: .25rem 1rem 1rem 3.95rem; }
.race-facts { font-size: .92rem; color: var(--text-soft); }
.race-cats { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }

.riders { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .35rem; }
.riders li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .5rem; font-size: .95rem; }
.riders li .badge { font-size: .78rem; padding: .15rem .55rem; }

.race-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.race-actions:empty { display: none; }

@media (max-width: 560px) {
	/* Phones: the buttons go under the race name, which keeps the whole width */
	.race-row {
		grid-template-columns: 2.4rem minmax(0, 1fr) .6rem;
		grid-template-areas: "date main chevron" "date side chevron";
		column-gap: .6rem;
		row-gap: 0;
		padding: .5rem .6rem .5rem .5rem;
	}
	.race-date { grid-area: date; align-self: start; padding-top: .1rem; }
	.race-main { grid-area: main; }
	.race-chevron { grid-area: chevron; }
	.race-side { grid-area: side; justify-content: flex-start; gap: .5rem; }
	.race-side > * { margin-top: .45rem; }
	.race-side .btn-sm { min-height: 44px; padding: 0 .8rem; font-size: .88rem; white-space: nowrap; }
	.race-side .btn-star { gap: .3rem; }
	.race-side .btn-star .star { font-size: 1.1rem; }
	.race-side .btn-star .star-label { display: none; }
	.race-side .btn-star .star-label-short { display: inline; }
	.race-side .btn-star.is-on .star-label { display: inline; }
	/* "Closes" joins the info line instead of taking a line of its own */
	.race-side .closed { display: none; }
	.race-meta .meta-closed { display: inline; }
	.race-title { font-size: .98rem; }
	.race-meta { font-size: .82rem; }
	.race-more { padding-left: 1rem; }
	.race-actions .btn { flex: 1 1 100%; }
}

/* ── Admin ──────────────────────────────────────────────── */

.tabs {
	display: flex;
	gap: .4rem;
	overflow-x: auto;
	margin-bottom: 1rem;
	padding-bottom: 2px;
	scrollbar-width: none;
}

.tabs a {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	min-height: 46px;
	padding: 0 1rem;
	border-radius: 999px;
	border: 2px solid var(--line-strong);
	background: var(--surface);
	color: var(--text-soft);
	font-weight: 700;
	font-size: .95rem;
	text-decoration: none;
	white-space: nowrap;
}

.tabs a.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }
.tabs-fill { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; overflow: visible; }
.tabs-fill a { justify-content: center; padding: 0 .5rem; }
.tabs-small a { min-height: 42px; font-size: .88rem; border-width: 1.5px; }
.tabs-fill a { min-width: 0; }
@media (max-width: 360px) {
	.tabs-small { gap: .25rem; }
	.tabs-small a { padding: 0 .3rem; gap: .25rem; font-size: .8rem; }
}
.tabs a .n { font-weight: 800; opacity: .85; }

.admin-home { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .admin-home { grid-template-columns: 1fr; } }

.admin-tile {
	display: block;
	text-decoration: none;
	color: var(--text);
	transition: border-color .15s, transform .15s;
}

.admin-tile:hover { border-color: var(--brand); color: var(--text); transform: translateY(-2px); }
.admin-tile .big { font-size: 2.4rem; font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: .4rem; }
.admin-tile h2 { margin-bottom: .3rem; }
.admin-tile p { color: var(--text-soft); }
.admin-tile .go { margin-top: 1rem; font-weight: 700; color: var(--brand); }

.race-group { margin-bottom: 1.25rem; }
.race-group-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: .2rem .75rem;
	margin: 0 0 .5rem;
	padding: 0 .25rem;
}
.race-group-head h2 { font-size: 1.1rem; }
.race-group-head .muted { font-size: .9rem; }

.request-list { padding: 0; overflow: hidden; }

.request + .request { border-top: 1px solid var(--line); }

.request {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .5rem 1rem;
	padding: .7rem 1rem;
}

.request-who { min-width: 0; }
.request-who strong { font-size: 1.05rem; margin-right: .5rem; }
.request-who .muted { font-size: .9rem; overflow-wrap: anywhere; }
.request-actions { display: flex; gap: .5rem; }

@media (max-width: 560px) {
	.request-actions { width: 100%; }
	.request-actions form { flex: 1; }
	.request-actions .btn { width: 100%; }
}

.registration-link { display: grid; grid-template-columns: 1fr auto; gap: .6rem; }
@media (max-width: 560px) { .registration-link { grid-template-columns: 1fr; } }

.member-search { margin-bottom: .75rem; }

.member-list { display: grid; gap: .6rem; }
.member { padding: 0; overflow: hidden; }
.member > summary { padding: .75rem 1rem; }
.member-main { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; min-width: 0; }
.member-name { font-size: 1.05rem; }
.member-email { width: 100%; font-weight: 500; font-size: .88rem; color: var(--text-soft); overflow-wrap: anywhere; }
.member-body { padding: 1rem; border-top: 1px solid var(--line); background: var(--surface-soft); }
.member-body .danger-zone { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* Confirmation dialog */
dialog.confirm {
	width: min(440px, calc(100vw - 32px));
	padding: 0;
	border: 0;
	border-radius: var(--radius);
	box-shadow: 0 20px 60px rgba(16, 38, 49, .3);
	color: var(--text);
}

dialog.confirm::backdrop { background: rgba(16, 38, 49, .45); }
dialog.confirm form { padding: 1.5rem; }
dialog.confirm h2 { margin-bottom: .5rem; }
dialog.confirm p { color: var(--text-soft); }
dialog.confirm .btn-row { margin-top: 1.25rem; justify-content: flex-end; }

/* ── Profile ────────────────────────────────────────────── */

.profile-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.avatar {
	display: grid;
	place-items: center;
	width: 64px; height: 64px;
	flex: none;
	border-radius: 50%;
	background: var(--brand);
	color: #fff;
	font-size: 1.6rem;
	font-weight: 800;
}
.profile-head p { color: var(--text-soft); overflow-wrap: anywhere; }

.form-section + .form-section { margin-top: 1rem; }
.form-section h2 { margin-bottom: 1rem; }

.save-bar {
	position: sticky;
	bottom: 12px;
	margin-top: 1rem;
	z-index: 5;
}

@media (max-width: 760px) {
	body.has-tabbar .save-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

.save-bar .btn { width: 100%; box-shadow: 0 6px 20px rgba(27, 77, 99, .3); }

.schedule { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: .5rem; }
.schedule .field + .field { margin-top: 0; }

.danger-card { border-color: #f5c6c1; }

/* Smallest phones */
@media (max-width: 360px) {
	.month-nav h1 { font-size: 1.2rem; }
	.tabbar a { font-size: .72rem; white-space: nowrap; }
	.page { padding-left: 12px; padding-right: 12px; }
}
