:root {
    --color-bg: #0f1b2d;
    --color-bg-gradient: linear-gradient(160deg, #0f1b2d 0%, #16283f 60%, #1c3350 100%);
    --color-card: #ffffff;
    --color-primary: #1e6f4c;
    --color-primary-dark: #155238;
    --color-text: #1c2733;
    --color-text-muted: #667380;
    --color-border: #e1e5ea;
    --color-error-bg: #fdecec;
    --color-error-text: #a12622;
    --color-success-bg: #e9f7ef;
    --color-success-text: #1e6f4c;
    --radius: 12px;
    --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: var(--color-bg-gradient);
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-logo-banner {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 26px;
}

.auth-logo-banner img {
    width: 100%;
    height: auto;
    display: block;
}

.auth-title {
    text-align: center;
    color: #fff;
    font-weight: 600;
    font-size: 22px;
    margin-bottom: 28px;
    letter-spacing: 0.2px;
}

.card {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.card h1 {
    font-size: 20px;
    margin: 0 0 24px;
    color: var(--color-text);
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.field input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--color-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn:hover { background: var(--color-primary-dark); }

.btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-secondary:hover {
    background: rgba(30, 111, 76, 0.08);
}

.divider {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    margin: 20px 0;
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 18px;
}

.flash-error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.flash-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.hint {
    font-size: 12.5px;
    color: var(--color-text-muted);
    margin-top: 6px;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

/* ---------------- Admin-Layout ---------------- */

.admin-wrapper {
    width: 100%;
    max-width: 880px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    color: #fff;
}

.admin-header h1 {
    font-size: 22px;
    margin: 0;
}

.admin-header .logout-link {
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    text-decoration: none;
}

.admin-header .logout-link:hover { text-decoration: underline; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
    padding: 10px 12px;
    border-bottom: 2px solid var(--color-border);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pending { background: #fff4dc; color: #8a5a00; }
.badge-approved { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-blocked { background: var(--color-error-bg); color: var(--color-error-text); }

.action-form { display: inline-block; margin-right: 6px; }
.action-form:last-child { margin-right: 0; }

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-approve { background: var(--color-primary); color: #fff; }
.btn-approve:hover { background: var(--color-primary-dark); }

.btn-block { background: transparent; color: var(--color-error-text); border: 1px solid var(--color-error-text); }
.btn-block:hover { background: var(--color-error-bg); }

.btn-unblock { background: transparent; color: var(--color-primary); border: 1px solid var(--color-primary); }
.btn-unblock:hover { background: rgba(30, 111, 76, 0.08); }

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    padding: 40px 0;
    font-size: 14px;
}

/* ---------------- Tipp-Eingabe ---------------- */

.matchday-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.matchday-nav a {
    padding: 6px 12px;
    border-radius: 999px;
    background: #eef1f4;
    color: var(--color-text-muted);
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--color-border);
}

.matchday-nav a.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.match-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
}

.match-card:nth-of-type(odd) { background: #eef0f3; }
.match-card:nth-of-type(even) { background: #dfe3e8; }

.match-card:last-child { margin-bottom: 0; }

.match-meta {
    font-size: 12.5px;
    color: var(--color-text-muted);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.match-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.team {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.team.away { justify-content: flex-end; text-align: right; }

.team img { width: 26px; height: 26px; object-fit: contain; }

.tip-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tip-inputs input {
    width: 48px;
    text-align: center;
    padding: 8px 4px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
}

.tip-inputs input:disabled {
    background: #f3f4f6;
    color: var(--color-text-muted);
}

.tip-inputs span { color: var(--color-text-muted); font-weight: 600; }

.lock-note {
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--color-text-muted);
}

.other-tips {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
    font-size: 13px;
}

.other-tips-title {
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.final-score-line {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.final-score-box {
    border: 1px solid var(--color-border);
    background: #fff;
    border-radius: 8px;
    padding: 8px 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.final-score-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.final-score-value {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
}

.other-tips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.other-tip-chip {
    background: #f4f6f8;
    border-radius: 6px;
    padding: 4px 10px;
}

.other-tip-chip.chip-tendency {
    background: #d9ecdf;
    color: #1c4a30;
}

.other-tip-chip.chip-goaldiff {
    background: #a9d9bb;
    color: #143d26;
    font-weight: 500;
}

.other-tip-chip.chip-exact {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

/* ---------------- Platzierungsverlauf ---------------- */

.ranking-chart-wrap {
    overflow-x: auto;
}

.ranking-chart {
    display: block;
    width: 100%;
    height: auto;
    min-width: 480px;
}

.ranking-chart-gridline {
    stroke: var(--color-border);
    stroke-width: 1;
}

.ranking-chart-ranklabel {
    fill: var(--color-text-muted);
    font-size: 11px;
    font-family: inherit;
}

.ranking-chart-mdlabel {
    fill: var(--color-text-muted);
    font-size: 10px;
    font-family: inherit;
}

.ranking-chart-initials {
    fill: #ffffff;
    font-size: 10px;
    font-weight: 700;
    font-family: inherit;
}

.ranking-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 16px;
}

.ranking-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    color: var(--color-text);
}

.ranking-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.sticky-save {
    position: sticky;
    bottom: 16px;
    margin-top: 20px;
}

/* ---------------- Rangliste ---------------- */

.rank-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #eef1f4;
    color: var(--color-text);
    font-weight: 700;
    font-size: 13px;
}

.rank-number.gold   { background: #f7dd9b; color: #6b4c00; }
.rank-number.silver { background: #dfe3e7; color: #46505a; }
.rank-number.bronze { background: #e8c2a0; color: #6b3d10; }

.data-table tr.own-row {
    background: rgba(30, 111, 76, 0.06);
}

.data-table td.points-total {
    font-weight: 700;
}

.points-breakdown {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ---------------- Bonusfragen ---------------- */

.field textarea,
.field select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}

.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.question-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
}

.question-card:last-child { margin-bottom: 0; }

.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.badge-type {
    background: #eaf1fb;
    color: #2255a4;
}

.question-text {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.answer-row {
    display: flex;
    gap: 8px;
}

.answer-row input[type="text"],
.answer-row select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}

.answer-result {
    margin-top: 10px;
    font-size: 13.5px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.answer-result .own-answer.correct { color: var(--color-success-text); font-weight: 600; }
.answer-result .own-answer.incorrect { color: var(--color-error-text); font-weight: 600; }

.resolve-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
    display: flex;
    gap: 8px;
}

.resolve-form input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
}

/* ---------------- Bezahlstatus ---------------- */

.amount-input {
    width: 90px;
    padding: 7px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    text-align: right;
}

.paid-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.pot-highlight {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form .field { margin-bottom: 0; }
.inline-form .field input,
.inline-form .field select { width: auto; }

.rule-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.rule-row:last-child { border-bottom: none; }

.btn-delete {
    background: transparent;
    color: var(--color-error-text);
    border: 1px solid var(--color-error-text);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
}

.btn-delete:hover { background: var(--color-error-bg); }

.payout-tie {
    color: var(--color-text-muted);
    font-size: 12px;
}

/* ---------------- Lustige Statistiken (Fakten-Kacheln) ---------------- */

.fun-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.fun-stat-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 16px 18px;
    background: #f8f9fb;
}

.fun-stat-icon {
    font-size: 22px;
    margin-bottom: 6px;
}

.fun-stat-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.fun-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.fun-stat-sub {
    font-size: 12.5px;
    color: var(--color-text-muted);
}

.fun-stat-card.wide {
    grid-column: 1 / -1;
}

.fun-stat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fun-stat-list-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

@media (max-width: 600px) {
    .fun-stats-grid { grid-template-columns: 1fr; }
}

/* ---------------- Mailversand ---------------- */

.recipient-list {
    margin-top: 10px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 4px 12px;
}

.recipient-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0f2f4;
}

.recipient-item:last-child { border-bottom: none; }

/* ---------------- Diskussion / Kommentare ---------------- */

.comments-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.comment-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.comment-item:last-child { border-bottom: none; }

.comment-meta {
    font-size: 12.5px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-message {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.comment-delete {
    background: none;
    border: none;
    color: var(--color-error-text);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    text-decoration: underline;
}

.comment-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.comment-form textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

@media (max-width: 480px) {
    .comment-form { flex-wrap: wrap; }
    .comment-form textarea { flex: 1 1 100%; }
    .comment-form button { width: 100%; }
}

/* ---------------- Sidebar-Layout ---------------- */

body.app-body {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    background: #eef1f4;
    padding: 0;
    min-height: 100vh;
}

.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--color-bg);
    background: linear-gradient(180deg, #0f1b2d 0%, #16283f 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 22px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    padding: 16px 22px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 190px;
    height: auto;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sidebar-section-title {
    padding: 18px 22px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar nav a {
    display: block;
    padding: 10px 22px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: background 0.12s ease, color 0.12s ease;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 600;
    border-left-color: var(--color-primary);
}

.nav-badge {
    display: inline-block;
    background: #e0473e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 7px;
    margin-left: 4px;
}

/* ---------------- News-Feed ---------------- */

.news-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.news-item:last-child { border-bottom: none; }

.news-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 30px;
    text-align: center;
}

.news-body {
    flex: 1;
    min-width: 0;
}

.news-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.news-time {
    font-weight: 400;
    font-size: 12px;
    white-space: nowrap;
}

.news-message {
    font-size: 13.5px;
    color: var(--color-text-muted);
    margin-top: 3px;
    line-height: 1.5;
}

.user-box {
    padding: 16px 22px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 12px;
    font-size: 13px;
}

.user-box-name {
    color: #fff;
    font-weight: 600;
    margin-bottom: 2px;
}

.user-box-role {
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 12px;
    font-size: 12px;
}

.user-box a {
    display: block;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 12.5px;
    padding: 5px 0;
}

.user-box a:hover {
    color: #fff;
}

.app-content {
    flex: 1;
    padding: 32px 40px 60px;
    max-width: 1040px;
}

.page-title {
    font-size: 24px;
    color: var(--color-text);
    margin: 0 0 20px;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

@media (max-width: 820px) {
    .app-shell {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: column;
        padding: 0;
        align-items: stretch;
    }
    .sidebar-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
    }
    .sidebar .brand {
        padding: 0;
        border-bottom: none;
        margin-bottom: 0;
        flex: 1;
        min-width: 0;
    }
    .brand-logo {
        max-width: 160px;
    }
    .hamburger-btn {
        display: block;
        flex-shrink: 0;
    }
    .sidebar nav#sidebarNav {
        display: none;
        flex-direction: column;
        padding: 4px 12px 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    .sidebar nav#sidebarNav.open {
        display: flex;
    }
    .sidebar-section-title {
        padding: 12px 10px 4px;
        margin: 0;
    }
    .sidebar nav a {
        padding: 11px 12px;
        border-left: none;
        border-radius: 8px;
    }
    .sidebar nav a.active {
        border-left: none;
    }
    .user-box {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0;
        padding: 10px 16px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 16px;
        flex-wrap: wrap;
    }
    .user-box-name, .user-box-role { display: none; }
    .user-box a { padding: 4px 0; }
    .app-content {
        padding: 18px;
    }
}

@media (max-width: 480px) {
    body { padding: 14px; }
    .card { padding: 20px; }
    .app-content { padding: 14px; }
    .page-title { font-size: 19px; margin-bottom: 14px; }
    .auth-logo-banner { margin-bottom: 18px; }

    .match-teams { gap: 6px; }
    .team { font-size: 12.5px; gap: 5px; }
    .team img { width: 20px; height: 20px; }
    .tip-inputs { gap: 4px; }
    .tip-inputs input { width: 38px; padding: 7px 2px; font-size: 14px; }
    .match-meta { flex-direction: column; gap: 2px; }

    .form-grid { grid-template-columns: 1fr; }

    .answer-row { flex-wrap: wrap; }
    .answer-row input[type="text"], .answer-row select { flex: 1 1 100%; }
    .answer-row button { flex: 1 1 100%; }

    .resolve-form { flex-wrap: wrap; }
    .resolve-form input[type="text"] { flex: 1 1 100%; }
    .resolve-form button { width: 100%; }

    .rule-row { flex-wrap: wrap; gap: 8px; }

    .inline-form .field { flex: 1 1 100%; }
    .inline-form .field input,
    .inline-form .field select { width: 100%; }
    .inline-form button { width: 100%; }

    .admin-header { flex-direction: column; align-items: flex-start; gap: 8px; }

    .match-card, .question-card { padding: 12px 14px; }
    .card h1 { font-size: 17px; }
}

/* Tabellen auf schmalen Bildschirmen horizontal scrollbar statt gequetscht */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll.table-wide .data-table {
    min-width: 460px;
}
