:root {
  --bg: #f4f6f5; --fg: #1d2521; --muted: #66706b; --card: #fff; --line: #dde3df;
  --brand: #d7141a; --brand-dark: #a30f14; --action: #1d3f9a; --action-dark: #152f75; --ok: #15803d; --danger: #b91c1c; --warn: #b45309;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }
main { max-width: 1400px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: .4em 0 .6em; }
h2 { font-size: 1.15rem; margin-top: 1.6em; }
a { color: var(--action); }
.muted { color: var(--muted); }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 10px 16px; background: var(--brand); color: #fff; }
.topbar a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 44px; width: auto; filter: drop-shadow(0 0 1px rgba(255,255,255,.9)); }
.login-logo { display: block; height: 140px; margin: 10px 0 18px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.topbar nav a { padding: 6px 10px; border-radius: 6px; }
.topbar nav a:hover, .topbar nav a.active { background: rgba(255,255,255,.18); }
.topbar .user { font-size: .9rem; }
.badge { background: #fbbf24; color: #1d2521; border-radius: 10px; padding: 0 7px; font-size: .8rem; font-weight: 700; }

.flash { padding: 10px 14px; border-radius: 8px; margin: 8px 0; background: #dcfce7; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; border-color: #fca5a5; }
.flash-warn { background: #fef3c7; border-color: #fcd34d; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; }
.narrow { max-width: 420px; }
label { display: block; margin-bottom: 10px; font-size: .9rem; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--fg); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #c5cdc8; border-radius: 6px; background: #fff; color: var(--fg); }
label input:not([type=checkbox]), label select, label textarea { display: block; width: 100%; margin-top: 3px; }
input.short { width: 80px; }
input[type=color] { padding: 2px; width: 48px; height: 34px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2 .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

button, .btn { display: inline-block; font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--action); background: var(--action); color: #fff; cursor: pointer; text-decoration: none; }
.btn { background: #fff; color: var(--action); }
.btn.active { background: var(--action); color: #fff; }
button.ok { background: var(--ok); border-color: var(--ok); }
button.danger { background: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }
.toolbar, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.row input { flex: 1; min-width: 200px; }
form.inline { display: inline; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; margin: 8px 0 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pending-swatch { background: repeating-linear-gradient(45deg, #999 0 3px, #fff 3px 6px); border: 1px solid #999; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--card); }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
thead th { background: #eef2ef; font-size: .9rem; }
table.list td input:not([type=checkbox]):not([type=color]) { width: 100%; }
tr.new td { background: #f7fbf8; }
tr.inactive td { color: var(--muted); }

table.week { min-width: 900px; table-layout: fixed; }
table.week th:first-child { width: 140px; }
table.week th.today { background: #d1fae5; }
table.week th.pitch small { display: block; font-weight: 400; color: var(--muted); }
table.week td { position: relative; padding: 4px 4px 22px; min-height: 60px; }
.slot { display: block; margin-bottom: 4px; padding: 4px 6px; border-radius: 5px; font-size: .8rem; text-decoration: none; color: #fff;
        background: var(--c); border-left: 4px solid rgba(0,0,0,.25); overflow-wrap: anywhere; }
.slot small { display: block; opacity: .9; }
.slot.pending { color: var(--fg); background: repeating-linear-gradient(45deg, #fff 0 6px, #f1f1f1 6px 12px); border: 1px dashed var(--c); border-left: 4px solid var(--c); }
.add { position: absolute; right: 4px; bottom: 2px; font-size: 1.1rem; text-decoration: none; color: var(--muted); opacity: .4; }
td:hover .add { opacity: 1; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .8rem; color: #fff; background: var(--c); }
.status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .8rem; font-weight: 600; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-cancelled { background: #e5e7eb; color: #374151; }

fieldset.series { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; }
.weekdays { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-bottom: 6px; }
.weekdays label.check { margin: 0; }

pre.log { white-space: pre-wrap; font-size: .82rem; background: #f6f8f7; border: 1px solid var(--line); border-radius: 6px; padding: 8px; max-height: 360px; overflow: auto; }

.slot .share { float: right; margin-left: 4px; padding: 0 5px; border-radius: 8px; background: rgba(255,255,255,.3); font-weight: 700; }
.slot.pending .share { background: rgba(0,0,0,.08); }

@media print {
  .topbar, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  table { font-size: 11px; }
  a { color: inherit; text-decoration: none; }
}

/* Farbe nach Altersstufe: Hintergrund = Altersstufe, linker Rand = Kategorie */
.slot { color: var(--t, #fff); border-left: 6px solid var(--k, rgba(0,0,0,.25)); }
.slot.pending { color: var(--fg); border-left: 6px solid var(--c); }
.chip { color: var(--t, #fff); }
.team-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.team-preview .chip { font-size: .85rem; padding: 3px 10px; }
.nowrap { white-space: nowrap; }

/* Hilfe-Bereich */
.help-list { display: grid; gap: 12px; }
.help-item { display: flex; gap: 16px; align-items: flex-start; margin: 0; }
.help-item h2 { margin: 0 0 4px; font-size: 1.1rem; }
.help-item p { margin: 4px 0; }
.help-icon { flex: none; width: 48px; height: 60px; border-radius: 4px; background: var(--brand); color: #fff; font-weight: 700; font-size: .8rem; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; }

/* Trainingsplaner */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 640px) { .grid3 { grid-template-columns: 1fr; } }
fieldset.series legend { font-size: .9rem; color: var(--muted); padding: 0 4px; }
/* Warmmachen vor dem Anpfiff */
.warmup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin-bottom: 12px; }
.warmup-grid label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; color: var(--fg); }
.warmup-input { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.warmup-grid label input[type=number] { width: 4.5em; margin: 0; display: inline-block; }
.slot .kickoff { display: block; font-size: .78em; font-weight: 600; opacity: .9; }

/* Saisonwechsel */
.season-table td { vertical-align: top; }
.season-table .sc-arrow { font-size: 1.3em; color: var(--muted); }
.sc-name { display: flex; gap: 6px; align-items: center; }
.sc-name input[name] { width: 9em; margin: 0; }
.btn.small { padding: 4px 9px; font-size: .85rem; }
.sc-carry label.check { margin: 0 0 2px; font-size: .9rem; }
.sc-carry input:disabled + * , .sc-carry label:has(input:disabled) { opacity: .45; }
.sc-state { display: inline-block; margin-top: 3px; font-weight: 600; }
tr.sc-keep .sc-state { color: var(--muted); font-weight: 400; }
tr.sc-new .sc-state { color: var(--action); }
tr.sc-merge .sc-state { color: #b45309; }
tr.sc-gone .sc-state, .danger-text { color: #b91c1c; font-weight: 600; }
tr.sc-gone .sc-name input { border-color: #fca5a5; background: #fef2f2; }
tr.sc-new .sc-name input { border-color: var(--action); }
tr.sc-merge .sc-name input { border-color: #f59e0b; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; box-shadow: 0 -2px 8px rgba(0,0,0,.08); }
#newTable input, #newTable select { margin: 0; min-width: 7em; }
.field-label { font-weight: 600; margin: 8px 0 4px; }
.weekday-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.weekday-picker label { margin: 0; cursor: pointer; }
.weekday-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.weekday-picker span { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 40px; padding: 0 10px;
  border: 2px solid #cbd5e1; border-radius: 999px; background: #fff; color: #475569; font-weight: 600; user-select: none;
  transition: background .15s, border-color .15s, color .15s; }
.weekday-picker label.we span { border-style: dashed; }
.weekday-picker label:hover span { border-color: var(--action); }
.weekday-picker input:checked + span { background: var(--action); border-color: var(--action); border-style: solid; color: #fff; }
.weekday-picker input:checked + span::before { content: "\2713"; margin-right: 5px; font-size: .9em; }
.weekday-picker input:focus-visible + span { outline: 3px solid rgba(29, 63, 154, .35); outline-offset: 2px; }
.day-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.day-tabs .count { font-size: .8em; opacity: .8; }
.planner { display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: start; }
@media (max-width: 800px) { .planner { grid-template-columns: 1fr; } }
.planner-teams { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.planner-teams h3 { margin: 0 0 4px; }
.team-chip { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 6px; margin: 5px 0; padding: 5px 8px; border-radius: 6px;
             background: var(--c); color: var(--t); cursor: grab; border: 2px solid transparent; font-size: .85rem; user-select: none; }
.team-chip small { grid-column: 1; opacity: .85; }
.team-chip .need { grid-row: 1 / span 2; grid-column: 2; font-weight: 700; background: rgba(255,255,255,.85); color: #1d2521; border-radius: 10px; padding: 1px 7px; font-size: .8rem; }
.team-chip.missing .need { background: #fde68a; }
.team-chip.over .need { background: #fecaca; }
.team-chip.selected { border-color: #111; box-shadow: 0 0 0 2px #fff inset; }
.planner-board-wrap { overflow-x: auto; }
.planner-board { display: flex; gap: 8px; min-width: max-content; padding-top: 4px; }
.pl-times { position: relative; width: 44px; margin-top: 30px; flex: none; font-size: .75rem; color: var(--muted); }
.pl-times div { position: absolute; transform: translateY(-50%); }
.pl-pitch { width: 220px; flex: none; }
.pl-head { height: 30px; font-weight: 700; font-size: .85rem; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pl-lanes { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; cursor: copy; }
.pl-lanes.over { outline: 2px dashed var(--action); }
.pl-lane { position: absolute; top: 0; bottom: 0; width: 25%; border-left: 1px dashed #e5e7eb; }
.pl-lane:first-child { border-left: 0; }
.pl-hour { position: absolute; left: 0; right: 0; border-top: 1px solid #eef0f3; }
.pl-slot { position: absolute; border-radius: 5px; background: var(--c); color: var(--t); padding: 2px 4px; font-size: .72rem; line-height: 1.2;
           overflow: hidden; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.pl-slot b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-slot small { display: block; opacity: .9; }
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 16px; max-width: 460px; width: 92vw; }
dialog::backdrop { background: rgba(0,0,0,.35); }
.print-only { display: none; }
@media print {
  .print-only { display: block; }
  .planner { display: block; }
  .planner-board-wrap { overflow: visible; }
  .pl-slot, .team-chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Spielplanung */
.gp-overview { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.gp-overview .btn { position: relative; }
.gp-overview .count { display: inline-block; min-width: 1.4em; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: rgba(0,0,0,.08); font-size: .8em; text-align: center; }
.gp-overview .gp-dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: #dc2626; }
.gp-daynav { align-items: center; }
.gp-daynav form.inline { display: inline; margin: 0; }
.gp-daynav input[type=date] { margin: 0; width: auto; }
.gp-dayname { margin: 0 6px; }
.gp-chip { position: relative; padding-right: 30px; }
.gp-chip .gp-edit { position: absolute; top: 4px; right: 4px; padding: 0 6px; min-height: 0; line-height: 1.5; font-size: .85rem;
  background: rgba(255,255,255,.85); color: #1e293b; border: 1px solid rgba(0,0,0,.15); border-radius: 6px; }
.gp-booked { position: absolute; overflow: hidden; box-sizing: border-box; padding: 2px 5px; border-radius: 5px; font-size: .75rem; line-height: 1.2;
  background: #e2e8f0; color: #334155; border-left: 4px solid var(--k, #94a3b8); text-decoration: none; opacity: .9; }
.gp-booked b, .gp-booked small, .gp-plan b, .gp-plan small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-booked.pending { background: repeating-linear-gradient(135deg, #e2e8f0 0 6px, #f8fafc 6px 12px); }
.gp-booked.overflow, .gp-plan.conflict { outline: 3px solid #dc2626; outline-offset: -1px; }
.gp-plan { border: 2px dashed rgba(0,0,0,.45); cursor: grab; }
.gp-plan.bump { outline: 3px solid #f59e0b; outline-offset: -1px; }
.gp-plan .gp-flag { font-weight: 700; background: rgba(255,255,255,.85); color: #b91c1c; border-radius: 3px; padding: 0 3px; width: max-content; max-width: 100%; }
.gp-plan.bump .gp-flag { color: #92400e; }
.gp-legend { margin-top: 14px; display: grid; gap: 4px; }
.gp-sw { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; border-radius: 3px; }
.gp-sw.plan { border: 2px dashed #475569; background: #fde68a; }
.gp-sw.booked { background: #e2e8f0; border-left: 4px solid #94a3b8; }
.gp-sw.conflict { outline: 3px solid #dc2626; outline-offset: -3px; background: #fff; }
.gp-sw.bump { outline: 3px solid #f59e0b; outline-offset: -3px; background: #fff; }

/* Trainingsplan-Vorschau (nur lesen) */
.preview-banner { background: #fef3c7; border: 1px solid #fcd34d; border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.trainer-view-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  background: #dbeafe; border: 1px solid #93c5fd; border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.warn-text { color: #b91c1c; }
.access-choice { border: 1px solid #d1d5db; border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.access-choice legend { font-weight: 600; padding: 0 4px; }
.access-choice label.check { margin: 4px 0; flex-wrap: wrap; }
.access-choice label.check input[type=radio] { width: auto; margin: 0; }
.access-choice .access-detail { margin: 4px 0 8px 26px; max-width: 420px; }
.access-choice .access-detail[hidden] { display: none; }
.planner.readonly .pl-slot { cursor: default; }
.planner.readonly .pl-slot.mine { outline: 3px solid #1d3f9a; outline-offset: -1px; z-index: 2; }
.planner.readonly.only-mine .pl-slot:not(.mine) { opacity: .25; }

/* Verlegungsanträge */
.move-wish { font-weight: 600; }
.planner.no-aside { grid-template-columns: 1fr; }
.move-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.move-actions input { margin: 0; min-width: 14em; }
.gp-chip { grid-template-columns: 1fr; }
.gp-chip .need { justify-self: start; margin-top: 3px; }
.gp-plan.overflow { opacity: .85; z-index: 3; }
.gp-chip .need { grid-column: 1; grid-row: auto; }
