:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f0ede5;
  --ink: #1f2a24;
  --muted: #62706a;
  --line: #d9d4c8;
  --brand: #0b5d3b;
  --brand-2: #147a4f;
  --hero-3: #2c8a5f;
  --accent: #c58b2a;
  --on-brand: #ffffff;
  --on-brand-muted: #cfe6da;
  --danger: #a83232;
  --warning: #8a5a00;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(31, 42, 36, 0.08);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--brand);
  color: var(--on-brand);
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
}

.brand {
  color: var(--on-brand);
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-decoration: none;
}
.brand strong { font-size: 1.05rem; letter-spacing: 0.02em; }

.season-switcher { position: relative; }
.season-switcher summary {
  list-style: none;
  cursor: pointer;
  color: var(--on-brand-muted);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.season-switcher summary::-webkit-details-marker { display: none; }
.season-switcher summary::after {
  content: "▾";
  font-size: 0.7rem;
}
.season-badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--on-brand);
  color: var(--brand);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.season-badge-alt {
  background: var(--on-brand-muted);
  color: var(--brand);
}
.season-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 30;
  min-width: 15rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.season-menu form { display: grid; gap: 0.1rem; }
.season-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.season-menu button:hover { background: var(--surface-2); }
.season-menu button.is-current { font-weight: 700; }
.season-manage-link {
  display: block;
  margin-top: 0.25rem;
  padding: 0.45rem 0.55rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.season-view-banner {
  background: var(--surface-2);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 1.25rem;
  font-size: 0.82rem;
  text-align: center;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.top-nav a, .top-nav button {
  color: var(--on-brand);
  font-size: 0.92rem;
}
.top-nav form { margin: 0; }
.top-nav a.is-active {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.3rem;
  text-decoration-thickness: 2px;
}
.user-name { color: var(--on-brand-muted); font-size: 0.88rem; }

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5rem; }
h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--brand-2);
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-2) 60%, var(--hero-3));
  color: var(--on-brand);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.hero h1 { max-width: 760px; }
.hero p { color: var(--on-brand-muted); max-width: 760px; }
.eyebrow-on-brand { color: var(--on-brand-muted); }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }
.card-muted { background: var(--surface-2); box-shadow: none; }

.stat-card { display: flex; flex-direction: column; gap: 0.2rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--brand); line-height: 1; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  background: var(--surface-2);
  color: var(--ink);
}
.button:hover { text-decoration: none; filter: brightness(0.97); }
.button-primary { background: var(--brand); color: #fff; }
.button-accent { background: var(--accent); color: #fff; }
.button-danger { background: var(--danger); color: #fff; }
.button-quiet { background: transparent; border-color: currentColor; color: inherit; }
.button-small { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }

.flash-stack { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.flash {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.flash-success { border-color: #9ccdb4; background: #eaf7f0; }
.flash-error { border-color: #e0a6a6; background: #fbecec; }
.flash-warning { border-color: #e5c98d; background: #fff7e3; }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.data th, table.data td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}
table.data th {
  background: var(--surface-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .result-cell { white-space: nowrap; }
table.data tr.is-highlight td { background: #eef8f2; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge-live { background: #fff1d6; color: #8a5a00; }
.badge-submitted { background: #e8f0ff; color: #2b4f9e; }
.badge-confirmed { background: #e6f6ec; color: #17653c; }
.badge-rejected { background: #fbe7e7; color: #9c2b2b; }
.badge-cancelled { background: #eee; color: #666; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: end;
}
label { display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand-2);
  border-color: var(--brand-2);
}
textarea { min-height: 80px; resize: vertical; }
.check-label { display: flex; align-items: center; gap: 0.4rem; color: var(--ink); font-weight: 600; }
.check-label input { width: auto; }

.inline-form { display: inline; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.match-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.match-score {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.match-score span { color: var(--muted); font-weight: 400; }

.position-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  background: var(--surface);
  margin-bottom: 0.9rem;
}
.position-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.position-title { font-weight: 800; }
.position-team { color: var(--muted); font-size: 0.82rem; }

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
}
.entry-grid label { font-size: 0.78rem; }
.entry-grid input { padding: 0.4rem 0.45rem; }

.partial-row {
  display: grid;
  grid-template-columns: 2fr 0.7fr 0.7fr 0.8fr 0.8fr 0.8fr auto;
  gap: 0.4rem;
  align-items: end;
  margin-bottom: 0.5rem;
}
.partial-row label { font-size: 0.72rem; }
.partial-row input, .partial-row select { padding: 0.35rem 0.4rem; }
.partial-row .remove-row { align-self: end; }

.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 700;
}
.tab.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }

.list { display: grid; gap: 0.5rem; }
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }

.empty-state { color: var(--muted); padding: 1rem 0; }

.results-filters {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0.25rem 0.6rem;
}
.results-filters .filter-field { display: contents; }
.results-filters .filter-title {
  grid-row: 1;
  display: block;
  min-height: 1em;
  font-size: 0.82rem;
  line-height: 1.2;
  color: var(--muted);
  font-weight: 600;
}
.results-filters select,
.results-filters .check-label,
.results-filters .button { grid-row: 2; }
.results-filters select { width: auto; }

.results-tables { display: grid; gap: 1.25rem; }
.league-block { padding: 1rem 1.1rem; }
.league-block-title {
  margin: 0;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  font-size: 1.05rem;
}
.league-block-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.league-block-grid table.data thead th { height: 2.5rem; vertical-align: middle; }
.league-results { display: flex; flex-direction: column; }
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-height: 2.5rem;
  padding: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.result-row:last-child { border-bottom: 0; }
.result-row:hover { background: var(--surface-2); }
.result-teams {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.35rem;
  min-width: 0;
}
.result-team { font-weight: 600; }
.result-away { font-weight: 400; }
.result-separator { color: var(--muted); }
.result-score { font-weight: 700; white-space: nowrap; }
.league-hint { margin: 0; padding: 0.5rem 0; color: var(--muted); font-size: 0.88rem; }

@media (max-width: 900px) {
  .league-block-grid { grid-template-columns: 1fr; gap: 1rem; }
}

.login-layout { max-width: 460px; margin: 2rem auto; }
.login-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.form-stack { display: grid; gap: 0.75rem; }
.code-separator { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.8rem; margin: 1rem 0; }
.code-separator::before, .code-separator::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.admin-section { margin-bottom: 1.5rem; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.section-index { color: var(--accent); font-weight: 800; font-size: 0.8rem; }

.print-only { display: none; }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; }
  .top-nav { gap: 0.6rem; }
  .partial-row { grid-template-columns: 1fr 1fr; }
  .partial-row .remove-row { grid-column: 1 / -1; }
  .page-shell { padding: 1rem 0.75rem 2rem; }
  .results-filters {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .results-filters .filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  .results-filters .filter-field-toggle,
  .results-filters .filter-field-action {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
  }
  .results-filters .filter-field > .filter-title:empty { display: none; }
  .results-filters select { width: 100%; }
  .result-teams { flex-direction: column; gap: 0.1rem; }
  .result-separator { display: none; }
  .result-away { padding-left: 1.25rem; }
}

@media print {
  .topbar, .site-footer, .no-print, .flash-stack { display: none !important; }
  .league-block { break-inside: avoid; page-break-inside: avoid; }
  body { background: #fff; }
  .page-shell { max-width: none; padding: 0; }
  .card, table.data { box-shadow: none; border-color: #999; }
  .print-only { display: block; }
  a { color: inherit; text-decoration: none; }
  table.data th, table.data td { font-size: 10pt; padding: 4pt; }
  .results-tables { gap: 4pt; }
  .results-filters { display: none !important; }
  .league-block { padding: 3pt 5pt; border-radius: 0; }
  .league-block-title { margin: 0; min-height: 0; font-size: 9pt; }
  .league-block-grid { grid-template-columns: 1.15fr 1fr; gap: 10pt; }
  .league-block-grid table.data thead th { height: auto; }
  .result-row { min-height: 0; padding: 1pt 0; }
  .result-teams { flex-direction: row; gap: 0 0.2rem; }
  .result-separator { display: inline; }
  .result-away { padding-left: 0; }
  .result-team, .result-score { font-size: 8pt; }
  .league-hint { padding: 1pt 0; font-size: 8pt; }
  .results-tables table.data th,
  .results-tables table.data td {
    font-size: 7.5pt;
    line-height: 1.15;
    padding: 1pt 2pt;
  }
  .results-tables table.data th { font-size: 7pt; }
}

/* Kompakte Spieleingabe */
.entry-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.entry-team { padding: 0.9rem; }
.entry-team-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}
.entry-team-head h2 { margin: 0; font-size: 1.05rem; }
.entry-player {
  display: grid;
  grid-template-columns: minmax(7.5rem, 1fr) 2.2fr;
  gap: 0.5rem;
  align-items: start;
  margin-bottom: 0.45rem;
}
.entry-player-left { display: flex; flex-direction: column; gap: 0.2rem; }
.entry-player-right { min-width: 0; }
.entry-player-label { font-weight: 700; font-size: 0.82rem; white-space: nowrap; }
.entry-player-left select { padding: 0.25rem 0.35rem; font-size: 0.8rem; }
.entry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.entry-table th, .entry-table td {
  border: 1px solid var(--line);
  padding: 0.1rem 0.22rem;
  text-align: center;
}
.entry-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.entry-table input {
  width: 100%;
  min-width: 2.4rem;
  padding: 0.15rem 0.22rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  text-align: right;
  font-size: 0.8rem;
  background: #eef7f2;
}
.entry-table input:focus { outline: 2px solid var(--brand-2); }
.entry-table .abr-cell { background: var(--surface-2); color: var(--muted); }
.entry-total td { background: var(--surface-2); font-weight: 700; }
.entry-substitute { opacity: 0.75; border-top: 1px dashed var(--line); padding-top: 0.5rem; }
.entry-partial-summary { font-size: 0.8rem; color: var(--muted); padding: 0.2rem 0; }

@media (max-width: 900px) {
  .entry-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .entry-player { grid-template-columns: 1fr; }
}

.entry-sub-card {
  margin-bottom: 0.6rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  background: var(--surface-2);
}
.entry-sub-card summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.entry-header-card { padding: 0.7rem 1rem; }
.entry-header-card h1 {
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  margin-bottom: 0.15rem;
}
.entry-header-card .match-header p { margin: 0; }
.entry-header-card .match-score {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  line-height: 1;
}
.entry-header-card .match-score [data-header-total] {
  color: var(--ink);
  font-weight: 800;
}
.entry-report { padding: 0.6rem 0.9rem; }
.report-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  align-items: center;
}
.issue-note { margin-top: 0.5rem; }
.issue-note textarea { min-height: 60px; }

.status-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #9aa39e;
  border: 1px solid rgba(0, 0, 0, 0.12);
  vertical-align: middle;
}
.status-dot.status-scheduled { background: #9aa39e; }
.status-dot.status-live { background: #d98b00; }
.status-dot.status-submitted { background: #17653c; }
.status-dot.status-cancelled { background: #555; }

.input-invalid {
  border-color: var(--danger) !important;
  background: #fbecec !important;
}

.score-over-400 { color: #a83232; font-weight: 700; }
.score-over-450 { color: #17653c; font-weight: 700; }
.score-over-500 { color: #6b2fa0; font-weight: 700; }
