:root {
    --water: #005b75;
    --deep: #123849;
    --pool: #e8f4f7;
    --paper: #fff;
    --line: #b6d2db;
    --marker: #b43e27;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--pool); color: var(--deep); font: 16px/1.5 "Trebuchet MS", "Segoe UI", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px max(20px, calc((100vw - 1200px) / 2)); background: var(--water); color: white; border-bottom: 6px solid var(--deep); }
header a { color: white; }
.brand { font-size: 25px; font-weight: 700; text-decoration: none; }
header p { margin: 0; font-size: 14px; }
nav { display: flex; flex-wrap: wrap; gap: 20px; }
main { max-width: 1240px; margin: auto; padding: 24px 20px 60px; }
h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.15; margin: 0 0 16px; }
h2 { font-size: 27px; margin-top: 40px; }
h3 { font-size: 23px; }
h4 { font-size: 18px; margin-bottom: 8px; }
p { max-width: 78ch; }
a { color: var(--water); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid #bb4b19; outline-offset: 3px; }
.stand, .hint, .refs { font-size: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; padding: 16px 0; border-top: 2px solid var(--line); margin-top: 24px; }
label { display: block; font-weight: 700; }
input, select, button { font: inherit; }
input:not([type=checkbox]), select { display: block; width: 100%; padding: 10px 12px; border: 1px solid #688f9c; background: white; color: var(--deep); border-radius: 4px; min-height: 46px; }
.filters label { flex: 1 1 200px; }
.team-filter-control { flex: 1 1 200px; min-width: 0; }
.team-picker { position: relative; }
.filter-picker summary { min-height: 46px; padding: 10px 12px; border: 1px solid #688f9c; border-radius: 4px; background: white; cursor: pointer; }
.team-picker-panel { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; padding: 8px; background: white; border: 1px solid #688f9c; box-shadow: 0 6px 12px #12384926; }
.team-picker-panel button { width: 100%; padding: 8px; font-size: 14px; }
#team-picker-options { max-height: 320px; overflow-y: auto; margin-top: 6px; }
.team-picker-panel label { display: flex; gap: 8px; align-items: center; padding: 7px 4px; font-size: 14px; font-weight: 400; cursor: pointer; }
.team-picker-panel label:hover { background: var(--pool); }
.team-picker-panel input[type=checkbox] { margin: 0; }
.filters p { margin: 0 0 10px; min-width: 80px; }
.lane-head, .slot { display: grid; grid-template-columns: 65px 1fr 1fr; gap: 12px; }
.lane-head { padding: 12px 0; font-weight: 700; }
.slot { border-top: 2px solid var(--line); padding: 12px 0; }
.slot h3 { margin: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.lane { min-width: 0; display: flex; flex-direction: column; }
.lane > .match { flex: 1; }
.mobile-pool { display: none; }
.match { background: white; border-left: 6px solid var(--water); padding: 12px 14px; }
.match.offen { border-color: #347b3d; }
.match.jugend { border-color: #336cbb; }
.match.damen { border-color: #a1437b; }
.match.youngsters { border-color: #b47700; }
.match-meta { font-size: 13px; margin-bottom: 8px; }
.match-meta b { padding-right: 6px; }
.list-pool, .print-mode { display: none; }
.view-switch { margin: 16px 0; gap: 8px; }
.view-switch a { display: inline-block; padding: 8px 14px; border: 1px solid var(--water); border-radius: 4px; }
.view-switch a[aria-current] { background: var(--water); color: white; text-decoration: none; }
.schedule-liste { --list-columns: 56px minmax(0, 1fr) 40px minmax(90px, .5fr); }
.schedule-liste .lane-head, .schedule-liste .slot { grid-template-columns: 55px minmax(0, 1fr) minmax(0, 1fr); gap: 0 8px; }
.schedule-liste .lane-head { align-items: end; padding: 8px 0; }
.schedule-liste .pool-heading > span { display: block; padding: 0 8px 6px; }
.schedule-liste .list-columns { display: grid; grid-template-columns: var(--list-columns); gap: 6px; padding: 6px 6px 6px 10px; background: var(--water); color: white; font-size: 11px; }
.schedule-liste .slot { padding: 0; border-top-width: 1px; }
.schedule-liste .slot h3 { grid-column: 1; grid-row: 1; padding-top: 8px; font-size: 14px; }
.schedule-liste .mobile-pool { display: none; }
.schedule-liste .pause { grid-column: 2 / 4; padding: 8px; }
.schedule-liste .match { display: grid; grid-template-columns: var(--list-columns); align-content: start; align-items: start; gap: 3px 6px; padding: 6px; border-left-width: 4px; font-size: 13px; line-height: 1.35; }
.schedule-liste .match-meta { grid-column: 1; grid-row: 1; margin: 0; font-size: 11px; }
.schedule-liste .match-meta b { display: block; font-size: 13px; }
.schedule-liste .match-phase { display: block; color: #405d69; }
.schedule-liste .match-code { text-decoration: none; cursor: help; }
.schedule-liste .pairing { display: contents; }
.schedule-liste .pairing > div { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 4px; grid-column: 2; grid-row: 1; min-width: 0; overflow-wrap: anywhere; }
.schedule-liste .team-separator { font-weight: 700; }
.schedule-liste .pairing > .score { grid-column: 3; grid-row: 1; font-size: 16px; }
.schedule-liste .refs { grid-column: 4; grid-row: 1; margin: 0; font-size: 11px; overflow-wrap: anywhere; }
.schedule-liste .referee-name { display: block; }
.schedule-liste .referee-label, .schedule-liste .referee-separator { display: none; }
.schedule-liste .match > .hint, .schedule-liste .match > .notice,
.schedule-liste .match-details { grid-column: 1 / -1; margin: 2px 0 0; font-size: 11px; }
.schedule-liste .match > .notice { padding: 4px 8px; border-left-width: 3px; }
.schedule-liste .match-details summary { cursor: pointer; color: var(--water); }
.schedule-liste .match-details .hint { margin: 4px 0; font-size: inherit; }
.schedule-liste .match > a { grid-column: 2 / -1; margin: 0; padding: 2px 0; font-size: 12px; }
.pairing { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.winner { font-weight: 700; }
.placeholder { font-style: italic; color: #526977; }
.bracket-source { display: block; font-size: .85em; font-weight: 400; }
.bracket-label { margin: 4px 0; }
.score { font-size: 28px; line-height: 1.2; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.score small { display: block; font-size: 12px; }
.refs { margin: 10px 0 0; color: #405d69; }
.match > a { display: inline-block; margin-top: 10px; padding: 5px 0; }
.pause { grid-column: 2 / 4; margin: 0; }
.class-tables { margin: 28px 0; padding: 10px 20px 24px; background: white; }
.class-tables h3 { color: var(--water); margin-bottom: 12px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--pool); font-size: 14px; }
.entry { max-width: 720px; margin-top: 24px; background: white; padding: 24px; border-top: 6px solid var(--water); }
.entry h2 { margin-top: 0; }
.ko-manual-confirm { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.ko-planning, .ko-warnings { margin-top: 12px; }
.ko-controls, .placement-override { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.ko-controls form, .placement-override form { margin-top: 10px; }
.ko-controls summary, .placement-override summary { cursor: pointer; color: var(--water); font-weight: 700; }
.schedule-liste .ko-controls, .schedule-liste .placement-override { grid-column: 1 / -1; min-width: 0; }
.ko-controls select, .placement-override select { max-width: 100%; }
.ko-referee-form { padding: 12px; background: var(--pool); border-left: 3px solid var(--water); }
.ko-referee-form button { margin: 8px 8px 0 0; }
.ko-referee-form .referee-inputs { margin-bottom: 8px; }
.ko-controls .ko-arrows { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ko-arrows button { min-width: 44px; min-height: 44px; padding: 6px 8px; font-size: 20px; line-height: 1; }
.ko-arrows button small { font-size: 12px; }
.ko-planning form { margin-top: 16px; }
.ko-planning button { margin-top: 10px; }
.entry .match { background: var(--pool); }
.placement-override form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.placement-override h3 { margin-top: 0; }
.login { max-width: 440px; }
.login button { margin-top: 18px; }
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 20px 0 24px; padding: 8px; background: white; border-bottom: 3px solid var(--water); }
.admin-menu { flex: 1 1 600px; gap: 4px; }
.admin-menu a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; text-decoration: none; border-radius: 3px; }
.admin-menu a:hover { background: var(--pool); text-decoration: underline; }
.admin-menu a[aria-current] { background: var(--water); color: white; font-weight: 700; }
.score-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 22px 0; }
.score-inputs input { margin-top: 8px; font-size: 30px; text-align: center; }
.game-picker { display: flex; align-items: end; gap: 12px; margin-bottom: 20px; }
.game-picker label { max-width: 180px; }
.game-navigation { justify-content: space-between; margin: 16px 0; font-size: 14px; }
.quick-entry h2 { margin: 20px 0 0; }
.quick-entry .score-inputs label .hint { display: block; font-weight: 400; }
.referee-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.referee-inputs .referee-previous-duty { background: #fff3d3; color: #714800; }
.referee-inputs select.referee-previous-duty { border-color: #a56800; }
.checkbox { display: flex; gap: 10px; align-items: baseline; margin: 16px 0; }
input[type=checkbox] { width: 20px; height: 20px; flex-shrink: 0; }
button { cursor: pointer; border: 0; padding: 12px 20px; border-radius: 4px; background: var(--water); color: white; font-weight: 700; }
button:hover { background: var(--deep); }
.secondary { background: white; color: var(--water); border: 1px solid var(--water); }
.secondary:hover { color: white; }
.danger { background: #a82d22; }
.clear-form { margin-top: 32px; border-top: 1px solid var(--line); }
.notice { padding: 14px 18px; background: #fff3d3; border-left: 5px solid #a56800; }
[data-attention] { scroll-margin-top: 16px; }
.error { background: #ffebe8; border-color: #a82d22; }
.success { background: #e1f4e6; border-color: #347b3d; }
button:disabled { opacity: .5; cursor: not-allowed; }
.quarterfinal-order { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 2px solid var(--line); }
.knockout-time { border-top: 1px solid var(--line); padding: 16px 0; }
.knockout-pools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.knockout-pool { min-width: 0; overflow-wrap: anywhere; }
.knockout-pool + .knockout-pool { border-left: 1px solid var(--line); padding-left: 16px; }
.knockout-pool h4 { margin: 0; }
.knockout-pool .referee-inputs { grid-template-columns: 1fr; }
@media screen and (max-width: 700px) {
    .knockout-pools { gap: 8px; font-size: 13px; }
    .knockout-pool + .knockout-pool { padding-left: 8px; }
}
.quarterfinal-list { list-style: none; padding: 0; }
.quarterfinal-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.quarterfinal-list li > div:first-of-type { flex: 1; min-width: 0; }
.quarterfinal-list .drag-handle { cursor: grab; touch-action: none; user-select: none; padding: 10px; }
.quarterfinal-list .is-dragging { background: var(--pool); outline: 2px solid var(--water); }
.order-buttons { display: flex; flex-direction: column; gap: 6px; }
.order-buttons button { padding: 6px 10px; }
footer { background: var(--deep); color: white; padding: 20px; text-align: center; }
[hidden] { display: none !important; }
@media screen and (min-width: 701px) and (max-width: 1100px) {
    .schedule-liste { --list-columns: 64px minmax(0, 1fr) 44px; }
    .schedule-liste .list-columns > :last-child { display: none; }
    .schedule-liste .refs { grid-column: 2 / -1; grid-row: 2; }
    .schedule-liste .referee-label { display: inline; }
}
@media screen and (max-width: 700px) {
    .admin-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex-basis: 100%; }
    .admin-menu a { padding: 8px; font-size: 14px; overflow-wrap: anywhere; }
    header { align-items: start; flex-direction: column; padding: 16px 20px; gap: 12px; }
    .lane-head { display: none; }
    .slot { grid-template-columns: 1fr; gap: 8px; padding: 16px 0; }
    .slot h3 { font-size: 20px; }
    .mobile-pool { display: block; font-size: 13px; margin: 4px 0; }
    .pause { grid-column: auto; }
    .score-inputs { grid-template-columns: 1fr; }
    .referee-inputs { grid-template-columns: 1fr; }
    .schedule-liste { --list-columns: 64px minmax(0, 1fr) 44px; }
    .schedule-liste .slot { grid-template-columns: 1fr; gap: 6px; padding: 8px 0; }
    .schedule-liste .slot h3 { grid-column: 1; grid-row: auto; font-size: 16px; }
    .schedule-liste .lane, .schedule-liste .pause { grid-column: 1; }
    .schedule-liste .list-pool { display: block; grid-column: 1 / -1; grid-row: 1; font-size: 12px; font-weight: 700; }
    .schedule-liste .match-meta, .schedule-liste .pairing > div,
    .schedule-liste .pairing > .score { grid-row: 2; }
    .schedule-liste .refs { grid-column: 2 / -1; grid-row: 3; }
    .schedule-liste .referee-label { display: inline; }
    .entry { padding: 16px; }
    th, td { padding: 8px; }
}
@media print {
    .admin-toolbar { display: none !important; }
    body:has(.referee-overview-form) > :not(main),
    body:has(.referee-overview-form) main > :not(.referee-overview-form),
    .referee-overview-form button, .referee-overview-form details,
    .referee-overview-form tr > :nth-child(n+3) { display: none !important; }
    .referee-overview-form input { padding: 0; min-height: 0; border: 0; font-weight: 700; }
    body:has(.referee-overview-form) { background: white; }
    body:has(.schedule) { background: white; color: black; }
    body:has(.schedule) > :not(main),
    body:has(.schedule) main > :not(.schedule),
    .schedule .match > a,
    .schedule .print-hide,
    .schedule .match-details { display: none !important; }
    body:has(.schedule) main > .test-mode-notice,
    body:has(.referee-overview-form) main > .test-mode-notice { display: block !important; }
    .test-mode-notice a { display: none; }
    .schedule .print-mode { display: block; }
    .schedule .handwritten-score { visibility: hidden; }
    body:has(.schedule) main { max-width: none; margin: 0; padding: 0; }
    .schedule .lane-head { break-after: avoid; }
    .schedule .slot { break-inside: avoid; }
    .schedule .match { background: white; }
    .schedule-liste { --list-columns: 42px minmax(0, 1fr) 34px minmax(65px, .5fr); }
    .schedule-liste .match { font-size: 9px; padding: 4px; gap: 3px 4px; }
    .schedule-liste .list-columns { font-size: 8px; padding: 4px 4px 4px 8px; gap: 4px; background: white; color: black; border-bottom: 1px solid; }
    .schedule-liste .match-meta, .schedule-liste .refs { font-size: 8px; }
    .schedule-liste .match-meta b { font-size: 9px; }
    .schedule-liste .pairing > .score { font-size: 11px; }
    .schedule-liste .slot h3 { font-size: 10px; padding-top: 4px; }
    .schedule-liste .lane-head, .schedule-liste .slot { grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr); gap: 0 6px; }
}
