/* Seiten-Styles der App; Farben und Kopfleiste stehen in theme.css (auch für die Datenpflege). */
:root {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--green-dark); }
h1 { font-size: 1.6rem; margin: 1.2rem 0 .6rem; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* Meldungen */
.messages { margin-top: 1rem; }
.msg { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; border: 1px solid transparent; }
.msg-success { background: var(--green-light); border-color: #b9dcc7; }
.msg-error { background: var(--red-light); border-color: #efc2bf; }
.msg-warning { background: var(--yellow-light); border-color: #f0dc9c; }
.msg-info { background: var(--blue-light); border-color: #c4d6f2; }

/* Karten & Boxen */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.hero { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-top: 1.2rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 1rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.stats { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; min-width: 120px; }
.stat b { display: block; font-size: 1.4rem; }
.stat span { color: var(--muted); font-size: .85rem; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 999px; padding: .1rem .55rem; background: var(--green-light); color: var(--green-dark); vertical-align: middle; }
.badge-warn { background: var(--yellow-light); color: #8a6100; }
.badge-error { background: var(--red-light); color: var(--red); }
.badge-muted { background: #eef0ef; color: var(--muted); }
.badge-ac { background: var(--green); color: #fff; }

/* Buttons */
/* nur Klassen-Selektoren (kein button.btn), sonst überstimmt die Element-Spezifität .btn-secondary/.btn-danger */
.btn { display: inline-block; border: 1px solid var(--green); background: var(--green); color: #fff; border-radius: var(--radius); padding: .5rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--green-dark); }
.btn-secondary { background: #fff; color: var(--green-dark); }
.btn-secondary:hover { background: var(--green-light); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #9e2d26; }
.btn-small { padding: .25rem .6rem; font-size: .85rem; font-weight: 500; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }

/* Formulare */
label { font-weight: 600; display: block; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], select {
  width: 100%; padding: .45rem .55rem; border: 1px solid #b9c2bc; border-radius: 6px; font: inherit; background: #fff;
}
input:focus, select:focus { outline: 2px solid #8fc7a7; border-color: var(--green); }
.field { margin-bottom: .9rem; }
.helptext, .field .help { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.errorlist { list-style: none; padding: 0; margin: .25rem 0; color: var(--red); font-size: .875rem; }
.has-error input, .has-error select { border-color: var(--red); background: #fffafa; }
.form-row { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfa; }
tr.deleted td { opacity: .45; text-decoration: line-through; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap table { border: 0; }

/* Teammitglieder-Eingabe */
.members td { padding: .3rem .3rem; }
.members .col-nr { width: 2rem; color: var(--muted); text-align: center; padding-top: .7rem; }
.members .col-year { width: 6.5rem; }
.members .col-gender { width: 8rem; }
.members .col-del { width: 4.5rem; text-align: center; padding-top: .7rem; }
.members tr.row-error td { background: #fff7f6; }
@media (max-width: 760px) {
  .members thead { display: none; }
  .members, .members tbody, .members tr, .members td { display: block; width: 100% !important; }
  .members tr { border-bottom: 2px solid var(--line); padding: .5rem 0; }
  .members td { border: 0; }
  .members td::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted); }
  .members .col-nr { text-align: left; font-weight: 700; }
}

/* Team-Karten auf "Meine Meldungen" */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.team-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; }
.team-card h3 { margin: 0 0 .3rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.team-card ol { margin: .4rem 0 .6rem; padding-left: 1.3rem; }
.team-card .actions { margin: auto 0 0; }

.empty { color: var(--muted); font-style: italic; }

@media print {
  .topbar, .footer, .actions, .messages { display: none; }
  body, :root { background: #fff; }
  .card, .team-card { break-inside: avoid; }
}

/* Wettkampfvorbereitung */
.tabs { display: flex; gap: .25rem; margin-top: 1rem; border-bottom: 2px solid var(--line); }
.tabs a { padding: .4rem .9rem; text-decoration: none; border-radius: 6px 6px 0 0; color: var(--muted); font-weight: 600; }
.tabs a.active { background: var(--green); color: #fff; }
.tabs a:not(.active):hover { background: var(--green-light); }
.tab-count { display: inline-block; min-width: 1.6em; font-size: .75rem; font-weight: 600; padding: 0 .35rem; margin-left: .2rem; border-radius: 999px; background: rgba(0,0,0,.08); text-align: center; }
.tabs a.active .tab-count { background: rgba(255,255,255,.25); }
.tabs + h2, .tabs + section { margin-top: 1rem; }
.checklist > div { padding: .35rem 0 .35rem 1.6rem; position: relative; }
.checklist > div::before { position: absolute; left: 0; font-weight: 700; }
.checklist .done::before { content: "✓"; color: var(--green); }
.checklist .todo::before { content: "○"; color: var(--orange); }
.squad-chip { display: inline-block; border-left: 6px solid var(--sq); background: var(--sq-light); border-radius: 4px; padding: .05rem .5rem; font-size: .85rem; margin: .1rem 0; }
.squad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.squad-card { background: var(--sq-light); border: 1px solid var(--line); border-top: 8px solid var(--sq); border-radius: var(--radius); padding: .6rem .9rem; }
.squad-card h3 { margin: 0 0 .2rem; }
.squad-kids { font-size: 1.6rem; font-weight: 700; }
.squad-kids span { font-size: .85rem; font-weight: 400; color: var(--muted); }
.squad-row td { background: var(--sq-light, #fff); }
tr.team-start td { border-top: 2px solid #b9c2bc; }
.sn-input { max-width: 7rem; }
.print-squad { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin: 1rem 0; overflow: hidden; }
.print-squad-head { display: flex; justify-content: space-between; align-items: baseline; background: var(--sq, #555); color: #fff; padding: .5rem 1rem; font-size: 1.3rem; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.print-sub { padding: .3rem 1rem 0; }
.print-table { margin: .3rem 0 .6rem; }
.print-table td, .print-table th { padding: .2rem 1rem; }
.print-team .team-head td { background: var(--sq-light, #eee); font-weight: 700; border-top: 1px solid #999; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .noprint, .tabs { display: none; }
  .print-squad { border: 0; margin: 0; }
  .print-squad + .print-squad { break-before: page; }
  .print-team { break-inside: avoid; }
}

/* Wertungsbögen */
.sheet-filter > div { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; margin-bottom: .6rem; }
.sheet-filter label { font-weight: 400; display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
.sheet { background: #fff; border: 1px solid var(--line); max-width: 210mm; margin: 1.5rem auto; padding: 10mm 12mm; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; border-left: 14px solid var(--sq); background: var(--sq-light); padding: .5rem .9rem; }
.sheet-title { font-size: 1.6rem; font-weight: 800; }
.sheet-meta { text-align: right; font-size: 1.2rem; font-weight: 700; }
.sheet-meta span { font-size: .85rem; font-weight: 400; }
.sheet-sub { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin: .3rem 0; }
.sheet-copy { font-weight: 700; color: var(--text); border: 1.5px solid var(--text); padding: 0 .4rem; }
.sheet-notes { font-size: .78rem; margin: .3rem 0 .5rem; color: #333; }
.sheet-table { border: 1.5px solid #333; font-size: .9rem; }
.sheet-table th { background: #f0f0f0; color: #222; font-size: .72rem; text-align: center; border: 1px solid #555; padding: .25rem; }
.sheet-table td { border: 1px solid #777; height: 8.5mm; padding: .1rem .35rem; vertical-align: middle; }
.sheet-table .num { text-align: center; white-space: nowrap; }
.sheet-table .name { font-weight: 600; }
.sheet-table .w-s { width: 11mm; }
.sheet-table .w-att { width: 13mm; }
.sheet-table .w-box { width: 24mm; }
.sheet-table tr.group-start td { border-top: 2.5px solid #333; }
.sheet-table .team-row td { background: var(--sq-light); font-weight: 700; height: auto; padding: .2rem .35rem; border-top: 2px solid #333; }
.sheet.dense .sheet-table td { height: 7.6mm; }
.sheet.dense2 .sheet-table td { height: 6.3mm; font-size: .84rem; }
.sheet.dense2 .sheet-notes, .sheet.dense3 .sheet-notes { font-size: .7rem; margin: .15rem 0 .3rem; }
.sheet.dense3 .sheet-table td { height: 5.5mm; font-size: .8rem; padding-top: 0; padding-bottom: 0; }
.sheet.dense3 .sheet-head { padding: .3rem .9rem; }
.sheet.dense3 .sheet-title { font-size: 1.3rem; }
.sheet.dense3 .sheet-foot { margin-top: .6rem; }
.sheet-foot { display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; margin-top: 1.2rem; }
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  .sheet { border: 0; margin: 0; padding: 0; max-width: none; }
  .sheet + .sheet { break-before: page; }
  .team-block { break-inside: avoid; }
}

/* Meldegeld */
.print-only { display: none; }
.fees-table tfoot th { background: #eef3ef; color: var(--text); font-size: .9rem; text-transform: none; letter-spacing: 0; border-top: 2px solid #999; }
.right-float { float: right; }
.checkbox-box { display: inline-block; width: 4mm; height: 4mm; border: 1px solid #333; }
@media print {
  .print-only { display: table-cell; }
  p.print-only { display: block; }
  .page-break-before { break-before: page; }
  .table-wrap { overflow: visible; border: 0; }
  .fees-table, .fee-club table { font-size: .82rem; }
  .fees-table th, .fees-table td { padding: .25rem .35rem; }
  .fees-table td:first-child { min-width: 45mm; }
  .badge { border: 1px solid #999; }
  .fee-club { break-inside: avoid; border: 0; border-bottom: 1px solid #999; border-radius: 0; padding: .4rem 0; }
  .fee-sign { margin-top: .6rem; }
  a { color: inherit; text-decoration: none; }
}

/* Ergebniserfassung (mobil zuerst) */
.station-card h2 { margin-bottom: .5rem; }
.squad-buttons { display: flex; flex-wrap: wrap; gap: .6rem; }
.squad-button { flex: 1 1 8rem; display: flex; flex-direction: column; align-items: center; padding: .8rem .5rem; border-radius: var(--radius); background: var(--sq-light); border: 2px solid var(--sq); color: var(--text); text-decoration: none; font-weight: 700; }
.squad-button .sb-progress { font-weight: 400; font-size: .9rem; }
.squad-button.done { background: var(--sq); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.entry-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem; margin: .8rem -1rem 0; padding: .5rem 1rem; background: var(--sq-light); border-bottom: 4px solid var(--sq); }
.entry-back { font-size: 2rem; line-height: 1; text-decoration: none; color: var(--text); padding: 0 .3rem; }
.entry-title { flex: 1; display: flex; flex-direction: column; }
.entry-title b { font-size: 1.1rem; }
.entry-title span { font-size: .85rem; color: var(--muted); }
.entry-progress { font-weight: 800; font-size: 1.2rem; background: #fff; border: 2px solid var(--sq); border-radius: 999px; padding: .1rem .7rem; }
.entry-hint { margin: .4rem 0 .6rem; }
.entry-group { font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: .9rem 0 .3rem; }
.entry-row { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); padding: .45rem .6rem; margin-bottom: .45rem; }
.entry-row.complete { border-left-color: var(--green); }
.entry-row.error, .entry-row.offline { border-left-color: var(--red); background: #fff7f6; }
.entry-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; margin-bottom: .3rem; }
.entry-stnr { font-weight: 700; min-width: 2.2rem; }
.entry-name { font-weight: 600; }
.entry-extra { font-size: .8rem; color: var(--muted); }
.entry-fields { display: grid; gap: .35rem; align-items: end; }
.entry-fields.fields-1 { grid-template-columns: 1fr 5.5rem; }
.entry-fields.fields-2 { grid-template-columns: 1fr 1fr 5.5rem; }
.entry-fields.fields-4 { grid-template-columns: repeat(4, 1fr) 4.5rem; }
.entry-field { margin: 0; font-weight: 400; }
.entry-field span { display: block; font-size: .7rem; color: var(--muted); text-align: center; }
.entry-field input { text-align: center; font-size: 1.15rem; padding: .45rem .2rem; }
.entry-field.has-error input { border-color: var(--red); background: #fff0ef; }
.entry-score { display: flex; justify-content: flex-end; align-items: center; gap: .3rem; font-weight: 700; min-height: 2.6rem; white-space: nowrap; }
.entry-score .status { width: 1.1rem; text-align: center; color: var(--green); }
.entry-row.error .status, .entry-row.offline .status { color: var(--red); }
.entry-row.saving .status { color: var(--muted); }
.entry-error { color: var(--red); font-size: .8rem; }
.entry-error:empty { display: none; }
.entry-actions { flex-wrap: wrap; }
@media (min-width: 760px) {
  .entry-row { display: grid; grid-template-columns: 16rem 1fr; gap: .8rem; align-items: center; }
  .entry-who { margin: 0; }
  .entry-error { grid-column: 2; }
}

/* Kompakte Kopfzeile auf dem Handy */
@media (max-width: 640px) {
  .entry-head { margin-top: .4rem; }
  .entry-row { padding: .35rem .5rem; margin-bottom: .35rem; }
  .entry-who { margin-bottom: .15rem; }
  .entry-field input { padding: .35rem .2rem; font-size: 1.1rem; }
  .entry-hint { font-size: .78rem; }
}

/* Auswertung */
.center { text-align: center; }
.eval-table td.place { font-size: 1.1rem; font-weight: 800; width: 3.5rem; }
.eval-table td.total { background: #f3f7f4; font-size: 1.1rem; }
.eval-table td.missing { background: var(--yellow-light); }
.eval-table tr.incomplete td.place { color: var(--muted); }
.squad-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--sq); vertical-align: middle; }
@media print {
  .eval-class { break-inside: avoid; border: 0; padding: 0; }
  .eval-table { font-size: .8rem; }
  .eval-table th, .eval-table td { padding: .15rem .3rem; }
  .eval-table tr { break-inside: avoid; }
  .eval-table thead { display: table-header-group; }
}
