:root {
  --bg: #f2f5f8;
  --card: #ffffff;
  --ink: #17212b;
  --muted: #617181;
  --line: #d7e0e8;
  --brand: #1e6f52;
  --brand-dark: #124c38;
  --accent: #e9b949;
  --danger: #b42318;
  --ok: #1d7a46;
  --shadow: 0 12px 35px rgba(25, 48, 64, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
.topbar {
  position: sticky; top: 0; z-index: 30; min-height: 68px; display: flex; align-items: center;
  justify-content: space-between; gap: 18px; padding: 10px 22px; color: #fff;
  background: linear-gradient(120deg, var(--brand-dark), var(--brand)); box-shadow: 0 4px 18px rgba(0,0,0,.15);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 46px; height: 46px; border-radius: 12px; background: #fff; padding: 5px; }
.brand h1 { margin: 0; font-size: clamp(17px, 2.5vw, 24px); line-height: 1.15; }
.brand small { display: block; color: rgba(255,255,255,.76); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.shell { width: min(1440px, 100%); margin: 0 auto; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card h2, .card h3 { margin-top: 0; }
.hero { text-align: center; padding: 28px; }
.hero h2 { font-size: clamp(25px, 4vw, 40px); margin-bottom: 8px; }
.hero p { color: var(--muted); margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 700; font-size: 14px; }
.field small { color: var(--muted); }
input, select, textarea {
  width: 100%; border: 1px solid #b9c6d2; border-radius: 11px; padding: 12px 13px; background: #fff; color: var(--ink); min-height: 46px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(30,111,82,.17); border-color: var(--brand); }
.btn { border: 0; border-radius: 11px; padding: 12px 17px; min-height: 46px; font-weight: 800; background: #e6edf2; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.warning { background: var(--accent); color: #332500; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
.btn.small { min-height: 34px; padding: 7px 10px; border-radius: 8px; font-size: 13px; }
.btn.full { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.end { justify-content: flex-end; }
.actions.between { justify-content: space-between; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; background: #e6edf2; font-size: 13px; font-weight: 800; }
.status-pill.ok { background: #dff4e8; color: #14532d; }
.status-pill.warn { background: #fff3cf; color: #6b4d00; }
.status-pill.danger { background: #fde6e3; color: #8c1d18; }
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 18px; }
.progress span { height: 7px; border-radius: 999px; background: #d8e0e8; }
.progress span.active { background: var(--brand); }
.team-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 15px; }
.team-head h2 { margin: 0; }
.lineup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lineup-row { border: 1px solid var(--line); background: #f9fbfc; padding: 12px; border-radius: 12px; }
.lineup-row strong { display: block; margin-bottom: 7px; }
.locked-panel { position: relative; overflow: hidden; }
.locked-panel .locked-content { filter: blur(12px); user-select: none; pointer-events: none; opacity: .62; }
.locked-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(235,241,245,.52); backdrop-filter: blur(2px); text-align: center; padding: 20px; }
.lock-icon { font-size: 42px; }
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; text-align: center; margin-bottom: 18px; }
.scoreboard .team { font-size: clamp(18px,3vw,30px); font-weight: 900; }
.scoreboard .score { font-size: clamp(28px,5vw,52px); font-weight: 950; color: var(--brand-dark); white-space: nowrap; }
.game-card { overflow: hidden; }
.game-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.game-title h2 { margin: 0; }
.players-versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin: 18px 0; }
.player-box { background: #f7fafb; border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; font-weight: 850; font-size: clamp(16px,2.6vw,24px); min-height: 70px; display: flex; flex-direction: column; justify-content: center; }
.player-box small { color: var(--muted); font-weight: 600; font-size: 12px; }
.vs { font-weight: 950; color: var(--muted); }
.score-entry { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px; border-radius: 14px; background: #edf4f1; margin-bottom: 16px; }
.score-entry input { text-align: center; font-size: 24px; font-weight: 900; }
.stats-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.stats-table th, .stats-table td { border: 1px solid var(--line); padding: 8px; text-align: center; }
.stats-table th { background: #edf2f5; }
.stats-table input { min-height: 40px; padding: 8px; text-align: center; }
.report-wrap { overflow-x: auto; padding-bottom: 8px; }
.report-paper { min-width: 1050px; background: white; border: 1px solid #222; color: #111; padding: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.15); }
.report-title { font-size: 25px; font-weight: 950; text-align: center; margin: 4px 0 10px; }
.report-meta { display: grid; grid-template-columns: 1fr 1fr 230px; border: 2px solid #111; border-bottom: 0; }
.report-meta > div { min-height: 70px; padding: 7px; border-right: 2px solid #111; }
.report-meta > div:last-child { border-right: 0; }
.report-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.report-table th, .report-table td { border: 1.5px solid #111; padding: 6px; text-align: center; height: 42px; }
.report-table th { font-size: 13px; }
.report-table .name { text-align: left; }
.report-bottom { display: grid; grid-template-columns: 1fr 210px; gap: 12px; margin-top: 0; }
.checks { padding: 10px 3px; }
.check-row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 8px 0; }
.signature-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 12px; }
.signature-box { border-bottom: 2px solid #222; height: 96px; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; position: relative; }
.signature-box img { max-height: 88px; max-width: 100%; }
.signature-box span { color: var(--muted); margin-bottom: 10px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(12,24,32,.68); backdrop-filter: blur(7px); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: white; border-radius: 18px; padding: 20px; box-shadow: 0 25px 80px rgba(0,0,0,.4); }
.modal.wide { width: min(1000px, 100%); }
.modal h2 { margin-top: 0; }
.signature-canvas { width: 100%; height: min(45vh, 330px); border: 2px dashed #7c8d9b; border-radius: 12px; background: #fff; touch-action: none; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 200; min-width: 260px; max-width: min(440px, calc(100vw - 36px)); padding: 14px 16px; border-radius: 12px; color: #fff; background: #1e2933; box-shadow: var(--shadow); transform: translateY(140%); opacity: 0; transition: .25s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }
.empty { text-align: center; padding: 35px; color: var(--muted); }
.hidden { display: none !important; }
.admin-layout { display: grid; grid-template-columns: 240px minmax(0,1fr); min-height: calc(100vh - 68px); }
.admin-nav { background: #142c25; padding: 15px; color: white; }
.admin-nav button { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: rgba(255,255,255,.82); padding: 12px 13px; border-radius: 9px; margin: 3px 0; font-weight: 700; }
.admin-nav button.active, .admin-nav button:hover { background: rgba(255,255,255,.13); color: #fff; }
.admin-main { padding: 20px; min-width: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.kpi { background: white; border: 1px solid var(--line); border-radius: 15px; padding: 18px; }
.kpi strong { display: block; font-size: 30px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
.data-table th { position: sticky; top: 0; background: #eef3f6; z-index: 1; }
.data-table tr:last-child td { border-bottom: 0; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg,#102a22,#2e8161); }
.login-card { width: min(470px,100%); }
.muted { color: var(--muted); }
.code-input { font-size: 38px; letter-spacing: 18px; text-align: center; font-weight: 950; }
.offline-banner { display: none; background: #7a271a; color: white; padding: 8px 16px; text-align: center; font-weight: 800; }
body.offline .offline-banner { display: block; }
@media (max-width: 900px) {
  .grid.two, .grid.three, .lineup-grid, .signature-row { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { display: flex; overflow-x: auto; position: sticky; top: 68px; z-index: 20; padding: 8px; }
  .admin-nav button { width: auto; white-space: nowrap; margin: 0 3px; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .score-entry { grid-template-columns: repeat(2,1fr); }
  .shell { padding: 12px; }
}
@media (max-width: 600px) {
  .topbar { padding: 8px 12px; }
  .brand small { display: none; }
  .brand-logo { width: 38px; height: 38px; }
  .top-actions .hide-mobile { display: none; }
  .players-versus, .scoreboard { grid-template-columns: 1fr; }
  .vs { padding: 2px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 14px; border-radius: 14px; }
}
@media print {
  .topbar, .offline-banner, .no-print, .actions { display:none !important; }
  body { background:white; }
  .shell { width:100%; padding:0; }
  .card { border:0; box-shadow:none; padding:0; }
  .report-paper { box-shadow:none; border:0; }
}

/* Statistik */
.compact-select { width: auto; min-width: 145px; }
.statistics-kpis { grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: 16px; }
.chart-legend { display:flex; flex-wrap:wrap; gap:16px; margin-bottom:12px; font-size:13px; font-weight:700; }
.chart-legend span { display:inline-flex; align-items:center; gap:7px; }
.chart-legend i { width:12px; height:12px; border-radius:3px; display:inline-block; }
.legend-page, .bar.page { background:#1e6f52; }
.legend-pdf, .bar.pdf { background:#d59b16; }
.legend-report, .bar.report { background:#426a8c; }
.chart-bars { height:280px; display:flex; gap:5px; align-items:stretch; overflow-x:auto; border-left:1px solid var(--line); border-bottom:1px solid var(--line); padding:12px 8px 0; }
.chart-day { flex:1 0 34px; min-width:34px; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:5px; }
.bar-cluster { width:100%; height:235px; display:flex; align-items:flex-end; justify-content:center; gap:2px; }
.bar { display:block; width:28%; min-height:2px; border-radius:4px 4px 0 0; }
.chart-day small { font-size:10px; color:var(--muted); transform:rotate(-45deg); transform-origin:center; margin-bottom:14px; white-space:nowrap; }
.breakdown-list { display:grid; gap:9px; }
.breakdown-list > div { display:flex; justify-content:space-between; gap:12px; padding-bottom:8px; border-bottom:1px solid var(--line); }
.breakdown-list > div:last-child { border-bottom:0; }
.statistics-breakdowns { align-items:start; }
@media (max-width: 1050px) { .statistics-kpis { grid-template-columns:repeat(3,1fr); } }
@media (max-width: 700px) { .statistics-kpis { grid-template-columns:repeat(2,1fr); } .chart-bars { height:240px; } .bar-cluster { height:195px; } }

/* HHEDL-Gesamtimport */
.import-status{margin-top:20px;padding-top:18px;border-top:1px solid var(--line)}
.import-status-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}
.import-status-head>div{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.progress-track{height:14px;border-radius:999px;background:var(--line);overflow:hidden;margin:12px 0 16px}
.progress-track i{display:block;height:100%;background:var(--primary);border-radius:inherit;transition:width .25s ease}
.kpi-grid.compact{grid-template-columns:repeat(4,minmax(120px,1fr));margin-top:10px}
.warning-list{max-height:260px;overflow:auto;margin-top:10px;padding:10px;border:1px solid var(--line);border-radius:10px;background:var(--surface-2)}
.warning-list>div{padding:6px 0;border-bottom:1px solid var(--line)}
.warning-list>div:last-child{border-bottom:0}
.small-text{font-size:.86rem}
.alert.error{margin-top:12px;padding:12px;border-radius:10px;background:#ffe8e8;color:#8a1f1f}
.status-pill.error{background:#ffe8e8;color:#8a1f1f}
@media(max-width:800px){.kpi-grid.compact{grid-template-columns:repeat(2,minmax(120px,1fr))}.import-status-head{align-items:flex-start;flex-direction:column}}

/* v1.3.0 - tabletoptimierte Leg- und Schnellwerteingabe */
.btn.large { min-height: 52px; padding: 13px 20px; font-size: 17px; }
.fixture-hint { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: #e8f5ee; border: 1px solid #a8d6c1; }
.mode-line { margin: 6px 0 0; color: var(--muted); font-weight: 700; }
.set-score { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; margin: 12px 0 18px; padding: 12px; border-radius: 14px; background: #edf4f1; }
.set-score strong { font-size: 32px; }
.legs-list { display: grid; gap: 14px; }
.leg-row { display: grid; grid-template-columns: minmax(0,1fr) 90px minmax(0,1fr); gap: 12px; align-items: stretch; padding: 14px; border: 2px solid var(--line); border-radius: 18px; background: #fff; }
.leg-row.played { border-color: #93bca9; background: #fbfefc; }
.leg-row.disabled { opacity: .55; }
.leg-side { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.performance-button { min-height: 72px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #f5f8fa; color: var(--text); }
.performance-button span { display: block; font-size: 12px; color: var(--muted); font-weight: 800; }
.performance-button strong { display: block; margin-top: 5px; font-size: 13px; line-height: 1.25; }
.performance-button:disabled { opacity: .45; cursor: not-allowed; }
.leg-win { grid-column: 1 / -1; min-height: 50px; border: 2px solid #b8c7d0; border-radius: 12px; background: white; font-weight: 900; font-size: 16px; }
.leg-win.selected { background: var(--primary); color: white; border-color: var(--primary); }
.leg-center { display: flex; flex-direction: column; justify-content: center; align-items: center; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; }
.leg-center span { color: var(--muted); font-weight: 800; }
.leg-center strong { font-size: 26px; margin-top: 5px; }
.special-score-summary { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin: 16px 0; padding: 12px 14px; border-radius: 12px; background: #f6f1df; }
.rule-key { margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.rule-key summary { cursor: pointer; font-weight: 850; }
.rule-key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.rule-key table { width: 100%; border-collapse: collapse; }
.rule-key th,.rule-key td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; }
.rule-key th { background: #edf2f5; }
.game-actions { margin-top: 18px; }
.code-display,.number-display { min-height: 82px; display: grid; place-items: center; margin: 14px 0; border: 2px solid var(--line); border-radius: 14px; font-size: 46px; font-weight: 950; letter-spacing: 14px; background: #f8fafb; }
.number-display { letter-spacing: 2px; }
.numeric-pad { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; }
.numeric-pad button,.value-grid button,.counter-grid button,.player-choice button { min-height: 62px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 24px; font-weight: 900; }
.numeric-pad button:active,.value-grid button:active,.counter-grid button:active,.player-choice button:active { transform: scale(.97); }
.numeric-pad .key-clear { grid-column: span 5; font-size: 16px; background: #f1f4f6; }
.value-grid { display: grid; grid-template-columns: repeat(4,minmax(80px,1fr)); gap: 10px; max-height: 62vh; overflow: auto; padding: 2px; }
.value-grid.digits { grid-template-columns: repeat(5,1fr); }
.value-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.value-grid button small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.value-grid button.selected,.player-choice button.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.value-grid button.selected small { color: rgba(255,255,255,.85); }
.player-choice { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin: 16px 0; }
.player-choice button { font-size: 17px; padding: 10px; }
.counter-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 14px 0; }
.counter-summary strong { padding: 16px 8px; border: 1px solid var(--line); border-radius: 12px; text-align: center; font-size: 18px; }
.counter-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-bottom: 16px; }
.counter-grid button { font-size: 20px; }
@media(max-width:1050px){
  .leg-row { grid-template-columns: 1fr; }
  .leg-center { order: -1; border: 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .leg-side { grid-template-columns: repeat(3,1fr); }
}
@media(max-width:650px){
  .leg-side { grid-template-columns: 1fr 1fr; }
  .performance-button:last-of-type { grid-column: 1 / -1; }
  .value-grid { grid-template-columns: repeat(3,1fr); }
  .numeric-pad { grid-template-columns: repeat(5,1fr); }
  .numeric-pad button { min-height: 58px; }
  .rule-key-grid { grid-template-columns: 1fr; }
  .game-actions { align-items: stretch; }
  .game-actions,.game-actions>.actions { flex-direction: column; }
  .game-actions .btn { width: 100%; }
}
