:root {
    color-scheme: light;
    --emerald: #064b40;
    --emerald-hover: #033c33;
    --page: #faf8f2;
    --surface: #fff;
    --ink: #19372f;
    --muted: #596b64;
    --line: #dedfd6;
    --input-line: #aabbb3;
    --soft: #edf1ec;
    --focus: #ad6000;
    --danger: #8d2222;
    --radius: 12px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:where(a, button, input, select, summary):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -100px; left: 16px; padding: 12px; background: var(--surface); z-index: 10; }
.skip-link:focus { top: 12px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--emerald); color: white; flex: none; position: relative; z-index: 3; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; font-size: 18px; font-weight: 700; line-height: 1.25; }
.brand-logo { display: block; width: 64px; height: 64px; flex: none; object-fit: contain; }
.header-menu { flex: none; }
.header-menu summary { display: grid; place-items: center; list-style: none; width: 44px; height: 44px; border-radius: 8px; cursor: pointer; }
.header-menu summary::-webkit-details-marker { display: none; }
.header-menu summary:hover { background: #ffffff18; }
.header-menu nav { position: absolute; right: 20px; top: calc(100% - 8px); width: min(240px, calc(100vw - 40px)); padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 8px 24px #133b2926; }
.header-menu nav a { display: flex; align-items: center; min-height: 48px; padding: 12px; text-decoration: none; border-radius: 8px; }
.header-menu nav a:hover, .header-menu nav a[aria-current] { background: var(--soft); }
.environment { display: block; padding: 12px; font-size: 12px; color: var(--muted); }
.sidebar { display: none; }
main { padding: 20px; width: 100%; max-width: 1080px; min-width: 0; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 40px); letter-spacing: -.04em; line-height: 1.2; }
h2 { font-size: 21px; line-height: 1.35; letter-spacing: -.02em; overflow-wrap: anywhere; }
.intro { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 8px 0 20px; }
.page-heading, .form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
button, .button { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; min-width: 44px; padding: 12px 20px; border: 1px solid var(--emerald); border-radius: var(--radius); background: var(--emerald); color: white; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
button:hover, .button:hover, .add-player-fab:hover { background: var(--emerald-hover); color: white; }
.secondary { background: var(--surface); color: var(--emerald); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; flex: none; padding: 10px; border: 0; border-radius: 10px; color: var(--emerald); background: var(--soft); text-decoration: none; }
.icon-button:hover { background: #dce8df; color: var(--emerald); }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; min-width: 0; }
label { font-weight: 650; font-size: 14px; }
input, select { width: 100%; min-width: 0; min-height: 48px; padding: 12px; border: 1px solid var(--input-line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; }
input::placeholder { color: var(--muted); opacity: 1; }
[aria-invalid="true"] { border: 2px solid var(--danger); }
.search-form { display: grid; gap: 12px; margin: 0 0 24px; }
.search-form .field { margin: 0; }
.search-field { position: relative; }
.search-field input { min-height: 52px; padding-right: 56px; }
.search-submit { position: absolute; right: 4px; top: 4px; background: transparent; }
.status-filter { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 20px; }
.search-form .secondary { justify-self: start; font-size: 14px; padding: 8px 12px; min-height: 44px; }
.result-count { font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.player-list { border-top: 1px solid var(--line); }
.player-row { display: flex; align-items: center; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.player-details { flex: 1; min-width: 0; }
.player-row h2, .player-row h3 { font-size: 17px; margin: 0 0 7px; line-height: 1.4; overflow-wrap: anywhere; }
.player-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 14px; line-height: 1.5; }
.status { display: inline-block; border-radius: 20px; padding: 3px 12px; font-size: 12px; font-weight: 700; line-height: 1.5; background: #e8e8e2; color: #505c55; }
.active { background: #d3efdb; color: #155336; }
.inactive-row .player-details { color: #56645c; }
.empty-state { padding: 32px 0; border-top: 1px solid var(--line); }
.empty-state p { color: var(--muted); line-height: 1.65; }
/* The roster scrolls above a reserved dock: the floating action never overlaps rows. */
.listing-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.listing-page .app-layout { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
.listing-page main { padding-bottom: 24px; }
.add-player-dock { flex: none; display: flex; justify-content: flex-end; padding: 12px 20px max(16px, env(safe-area-inset-bottom)); background: var(--page); }
.add-player-fab { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--emerald); color: white; box-shadow: 0 4px 12px #064b4033; }
.add-player-fab svg { width: 32px; height: 32px; }
.player-form { max-width: 620px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.notice { padding: 16px 20px; border-radius: var(--radius); line-height: 1.6; }
.notice h2 { margin-top: 0; font-size: 18px; }
.success { background: #e6f4e9; color: #225332; }
.error { background: #fff0ef; color: var(--danger); }
.field-error { color: var(--danger); margin: 0; font-size: 14px; }
.status-control { margin-top: 28px; }
.status-control p, .player-form > p { line-height: 1.65; }
.danger { background: var(--danger); border-color: var(--danger); }
.danger:hover { background: #711b1b; }
footer { margin-top: 32px; color: var(--muted); font-size: 12px; line-height: 1.6; }
@media (min-width: 768px) {
    .app-header { padding: 16px 32px; }
    .brand { font-size: 20px; }
    .app-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); }
    .sidebar { display: block; padding: 32px 20px; border-right: 1px solid var(--line); }
    .nav-label { display: block; color: var(--muted); font-size: 12px; margin: 0 0 16px 12px; }
    .nav-link { display: flex; align-items: center; min-height: 48px; padding: 12px; border-radius: 10px; background: #e3ece3; color: var(--emerald); font-weight: 650; text-decoration: none; }
    main { padding: 32px clamp(24px, 4vw, 56px); }
    .player-row { padding: 20px 4px; }
    .add-player-dock { padding-right: 32px; }
    .form-page .app-layout { min-height: calc(100vh - 96px); }
}

/* Shared navigation and competition views use the existing row/form components. */
.sidebar .nav-link { margin-bottom: 8px; background: transparent; }
.sidebar .nav-link[aria-current] { background: #e3ece3; }
.competition-row { text-decoration: none; min-height: 88px; }
.competition-row:hover { background: var(--soft); }
.competition-dates { display: flex; gap: 8px 20px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 8px; }
.competition-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: 20px 0; margin: 0 0 20px; border-block: 1px solid var(--line); }
.competition-facts dt { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.competition-facts dd { margin: 0; overflow-wrap: anywhere; }
.competition-detail-layout { display: grid; gap: 32px; }
.teams-placeholder { border-top: 1px solid var(--line); padding-top: 16px; }
.teams-placeholder p { color: var(--muted); line-height: 1.65; }
.page-heading h1 { overflow-wrap: anywhere; max-width: 100%; }
@media (min-width: 1100px) {
    .competition-detail-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
    .teams-placeholder { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 24px; }
}

.team-heading { justify-content: space-between; margin-bottom: 16px; }
.team-heading h2 { margin: 0; }
.team-group { margin: 28px 0; }
.team-group > h2 { margin-bottom: 8px; }
.team-group > h2 a, .team-context a { display: inline-flex; align-items: center; min-height: 44px; }
.team-context { overflow-wrap: anywhere; }

textarea { width: 100%; min-height: 64px; padding: 12px; border: 1px solid var(--input-line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.month-navigation { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0; }
.month-navigation h2 { font-size: 20px; text-align: center; margin: 0; }
.practice-date { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.practice-time { margin: 6px 0; }
.cancelled { background: #f7dfd9; color: #82291d; }
.cancelled-practice { border-left: 3px solid #a85943; padding-left: 12px; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.team-picker { border: 0; padding: 0; margin: 0 0 24px; min-width: 0; }
.team-picker legend { font-weight: 700; padding: 0 0 8px; }
.team-choice { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.team-choice input[type=checkbox] { width: 24px; min-height: 24px; height: 24px; flex: none; accent-color: var(--emerald); }
.team-choice span { min-width: 0; }
.team-choice small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; }
.attendance-summary { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--line); }
.attendance-counts { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.attendance-counts dt { color: var(--muted); font-size: 13px; }
.attendance-counts dd { margin: 4px 0 0; font-size: 22px; font-weight: 700; }
.attendance-player { min-width: 0; padding: 16px 0 24px; border: 0; border-bottom: 1px solid var(--line); margin: 24px 0; }
.attendance-player legend { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; max-width: 100%; }
.attendance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.attendance-option { position: relative; min-width: 0; }
.attendance-option input { position: absolute; opacity: 0; width: 1px; min-height: 1px; height: 1px; }
.attendance-option span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px; border: 1px solid var(--input-line); border-radius: 10px; cursor: pointer; font-size: 13px; }
.attendance-option input:checked + span { background: var(--emerald); border-color: var(--emerald); color: white; }
.attendance-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.attendance-form { max-width: 840px; }
@media (min-width: 768px) { .attendance-options { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.team-detail-layout { display: grid; gap: 32px; }
.team-roster { min-width: 0; }
.team-member { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.team-member-details { flex: 1 1 190px; min-width: 0; min-height: 48px; text-decoration: none; padding-block: 4px; }
.team-member-details h3 { font-size: 17px; }
.team-member-details .status { margin-left: 8px; }
.remove-team-player { font-size: 13px; padding: 10px 12px; }
.assignment-form, .assignment-review { max-width: 760px; }
.assignment-picker { border: 0; padding: 0; margin: 20px 0; min-width: 0; }
.assignment-choice { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 16px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.assignment-choice input { width: 24px; height: 24px; min-height: 24px; padding: 0; flex: none; accent-color: var(--emerald); }
.assignment-choice > span { min-width: 0; overflow-wrap: anywhere; }
.assignment-choice strong { font-size: 17px; }
.assignment-choice small { display: block; margin-top: 5px; color: var(--muted); font-weight: 400; }
.assignment-choice .move-label { color: #785013; }
.move-notice { background: #fff1d2; color: #684509; }
.assignment-changes { padding-left: 20px; }
.assignment-changes li { padding: 12px 0; overflow-wrap: anywhere; line-height: 1.6; }
.assignment-save { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 0 max(16px, env(safe-area-inset-bottom)); }

/* Calendar/practice screens share the supplied card and compact-control direction. */
.practice-screen { --practice-border: #dfe5e4; --present: #087744; --absent: #bb2436; --late: #c7e5ff; --excused: #ffcf70; }
.practice-screen main { max-width: 1080px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.practice-screen .page-heading { margin-bottom: 12px; }
.practice-back { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; margin-bottom: 2px; }
.practice-card, .month-card, .practice-event { background: var(--surface); border: 1px solid var(--practice-border); border-radius: 12px; }
.practice-card { padding: 16px; margin: 16px 0; max-width: 760px; }
.practice-card-heading { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.practice-card-heading h2 { margin: 0 0 14px; font-size: 21px; min-width: 0; }
.practice-card-heading .status { flex: none; }
.practice-metadata { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.practice-metadata li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.5; font-size: 14px; }
.practice-metadata span { min-width: 0; overflow-wrap: anywhere; }
.practice-metadata svg { width: 20px; height: 22px; }
.practice-notes { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.practice-notes h3 { margin: 0; font-size: 15px; }
.practice-notes p { font-size: 14px; line-height: 1.5; }
.primary-wide { width: 100%; gap: 10px; min-height: 50px; }
.practice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.practice-actions .button { padding: 10px 8px; font-size: 13px; }
.cancel-button { background: #fff6f6; color: #b91e34; border-color: #b91e34; }
.cancelled-card { background: #fff8f8; border-color: #efcdcf; }
.cancellation-notice { background: #ffe8ea; color: #a7192c; margin-top: 16px; }
.cancellation-notice p { margin: 4px 0 0; }
.practice-screen .month-card { padding: 10px; }
.practice-screen .month-navigation { margin: 0 0 12px; gap: 4px; }
.practice-screen .month-navigation h2 { font-size: 18px; flex: 1; }
.month-arrow { display: grid; place-items: center; min-width: 44px; height: 44px; font-size: 30px; text-decoration: none; }
.today-button { min-height: 44px; padding: 8px 10px; font-size: 13px; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.weekday { font-size: 11px; color: var(--muted); padding: 8px 0; }
.month-day { position: relative; display: grid; place-items: center; min-height: 44px; text-decoration: none; font-size: 15px; border-radius: 50%; }
.month-day.is-today { background: var(--emerald); color: white; font-weight: 700; }
.event-dots { display: flex; gap: 3px; position: absolute; bottom: 2px; }
.event-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--present); }
.is-today .event-dots i { background: white; }
.event-dots .cancelled-dot { background: var(--absent); }
.agenda-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 0 12px; }
.agenda-heading h2 { font-size: 19px; margin: 0; }
.agenda-heading > span { color: var(--muted); font-size: 12px; }
.practice-agenda { display: grid; gap: 10px; }
.practice-event { display: flex; gap: 10px; padding: 12px; text-decoration: none; scroll-margin-top: 16px; }
.practice-event:hover { border-color: var(--emerald); }
.date-tile { flex: 0 0 48px; align-self: flex-start; display: grid; text-align: center; gap: 2px; background: #eaf6ee; color: var(--emerald); border-radius: 10px; padding: 8px 3px; font-size: 11px; }
.date-tile > span:first-child { text-transform: uppercase; font-weight: 700; }
.date-tile strong { font-size: 24px; line-height: 1; }
.practice-event.cancelled-practice { border-left: 1px solid var(--practice-border); }
.cancelled-practice .date-tile { background: #ffedef; color: #b91e34; }
.event-info { min-width: 0; flex: 1; }
.event-info h3 { margin: 4px 0; font-size: 16px; overflow-wrap: anywhere; }
.event-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.event-top p { margin: 0; font-size: 11px; color: var(--muted); }
.event-top .status { padding: 3px 7px; font-size: 10px; }
.event-meta { display: flex; gap: 7px; margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.event-meta svg { width: 16px; height: 17px; }
.event-meta span { min-width: 0; overflow-wrap: anywhere; }
.cancellation-text { color: #a7192c; font-size: 12px; overflow-wrap: anywhere; }
.practice-screen .practice-form { max-width: 760px; margin-top: 24px; }
.practice-time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.practice-time-fields input { padding: 10px; }
.practice-form .team-picker { background: white; border: 1px solid var(--practice-border); border-radius: 12px; padding: 12px; }
.practice-form .team-picker legend { padding: 0 6px; }
.practice-form .team-choice:last-child { border-bottom: 0; }
.practice-save { display: grid; gap: 10px; }
.practice-screen.listing-page main { padding-bottom: 16px; }
.practice-screen .add-player-dock { padding-top: 6px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.practice-screen .attendance-summary { max-width: 760px; }
.attendance-context { margin-top: 12px; }
.attendance-totals { display: flex; flex-wrap: wrap; gap: 8px; max-width: 760px; }
.attendance-badge { padding: 10px 12px; border-radius: 9px; background: #edf0f1; font-size: 12px; text-align: center; flex: 1; white-space: nowrap; }
.attendance-badge[hidden] { display: none; }
.attendance-badge.status-present { background: #dff5e8; color: #075e37; }
.attendance-badge.status-absent { background: #ffe3e7; color: #a71a2c; }
.attendance-badge.status-late { background: #e1f0ff; }
.attendance-badge.status-excused { background: #ffedc8; }
.attendance-hint { font-size: 12px; line-height: 1.5; }
.attendance-legend { max-width: 760px; display: flex; justify-content: space-between; gap: 4px; border: 1px solid var(--practice-border); border-radius: 10px; background: white; padding: 8px; margin: 12px 0; }
.attendance-legend > span { display: flex; align-items: center; gap: 4px; font-size: 10px; }
.attendance-legend b { border-radius: 50%; width: 23px; height: 23px; display: grid; place-items: center; font-size: 12px; }
.attendance-legend .status-present { background: var(--present); color: white; }
.attendance-legend .status-absent { background: #ffe3e7; color: #a71a2c; }
.attendance-legend .status-late { background: var(--late); }
.attendance-legend .status-excused { background: var(--excused); }
.practice-screen .attendance-form { max-width: 760px; }
.practice-screen .attendance-player { background: white; border: 1px solid var(--practice-border); border-radius: 12px; padding: 8px; margin: 8px 0; }
.attendance-player-line { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.attendance-name { flex: 1; min-width: 0; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.practice-screen .attendance-options { display: flex; gap: 4px; flex: none; margin: 0; }
.practice-screen .attendance-option span { width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 15px; background: #f2f4f5; color: #496158; font-size: 14px; }
.practice-screen .attendance-option input:checked + .status-present { background: var(--present); border-color: var(--present); color: white; }
.practice-screen .attendance-option input:checked + .status-absent { background: var(--absent); border-color: var(--absent); color: white; box-shadow: 0 0 0 3px #ffe1e5; }
.practice-screen .attendance-option input:checked + .status-late { background: var(--late); border-color: #72a9d2; color: #143e5b; }
.practice-screen .attendance-option input:checked + .status-excused { background: var(--excused); border-color: #e1ae49; color: #49310a; }
.excused-note { display: none; margin: 8px 0 0; background: #fff2f3; padding: 8px; border-radius: 8px; }
.attendance-player:has(input[value="Excused"]:checked) .excused-note { display: flex; }
.excused-note label { font-size: 12px; }
.excused-note textarea { min-height: 48px; font-size: 13px; }
.note-error { font-size: 12px; }
.note-error[hidden] { display: none; }
.legacy-unmarked { font-size: 12px; color: var(--muted); }
.attendance-player:has(input[type="radio"]:checked) .legacy-unmarked { display: none; }
.attendance-save { position: sticky; bottom: 0; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: var(--page); margin-top: 24px; z-index: 2; }
.historical-attendance p { font-size: 13px; }
.historical-attendance .attendance-badge { display: inline-block; margin-left: 8px; }
@media (max-width: 360px) {
    .practice-screen main { padding-left: 5px; padding-right: 5px; }
    .practice-screen .month-card { padding: 0; }
}
@media (min-width: 768px) {
    .practice-screen main { padding-bottom: 32px; }
    .attendance-name { font-size: 16px; }
    .practice-screen .month-card { max-width: 760px; }
    .practice-agenda { max-width: 760px; }
}
.practice-team-select { margin-bottom: 20px; border: 1px solid var(--practice-border); border-radius: 12px; background: white; }
.practice-team-select > summary { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px; cursor: pointer; list-style: none; font-size: 12px; }
.practice-team-select > summary::-webkit-details-marker { display: none; }
.practice-team-select > summary > span:first-of-type { flex: 1; }
.practice-team-select strong { display: block; margin-top: 4px; font-size: 14px; }
.practice-team-select .team-picker { margin: 0; border: 0; }
