/* =====================================================================
   Ref-Tracker · Design „Anpfiff“
   Tinte #0E1726 · Grund #F4F5F7 · Akzent Orange #E8590C · 2. Reihe Blau #2F6FDB
   ===================================================================== */

@font-face { font-family: "Inter"; src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/static/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/static/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-display: swap; }

html:root:not([data-theme=dark]) {
  --ink: #0E1726;
  --ink-2: #17233A;
  --ink-3: #26354D;
  --ink-line: #2A3852;
  --ink-text: #C9D1DC;
  --ink-muted: #8C97A8;
  --ground: #F4F5F7;
  --card: #FFFFFF;
  --line: #E2E5EA;
  --line-strong: #D5DAE1;
  --text: #0E1726;
  --text-2: #3A4352;
  --muted: #5B6473;
  --accent: #E8590C;
  --accent-hover: #C9480A;
  --accent-text: #B8460B;
  --accent-soft: #FFF6EF;
  --accent-tint: #FDE3D0;
  --blue: #2F6FDB;
  --blue-text: #1E4FA6;
  --blue-soft: #E8EEF9;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;

  --pico-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pico-font-size: 95%;
  --pico-line-height: 1.5;
  --pico-border-radius: 10px;
  --pico-background-color: var(--ground);
  --pico-color: var(--text);
  --pico-h1-color: var(--text); --pico-h2-color: var(--text); --pico-h3-color: var(--text);
  --pico-h4-color: var(--text); --pico-h5-color: var(--text); --pico-h6-color: var(--text);
  --pico-muted-color: var(--muted);
  --pico-muted-border-color: var(--line);
  --pico-primary: var(--accent-text);
  --pico-primary-background: var(--accent);
  --pico-primary-border: var(--accent);
  --pico-primary-underline: rgba(184, 70, 11, .4);
  --pico-primary-hover: #8F360A;
  --pico-primary-hover-background: var(--accent-hover);
  --pico-primary-hover-border: var(--accent-hover);
  --pico-primary-focus: rgba(232, 89, 12, .3);
  --pico-primary-inverse: #FFFFFF;
  --pico-secondary: var(--text-2);
  --pico-secondary-background: var(--ink);
  --pico-secondary-border: var(--line-strong);
  --pico-secondary-hover: var(--text);
  --pico-secondary-hover-background: var(--ink-3);
  --pico-secondary-hover-border: var(--muted);
  --pico-secondary-inverse: #FFFFFF;
  --pico-card-background-color: var(--card);
  --pico-card-sectioning-background-color: #F8F9FA;
  --pico-card-box-shadow: none;
  --pico-form-element-background-color: var(--card);
  --pico-form-element-border-color: var(--line-strong);
  --pico-form-element-focus-color: var(--accent);
  --pico-form-element-active-border-color: var(--accent);
  --pico-table-border-color: #EEF0F3;
  --pico-table-row-stripped-background-color: #FAFBFC;
  --pico-dropdown-background-color: var(--card);
  --pico-dropdown-border-color: var(--line);
  --pico-dropdown-hover-background-color: var(--ground);
  --pico-del-color: #B42318;
  --pico-spacing: 1rem;
  --pico-typography-spacing-vertical: 1rem;
  color-scheme: light;
}

body { background: var(--ground); font-variant-numeric: tabular-nums; }
h1, h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .01em; line-height: 1.05; }
h2 { font-size: 2.6rem; }
h3, h4 { font-weight: 600; }
h4 { font-size: 1.05rem; }
article { border: 1px solid var(--line); border-radius: 14px; box-shadow: none; }
button, [role=button] { font-weight: 600; }
table { font-size: .95rem; }
th { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
:where(table) thead th { background: #F8F9FA; }
details summary { font-weight: 500; }

/* ---------- Grundlayout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { flex: 0 0 244px; background: var(--ink); color: var(--ink-text); padding: 1.6rem 1rem 1rem;
  display: flex; flex-direction: column; gap: 1.6rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  box-sizing: border-box; }
.brand { display: flex; align-items: center; gap: .6rem; color: #FFFFFF; text-decoration: none; padding: 0 .4rem; }
.brand span:last-child { font-family: var(--display); font-weight: 700; font-size: 1.5rem; text-transform: uppercase;
  letter-spacing: .02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center;
  color: #FFFFFF; flex: 0 0 auto; }
.brand:hover { color: #FFFFFF; }
.sidebar .new-btn { display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; margin: 0;
  min-height: 44px; border-radius: 10px; }
.side-nav { display: block; }
.side-nav ul, .side-nav ul:first-of-type, .side-nav ul:last-of-type { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.side-nav li { list-style: none; margin: 0; padding: 0; }
.side-nav a { display: flex; align-items: center; gap: .75rem; min-height: 42px; padding: 0 .75rem; border-radius: 8px;
  color: var(--ink-text); text-decoration: none; font-weight: 500; }
.side-nav a:hover { color: #FFFFFF; background: var(--ink-2); }
.side-nav a[aria-current=page] { background: var(--ink-3); color: #FFFFFF; font-weight: 600; }
.side-nav .dot { width: 8px; height: 8px; border-radius: 2px; background: #3A4A66; }
.side-nav a[aria-current=page] .dot { background: var(--accent); }
.side-nav .sub a { min-height: 36px; font-size: .9rem; }
.side-head { margin: 1.4rem 0 .4rem; padding: 0 .75rem; font-size: .7rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-muted); }
.user-box { margin: auto 0 0; display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: 10px;
  background: var(--ink-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #FFFFFF; display: grid;
  place-items: center; font-weight: 600; font-size: .8rem; flex: 0 0 auto; }
.user-box .icon-btn { width: 38px; flex: 0 0 38px; margin: 0; }
.user-name { flex: 1; min-width: 0; color: #FFFFFF; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 38px; height: 38px; padding: 0; margin: 0; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-text); display: grid; place-items: center; }
.icon-btn:hover, .icon-btn:focus { background: var(--ink-3); color: #FFFFFF; }
.content { flex: 1; min-width: 0; padding: 2.2rem 2.5rem 3.5rem; }
.page { max-width: 1120px; margin: 0 auto; }
.topbar, .tabbar { display: none; }
body.public main.container { padding-top: 2rem; }

/* ---------- Bausteine ---------- */
form.inline { display: inline; margin: 0; }
form.inline button, button.small, a.small[role=button] { padding: .35rem .7rem; font-size: .85rem; margin: 0; width: auto;
  border-radius: 8px; }
.actions { white-space: nowrap; display: flex; gap: .3rem; justify-content: flex-end; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.error { color: var(--pico-del-color); }
.hint { font-size: .85rem; color: var(--muted); }
.warn { color: #B45309; font-weight: 600; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; }

.toolbar { display: flex; gap: 1rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  margin-bottom: 1.6rem; }
.toolbar h2 { margin: 0; }
.toolbar select { width: auto; margin: 0; }
.toolbar .actions { align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem 1.4rem; }
.card > h3, .card-head h3 { font-size: 1.05rem; margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; flex-wrap: wrap;
  margin-bottom: 1rem; }
.card-sub { font-size: .85rem; color: var(--muted); margin: .2rem 0 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.tiles article { margin: 0; padding: 1rem 1.2rem; background: var(--card); }
.tiles .label { color: var(--muted); font-size: .85rem; font-weight: 500; }
.tiles .value { font-family: var(--display); font-size: 2.4rem; font-weight: 700; line-height: 1.05; }
.tiles .sub { font-size: .82rem; color: var(--muted); }
.tiles .label { order: -1; }
.tiles article { display: flex; flex-direction: column; gap: .15rem; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue-text); white-space: nowrap; }
.badge.Turnier { background: var(--accent-tint); color: #9A3A08; }
.badge.Testspiel { background: #ECEEF1; color: var(--text-2); }
.badge.Zuschauer { background: #ECEEF1; color: var(--text-2); }
.badge.today-badge { background: var(--accent); color: #FFFFFF; }

.login { max-width: 420px; margin: 10vh auto; padding: 2rem; background: var(--card); }
.login h2 { display: flex; align-items: center; gap: .6rem; }

/* ---------- Nächster Einsatz ---------- */
.next-game { background: var(--ink); color: #FFFFFF; border-radius: 16px; padding: 1.6rem 1.8rem; margin-bottom: 1.6rem;
  display: flex; flex-wrap: wrap; gap: 1.4rem 1.8rem; align-items: center; }
.next-game .when { text-align: center; padding-right: 1.8rem; border-right: 1px solid var(--ink-line); }
.next-game .kicker { font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #F7A06B; }
.next-game .day { font-family: var(--display); font-weight: 700; font-size: 3.6rem; line-height: 1; margin-top: .3rem;
  text-transform: uppercase; }
.next-game .time { color: var(--ink-text); font-size: .95rem; margin-top: .2rem; }
.next-game .what { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: .5rem; }
.next-game .chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.next-game .chip { font-size: .75rem; font-weight: 600; padding: .2rem .65rem; border-radius: 999px; background: var(--ink-3); }
.next-game .title { font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1.1; }
.next-game .where { color: var(--ink-text); font-size: .95rem; }
.next-game .facts { display: flex; gap: .4rem 1.4rem; flex-wrap: wrap; font-size: .9rem; margin-top: .2rem; }
.next-game .facts span span { color: var(--ink-muted); margin-right: .3rem; }
.next-game .go { display: flex; flex-direction: column; gap: .5rem; }
.next-game .go [role=button] { margin: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.next-game .go .ghost { background: transparent; border: 1px solid #3A4A66; color: #FFFFFF; }
.next-game .go .ghost:hover { background: var(--ink-3); }

/* ---------- Tabellen ---------- */
.table-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 1.6rem; }
.table-card table { margin: 0; }
.table-card th:first-child, .table-card td:first-child { padding-left: 1.3rem; }
.table-card th:last-child, .table-card td:last-child { padding-right: 1.3rem; }
table td, table th { vertical-align: middle; }
.page > table, .page > .overflow-auto > table, .page > article > table { background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.page > table th:first-child, .page > table td:first-child { padding-left: 1.2rem; }
.page > table th:last-child, .page > table td:last-child { padding-right: 1.2rem; }
.page > table tr:last-child td { border-bottom: 0; }
.cell-title a { color: var(--text); font-weight: 600; text-decoration: none; }
.cell-title a:hover { color: var(--accent-text); }
.cell-title a.hb-link { font-weight: 500; color: var(--accent-text); }
tr.section-row td { background: transparent !important; font-weight: 700; font-size: .75rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--accent-text); padding-top: 1.1rem; border-bottom: none; }
tr.past-divider td { color: var(--muted); border-top: 1px solid var(--line); }
tr.past td { color: #4A5363; }
tr.past td .cell-title a, tr.past .cell-title a { color: #4A5363; }
tr.today td { background: var(--accent-soft) !important; }

/* ---------- Formular (Schritte) ---------- */
fieldset.step { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 1.2rem 1.4rem .4rem;
  margin-bottom: 1.2rem; transition: opacity .2s; }
fieldset.step legend { font-weight: 600; padding: 0 .4rem; display: flex; align-items: center; gap: .5rem; }
.locked { opacity: .35 !important; filter: grayscale(1); cursor: not-allowed; }
fieldset.step.locked legend::after { content: " – zuerst vorherigen Schritt ausfüllen"; font-weight: 400; font-size: .85rem;
  color: var(--muted); }
.step-no { display: inline-grid; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: 50%;
  background: var(--ink); color: #FFFFFF; font-size: .8rem; font-weight: 600; }
.refs { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.team-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 var(--pico-grid-column-gap); }
fieldset.date-parts { display: flex; align-items: center; gap: .35rem; margin: 0 0 var(--pico-spacing); }
fieldset.date-parts legend { margin-bottom: calc(var(--pico-spacing) * .375); font-weight: normal; padding: 0; }
fieldset.date-parts input { width: 4.2rem; margin: 0; text-align: center; }
fieldset.date-parts select { width: auto; margin: 0; }
.copy-row { display: flex; gap: .4rem; align-items: center; }
.copy-row input { margin: 0; font-family: var(--pico-font-family-monospace); font-size: .8rem; }
.import-table td { font-size: .9rem; }
tr.row-error td { background: color-mix(in srgb, var(--pico-del-color) 12%, transparent) !important; }
tr.row-dup td { opacity: .55; }
table.times { margin-bottom: .25rem; font-size: .9rem; }

/* ---------- Bearbeiten-Dialog ---------- */
dialog#edit-dialog article.modal { max-width: min(1100px, 96vw); width: 100%; max-height: 92vh; overflow: auto;
  padding-top: 1rem; background: var(--ground); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.modal-head h3 { margin: 0; }
button.icon { font-size: 1rem; line-height: 1; }

/* ---------- Hallen-Ranking ---------- */
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.podium article { margin: 0; padding: 1.2rem 1.4rem; display: flex; flex-direction: column; gap: .3rem; background: var(--card); }
.podium article:first-child { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.podium .top { display: flex; justify-content: space-between; align-items: flex-start; }
.podium .rank { font-family: var(--display); font-size: 3.2rem; font-weight: 700; line-height: .9; color: var(--accent-text); }
.podium article:first-child .rank { color: #F7A06B; }
.podium .avg { font-family: var(--display); font-size: 2.2rem; font-weight: 700; }
.podium .name { font-weight: 600; font-size: 1.05rem; }
.podium .place { font-size: .85rem; color: var(--muted); }
.podium article:first-child .place { color: var(--ink-text); }
table.ratings select.rating-select { margin: 0; padding: .3rem 1.8rem .3rem .6rem; width: auto; min-width: 3.8rem; }
.rating-avg { display: inline-block; min-width: 3rem; padding: .25rem .5rem; font-weight: 700; font-size: 1.05rem;
  text-align: center; border-radius: 8px; }

/* ---------- Statistik ---------- */
.seg-control { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #E6E9EE; flex-wrap: wrap; }
.seg-control a { min-height: 40px; padding: 0 1rem; border-radius: 9px; display: flex; align-items: center;
  color: var(--text-2); text-decoration: none; font-size: .9rem; font-weight: 500; }
.seg-control a:hover { color: var(--text); background: rgba(255, 255, 255, .5); }
.seg-control a[aria-current=page] { background: var(--card); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(14, 23, 38, .12); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1.2rem; margin-bottom: 1.2rem; }
.stats-grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.orange { background: var(--accent); }
.sw.blue { background: var(--blue); }
.sw.line { width: 14px; height: 3px; border-radius: 2px; }
.readout { min-height: 44px; padding: .6rem .9rem; border-radius: 10px; background: var(--ground); font-size: .9rem;
  display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; align-items: center; margin-bottom: 1rem; }
.bars { height: 220px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; align-items: end;
  border-bottom: 1px solid var(--line-strong); }
.bars .bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; position: relative;
  outline-offset: 2px; border-radius: 4px; }
.bars .bar span { display: block; }
.bars .bar .fee { background: var(--accent); }
.bars .bar .travel { background: var(--blue); border-radius: 4px 4px 0 0; }
.bars .bar .fee:first-child { border-radius: 4px 4px 0 0; }
.bars .bar:hover span, .bars .bar:focus span { filter: brightness(.85); }
.bars .bar .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #FFFFFF; font-size: .78rem; padding: .4rem .6rem; border-radius: 8px; white-space: nowrap;
  z-index: 2; pointer-events: none; filter: none !important; }
.bars .bar:hover .tip, .bars .bar:focus .tip { display: block; }
.axis { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; font-size: .75rem; color: var(--muted);
  text-align: center; margin-top: .4rem; }
.line-chart { width: 100%; height: auto; font-family: var(--pico-font-family); }
.line-chart .grid-line { stroke: #ECEEF1; }
.line-chart .base { stroke: #C3C9D2; }
.line-chart text { fill: var(--muted); font-size: 12px; }
.line-chart text.val { fill: var(--text); font-size: 13px; font-weight: 600; }
.section-title { display: flex; align-items: center; gap: 1rem; margin: 2.2rem 0 1.2rem; }
.section-title h2 { margin: 0; font-size: 1.9rem; white-space: nowrap; }
.section-title .rule { flex: 1; height: 1px; background: var(--line-strong); }
.section-title .muted { font-size: .85rem; white-space: nowrap; }
.records { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.record { margin: 0; background: var(--ink); color: #FFFFFF; border-radius: 14px; padding: 1.1rem 1.2rem; display: flex; gap: 1rem;
  align-items: flex-start; }
.record .ic { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; background: var(--ink-3); display: grid;
  place-items: center; color: #F7A06B; }
.record .label { font-size: .82rem; color: #AEB8C6; }
.record .value { font-family: var(--display); font-size: 2.1rem; font-weight: 700; line-height: 1.05; }
.record .sub { font-size: .82rem; color: var(--ink-text); overflow-wrap: anywhere; }
.heat { display: grid; grid-template-columns: 36px repeat(5, minmax(0, 1fr)); gap: 4px; font-size: .78rem; }
.heat .h { text-align: center; color: var(--muted); padding-bottom: .2rem; }
.heat .d { display: flex; align-items: center; color: var(--muted); font-weight: 500; }
.heat .c { height: 38px; border-radius: 6px; display: grid; place-items: center; font-weight: 600; background: #F1F2F4; }
.heat .l1 { background: #FDE3D0; color: #6B2A05; }
.heat .l2 { background: #F9B98E; color: #5A2304; }
.heat .l3 { background: #F08A4B; color: #2B1102; }
.heat .l4 { background: #C9480A; color: #FFFFFF; }
.heat-legend { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--muted); margin-top: 1rem; flex-wrap: wrap; }
.heat-legend .c { width: 22px; height: 12px; border-radius: 3px; }
.heat-legend .fav { margin-left: auto; color: var(--text-2); }
.hbars { display: flex; flex-direction: column; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.hbars li { list-style: none; display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr) 36px; gap: .8rem;
  align-items: center; font-size: .9rem; margin: 0; }
.hbars .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbars .track { height: 14px; background: #F1F2F4; border-radius: 4px; display: flex; }
.hbars .fill { background: var(--accent); border-radius: 4px; }
.hbars .fill.grey { background: #8C97A8; }
.hbars strong { text-align: right; font-weight: 600; }
.ranked li { grid-template-columns: 24px minmax(0, 1fr) 44px; }
.ranked .rank { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--accent-text); }
.ranked .who { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.ranked .track { height: 6px; border-radius: 3px; }
.vbars { height: 120px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-items: end;
  border-bottom: 1px solid var(--line-strong); }
.vbars div { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.vbars b { font-size: .78rem; font-weight: 600; }
.vbars i { display: block; width: 100%; background: var(--blue); border-radius: 4px 4px 0 0; }
.axis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: flex; gap: 2px; height: 26px; margin-bottom: 1rem; }
.split span:first-child { border-radius: 6px 0 0 6px; }
.split span:last-child { border-radius: 0 6px 6px 0; }
.split span:only-child { border-radius: 6px; }
.split .s0 { background: var(--accent); }
.split .s1 { background: var(--blue); }
.split .s2 { background: #8C97A8; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .8rem; }
.ref-grid .big { font-family: var(--display); font-size: 1.9rem; font-weight: 700; display: block; line-height: 1.1; }
.ref-grid .who { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--text-2); }
.mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 1rem; }
.mini div { padding: 1rem 1.1rem; border-radius: 12px; background: #F8F9FA; border: 1px solid #ECEEF1; display: flex;
  flex-direction: column; gap: .2rem; }
.mini .k { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mini .n { font-weight: 600; }
.mini .v { font-family: var(--display); font-size: 1.7rem; font-weight: 700; color: var(--accent-text); }
.empty { padding: 1.6rem; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line-strong);
  border-radius: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* ---------- handball.net-Link & Ergebnis ---------- */
.result { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hb-link { white-space: nowrap; }

/* ---------- Navigation (Dropdowns) ---------- */
nav details.dropdown ul li { direction: ltr; text-align: left; }
nav details.dropdown summary { white-space: nowrap; }
.mobile-only { display: none !important; }

/* =====================================================================
   Handy
   ===================================================================== */
@media (max-width: 900px) {
  html:root:not([data-theme=dark]) { --pico-font-size: 93%; }
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--ink); padding: .7rem 1rem;
    position: sticky; top: 0; z-index: 5; }
  .topbar .brand span:last-child { font-size: 1.3rem; }
  .content { padding: 1.2rem 12px 6.5rem; }
  h2 { font-size: 2rem; }
  .refs { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr 1fr; }
  .team-grid > label:first-child { grid-column: 1 / -1; }

  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; position: fixed; left: 0;
    right: 0; bottom: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--line);
    padding: .3rem 0 calc(.4rem + env(safe-area-inset-bottom)); }
  .tabbar > a, .tabbar summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 50px; font-size: .7rem; font-weight: 500; color: var(--text-2); text-decoration: none; list-style: none;
    cursor: pointer; }
  .tabbar summary::-webkit-details-marker { display: none; }
  .tabbar summary::after { display: none; }
  .tabbar > a[aria-current=page] { color: var(--accent-text); font-weight: 600; }
  .tabbar .tab-new { justify-self: center; width: 52px; height: 52px; min-height: 0; border-radius: 16px; background: var(--accent);
    color: #FFFFFF; margin-top: -20px; box-shadow: 0 6px 16px rgba(232, 89, 12, .35); }
  .tab-more { position: relative; margin: 0; }
  .tab-more ul { position: absolute; right: 8px; bottom: calc(100% + 10px); margin: 0; padding: .4rem; list-style: none;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-width: 210px;
    box-shadow: 0 10px 30px rgba(14, 23, 38, .18); }
  .tab-more li { list-style: none; margin: 0; }
  .tab-more a, .tab-more .link-btn { display: flex; align-items: center; min-height: 44px; padding: 0 .9rem; border-radius: 8px;
    color: var(--text); text-decoration: none; font-size: .95rem; }
  .tab-more a:hover { background: var(--ground); }
  .link-btn { width: 100%; margin: 0; border: 0; background: transparent; font-weight: 500; text-align: left; color: var(--accent-text) !important; }

  .next-game { padding: 1.2rem; gap: 1rem; }
  .next-game .when { text-align: left; border-right: 0; padding-right: 0; display: flex; flex-wrap: wrap; align-items: baseline;
    gap: .2rem .7rem; }
  .next-game .kicker { width: 100%; }
  .next-game .day { font-size: 2.6rem; }
  .next-game .title { font-size: 1.6rem; }
  .next-game .go { flex-direction: row; width: 100%; }
  .next-game .go [role=button] { flex: 1; }

  /* Tabellen werden zu Karten */
  .table-card { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .table-card th:first-child, .table-card td:first-child, .table-card th:last-child, .table-card td:last-child { padding-left: 0; padding-right: 0; }
  .page > table, .page > .overflow-auto > table, .page > article > table { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .page > table th:first-child, .page > table td:first-child, .page > table th:last-child, .page > table td:last-child { padding-left: 0; padding-right: 0; }
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: .6rem; padding: .5rem .9rem;
    background: var(--card); }
  table.responsive td { border: none; padding: .25rem 0 !important; text-align: right; background: transparent !important;
    overflow: hidden; }
  table.responsive td[data-label]::before { content: attr(data-label); float: left; margin-right: 1rem; font-weight: 600;
    text-align: left; color: var(--muted); }
  table.responsive td .actions { justify-content: flex-end; flex-wrap: wrap; }
  table.responsive td select { display: inline-block; }
  table.responsive tr.section-row { border: none; background: none; padding: 0; margin: 1rem 0 .4rem; }
  table.responsive tr.section-row td { display: block; text-align: left; padding: 0 !important; }
  table.responsive tr.past-divider td { border-top: 0; }
  table.responsive tr.today { background: var(--accent-soft); border-color: #F5C19E; }
  table.responsive td.cell-title { font-weight: 600; }
  .overflow-auto { overflow: visible; }

  /* Ranking kompakt: Name, darunter 5 Kriterien nebeneinander, dann Ø */
  table.ratings tr { display: grid; grid-template-columns: repeat(5, 1fr); gap: .2rem .35rem; align-items: end; }
  table.ratings td { text-align: center; padding: 0; }
  table.ratings td[data-label]::before { float: none; display: block; margin: 0 0 .15rem; font-size: .7rem; text-align: center; }
  table.ratings td:first-child, table.ratings td:last-child { grid-column: 1 / -1; text-align: left; }
  table.ratings td:first-child::before { display: none; }
  table.ratings td:last-child { display: flex; justify-content: space-between; align-items: center; margin-top: .3rem; }
  table.ratings td:last-child::before { margin: 0; font-size: .85rem; }
  table.ratings select.rating-select { width: 100%; min-width: 0; padding: .3rem .2rem; background-image: none;
    text-align: center; text-align-last: center; }

  .tiles { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .tiles .value { font-size: 1.8rem; }
  .tiles article:last-child:nth-child(odd) { grid-column: span 2; }

  fieldset.step { padding: .9rem .9rem .1rem; }
  fieldset.date-parts input { width: 3.6rem; }
  .copy-row { flex-wrap: wrap; }
  .copy-row input { flex-basis: 100%; }
  .toolbar { gap: .6rem; margin-bottom: 1rem; }

  dialog#edit-dialog { padding: 0; }
  dialog#edit-dialog article.modal { max-width: 100vw; width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0;
    border-radius: 0; padding: .8rem; }
  .modal-head { flex-wrap: wrap; }
  .modal-head h3 { font-size: 1.1rem; }

  .bars { gap: 4px; height: 160px; }
  .axis { gap: 4px; font-size: .65rem; }
  .card { padding: 1rem; }
  .hbars li { grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 30px; }
  .section-title h2 { font-size: 1.6rem; }
  .section-title .muted { display: none; }
  .heat .c { height: 32px; }
  .heat-legend .fav { margin-left: 0; width: 100%; }
}
