@import url("tokens.css");

* {
	box-sizing: border-box;
}

body {
	font-family: var(--font-family);
	margin: 0px;
	height: 100%;
}


a {
	color: var(--color-link);
	text-decoration: none;
}


a:hover {
	text-decoration: underline;
}

/* ---------- Inputs ----------
 * .tk-input on input and select, .tk-textarea on textarea. One size, plus
 * .tk-input-small for compact repeated rows. No outer margin. */
.tk-input,
.tk-textarea {
	width: 100%;
	padding: 0.65rem 0.85rem;
	margin: 0;
	display: inline-block;
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-md);
	box-sizing: border-box;
	background-color: var(--color-surface);
	color: var(--color-text);
	font: inherit;
}

.tk-input-small {
	padding: var(--space-1) var(--space-2);
	font-size: var(--font-size-sm);
}

.tk-input:hover,
.tk-textarea:hover {
	border-color: var(--color-accent-1);
}

/* ---------- Buttons ----------
 * One size scale (default, .tk-button-small), variants primary (default),
 * secondary, danger and ghost. Buttons have no outer margin: the parent
 * layout (gap, .tk-form-actions, …) spaces them. */
.tk-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	margin: 0;
	padding: var(--space-2) var(--space-4);
	border: none;
	border-radius: var(--radius-button);
	background-color: var(--button-background-color);
	color: var(--button-color);
	font-family: inherit;
	font-size: var(--font-size-md);
	font-weight: bold;
	line-height: 1.25;
	white-space: nowrap;
	cursor: pointer;
	--button-background-color: var(--color-primary);
	--button-background-color-hover: var(--color-accent-1-400);
	--button-color: var(--color-text-light);
	--button-color-hover: var(--button-color);
}

.tk-button:hover {
	background-color: var(--button-background-color-hover);
	text-decoration: none;
	color: var(--button-color-hover);
}

.tk-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.tk-button-small {
	padding: var(--space-1) var(--space-3);
	font-size: var(--font-size-sm);
}

.tk-button-secondary {
	--button-background-color: transparent;
	--button-background-color-hover: var(--color-accent-1-950);
	--button-color: var(--color-primary);
	box-shadow: inset 0 0 0 1px var(--color-accent-1-800);
}

.tk-button-danger {
	--button-background-color: var(--color-danger);
	--button-background-color-hover: color-mix(in srgb, var(--color-danger) 80%, black);
}

.tk-button-ghost {
	--button-background-color: transparent;
	--button-background-color-hover: var(--color-accent-1-950);
	--button-color: var(--color-link);
}

/* A ghost delete button (ui.DeleteButton in a row) in the danger colour. */
.tk-button-ghost.tk-button-danger-text {
	--button-color: var(--color-danger);
}

/* "(N)" after a section or card title (ui.Count). */
.tk-count {
	font-weight: normal;
	color: var(--color-text-muted);
}

/* ---------- Disclosure (.tk-details) ----------
 * Collapsible section. Only details elements with this class are styled, so
 * other uses (the header menu) keep the browser default. */
.tk-details {
	--padding: var(--space-3);
	--bg: var(--color-accent-2-950);
	--bg-hover: var(--color-accent-2-900);
	display: block;
	background-color: var(--bg);
	padding: var(--padding);
	border-radius: var(--radius-lg);
	margin: var(--space-6) 0;
}

.tk-details:hover {
	background-color: var(--bg-hover);
}

.tk-details > summary {
	cursor: pointer;
}

/* The summary of ui.Section (an h2) and ui.Details (plain text): same size
 * whatever the heading level. */
.tk-details-title {
	display: inline;
	margin: 0;
	font-size: var(--font-size-lg);
	font-weight: bold;
}

span.tk-details-title {
	font-size: inherit;
}

/* Content of an open .tk-details, padded like its summary. */
.tk-details-body {
	padding: var(--space-4);
}

.tk-details[open] {
	background-color: transparent;
	padding: inherit;
	border: 1px solid var(--bg);
}

.tk-details[open] > summary {
	background-color: var(--bg);
	padding: var(--padding);
	border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tk-details[open] > summary:hover {
	background-color: var(--bg-hover);
}

/* ---------- Modal (ui.Modal) ---------- */
.tk-modal {
	padding: 0;
	border: none;
	border-radius: var(--radius-dialog);
	box-shadow: var(--shadow-5);
	width: min(32rem, calc(100% - 2 * var(--space-4)));
	max-height: 80vh;
	overflow-y: auto;
	color: var(--color-text);
	background: var(--color-surface);
}

.tk-modal::backdrop {
	background-color: var(--color-backdrop);
}

.tk-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--space-4);
	padding: var(--space-4) var(--space-5);
	border-bottom: 1px solid var(--color-border);
}

.tk-modal-title {
	margin: 0;
	font-size: var(--font-size-lg);
}

.tk-modal-header form {
	display: contents;
}

.tk-modal-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: none;
	border-radius: var(--radius-button);
	background: none;
	font-size: var(--font-size-xl);
	line-height: 1;
	color: var(--color-text-muted);
	cursor: pointer;
}

.tk-modal-close:hover {
	background: var(--color-accent-1-950);
	color: var(--color-text);
}

.tk-modal-body {
	padding: var(--space-4) var(--space-5) var(--space-5);
}

.icon svg {
	width: var(--icon-width);
	height: var(--icon-height);
}

/* Markdown rendered content */
.markdown blockquote {
	border-left: 0.25rem solid var(--color-accent-1-500);
	margin: 0.5rem 0;
	box-shadow: var(--shadow-4);
	padding: 0.5rem 1rem;
}

mark {
	background-color: var(--color-yellow-800);
	border-radius: 0.15rem;
	padding: 0 0.1rem;
}

.callout {
	--callout-color: var(--color-accent-1-500);
	border-left: 0.25rem solid var(--callout-color);
	background-color: color-mix(in srgb, var(--callout-color) 8%, transparent);
	margin: 0.5rem 0;
	padding: 0.5rem 1rem;
	border-radius: 0 var(--radius-card) var(--radius-card) 0;
}

.callout-note {
	--callout-color: var(--color-accent-3);
}

.callout-tip {
	--callout-color: var(--color-green);
}

.callout-important {
	--callout-color: var(--color-blue);
}

.callout-warning {
	--callout-color: var(--color-yellow);
}

.callout-caution {
	--callout-color: var(--color-red);
}

.event-coaches-subtitle {
	margin: 0.25rem 0 0.5rem;
	font-size: 0.9rem;
	color: var(--color-text-muted);
	opacity: 0.75;
}

/* Credited duration per user (event page): name, then a small input. */
.event-credited-duration {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

.event-credited-duration label {
	flex: 1;
}

.event-credited-duration .tk-input {
	width: 7rem;
}

/* Users confirmation below the user picker, which already leaves space. */
.event-users-confirmation.tk-details-body {
	padding-top: 0;
}

/* Hour report: events with unconfirmed users. */
.hours-unconfirmed-events h2 {
	font-size: var(--font-size-lg);
	margin: var(--space-5) 0 0;
}

.student-search-form {
	margin-top: 1rem;
}

.student-search-form>div {
	margin-top: 0.25rem;
	border: 1px solid var(--color-border-strong);
	border-radius: 4px;
	overflow: hidden;
}

.student-search-form>div:empty {
	display: none;
}

.student-search-result {
	display: block;
	width: 100%;
	padding: 0.5rem 1rem;
	background: none;
	border: none;
	border-bottom: 1px solid var(--color-border-subtle);
	text-align: left;
	cursor: pointer;
	font-size: 1rem;
}

.student-search-result:last-child {
	border-bottom: none;
}

.student-search-result:hover {
	background-color: var(--color-accent-1-950);
}

.event-student-quick-add {
	padding: var(--space-2) 1rem;
}

.event-students-list {
	--bg-even: var(--color-accent-1-950);
}

.event-student-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 1.5rem;
	padding: 0.75rem 1.5rem;
}

.event-student-row:nth-child(even) {
	background-color: var(--bg-even);
}

.event-student-name {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex: 1 1 20rem;
	/* The buttons wrap below once the student gets narrower than this (the
	   marks wrap under the name first), so a long badge does not push them
	   off the line on wide screens and the name keeps room on phones. */
	min-width: min(100%, 20rem);
}

.event-student-attendance {
	flex: 0 0 auto;
	/* Push buttons to the right while sharing a line with the name. */
	margin-left: auto;
}

.attendance-buttons {
	display: flex;
	justify-content: flex-start;
}

.attendance-btn {
	padding: 0;
	margin: 0.1rem;
	width: 35px;
	height: 35px;
	color: var(--color-text-dark);
	font-size: 0.85rem;
	--button-background-color: var(--color-accent-3-850);
	--button-background-color-hover: var(--color-accent-3-750);
}

.attendance-present.active {
	--button-background-color: var(--color-green);
	--button-background-color-hover: var(--color-green-400);
}

.attendance-excused.active {
	--button-background-color: var(--color-yellow);
	--button-background-color-hover: var(--color-yellow-400);
}

.attendance-unexcused.active {
	--button-background-color: var(--color-red);
	--button-background-color-hover: var(--color-red-400);
}

.attendance-absent.active {
	--button-background-color: var(--color-gray);
	--button-background-color-hover: var(--color-gray-400);
}

/* Missing student data indicator */
.missing-data {
	position: relative;
	display: inline-flex;
	cursor: pointer;
	outline: none;
}

.missing-data .missing-data-icon {
	--icon-color: var(--color-yellow-400);
	display: inline-flex;
}

.missing-data-popover {
	display: none;
	position: absolute;
	left: 0;
	top: 1.5rem;
	z-index: 10;
	background-color: var(--color-background);
	color: var(--color-text-dark);
	padding: 0.5rem 0.75rem;
	border-radius: 0.5rem;
	box-shadow: var(--shadow-5);
	white-space: nowrap;
}

.missing-data:hover .missing-data-popover,
.missing-data:focus .missing-data-popover,
.missing-data:focus-within .missing-data-popover {
	display: block;
}

.missing-data-item {
	display: block;
}

.missing-data-item::before {
	content: "– ";
}

.missing-data-card {
	background-color: var(--color-yellow-800);
	border: 1px solid var(--color-yellow);
	border-radius: var(--radius-card);
	color: var(--color-text-dark);
	padding: 0.5rem 1rem;
	margin: 0.5rem 0;
	max-width: max-content;
}

.missing-data-card p {
	margin: 0 0 0.25rem;
	font-weight: bold;
}

.missing-data-card ul {
	margin: 0;
	padding-left: 1.25rem;
}

/* ---------- Page scaffolding (shared list/form pages) ---------- */
.tk-page {
	max-width: 72rem;
	margin: 0 auto;
}

.tk-page-wide {
	max-width: none;
}

.tk-page-narrow {
	max-width: 40rem;
	margin: 0;
}

.tk-page-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin: 0.5rem 0 1.5rem;
}

.tk-page-header h1 {
	margin: 0;
	font-size: 1.75rem;
	color: var(--color-accent-1);
}

.tk-page-header-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-4);
	margin-top: var(--space-1);
	color: var(--color-muted);
}

/* Several page actions next to each other (in a .tk-page-header or below
 * the content). */
.tk-page-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
}

.tk-page-subtitle {
	margin: 0.25rem 0 0;
	color: var(--color-muted);
	font-size: 0.95rem;
}

.tk-breadcrumb {
	font-size: 0.9rem;
	margin-bottom: 0.5rem;
}

.tk-muted {
	color: var(--color-muted);
}

.tk-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-1);
}

.tk-card-padded {
	padding: var(--space-5);
}

.tk-card-title {
	margin: 0 0 var(--space-3);
	font-size: var(--font-size-lg);
	color: var(--color-primary);
}

/* A flush card pads its title itself. */
.tk-card:not(.tk-card-padded) > .tk-card-title {
	margin: 0;
	padding: var(--space-4) var(--space-4) var(--space-2);
}

/* ---------- Alerts (ui.Alert, ui.Flash) ---------- */
.tk-alert {
	--alert-color: var(--color-info);
	margin: 0;
	padding: var(--space-3) var(--space-4);
	border-left: 0.25rem solid var(--alert-color);
	border-radius: 0 var(--radius-card) var(--radius-card) 0;
	background-color: color-mix(in srgb, var(--alert-color) 10%, var(--color-surface));
	color: var(--color-text);
}

.tk-alert > :first-child {
	margin-top: 0;
}

.tk-alert > :last-child {
	margin-bottom: 0;
}

.tk-alert-info {
	--alert-color: var(--color-info);
}

.tk-alert-success {
	--alert-color: var(--color-success);
}

.tk-alert-warning {
	--alert-color: var(--color-warning);
}

.tk-alert-danger {
	--alert-color: var(--color-danger);
}

.tk-flash {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.tk-flash:empty {
	display: none;
}

.tk-button:focus-visible,
.tk-input:focus-visible,
.tk-textarea:focus-visible {
	outline: 2px solid var(--color-accent-3);
	outline-offset: 1px;
}

/* ---------- Filter bar ---------- */
.tk-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem 1rem;
	padding: 1rem;
	margin-bottom: 1rem;
	background: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-card);
}

.tk-filter-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 9rem;
	margin: 0;
	padding: 0;
	border: none;
}

.tk-filter-field > label {
	font-size: 0.75rem;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-muted);
}

.tk-filter-field .tk-input {
	margin: 0;
	padding: 0.55rem 0.75rem;
	font-size: 0.95rem;
	background-color: var(--color-surface);
	height: 2.5rem;
}

.tk-filter-search {
	flex: 1 1 16rem;
}

.tk-filter-age .tk-range {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.tk-filter-age .tk-input {
	width: 4.75rem;
}

.tk-filter-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	height: 2.5rem;
	font-size: 0.9rem;
	cursor: pointer;
	white-space: nowrap;
}

.tk-filter-toggle input {
	width: 1rem;
	height: 1rem;
	accent-color: var(--color-accent-1);
}

.tk-filter-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
	min-height: 2.5rem;
}

/* ---------- Results ---------- */
.tk-results-meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	margin: 0 0.25rem 0.5rem;
	font-size: 0.875rem;
	color: var(--color-muted);
}

.tk-results.htmx-request {
	opacity: 0.6;
	transition: opacity 150ms;
}

.tk-table-card {
	overflow: hidden;
}

.tk-table {
	width: 100%;
	border-collapse: collapse;
}

.tk-table th {
	text-align: left;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-muted);
	background: var(--color-surface-alt);
	padding: 0.6rem 1rem;
	border-bottom: 1px solid var(--color-border);
}

.tk-table td {
	padding: 0.65rem 1rem;
	border-bottom: 1px solid var(--color-border);
	vertical-align: middle;
}

.tk-table tbody tr:last-child td,
.tk-table tbody tr:last-child th {
	border-bottom: none;
}

/* Row headers (<th scope="row">) of key/value tables: the key column. */
.tk-table tbody th {
	width: 30%;
	font-size: inherit;
	text-transform: none;
	letter-spacing: normal;
	font-weight: 600;
	color: var(--color-text);
}

.tk-table tbody tr {
	position: relative;
	transition: background-color 120ms;
}

.tk-table tbody tr:hover {
	background-color: var(--color-accent-1-950);
}

.tk-table-dense th {
	padding: var(--space-2) var(--space-3);
}

.tk-table-dense td {
	padding: var(--space-2) var(--space-3);
	font-size: var(--font-size-sm);
}

/* Wide tables scroll sideways instead of squeezing their columns. */
.tk-table-card.tk-table-scroll {
	overflow-x: auto;
}

.tk-table-scroll .tk-table th,
.tk-table-scroll .tk-table td {
	white-space: nowrap;
}

/* Stack (ui.TableProps.Stack): on phones every row becomes a small card. */
@media (max-width: 640px) {
	.tk-table-stack thead {
		display: none;
	}

	.tk-table-stack,
	.tk-table-stack tbody,
	.tk-table-stack tr,
	.tk-table-stack td {
		display: block;
	}

	.tk-table-stack tbody tr {
		padding: var(--space-2) var(--space-4);
		border-bottom: 1px solid var(--color-border-subtle);
	}

	.tk-table-stack tbody tr:last-child {
		border-bottom: none;
	}

	.tk-table-stack td,
	.tk-table-stack tbody tr:last-child td {
		border: none;
		padding: var(--space-1) 0;
	}

	.tk-table-stack td:empty {
		display: none;
	}

	.tk-table-stack td[data-label]::before {
		content: attr(data-label) ": ";
		color: var(--color-text-muted);
		font-size: var(--font-size-sm);
	}

	.tk-table-stack .tk-row-actions {
		justify-content: flex-start;
	}
}

/* Overflow menu (ui.Menu): a three-dots button opening a list of less
 * frequent actions, aligned to the button's right edge. */
.tk-menu {
	position: relative;
	display: inline-block;
}

.tk-menu-toggle {
	list-style: none;
	padding-inline: var(--space-2);
	--icon-color: currentColor;
}

.tk-menu-toggle::-webkit-details-marker {
	display: none;
}

.tk-menu-list {
	position: absolute;
	top: calc(100% + var(--space-1));
	right: 0;
	z-index: 10;
	display: flex;
	flex-direction: column;
	min-width: 12rem;
	padding: var(--space-1) 0;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-3);
}

.tk-menu-item {
	padding: var(--space-2) var(--space-4);
	color: var(--color-text);
	text-decoration: none;
	white-space: nowrap;
}

.tk-menu-item:hover,
.tk-menu-item:focus-visible {
	background-color: var(--color-surface-alt);
}

/* Edit/delete actions in the last cell of a row. */
.tk-row-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
	gap: var(--space-1);
}

/* Makes the whole row clickable while the link text stays the accessible name. */
.tk-row-link {
	color: var(--color-text-dark-a1);
	font-weight: bold;
}

.tk-row-link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.tk-row-link:focus-visible {
	outline: none;
}

.tk-row-link:focus-visible::after {
	outline: 2px solid var(--color-accent-3);
	outline-offset: -2px;
}

.tk-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tk-chip {
	font-size: 0.8rem;
	padding: 0.15rem 0.6rem;
	border-radius: 999px;
	background: var(--color-accent-2-900);
	color: var(--color-accent-2-250);
	white-space: nowrap;
}

/* ---------- Badges (ui.Badge) ---------- */
.tk-badge {
	--badge-color: var(--color-info);
	display: inline-block;
	font-size: 0.7rem;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.1rem 0.45rem;
	border-radius: var(--radius-button);
	background: color-mix(in srgb, var(--badge-color) 18%, var(--color-surface));
	color: var(--color-text);
	white-space: nowrap;
}

.tk-badge-info {
	--badge-color: var(--color-info);
}

.tk-badge-success {
	--badge-color: var(--color-success);
}

.tk-badge-danger {
	--badge-color: var(--color-danger);
}

.tk-badge-warning {
	background: var(--color-yellow-800);
	color: var(--color-warning-text);
}

.tk-empty-state {
	text-align: center;
	padding: 3rem 1rem;
	border: 1px dashed var(--color-accent-1-850);
	border-radius: var(--radius-card);
	color: var(--color-muted);
}

.tk-empty-state p {
	margin: 0 0 0.5rem;
}

.tk-empty-state .tk-button {
	margin-top: 0.75rem;
}

.tk-empty-state-title {
	font-size: 1.1rem;
	font-weight: bold;
	color: var(--color-text-dark-a1);
}

/* ---------- Pagination (ui.Pagination) ---------- */
.tk-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	font-size: var(--font-size-sm);
}

.tk-pagination-pages {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.tk-pagination-page,
.tk-pagination-step,
.tk-pagination-gap {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-1);
	min-width: 2.25rem;
	height: 2.25rem;
	padding: 0 var(--space-2);
	border-radius: var(--radius-button);
}

.tk-pagination a {
	border: 1px solid var(--color-border);
	background: var(--color-surface);
	color: var(--color-link);
}

.tk-pagination a:hover {
	background: var(--color-surface-alt);
	text-decoration: none;
}

.tk-pagination [aria-current="page"] {
	border: 1px solid var(--color-primary);
	background: var(--color-primary);
	color: var(--color-surface);
	font-weight: bold;
}

.tk-pagination-gap {
	min-width: auto;
	color: var(--color-text-muted);
}

/* ---------- Steps (ui.Steps) ---------- */
.tk-steps {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-4);
	padding: 0;
	margin: 0;
	list-style: none;
	counter-reset: tk-step;
	font-size: var(--font-size-sm);
}
.tk-steps li {
	counter-increment: tk-step;
	color: var(--color-text-muted);
}
.tk-steps li::before {
	content: counter(tk-step) ". ";
}
.tk-steps .tk-step-current {
	color: inherit;
	font-weight: 700;
}

/* ---------- List page (ui.ListPage) ---------- */
.tk-list-page > .tk-flash:not(:empty) {
	margin-bottom: var(--space-4);
}

.tk-results > .tk-pagination {
	margin-top: var(--space-4);
}

/* Numeric table columns. */
.tk-table th.tk-num,
.tk-table td.tk-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* ---------- Admin summary cards (signup attempts) ---------- */
.admin-summary-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
	gap: var(--space-4);
	margin-bottom: var(--space-4);
}

.admin-summary {
	min-width: 0;
}

.admin-summary-title {
	margin: 0 0 var(--space-2);
	font-size: var(--font-size-lg);
	color: var(--color-primary);
}

.admin-summary-hint {
	margin: var(--space-2) 0 0;
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
}

/* A long cell (user agent) cut off with an ellipsis; the full text is the title. */
.tk-table td.admin-truncate {
	max-width: 18rem;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---------- Team list & detail ---------- */
.team-add-form {
	display: flex;
	gap: 0.5rem;
	flex: 0 1 38rem;
}

.team-add-form .tk-input {
	margin: 0;
	padding: 0.55rem 0.75rem;
	font-size: 0.95rem;
	height: 2.5rem;
	min-width: 0;
}

/* The team list is a tree in one card (team.TeamTree): a row per team,
   child teams indented below their parent; a toggle expands and collapses
   them (assets/js/tree.js). */
.team-tree-card {
	overflow: hidden;
}

.team-tree {
	margin: 0;
	padding: 0;
	list-style: none;
}

.team-tree[hidden] {
	display: none;
}

/* Child rows start where the parent's name starts. */
.team-tree .team-tree {
	padding-left: 1.75rem;
}

.team-tree-item + .team-tree-item,
.team-tree .team-tree {
	border-top: 1px solid var(--color-border);
}

.team-row {
	position: relative;
	display: grid;
	/* toggle | name | users | count: the users and count columns end at the
	   card edge, so they line up across all depths. */
	grid-template-columns: 1.5rem minmax(8rem, 1fr) minmax(0, 2fr) 6.5rem;
	align-items: center;
	gap: 0.25rem 1rem;
	padding: 0.7rem 1.25rem 0.7rem 0.75rem;
	transition: background-color 120ms;
}

.team-row:hover {
	background-color: var(--color-accent-1-950);
}

.team-row-name {
	overflow-wrap: anywhere;
}

.team-row-count {
	grid-column: 4;
	grid-row: 1;
	text-align: right;
	font-size: 0.9rem;
	color: var(--color-muted);
	white-space: nowrap;
}

.team-row-users {
	grid-column: 3;
	grid-row: 1;
	display: flex;
	justify-content: flex-end;
	font-size: 0.9rem;
}

.team-row-users .tk-chips {
	justify-content: flex-end;
}

.team-tree-toggle {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	border: none;
	border-radius: var(--radius-button);
	background: transparent;
	color: var(--color-muted);
	cursor: pointer;
}

.team-tree-toggle:hover {
	color: var(--color-text-dark-a1);
	background-color: var(--color-border);
}

.team-tree-toggle:focus-visible {
	outline: 2px solid var(--color-accent-3);
	outline-offset: 1px;
}

/* A CSS chevron: points down when expanded, right when collapsed. */
.team-tree-chevron {
	width: 0.45rem;
	height: 0.45rem;
	margin-top: -0.2rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 120ms;
}

.team-tree-toggle[aria-expanded="false"] .team-tree-chevron {
	margin-top: 0;
	margin-left: -0.2rem;
	transform: rotate(-45deg);
}

.team-hierarchy {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.5rem 1rem;
	margin: 0;
}

.team-hierarchy dt {
	font-weight: bold;
	color: var(--color-muted);
}

.team-hierarchy dd {
	margin: 0;
}

.team-children {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Inherited members (team page): "via <child team>". The link sits above
   the row link of the roster entry. */
.team-inherited {
	font-size: 0.85rem;
	color: var(--color-muted);
}

.team-inherited-link {
	position: relative;
	z-index: 1;
}

.team-inherited-heading {
	margin: 1rem 0 0.35rem;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-muted);
}

.team-inherited-list {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.team-inherited-hint {
	margin: 0.5rem 0 0;
	font-size: 0.85rem;
	color: var(--color-muted);
}

.team-inherited-list li {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	align-items: baseline;
}







.team-detail {
	display: grid;
	grid-template-columns: minmax(14rem, 1fr) 2fr;
	gap: 1rem;
	align-items: start;
}

.team-section p {
	margin: 0;
}

.team-roster {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
	gap: 0.25rem 1rem;
	margin: 0 -0.5rem;
	padding: 0;
	list-style: none;
}

.team-roster li {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	padding: 0.4rem 0.5rem;
	border-radius: var(--radius-button);
}

.team-roster li:hover {
	background-color: var(--color-accent-1-950);
}

@media (max-width: 640px) {
	.team-add-form {
		flex: 1 1 100%;
		flex-wrap: wrap;
	}

	.team-add-form .tk-input {
		flex: 1 1 100%;
	}

	.tk-page-header .team-add-form .tk-button-primary {
		width: auto;
	}

	.team-detail {
		grid-template-columns: 1fr;
	}

	.team-tree .team-tree {
		padding-left: 1rem;
	}

	.team-row {
		grid-template-columns: 1.5rem minmax(0, 1fr) auto;
		padding-right: 0.75rem;
	}

	.team-row-count {
		grid-column: 3;
	}

	.team-row-users {
		grid-column: 2 / -1;
		grid-row: 2;
		justify-content: flex-start;
	}

	.team-row-users .tk-chips {
		justify-content: flex-start;
	}
}

/* ---------- Student list ---------- */
.student-col-age {
	width: 6rem;
	white-space: nowrap;
}

.student-age-label {
	display: none;
}


@media (max-width: 640px) {
	.tk-page-header .tk-button-primary {
		width: 100%;
		justify-content: center;
	}

	.tk-filter-bar {
		padding: 0.75rem;
	}

	.tk-filter-search {
		flex: 1 1 100%;
	}

	.tk-filter-field {
		flex: 1 1 8rem;
		min-width: 0;
	}

	.tk-filter-age {
		flex: 0 0 auto;
	}

	.tk-filter-age .tk-input {
		width: 4rem;
	}

	.tk-filter-toggle {
		height: auto;
	}

	.student-age-unknown {
		display: none;
	}

	.student-table thead {
		display: none;
	}

	.student-table tbody tr {
		display: grid;
		grid-template-columns: 1fr auto;
		gap: 0.35rem 0.75rem;
		padding: 0.75rem 1rem;
		border-bottom: 1px solid var(--color-border);
	}

	.student-table tbody tr:last-child {
		border-bottom: none;
	}

	.student-table td {
		padding: 0;
		border: none;
	}

	.student-table td:last-child {
		grid-column: 1 / -1;
		padding-left: 2.75rem;
	}

	.student-col-age {
		width: auto;
		font-size: 0.85rem;
		color: var(--color-muted);
		align-self: center;
	}

	.student-age-label {
		display: inline;
	}
}

/* ---------- Timetable (week view) ---------- */
.tk-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.timetable {
	container-type: inline-size;
}

.timetable-week {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.timetable-day {
	margin: 0;
}

.timetable-day-name {
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-accent-1);
}

.timetable-day.is-empty .timetable-day-name {
	color: var(--color-muted);
}

.timetable-day-empty {
	margin: 0;
	font-size: 0.85rem;
	color: var(--color-muted);
}

.timetable-day-slots {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
	gap: 0.6rem;
}

.timetable-slot {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	min-width: 0;
	padding: 0.7rem 0.85rem 0.75rem;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-left: 4px solid var(--color-accent-1-600);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-1);
	transition: background-color 120ms, box-shadow 120ms;
}

.timetable-slot:hover {
	background-color: var(--color-accent-1-950);
	box-shadow: var(--shadow-2);
}

.timetable-slot:focus-within {
	outline: 2px solid var(--color-accent-3);
	outline-offset: 1px;
}

/* Visually the time comes first; in the markup the name is the heading. */
.timetable-slot-time {
	order: -1;
	display: flex;
	flex-wrap: wrap;
	column-gap: 0.3rem;
	margin: 0;
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
	color: var(--color-accent-1);
}

.timetable-slot-range {
	font-weight: bold;
	white-space: nowrap;
}

.timetable-slot-duration {
	color: var(--color-muted);
}

.timetable-slot-name {
	margin: 0;
	font-size: 1rem;
	line-height: 1.25;
	overflow-wrap: anywhere;
	hyphens: auto;
}

/* Stretched link: the whole card opens the slot. */
.timetable-slot-link {
	color: var(--color-text-dark-a1);
}

.timetable-slot-link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.timetable-slot-link:hover {
	text-decoration: none;
}

.timetable-slot-link:focus-visible {
	outline: none;
}

.timetable-slot-coaches {
	display: flex;
	align-items: flex-start;
	gap: 0.4rem;
	margin: 0;
	font-size: 0.85rem;
	line-height: 1.25;
	color: var(--color-muted);
}

.timetable-slot-icon {
	flex: none;
	margin-top: 0.05rem;
	--icon-color: var(--color-accent-1-700);
}

/* Phones: list only the days that have slots. */
@container (max-width: 40rem) {
	.timetable-day.is-empty {
		display: none;
	}
}

/* Wide screens: a classic week plan with one column per weekday. */
@container (min-width: 56rem) {
	.timetable-week {
		display: grid;
		grid-template-columns: repeat(7, minmax(0, 1fr));
		gap: 0;
		border: 1px solid var(--color-border);
		border-radius: var(--radius-card);
		background: var(--color-surface-alt);
		overflow: hidden;
	}

	.timetable-day {
		display: flex;
		flex-direction: column;
		min-height: 14rem;
		border-left: 1px solid var(--color-border);
	}

	.timetable-day:first-child {
		border-left: none;
	}

	.timetable-day-name {
		margin: 0;
		padding: 0.6rem 0.6rem;
		text-align: center;
		background: var(--color-surface);
		border-bottom: 1px solid var(--color-border);
	}

	.timetable-day-empty {
		padding: 1rem 0.5rem;
		text-align: center;
	}

	.timetable-day-slots {
		grid-template-columns: 1fr;
		gap: 0.4rem;
		padding: 0.4rem;
	}

	.timetable-slot {
		gap: 0.3rem;
		padding: 0.5rem 0.55rem 0.55rem;
		border-left-width: 3px;
	}

	.timetable-slot-time,
	.timetable-slot-coaches {
		font-size: 0.8rem;
	}

	.timetable-slot-name {
		font-size: 0.95rem;
	}
}

/* Coaches and teams of a slot (timetable edit page). */
.timetable-assign {
	margin-top: var(--space-5);
}

.timetable-assign-form {
	padding: var(--space-3) var(--space-4);
	border-top: 1px solid var(--color-border-subtle);
}

.timetable-assign-form .tk-input {
	flex: 1 1 12rem;
	width: auto;
}

/* ---------- Forms ---------- */
.tk-form-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	gap: 0 var(--space-4);
}

.tk-form > .tk-alert {
	margin-bottom: var(--space-4);
}

.tk-form-field {
	margin-bottom: var(--space-4);
}

.tk-form-field > label {
	display: block;
	font-weight: bold;
	font-size: var(--font-size-sm);
	margin-bottom: var(--space-1);
}

.tk-form-field-invalid .tk-input,
.tk-form-field-invalid .tk-textarea {
	border-color: var(--color-red-400);
}

.tk-optional {
	font-weight: normal;
	font-size: var(--font-size-xs);
	color: var(--color-muted);
}

.tk-form-hint,
.tk-form-field-error {
	margin: var(--space-1) 0 0;
	font-size: var(--font-size-sm);
}

.tk-form-hint {
	color: var(--color-text-muted);
}

.tk-form-field-error {
	color: var(--color-red-400);
}

/* Destructive actions (delete) below a form, apart from its Save button. */
.tk-danger-zone {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: var(--space-3);
	margin-top: var(--space-4);
}

.tk-form-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: var(--space-3);
	margin-top: var(--space-5);
	padding-top: var(--space-4);
	border-top: 1px solid var(--color-border);
}

/* A checkbox (or radio) with its label text next to it. */
.tk-check,
.tk-form-field > label.tk-check {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0;
	font-weight: normal;
	font-size: inherit;
	cursor: pointer;
}

/* ---------- Detail list (label/value rows, <dl>) ---------- */
.tk-detail-list {
	margin: 0;
}

.tk-detail-list > div {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-4);
	padding: var(--space-2) 0;
	border-bottom: 1px solid var(--color-border-subtle);
}

.tk-detail-list > div:last-child {
	border-bottom: none;
}

.tk-detail-list dt {
	flex: 0 0 12rem;
	font-weight: bold;
	color: var(--color-text-muted);
}

.tk-detail-list dd {
	flex: 1 1 12rem;
	min-width: 0;
	margin: 0;
	overflow-wrap: anywhere;
}

.tk-mono {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: var(--font-size-sm);
}

/* ---------- Layout helpers ---------- */
.tk-stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

/* Items side by side (avatar and name, label and small input), wrapping on
 * small screens. */
.tk-cluster {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2) var(--space-3);
}

/* ---------- Item list (rows of text with actions, on a flush card) ---------- */
.tk-item-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tk-item-list > li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2) var(--space-3);
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--color-border-subtle);
}

.tk-item-list > li:last-child {
	border-bottom: none;
}

/* The growing part of a row; the actions after it sit on the right. */
.tk-item-list-main {
	flex: 1 1 12rem;
	min-width: 0;
}

/* ---------- Admin lists ---------- */
.admin-select-cell {
	width: 1%;
}

.tk-table tbody tr.is-disabled td {
	color: var(--color-text-muted);
	background-color: var(--color-surface-alt);
}

.admin-batch-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
	margin-top: var(--space-4);
}

/* ---------- Link cards (a list of clickable cards) ---------- */
.tk-link-card-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.tk-link-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-card);
	background-color: var(--color-surface);
	box-shadow: var(--shadow-1);
	color: inherit;
	text-decoration: none;
}

.tk-link-card:hover {
	color: inherit;
	box-shadow: var(--shadow-3);
}

.tk-link-card:focus-visible {
	outline: 2px solid var(--color-accent-3);
	outline-offset: 1px;
}

.tk-link-card-title {
	font-weight: bold;
}

.tk-link-card-meta {
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
}

/* ---------- Dashboard ---------- */
.dashboard-section h2 {
	font-size: var(--font-size-lg);
	margin: var(--space-5) 0 var(--space-3);
}

.dashboard-card.is-event {
	border-left: 0.25rem solid var(--color-accent-2);
}

.dashboard-card.is-timetable {
	border-left: 0.25rem solid var(--color-yellow);
}

/* ---------- Profile ---------- */
.pending-email {
	margin-bottom: var(--space-4);
}

.pending-email form {
	margin-top: var(--space-2);
}

.profile-account-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
}

/* ---------- Error page (standalone, no navigation) ---------- */
.error-page {
	display: flex;
	min-height: 100vh;
	align-items: center;
	justify-content: center;
	padding: var(--space-4);
	background-color: var(--color-surface-alt);
}

.error-page-card {
	max-width: 32rem;
	text-align: center;
}

.error-page-status {
	margin: 0;
	font-size: var(--font-size-2xl);
	font-weight: bold;
	color: var(--color-primary);
}

.error-page-card h1 {
	margin: var(--space-2) 0 var(--space-4);
}

.error-page-message {
	margin-bottom: var(--space-5);
}

.error-page-id {
	margin: var(--space-5) 0 0;
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
}
