:root {
    color-scheme: light;
    --bg: #f4f3ef;
    --surface: #ffffff;
    --surface-2: #f7f6f2;
    --border: #ddd9d0;
    --text: #201f1c;
    --text-secondary: #6b675f;
    --text-muted: #96918685;
    --accent: #185fa5;
    --danger: #a32d2d;
    --success: #3b6d11;
    --warning: #854f0b;
    --radius: 12px;
    --not-needed-bg: #2c2c2a;
    --not-needed-text: #d3d1c7;
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 12px 12px 80px; }

a { color: var(--accent); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.topbar h1 { font-size: 18px; font-weight: 600; margin: 0; }
.topbar .club { font-size: 12px; color: var(--text-muted); margin: 0; }
.topbar-title { display: flex; align-items: center; gap: 10px; }
.club-logo { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.portal-back { display: block; font-size: 11px; color: var(--text-muted); text-decoration: none; margin-bottom: 4px; }

.pill {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--surface-2);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.pill.admin { background: #faeeda; color: #633806; }
.pill.unlocked { background: #eaf3de; color: #27500a; }

.admin-banner {
    background: #faeeda;
    color: #633806;
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.admin-banner .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}
.btn.primary { border: 2px solid var(--accent); font-weight: 600; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; color: var(--text-secondary); }

.nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.nav-row .range { font-size: 13px; font-weight: 600; }

.past-toggle {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 6px 0;
    margin-bottom: 8px;
}
.past-content { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; }

.week-label { font-size: 12px; color: var(--text-muted); margin: 16px 0 6px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

.match-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    text-decoration: none;
    color: var(--text);
}
.match-card:hover { border-color: var(--accent); }
.match-occ-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dots { display: flex; gap: 5px; }
.dot {
    width: 12px; height: 12px; border-radius: 50%; display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.25);
}
.match-title { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.match-sub { font-size: 12px; color: var(--text-secondary); margin: 0 0 6px; }
.match-occ { font-size: 11px; margin: 0; }
.occ-full { color: var(--success); }
.occ-partial { color: var(--warning); }
.occ-empty { color: var(--danger); }

.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.badge { font-size: 11px; padding: 2px 9px; border-radius: 20px; }
.badge.fixed-badge { background: #f1efe8; color: #444441; }
.badge.not-needed-badge { background: var(--not-needed-bg); color: var(--not-needed-text); }

footer.appfooter { text-align: center; padding: 20px 0; }
footer.appfooter a { font-size: 11px; color: var(--text-muted); text-decoration: none; margin: 0 8px; }

.sheet-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    align-items: flex-end;
    justify-content: center;
}
.sheet {
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    padding: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
}
@media (min-width: 640px) {
    .sheet-overlay { align-items: center; }
    .sheet { border-radius: 16px; }
}

.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
.sheet-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.sheet-head p { font-size: 15px; margin: 2px 0 0; }
.sheet-close { font-size: 20px; text-decoration: none; color: var(--text-secondary); line-height: 1; padding: 4px 8px; }
.sheet-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.sheet-head-right .badge { white-space: nowrap; }
.aufbau-abbau-field { display: flex; align-items: center; gap: 6px; }
.aufbau-abbau-field label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.aufbau-abbau-field select { font-size: 12px; padding: 4px 6px; }

.note-box {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--surface-2);
    padding: 8px 10px;
    border-radius: 8px;
    margin: 0 0 12px;
}

.pin-form { display: flex; flex-direction: column; gap: 10px; }
.pin-form .row { display: flex; gap: 8px; }

input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="file"], select, textarea {
    width: 100%;
    font-size: 14px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}
label { font-size: 12px; color: var(--text-secondary); display: block; margin-bottom: 4px; }

.service-columns { display: grid; grid-template-columns: 1fr; gap: 18px; }
.service-column-title {
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.02em;
}
@media (min-width: 620px) {
    .service-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .sheet { max-width: 700px; }
}
@media (min-width: 940px) {
    .service-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sheet { max-width: 980px; }
}
.service-row { margin-bottom: 12px; }
.service-row .row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 8px; }
.service-row.not-needed { opacity: 0.55; }
.service-row.not-needed label { text-decoration: line-through; }
.admin-preset-select { max-width: 150px; font-size: 12px; padding: 4px 6px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.field-grid .full { grid-column: 1 / -1; }

.msg { border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 10px; }
.msg.error { background: #fcebeb; color: #791f1f; }
.msg.success { background: #eaf3de; color: #27500a; }
