:root {
    --green: #0e7c3a;
    --green-dark: #0a5f2c;
    --green-light: #e8f5ee;
    --ink: #1c2530;
    --muted: #6b7684;
    --line: #e3e7ec;
    --bg: #f5f7f9;
    --gold: #c9a227;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16,24,32,.06), 0 8px 24px rgba(16,24,32,.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
    background: linear-gradient(135deg, #123a28 0%, #0e7c3a 100%);
    color: #fff;
}
.site-header .wrap {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo {
    width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.15);
    display: grid; place-items: center; font-size: 20px;
}
.brand .logo-img {
    width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
    background: #000; border: 2px solid rgba(255,255,255,.5);
}
.brand b { font-size: 18px; letter-spacing: .2px; display: block; }
.brand small { color: rgba(255,255,255,.75); font-size: 12px; }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
    color: rgba(255,255,255,.85); padding: 8px 14px; border-radius: 999px;
    font-size: 14px; font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.14); color: #fff; text-decoration: none; }
.nav a.active { background: #fff; color: var(--green-dark); }

/* Page */
main { padding: 32px 0 56px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 4px; font-size: 28px; }
.page-head p { margin: 0; color: var(--muted); }

/* Hero */
.hero {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 40px; margin-bottom: 28px; border: 1px solid var(--line);
}
.hero h1 { margin: 0 0 8px; font-size: 32px; }
.hero p { margin: 0 0 20px; color: var(--muted); max-width: 60ch; }
.hero .btns { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
    display: inline-block; padding: 11px 20px; border-radius: 10px; font-weight: 600;
    font-size: 15px; cursor: pointer; border: 1px solid transparent; transition: .15s;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--green); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green); text-decoration: none; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.stat .n { font-size: 30px; font-weight: 700; color: var(--green-dark); line-height: 1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 6px; text-transform: uppercase; letter-spacing: .04em; }

/* Cards */
.card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.card-head {
    padding: 16px 20px; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 17px; }
.card-head .tag {
    background: var(--green-light); color: var(--green-dark); font-size: 12px;
    font-weight: 600; padding: 3px 10px; border-radius: 999px;
}
.card-body { padding: 6px 4px; }

/* Table */
.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; white-space: nowrap; }
table.tbl thead th {
    color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 2px solid var(--line); font-weight: 600;
}
table.tbl tbody tr { border-bottom: 1px solid var(--line); }
table.tbl tbody tr:last-child { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fafcfb; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank {
    display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
    background: #eef1f4; font-weight: 700; font-size: 13px; color: var(--ink);
}
.rank.r1 { background: var(--gold); color: #fff; }
.rank.r2 { background: #b8c0c8; color: #fff; }
.rank.r3 { background: #cd8b52; color: #fff; }
.akt { font-weight: 700; color: var(--green-dark); }
.dim { color: #c2c9d0; }
.badge-l {
    background: #eef1f4; color: var(--muted); font-size: 11px; font-weight: 700;
    padding: 1px 6px; border-radius: 6px; margin-left: 6px;
}
.muted { color: var(--muted); }

/* Empty state */
.empty { background:#fff; border:1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align:center; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 24px; color: var(--muted); font-size: 13px; background:#fff; }
.site-footer .wrap { display:flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sponsor-wrap { justify-content: center !important; margin-bottom: 16px; }
.sponsor-strip { max-width: 100%; height: auto; opacity: .92; }

/* Offizieller Titelblock (wie Vorlage) */
.liga-kopf {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 22px 26px; margin-bottom: 22px;
    display: grid; grid-template-columns: 72px 1fr 72px; gap: 18px; align-items: center;
}
.liga-kopf .logo-osb, .liga-kopf .logo-bl { width: 72px; height: 72px; object-fit: contain; }
.liga-kopf .logo-bl { border-radius: 50%; }
.liga-kopf .titel { text-align: center; }
.liga-kopf .titel .t1 { font-size: 20px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.liga-kopf .titel .t2 { font-size: 16px; font-weight: 700; color: var(--green-dark); text-transform: uppercase; }
.liga-kopf .titel .t3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.liga-kopf .titel .t4 { margin-top: 6px; font-size: 14px; font-weight: 600; }
.liga-meta {
    display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 20px; font-size: 13.5px;
    background: var(--green-light); border: 1px solid #bfe6cd; border-radius: 10px; padding: 12px 16px;
}
.liga-meta b { color: var(--green-dark); }

/* Volltabelle (Setzliste offiziell) */
.offiziell table.tbl th, .offiziell table.tbl td { padding: 6px 8px; font-size: 13px; }
.offiziell .team-title { font-weight: 800; font-size: 15px; }
.team-block { padding: 0; }
.team-summary {
    list-style: none; cursor: pointer; padding: 14px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border-bottom: 1px solid transparent;
}
.team-block[open] .team-summary { border-bottom-color: var(--line); }
.team-summary::-webkit-details-marker { display: none; }
.team-summary::before {
    content: '▸'; color: var(--green); font-size: 13px; margin-right: 8px; transition: transform .15s;
    display: inline-block;
}
.team-block[open] .team-summary::before { transform: rotate(90deg); }
.team-summary:hover { background: #fafcfb; }

/* Begegnungen (Duell-Ansicht wie Vorlage) */
.begegnung { margin-bottom: 22px; }
.beg-head {
    background: linear-gradient(135deg, #123a28 0%, #0e7c3a 100%); color: #fff;
    padding: 12px 18px;
}
.beg-nr {
    font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .85;
    text-align: center; margin-bottom: 8px;
}
.beg-teams {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    gap: 6px 14px; font-size: 16px;
}
.beg-team { font-weight: 700; text-align: right; }
.beg-team-r { text-align: left; }
.beg-team a { color: #fff; }
.beg-team.sieger { color: #ffe08a; }
.beg-score { display: flex; flex-direction: column; align-items: center; }
.beg-mp {
    font-size: 20px; font-weight: 800; background: rgba(255,255,255,.15);
    padding: 2px 12px; border-radius: 8px; white-space: nowrap;
}
.beg-mp-label { font-size: 11px; opacity: .8; margin-top: 2px; }
.beg-tbl { min-width: 700px; }
.beg-tbl th, .beg-tbl td { padding: 5px 7px; font-size: 12.5px; text-align: center; }
.beg-tbl th:nth-child(2), .beg-tbl td:nth-child(2),
.beg-tbl th:nth-child(16), .beg-tbl td:nth-child(16) { text-align: left; min-width: 120px; }
.beg-tbl .sum { font-weight: 700; background: #f6f8f7; }
.beg-tbl .sep { background: #f0f3f1; }
.beg-tbl .sep.sieger { color: var(--green-dark); font-weight: 800; }
.beg-tbl tr.beg-dp td { color: #9aa4ad; font-size: 11px; padding-top: 0; padding-bottom: 4px; border: 0; }
.beg-tbl tr.beg-main td { border-bottom: 0; }
.offiziell tr.summe td { border-top: 2px solid var(--ink); font-weight: 700; background: #f3f6f4; }
.offiziell tr.leer td { color: #c2c9d0; }

@media print {
    .site-header, .site-footer, .no-print, .btns, .btn { display: none !important; }
    body { background: #fff; }
    .card, .liga-kopf { box-shadow: none; border-color: #999; }
    main { padding: 0; }
    .offiziell table.tbl th, .offiziell table.tbl td { padding: 3px 5px; font-size: 11px; }
    a { color: #000; text-decoration: none; }
    /* Beim Drucken alle Teams aufklappen */
    details .card-body { display: block !important; }
    .team-summary::before { display: none; }
    details:not([open]) .card-body { display: block !important; }
}

/* Forms */
.auth-card {
    max-width: 420px; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px;
}
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
    font-size: 15px; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
    outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-error { display: block; color: #c0392b; font-size: 12.5px; margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 14px; color: var(--muted); }
.check input { width: auto; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-success { background: var(--green-light); color: var(--green-dark); border: 1px solid #bfe6cd; }
.flash-error { background: #fdecea; color: #b0281a; border: 1px solid #f5c6c0; }
.flash-warning { background: #fff7e6; color: #8a6100; border: 1px solid #f3e0b3; }

.eingabe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

.verw-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.verw-tabs a { background: #fff; border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.verw-tabs a:hover { border-color: var(--green); text-decoration: none; }
.verw-h2 { font-size: 20px; margin: 34px 0 14px; padding-top: 10px; border-top: 2px solid var(--line); scroll-margin-top: 90px; }
.link-danger { color: #c0392b; }

button[disabled] { opacity: .65; cursor: default; }
[data-attach-loading].jax-attach-loader::after {
    content: ''; display: inline-block; width: 13px; height: 13px; margin-left: 8px;
    border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%;
    vertical-align: -2px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .hero { padding: 28px 22px; }
    .hero h1 { font-size: 26px; }
    .eingabe-grid { grid-template-columns: 1fr; }
}

/* Titelblock auf schmalen Bildschirmen: beide Logos oben nebeneinander, Titel darunter */
@media (max-width: 600px) {
    .liga-kopf {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px 28px;
        padding: 16px 14px;
        text-align: center;
    }
    .liga-kopf .logo-osb { order: 1; width: 52px; height: 52px; }
    .liga-kopf .logo-bl  { order: 2; width: 52px; height: 52px; }
    .liga-kopf .titel    { order: 3; flex: 1 0 100%; }
    .liga-kopf .titel .t1 { font-size: 16px; overflow-wrap: anywhere; }
    .liga-kopf .titel .t2 { font-size: 14px; overflow-wrap: anywhere; }
    .liga-kopf .titel .t3 { font-size: 12px; }
    .nav { gap: 2px; }
    .nav a { padding: 7px 11px; }
    .beg-teams { font-size: 14px; gap: 8px; }
    .beg-mp { font-size: 17px; padding: 2px 9px; }
}
