:root {
  --blue: #0b4f8a;
  --blue-dark: #083a66;
  --blue-light: #e8f1fa;
  --ink: #1d2633;
  --muted: #5d6b7c;
  --line: #d8e0ea;
  --bg: #f4f7fb;
  --card: #ffffff;
  --green: #1b7a43;
  --green-bg: #e5f5eb;
  --amber: #8a5a00;
  --amber-bg: #fff4d6;
  --red: #b3261e;
  --red-bg: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 36, 64, .06), 0 4px 16px rgba(16, 36, 64, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--blue); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 .5rem; }
p { margin: .5rem 0; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 40px; }

/* Header */
.site-header { background: var(--blue); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: #fff; color: var(--blue); font-weight: 800; font-size: .8rem; letter-spacing: .04em; }
.brand-text { font-weight: 700; line-height: 1.15; }
.brand-text small { display: block; font-weight: 400; opacity: .85; font-size: .8rem; }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.admin-nav a, .admin-nav button { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 6px; font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer; }
.admin-nav a:hover, .admin-nav button:hover, .admin-nav a.is-active { background: rgba(255,255,255,.15); }
.admin-nav form { margin: 0; }

.site-footer { color: var(--muted); font-size: .85rem; padding-bottom: 24px; }

/* Cards & alerts */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.intro { margin-bottom: 16px; }
.alert { border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; border: 1px solid; }
.alert-error { background: var(--red-bg); border-color: #f3b8b3; color: var(--red); }
.alert-warn { background: var(--amber-bg); border-color: #f0d68c; color: var(--amber); }
.alert-info { background: var(--blue-light); border-color: #bcd5ee; color: var(--blue-dark); }
.alert p { margin: .25rem 0; }
.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; background: var(--blue-light); color: var(--blue-dark); }
.msg-success { background: var(--green-bg); color: var(--green); }
.msg-error { background: var(--red-bg); color: var(--red); }
.msg-warning { background: var(--amber-bg); color: var(--amber); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; }
.tab { flex: 1 1 0; text-align: center; padding: 12px 8px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.is-active { color: var(--blue); border-bottom-color: var(--blue); }
@media (min-width: 640px) { .tab { flex: 0 0 auto; padding: 12px 20px; } }

/* Forms */
.field { margin-bottom: 18px; }
.field > label, .field-label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number],
input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #b9c6d6; border-radius: 8px; background: #fff; color: var(--ink);
  min-height: 44px;
}
select:disabled { background: #eef2f6; color: var(--muted); }
input[type=file] { width: 100%; font: inherit; padding: 10px; border: 1px dashed #9fb2c8; border-radius: 8px; background: #fafcff; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(11, 79, 138, .25); border-color: var(--blue); }
.has-error input, .has-error select { border-color: var(--red); }
.error { color: var(--red); font-size: .9rem; margin: 4px 0 0; }
.hint, .helptext { color: var(--muted); font-size: .875rem; margin: 4px 0 0; }
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.checkbox-row { display: flex; gap: 8px; align-items: center; }
.checkbox-row input { width: 20px; height: 20px; }
ul.radio-list, .field ul { list-style: none; padding: 0; margin: 0; }
.field ul li { margin: 6px 0; }
.field ul label { display: flex; gap: 8px; align-items: center; font-weight: 400; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--blue); background: #fff; color: var(--blue); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--blue-light); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-danger.btn-solid { background: var(--red); color: #fff; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .875rem; }
.btn-block { width: 100%; min-height: 48px; font-size: 1.05rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; margin: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-decoration: underline; }

/* Multi-Team Auswahl */
.league-groups { display: grid; gap: 8px; margin-bottom: 12px; }
.league-group { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.league-group.has-selection { border-color: var(--blue); }
.league-group summary { display: flex; justify-content: space-between; gap: 8px; padding: 12px 14px; cursor: pointer; font-weight: 600; list-style: none; }
.league-group summary::-webkit-details-marker { display: none; }
.league-group summary::before { content: "▸"; color: var(--muted); margin-right: 4px; }
.league-group[open] summary::before { content: "▾"; }
.league-name { flex: 1; }
.league-meta { color: var(--muted); font-weight: 400; font-size: .875rem; white-space: nowrap; }
.team-checks { list-style: none; margin: 0; padding: 0 8px 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 6px; cursor: pointer; min-height: 44px; }
.check:hover { background: var(--blue-light); }
.check input { width: 22px; height: 22px; flex: 0 0 auto; }
.check.is-disabled { color: var(--muted); cursor: not-allowed; }
.check.is-disabled:hover { background: none; }
.check .badge { margin-left: auto; }
.selection-summary { margin: 8px 0 16px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-done { background: var(--green-bg); color: var(--green); }
.badge-open { background: var(--amber-bg); color: var(--amber); }
.badge-info { background: var(--blue-light); color: var(--blue-dark); }
.badge-muted { background: #eef2f6; color: var(--muted); }
.badge-red { background: var(--red-bg); color: var(--red); }

/* Erfolg */
.success { text-align: center; }
.success-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: grid; place-items: center; font-size: 2rem; font-weight: 700; }
.team-list { list-style: none; padding: 0; margin: 16px auto; max-width: 520px; text-align: left; }
.team-list li { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: #fbfdff; }
.muted { color: var(--muted); }
.team-list .muted { display: block; font-size: .8rem; }

/* Verwaltung */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; justify-content: space-between; margin-bottom: 16px; }
.toolbar form { margin: 0; }
.toolbar select { width: auto; min-width: 160px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; min-width: 140px; }
.stat strong { display: block; font-size: 1.4rem; }
.league-block { margin-bottom: 28px; }
.league-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.league-head h2 { margin: 0; }
.progress { height: 6px; background: #e3e9f0; border-radius: 999px; overflow: hidden; margin: 0 0 10px; }
.progress span { display: block; height: 100%; background: var(--green); }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f9fc; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nowrap, th.nowrap { white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }
.multi-hint { display: block; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.row-removed td { background: #fff7f6; }
.row-warning td { background: var(--amber-bg); }
.diff-old { text-decoration: line-through; color: var(--muted); }
.form-narrow { max-width: 560px; }
.section-note { color: var(--muted); font-size: .9rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.empty { color: var(--muted); font-style: italic; padding: 12px; }

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; }
  th, td { padding: 8px; }
  .hide-sm { display: none; }
}
