:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --border: #2d3a4d;
    --text: #e8edf4;
    --muted: #8b9cb3;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --rumor: #f59e0b;
    --confirmed: #22c55e;
    --completed: #06b6d4;
    --rejected: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 52px;
    height: 52px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}

.nav-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.nav-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
.nav-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.nav { display: flex; gap: 1.25rem; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 0.9rem; }
.nav a:hover { color: var(--text); text-decoration: none; }

.nav-user-mobile { display: none; }
.nav-backdrop { display: none; }

.user { display: flex; align-items: center; gap: 1rem; font-size: 0.85rem; color: var(--muted); margin-left: auto; }

@media (max-width: 900px) {
    .header-inner {
        padding: 0.85rem 1rem 0.85rem max(1rem, env(safe-area-inset-left, 0px));
        gap: 0.85rem;
        min-height: 56px;
    }

    .nav-toggle { display: flex; }

    .logo {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user { display: none; }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        top: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 90;
        border: 0;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }

    .nav-open .nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 86vw);
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
        padding: calc(5rem + env(safe-area-inset-top, 0px)) 0 calc(1.5rem + env(safe-area-inset-bottom, 0px));
        background: var(--surface);
        border-right: 1px solid var(--border);
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
        z-index: 110;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
    }

    .nav-open .nav {
        transform: translateX(0);
    }

    .nav > a {
        display: block;
        padding: 0.95rem 1.25rem;
        font-size: 1.05rem;
        color: var(--text);
        border-bottom: 1px solid var(--border);
    }

    .nav > a:hover,
    .nav > a:active {
        background: rgba(59, 130, 246, 0.12);
        color: var(--text);
        text-decoration: none;
    }

    .nav-user-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: auto;
        padding: 1.25rem;
        border-top: 1px solid var(--border);
        color: var(--muted);
        font-size: 0.85rem;
    }

    body.nav-open {
        overflow: hidden;
    }
}

.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

h1 { font-size: 1.75rem; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; margin-bottom: 0.75rem; }

.meta { color: var(--muted); margin-bottom: 1.5rem; }

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: var(--border); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
}

.stat-value { display: block; font-size: 2rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-rumor .stat-value { color: var(--rumor); }
.stat-confirmed .stat-value { color: var(--confirmed); }

.section { margin-bottom: 2rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.875rem;
}

.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th { background: rgba(0,0,0,0.2); color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table-wide { font-size: 0.8rem; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-rumor { background: rgba(245,158,11,0.2); color: var(--rumor); }
.badge-confirmed { background: rgba(34,197,94,0.2); color: var(--confirmed); }
.badge-completed { background: rgba(6,182,212,0.2); color: var(--completed); }
.badge-rejected { background: rgba(239,68,68,0.2); color: var(--rejected); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.filters { display: flex; gap: 0.5rem; }
.filters select,
.filters input[type="search"],
.filters .filter-search {
    padding: 0.5rem 0.75rem;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}

.form { max-width: 520px; }
.form label { display: block; margin-bottom: 1rem; font-size: 0.875rem; color: var(--muted); }
.form input, .form select, .form textarea {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.6rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
}

.form .checkbox { display: flex; align-items: center; gap: 0.5rem; }
.form .checkbox input { width: auto; margin: 0; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.875rem; }
.alert-success { background: rgba(34,197,94,0.15); border: 1px solid var(--success); color: var(--success); }
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid var(--error); color: var(--error); }

.empty { color: var(--muted); padding: 1.5rem; background: var(--surface); border-radius: 8px; border: 1px dashed var(--border); }
.empty.warn { border-color: var(--warning); color: var(--warning); }

.muted { color: var(--muted); font-size: 0.85rem; }
.actions { white-space: nowrap; }

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    display: block;
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 16px;
}
.auth-card h1 { text-align: center; }
.auth-card .subtitle { text-align: center; color: var(--muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
    font-size: 0.9rem;
    color: var(--muted);
    cursor: pointer;
}
.auth-remember input { width: auto; margin: 0; }
.auth-ios-hint {
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.4;
}

.quick-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.transfer-item { padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.evaluation-box { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }

.budget-bar { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; height: 2rem; margin: 1rem 0; overflow: hidden; }
.budget-bar-fill { height: 100%; background: var(--primary); opacity: 0.7; transition: width 0.3s; }
.budget-bar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }

.inline-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; max-width: none; }
.inline-form label { margin-bottom: 0; flex: 1; min-width: 140px; }

.compare-stats { list-style: none; padding: 0; }
.compare-stats li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }

.player-profile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
    gap: 2rem;
    align-items: start;
}

.player-profile-content h1 { margin-bottom: 0.5rem; }
.player-profile-content .meta { margin-bottom: 0; }

.player-season-stats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1.5rem; }
.stat-pill {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--muted);
}
.warn-text { color: var(--warning); }

.player-profile-photo {
    position: sticky;
    top: 5rem;
    min-height: 280px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: linear-gradient(180deg, rgba(26, 35, 50, 0.3) 0%, var(--surface) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1rem 0;
}

.player-profile-photo img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    object-position: bottom center;
    display: block;
}

@media (max-width: 900px) {
    .player-profile {
        grid-template-columns: 1fr;
    }

    .player-profile-photo {
        order: -1;
        position: static;
        max-width: 280px;
        margin: 0 auto 1rem;
    }
}

.facts-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0; }
.facts-dl dt { color: var(--muted); font-size: 0.85rem; margin: 0; }
.facts-dl dd { margin: 0 0 0.5rem; }
.facts-list { margin: 0; padding-left: 1.25rem; }
.facts-list-inline { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; list-style: none; padding: 0; }
.facts-list-inline li { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.2rem 0.5rem; font-size: 0.85rem; }
.news-facts-preview { font-size: 0.8rem; display: inline-block; margin-top: 0.2rem; }
.table-compact { font-size: 0.85rem; }
.table-compact th, .table-compact td { padding: 0.35rem 0.5rem; }
.small { font-size: 0.8rem; }

.feed-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}
.feed-status-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.feed-ampel {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.feed-status-green .feed-ampel { background: var(--success); box-shadow: 0 0 6px var(--success); }
.feed-status-yellow .feed-ampel { background: var(--warning); }
.feed-status-red .feed-ampel { background: var(--error); }
.feed-status-gray .feed-ampel { background: var(--muted); }

/* Dashboard kompakt */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.dashboard-header h1 { margin-bottom: 0; }

.feed-status-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
    max-width: 520px;
}
.feed-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.72rem;
    line-height: 1.2;
}
.feed-pill-label { font-weight: 600; }
.feed-pill-time { color: var(--muted); }
.feed-pill-count {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.68rem;
}
.dashboard-window-hint { font-size: 0.72rem; margin: -0.75rem 0 1rem; text-align: right; }
.section-hint { font-size: 0.72rem; }
.text-success { color: var(--success); }
.kickbase-riser-list strong { min-width: 4rem; text-align: right; }

.stats-grid-compact {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 1.25rem;
    gap: 0.65rem;
}
.stats-grid-compact .stat-card { padding: 0.75rem 0.5rem; }
.stats-grid-compact .stat-value { font-size: 1.35rem; }
.stats-grid-compact .stat-label { font-size: 0.75rem; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid-compact { grid-template-columns: repeat(2, 1fr); }
}

.section-compact { margin-bottom: 1.25rem; }
.section-compact h2 { font-size: 1rem; margin-bottom: 0; }
.empty-sm { font-size: 0.85rem; padding: 0.5rem 0; }

.signal-list, .news-compact-list, .transfer-compact-list, .gem-compact-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.signal-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.15rem 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    align-items: center;
}
.signal-item .badge { grid-row: span 2; align-self: center; }
.signal-player { font-weight: 600; grid-column: 2; }
.signal-detail { grid-column: 2; font-size: 0.78rem; }
.signal-time { grid-column: 3; grid-row: span 2; font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

.news-compact-list li, .transfer-compact-list li, .gem-compact-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}
.news-compact-list time, .gem-compact-list .muted { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.news-compact-list a { flex: 1; min-width: 0; }
.gem-compact-list li { justify-content: space-between; }
.gem-compact-list strong { color: var(--success); }

.pagination-sm { margin-top: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.dashboard-footer-note { font-size: 0.72rem; margin-top: 0.5rem; }
.dashboard-footer-note code { font-size: 0.68rem; }

.kicker-layout { align-items: start; }

/* Kickbase Marktwert-Verlauf (Liniendiagramm) */
.kickbase-chart-section { margin-top: 0.5rem; }
.kickbase-chart-hint { font-size: 0.78rem; margin: 0 0 0.75rem; }
.kickbase-chart-svg {
    display: block;
    width: 100%;
    max-width: 720px;
    height: auto;
    margin-bottom: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.kickbase-chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 4; }
.kickbase-chart-line { fill: none; stroke: var(--accent, #4a9eff); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.kickbase-chart-area { fill: rgba(74, 158, 255, 0.12); }
.kickbase-chart-dot { fill: var(--accent, #4a9eff); stroke: var(--bg); stroke-width: 1.5; }
.kickbase-chart-axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.kickbase-chart-last { fill: var(--text); font-size: 12px; font-weight: 600; font-family: inherit; }
.kickbase-history-table { max-width: 420px; font-size: 0.82rem; }
.kickbase-history-table th,
.kickbase-history-table td { padding: 0.35rem 0.5rem; }

.ai-chat-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    max-height: 320px;
    overflow-y: auto;
    margin-top: 1rem;
}
.ai-chat-msg { margin-bottom: 0.75rem; font-size: 0.9rem; }
.ai-chat-user { border-left: 3px solid var(--primary); padding-left: 0.75rem; }
.ai-chat-assistant { border-left: 3px solid var(--success); padding-left: 0.75rem; }
