/* SpVgg Hofdorf-Kiefenholz – FUNino-Meldung
   Matchday team-sheet look. Colors sampled from the club crest. */

@import url('https://fonts.googleapis.com/css2?family=Saira+Condensed:wght@500;600;700;800&family=Figtree:wght@400;500;600;700&display=swap');

:root {
  --white: #ffffff;
  --gold: #f7af1c;
  --gold-soft: #fef3da;
  --blue: #1d5399;
  --blue-dark: #163f73;
  --blue-soft: #eaf0f8;
  --ink: #1d1d1d;
  --muted: #6b7280;
  --line: #e6e8ec;
  --bg: #f4f6f9;
  --danger: #c0392b;
  --ok: #1e7a46;

  --display: "Saira Condensed", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, sans-serif;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(29,29,29,.06), 0 6px 24px rgba(22,63,115,.07);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px 80px; }
.wrap--wide { max-width: 980px; }

/* ---------- Header / kit stripe ---------- */
.masthead { background: var(--white); border-bottom: 1px solid var(--line); }
.masthead__inner {
  max-width: 720px; margin: 0 auto; padding: 18px 16px 0;
  display: flex; align-items: center; gap: 14px;
}
.masthead--wide .masthead__inner { max-width: 980px; }
.crest {
  width: 56px; height: 56px; flex: 0 0 auto;
  border-radius: 12px; background: var(--white);
  border: 1px solid var(--line); padding: 4px;
  object-fit: contain;
}
.masthead__text { min-width: 0; }
.eyebrow {
  font-family: var(--body); font-weight: 700; font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--blue);
  margin: 0;
}
.masthead h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(26px, 7vw, 38px); line-height: .98;
  letter-spacing: .01em; margin: 2px 0 0; text-transform: uppercase;
}
/* diagonal kit rule echoing the crest's gold/blue split */
.kit-rule {
  height: 8px; margin-top: 14px;
  background: repeating-linear-gradient(
    -55deg, var(--gold) 0 22px, var(--blue) 22px 44px);
}

/* ---------- Cards ---------- */
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.section-top { margin-top: 22px; }

.clubbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 18px; flex-wrap: wrap;
}
.clubbar__label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.clubbar__name { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1; margin-top: 2px; }
.counts { display: flex; gap: 8px; }

.count-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: var(--bg); border: 1px solid var(--line);
}
.count-chip .dot { width: 12px; height: 12px; border-radius: 3px; }
.count-chip.is-t1 .dot { background: var(--gold); }
.count-chip.is-t2 .dot { background: var(--blue); }

/* ---------- Add form ---------- */
.add { padding: 16px 18px; }
.add h2, .roster h2 { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing:.02em; text-transform: uppercase; margin: 0 0 12px; }
.add__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 5px; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; height: 46px; padding: 0 13px; font-size: 16px; font-family: var(--body);
  color: var(--ink); background: var(--white);
  border: 1.5px solid var(--line); border-radius: 10px; outline: none;
}
input:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; height: 46px; }
.seg button {
  appearance: none; border: 0; background: var(--white); cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .03em;
  padding: 0 16px; color: var(--ink); border-right: 1.5px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed=true].is-t1 { background: var(--gold); color: var(--ink); }
.seg button[aria-pressed=true].is-t2 { background: var(--blue); color: #fff; }
.seg button:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: -3px; }

.add__row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.add__seg-field { display: flex; flex-direction: column; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; cursor: pointer; font-family: var(--body); font-weight: 700;
  font-size: 15px; height: 46px; padding: 0 18px; border-radius: 10px;
  border: 1.5px solid transparent; display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap; transition: transform .04s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dark); }
.btn--ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn--gold:hover { filter: brightness(.96); }
.btn:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn--sm { height: 38px; font-size: 14px; padding: 0 13px; }
.btn--block { flex: 1; justify-content: center; }

/* ---------- Roster (team sheet) ---------- */
.roster { padding: 8px 18px 18px; }
.group-head {
  display: flex; align-items: center; gap: 10px; margin: 16px 0 8px;
}
.group-head h3 { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .04em; text-transform: uppercase; margin: 0; }
.group-head .n { color: var(--muted); font-weight: 600; font-size: 14px; }

.player {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid var(--line);
}
.player:last-child { border-bottom: 0; }
.badge {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 19px; color: var(--ink);
}
.badge.is-t1 { background: var(--gold); }
.badge.is-t2 { background: var(--blue); color: #fff; }
.player__name { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; }
.player__name .last { font-weight: 700; }
.player__actions { display: flex; gap: 6px; }
.iconbtn {
  appearance: none; border: 1.5px solid var(--line); background: var(--white);
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer; color: var(--muted);
  display: grid; place-items: center;
}
.iconbtn:hover { border-color: var(--blue); color: var(--blue); }
.iconbtn--danger:hover { border-color: var(--danger); color: var(--danger); }
.iconbtn svg { width: 18px; height: 18px; }

/* inline edit */
.player.editing { gap: 8px; flex-wrap: wrap; }
.player.editing input { height: 42px; flex: 1; min-width: 120px; }

.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty strong { color: var(--ink); display: block; font-family: var(--display); font-size: 18px; font-weight: 700; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50; display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

.foot { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 22px; line-height: 1.6; }

/* ---------- Admin ---------- */
.login { max-width: 380px; margin: 60px auto 0; }
.login .card { padding: 24px; }
.login h2 { font-family: var(--display); text-transform: uppercase; letter-spacing: .03em; margin: 0 0 4px; font-size: 24px; }
.login p { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.login .field { margin-bottom: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 22px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .v { font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1; }
.stat .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.stat.t1 .v { color: var(--gold); } .stat.t2 .v { color: var(--blue); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.toolbar .spacer { flex: 1; }

table.clubs { width: 100%; border-collapse: collapse; }
table.clubs th, table.clubs td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.clubs th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
table.clubs td.num, table.clubs th.num { text-align: center; width: 52px; }
table.clubs .cname { font-weight: 700; font-size: 15px; }
table.clubs .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.modal-back { position: fixed; inset: 0; background: rgba(22,63,115,.32); display: none; place-items: center; padding: 16px; z-index: 60; }
.modal-back.show { display: grid; }
.modal { background: #fff; border-radius: var(--radius); padding: 22px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.modal h3 { font-family: var(--display); text-transform: uppercase; margin: 0 0 14px; font-size: 22px; }
.linkbox { background: var(--blue-soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; word-break: break-all; margin: 10px 0 16px; }

/* print: clean team sheets for PDF */
.print-area { display: none; }
@media print {
  body { background: #fff; }
  .masthead, .toolbar, .stats, .card--clubs, .toast, .modal-back, .noprint { display: none !important; }
  .print-area { display: block; }
  .print-club { page-break-inside: avoid; margin-bottom: 26px; }
  .print-club h2 { font-family: var(--display); border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
  .print-grp { margin: 8px 0 12px; }
  .print-grp h4 { margin: 0 0 4px; }
  .print-grp ol { margin: 0; padding-left: 22px; }
  .print-grp li { padding: 2px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .clubbar { flex-direction: column; align-items: flex-start; }
  .add__grid { grid-template-columns: 1fr; }
}

/* ============================================================
   v2 – Vereinsauswahl, Logos, Passwortschutz, Mannschaften
   ============================================================ */

.lead { text-align: center; color: var(--muted); margin: 18px 0 4px; font-size: 15px; }
.h-display { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }

/* club picker grid */
.club-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 20px; }
@media (min-width: 640px) { .club-grid { grid-template-columns: repeat(3, 1fr); } }

.club-card {
  appearance: none; cursor: pointer; text-align: center;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 14px 16px; display: flex; flex-direction: column;
  align-items: center; gap: 12px; transition: transform .06s ease, border-color .15s ease;
}
.club-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.club-card:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: 2px; }
.club-card .cname { font-family: var(--display); font-weight: 700; font-size: 17px; line-height: 1.05; }
.club-card .lock { font-size: 12px; color: var(--muted); font-weight: 600; }

/* logo / initials avatar */
.logo {
  width: 76px; height: 76px; border-radius: 16px; object-fit: contain;
  background: var(--white); border: 1px solid var(--line); padding: 6px;
}
.logo--sm { width: 38px; height: 38px; border-radius: 9px; padding: 3px; }
.logo--lg { width: 92px; height: 92px; }
.logo.is-ph {
  display: grid; place-items: center; font-family: var(--display); font-weight: 800;
  font-size: 26px; color: #fff; background: var(--blue); border: 0; letter-spacing: .02em;
}
.logo--sm.is-ph { font-size: 14px; }
.logo--lg.is-ph { font-size: 32px; }

/* locked / password view */
.lock-view { max-width: 420px; margin: 26px auto 0; text-align: center; }
.lock-view .card { padding: 26px 22px; }
.lock-view .logo { margin: 0 auto 14px; }
.lock-view h2 { margin: 0 0 4px; }
.lock-view p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }

/* club workspace header */
.club-head {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; flex-wrap: wrap;
}
.club-head .meta { flex: 1; min-width: 0; }
.club-head .meta .nm { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; text-transform: uppercase; }
.club-head .meta .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.linklike { background: none; border: 0; color: var(--blue); font-weight: 700; cursor: pointer; font-size: 14px; padding: 6px 4px; }
.linklike:hover { text-decoration: underline; }

/* team card */
.team { padding: 0; overflow: hidden; }
.team + .team { margin-top: 14px; }
.team__head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: var(--blue-soft); border-bottom: 1px solid var(--line);
}
.team.alt .team__head { background: var(--gold-soft); }
.team__name {
  font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: .02em;
  background: transparent; border: 1.5px solid transparent; border-radius: 8px;
  padding: 4px 8px; flex: 1; min-width: 0; color: var(--ink);
}
.team__name:hover { border-color: rgba(0,0,0,.12); }
.team__name:focus-visible { outline: none; border-color: var(--blue); background: #fff; }
.team__count { color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.team__body { padding: 6px 16px 8px; }
.team__add { display: flex; gap: 8px; padding: 10px 16px 16px; flex-wrap: wrap; align-items: flex-end; }
.team__add .field { flex: 1; min-width: 120px; }

.add-team { width: 100%; margin-top: 16px; border-style: dashed; }
