:root {
  color-scheme: light;
  --navy: #102a43;
  --blue: #0967d2;
  --muted: #53667b;
  --line: #dce3eb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.print-only { display: none; }
body { margin: 0; color: var(--navy); background: #f4f7fb; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
a { color: var(--blue); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 76px; padding: 16px max(24px, calc((100vw - 1440px) / 2)); background: var(--navy); color: white; }
.brand { color: inherit; text-decoration: none; font-size: 19px; font-weight: 800; }
.brand span { display: block; margin-top: 3px; color: #b4c9dc; font-size: 12px; font-weight: 500; }
.back-link { color: white; font-size: 13px; text-underline-offset: 4px; }
main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 48px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 22px; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.toolbar-intro h2 { margin: 0 0 7px; font-size: 25px; letter-spacing: -.035em; }
.toolbar-intro { max-width: 650px; }
.toolbar-intro p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.toolbar-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.toolbar-intro { flex-basis: 100%; }
.meet-picker { display: grid; grid-template-columns: .85fr 1.1fr 1.7fr; gap: 14px; width: 100%; }
.meet-picker select, .meet-picker input { width: 100%; max-width: none; min-width: 0; }
.meet-picker input { min-height: 43px; border: 1px solid #c6d2df; border-radius: 8px; padding: 10px 12px; color: var(--navy); background: white; font-size: 13px; }
.meet-picker-status { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.day-field { display: grid; gap: 6px; font-size: 12px; font-weight: 700; }
select { max-width: 235px; min-height: 43px; border: 1px solid #c6d2df; border-radius: 8px; padding: 10px 30px 10px 12px; background: white; color: var(--navy); font-size: 13px; }
.button { display: inline-block; padding: 12px 17px; min-height: 43px; border: 0; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 750; }
.button-primary { color: white; background: var(--blue); }
.button-primary:hover { background: #0756b1; }
.button-secondary { margin-top: 12px; color: var(--navy); background: #e8eef5; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid #63adff; outline-offset: 3px; }
.print-tip { flex-basis: 100%; margin: -7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.state-card { margin: 0; padding: 30px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.state-card h2 { margin: 0 0 8px; font-size: 20px; }
.state-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.sheet { padding: 28px; background: white; border: 1px solid var(--line); box-shadow: 0 8px 30px #102a4309; }
.sheet-heading { display: flex; justify-content: space-between; align-items: start; gap: 24px; padding-bottom: 17px; }
.eyebrow { margin: 0 0 8px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 800; }
.sheet-heading h2 { margin: 0 0 8px; font-size: 25px; line-height: 1.2; letter-spacing: -.025em; }
.meet-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 12px; line-height: 1.5; }
#meetDetails { color: var(--muted); }
.sheet-summary { display: grid; gap: 4px; flex-shrink: 0; text-align: right; font-size: 12px; line-height: 1.5; }
.coach-line { margin-top: 10px; }
.source-note { margin: 0 0 18px; padding: 11px 13px; border: 1px solid var(--line); border-left: 3px solid #89a8c5; color: #415670; font-size: 11px; line-height: 1.5; }
.source-note p { margin: 0; }
.source-note ul { margin: 4px 0 0; padding-left: 17px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 1030px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.col-event { width: 16%; }
.col-swimmer { width: 20%; }
.col-heat { width: 6%; }
.col-time { width: 8%; }
.col-pace { width: 31%; }
.col-notes { width: 19%; }
th { padding: 10px 8px; background: #edf2f7; color: var(--navy); text-align: left; font-size: 11px; font-weight: 750; border: 1px solid #becad7; }
td { height: 64px; padding: 7px 8px; border: 1px solid #becad7; vertical-align: middle; overflow-wrap: anywhere; }
tbody + tbody tr:first-child td { border-top: 2px solid #8295a8; }
.event-title, .swimmer-name { display: block; font-weight: 700; line-height: 1.4; }
.row-detail { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.timing, .heat-lane { text-align: center; font-variant-numeric: tabular-nums; }
.heat-lane span { display: block; line-height: 1.6; white-space: nowrap; }
.writing-cell { padding: 0 8px; }
.writing-lines { display: flex; flex-direction: column; justify-content: space-evenly; height: 56px; }
.writing-lines span { display: block; height: 14px; border-bottom: 1px solid #d3dae1; }
.empty-message { margin: 22px 0; color: var(--muted); font-size: 14px; }
.sheet-footer { margin-top: 13px; color: var(--muted); font-size: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  .topbar { padding: 15px 18px; }
  main { width: calc(100% - 28px); padding-top: 22px; }
  .toolbar-intro h2 { font-size: 23px; }
  .meet-picker { grid-template-columns: 1fr; }
  .toolbar-actions { flex-wrap: wrap; }
  .sheet { padding: 17px; }
  .sheet-heading { flex-direction: column; gap: 14px; }
  .sheet-summary { text-align: left; }
  .sheet-heading h2 { font-size: 22px; }
}
@page { size: A4 portrait; margin: 10mm; }
@media print {
  body { background: white; color: black; }
  .screen-only { display: none !important; }
  tr.print-only { display: table-row; }
  main { width: 100%; margin: 0; padding: 0; }
  .sheet { padding: 0; border: 0; box-shadow: none; }
  .sheet-heading { flex-direction: row; gap: 4mm; padding-bottom: 3mm; break-inside: avoid; }
  .eyebrow { margin-bottom: 2mm; font-size: 7pt; }
  .sheet-heading h2 { font-size: 14pt; margin-bottom: 2mm; }
  .meet-meta, .sheet-summary { font-size: 8pt; }
  .sheet-summary { text-align: right; }
  #meetDetails, .row-detail, .source-note, .sheet-footer { color: #333; }
  .coach-line { margin-top: 2mm; }
  .source-note { margin-bottom: 3mm; padding: 2mm 3mm; border: 1px solid #999; font-size: 7.5pt; break-inside: avoid; }
  .table-scroll { overflow: visible; }
  table { min-width: 0; width: 100%; font-size: 8.5pt; }
  .col-event { width: 18%; }
  .col-swimmer { width: 23%; }
  .col-heat { width: 7%; }
  .col-time { width: 9%; }
  .col-pace { width: 27%; }
  .col-notes { width: 16%; }
  thead { display: table-header-group; }
  tbody { break-inside: auto; }
  tr { break-inside: avoid; page-break-inside: avoid; }
  th { padding: 2mm 1.3mm; background: white; color: black; border-color: #777; font-size: 8pt; }
  .print-context { padding-top: 1.5mm; padding-bottom: 1.5mm; font-size: 7.5pt; font-weight: 600; }
  td { height: 18mm; padding: 1.5mm 1.3mm; border-color: #999; }
  tbody + tbody tr:first-child td { border-top-color: #555; }
  .row-detail { font-size: 7pt; }
  .writing-cell { padding: 0 1.5mm; }
  .writing-lines { height: 16mm; }
  .writing-lines span { height: 4mm; border-color: #bbb; }
  .sheet-footer { margin-top: 3mm; font-size: 7pt; }
}
