* { box-sizing: border-box; }
html { background: #e7e9ed; }
body { margin: 0; color: #000; font-family: Arial, Helvetica, sans-serif; }
[hidden] { display: none !important; }
.toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px max(16px, calc((100vw - 210mm)/2)); background: #253044; color: white; font-size: 14px; box-shadow: 0 2px 8px #0002; }
.toolbar-actions { display: flex; gap: 8px; }
.toolbar button { border: 1px solid #cbd5e1; border-radius: 5px; padding: 8px 12px; background: white; color: #172033; cursor: pointer; font: inherit; }
.toolbar button.primary { background: #1765d1; border-color: #1765d1; color: white; font-weight: bold; }
.toolbar button:focus-visible, input:focus-visible { outline: 2px solid #1765d1; outline-offset: 2px; }
.tabs { display: flex; gap: 4px; width: 210mm; margin: 18px auto 0; border-bottom: 1px solid #b7c3d5; }
.tabs button { border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; padding: 10px 18px; background: transparent; color: #35435a; cursor: pointer; font: 600 14px Arial, sans-serif; }
.tabs button[aria-selected="true"] { border-color: #b7c3d5; background: white; color: #173d76; }
.tabs button:focus-visible { outline: 2px solid #1765d1; outline-offset: 2px; }
.sheet { width: 210mm; min-height: 297mm; margin: 18px auto; padding: 5mm 19mm 8mm 18mm; background: #fff; box-shadow: 0 3px 20px #0003; font-size: 10pt; line-height: 1.08; }
p { margin: 0; }
.warning { text-align: center; font-family: "Times New Roman", serif; font-size: 12pt; font-style: italic; white-space: nowrap; }
.form-header { position: relative; height: 25mm; display: flex; align-items: center; justify-content: center; margin-top: 3mm; }
.logo { position: absolute; left: 1mm; top: 1mm; width: 21mm; height: 21mm; object-fit: contain; }
.form-title { padding-left: 18mm; text-align: center; font-weight: bold; }
.form-title h1 { margin: 0 0 1mm; font-size: 15pt; letter-spacing: 1px; line-height: 1; }
.form-title p { font-size: 11pt; line-height: 1.02; }
.legal-intro { font-size: 9pt; text-align: justify; line-height: 1.05; }
input { color: #000; font-family: inherit; }
.disciplines { display: flex; justify-content: flex-end; align-items: center; gap: 7mm; height: 9mm; white-space: nowrap; font-size: 11pt; }
.disciplines label { display: flex; align-items: center; gap: 3mm; }
.disciplines input { appearance: none; width: 7.5mm; height: 5mm; margin: 0; border: 1px solid #aaa; border-radius: 0; background: #fff; cursor: pointer; }
.disciplines input:checked::after { content: "✕"; display: block; font-size: 14pt; font-weight: bold; line-height: 4mm; text-align: center; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 6mm; }
.field-row label { display: flex; align-items: center; gap: 3mm; white-space: nowrap; }
.field-row input, .name-row input { height: 7.2mm; border: 1px solid #aaa; border-radius: 0; background: white; padding: 0 1mm; font-size: 10pt; }
.license-row { margin-top: 2mm; }
.license-row label:first-child input { width: 45mm; }
.license-row label:last-child input { width: 40mm; }
.identity-row { margin-top: 3mm; }
.pesel-field { display: flex; align-items: center; gap: 2mm; }
.spaced-label { white-space: nowrap; }
.pesel-boxes { display: flex; }
.pesel-boxes input { width: 5mm; height: 7.2mm; border: 1px solid #aaa; border-right: 0; padding: 0; text-align: center; font-size: 10pt; }
.pesel-boxes input:last-child { border-right: 1px solid #aaa; }
.phone-field input { width: 55mm; }
.name-row { display: flex; align-items: center; gap: 8mm; margin-top: 3.5mm; white-space: nowrap; }
.name-row input { flex: 1; min-width: 0; }
.declaration { margin-top: 5mm; font-size: 11pt; line-height: 1.04; }
.year-row { display: flex; justify-content: center; align-items: baseline; gap: 3mm; height: 7mm; margin-top: 1mm; font-size: 10pt; font-weight: bold; }
.year-row input { width: 12mm; border: 0; padding: 0; text-align: center; font-size: inherit; font-weight: inherit; }
.year-row input::placeholder { color: #000; opacity: 1; }
.competitions { width: 100%; border: 2px solid #000; border-collapse: collapse; table-layout: fixed; }
.competitions th, .competitions td { border: 1px solid #000; padding: 0; }
.competitions th { height: 14.5mm; font-size: 7pt; font-style: italic; font-weight: normal; text-align: center; vertical-align: middle; }
.competitions th.vertical { position: relative; }
.competitions th.vertical span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.competitions td { height: 10.2mm; }
.competitions tr:nth-child(4), .competitions tr:nth-child(6) { border-bottom: 2px solid #000; }
.competitions td:first-child { padding-left: 3.5mm; font-size: 10pt; }
.competitions td input[type="text"] { display: block; width: 100%; height: 9.5mm; border: 0; padding: 0 1mm; background: transparent; font-size: 9pt; }
.competitions td input[type="checkbox"] { display: block; width: 100%; height: 9mm; margin: 0; appearance: none; cursor: pointer; }
.competitions td input[type="checkbox"]:checked::after { content: "X"; display: block; font-size: 11pt; font-weight: bold; line-height: 9mm; text-align: center; }
.col-no { width: 6%; } .col-name { width: 32.8%; } .col-date { width: 11.8%; } .col-place { width: 13.2%; }
.col-discipline { width: 3.5%; } .col-calendar { width: 10.7%; } .col-notes { width: 15%; }
.closing { margin-top: 2mm; font-size: 10.8pt; line-height: 1.08; }
.signature-row { display: flex; justify-content: space-between; margin-top: 3mm; }
.signature-row label { width: 48mm; display: flex; flex-direction: column; align-items: center; }
.signature-row label:last-child { width: 62mm; }
.signature-row input { width: 100%; height: 4mm; border: 0; border-bottom: 1px dotted #555; border-radius: 0; background: transparent; text-align: center; font-size: 9pt; }
.signature-row span { margin-top: .5mm; font-size: 7pt; font-style: italic; }
.club-section { margin-top: 2.5mm; border-top: 1px solid #000; padding-top: 5mm; }
.club-section h2 { margin: 0 0 4mm; font-size: 11pt; }
.club-section p { font-size: 9.5pt; line-height: 1.05; }
.club-signatures { margin-top: 9mm; }
.results-panel { width: 210mm; min-height: 180mm; margin: 18px auto; padding: 25px 30px 35px; background: white; box-shadow: 0 3px 20px #0003; font-size: 14px; line-height: 1.45; }
.results-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.results-heading h2 { margin: 0 0 7px; font-size: 24px; }
.results-heading p { color: #475569; }
.results-count { flex: none; border-radius: 20px; padding: 5px 11px; background: #eaf1fc; color: #173d76; font-weight: 600; }
.search-label { display: block; margin-bottom: 6px; font-weight: bold; }
#results-search { display: block; width: 100%; max-width: 450px; border: 1px solid #9aa9bc; border-radius: 5px; padding: 11px 12px; background: #fff; font-size: 16px; }
.results-hint { margin-top: 9px; color: #526176; }
.results-message { min-height: 20px; margin: 20px 0 12px; color: #35435a; font-weight: 600; }
.results-list { display: grid; gap: 12px; }
.result-card { border: 1px solid #cbd5e1; border-radius: 7px; padding: 15px 17px; }
.result-card h3 { margin: 0; font-size: 17px; }
.result-card .result-meta { margin: 4px 0 10px; color: #475569; }
.result-card .result-details { margin: 8px 0; }
.result-card .result-details strong { color: #173d76; }
.result-card ul { margin: 5px 0 13px; padding-left: 20px; }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.result-actions a { color: #1759b1; }
.result-actions button { border: 1px solid #1765d1; border-radius: 5px; padding: 7px 10px; background: #fff; color: #1759b1; cursor: pointer; font: inherit; }
.result-actions button:hover { background: #edf4ff; }
.result-actions button:focus-visible { outline: 2px solid #1765d1; outline-offset: 2px; }
.result-actions .add-result-button { background: #1765d1; color: white; font-weight: bold; }
.result-actions .add-result-button:hover { background: #0f4ea9; }
.import-dialog { width: min(760px, calc(100vw - 28px)); max-height: min(90vh, 850px); overflow-y: auto; border: 0; border-radius: 10px; padding: 0; box-shadow: 0 18px 55px #0005; color: #172033; font: 14px/1.4 Arial, sans-serif; }
.import-dialog::backdrop { background: #172033a6; }
.import-dialog form { padding: 24px; }
.import-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.import-header h2 { margin: 0; font-size: 22px; }
.import-header .icon-button { border: 0; background: transparent; color: #475569; cursor: pointer; font-size: 26px; line-height: 1; }
.import-event { margin-top: 12px; font-weight: 600; }
.import-found { margin: 5px 0 18px; color: #526176; }
.import-dialog fieldset { min-width: 0; margin: 0 0 16px; border: 0; padding: 0; }
.import-dialog legend { margin-bottom: 8px; font-weight: bold; }
.import-table-wrap { max-height: 350px; overflow: auto; }
.import-table { width: 100%; border: 2px solid #172033; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.import-table th, .import-table td { border: 1px solid #172033; padding: 5px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-table th { background: #f2f5f9; font-size: 11px; font-weight: 600; text-align: center; }
.import-table td { height: 36px; }
.import-table th:nth-child(1) { width: 34px; }
.import-table th:nth-child(2) { width: auto; }
.import-table th:nth-child(3) { width: 83px; }
.import-table th:nth-child(4) { width: 76px; }
.import-table th:nth-child(n+5) { width: 27px; }
.import-table td:nth-child(1), .import-table td:nth-child(n+5) { text-align: center; }
.import-table td:nth-child(2) { padding: 0; }
.import-table td:nth-child(2) select { display: block; width: 100%; min-width: 0; height: 35px; border: 0; padding: 0 4px; background: transparent; color: #172033; font: inherit; cursor: pointer; }
.import-table td:nth-child(2) select:focus-visible { outline: 2px solid #1765d1; outline-offset: -2px; }
.import-table input { width: 17px; height: 17px; margin: 0; accent-color: #1765d1; cursor: pointer; }
.import-table tbody tr:hover { background: #f2f6fc; }
.import-table tbody tr.selected { background: #eaf2ff; }
.import-table tbody tr.occupied td:nth-child(2) { color: #475569; }
.import-table tbody tr.section-end td { border-bottom: 3px solid #172033; }
.import-selection-count { margin: 4px 0 8px; font-weight: bold; color: #173d76; }
.import-error { min-height: 20px; margin: 0 0 10px; color: #ae2a20; font-weight: bold; }
.import-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.import-actions button { border: 1px solid #a6b3c4; border-radius: 5px; padding: 9px 12px; background: white; color: #172033; cursor: pointer; font: inherit; }
.import-actions button.primary { border-color: #1765d1; background: #1765d1; color: white; font-weight: bold; }
.import-actions button:focus-visible, .icon-button:focus-visible { outline: 2px solid #1765d1; outline-offset: 2px; }
@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { margin: 0; background: white; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .toolbar, .tabs, .results-panel, .import-dialog { display: none !important; }
  .sheet, .sheet[hidden] { display: block !important; width: 210mm; height: 297mm; min-height: 0; margin: 0; box-shadow: none; overflow: hidden; }
  input { outline: none !important; }
}
@media screen and (max-width: 820px) {
  body { overflow-x: auto; }
  .toolbar { min-width: 210mm; }
  .tabs, .sheet, .results-panel { margin-left: 0; margin-right: 0; }
}
@media screen and (max-width: 600px) {
  .import-dialog form { padding: 16px; }
  .import-table { min-width: 650px; }
}
