/* Dienstplan – mobil zuerst, Farben im Stil des Logos: Schwarz, Weiß, Dunkelrot */

:root {
    --bg: #000000;
    --surface: #121212;
    --surface-2: #1e1e1e;
    --text: #ffffff;
    --muted: #a6a6a6;
    --border: #2b2b2b;
    /* Dunkelrot für Flächen (Buttons, Markierungen) mit weißer Schrift */
    --primary: #9e1b1b;
    --primary-hover: #b52222;
    --primary-text: #ffffff;
    --primary-soft: #2b0b0d;
    /* Helleres Rot für Text und Links auf Schwarz, sonst zu wenig Kontrast */
    --accent: #e5484d;
    --success: #4ade80;
    --success-soft: #0f2a19;
    --warning: #fbbf24;
    --warning-soft: #2e2508;
    --danger: #ff6b6b;
    --danger-soft: #2e0f10;
    --info: #7aa7f5;
    --info-soft: #13223b;
    --radius: 14px;
    --tabbar-height: 62px;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 12px; }
h2, h3 { margin: 0; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
strong { font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Gerüst */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--primary);
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: .02em; }
.brand img { display: block; width: 30px; height: 30px; }
.topbar-user { color: var(--muted); font-size: .9rem; }

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 16px calc(var(--tabbar-height) + 32px + env(safe-area-inset-bottom));
}

.tabbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    display: flex;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    height: var(--tabbar-height);
    justify-content: center;
    color: var(--muted);
    font-size: .72rem;
    text-decoration: none;
}

.tabbar a.active { color: var(--accent); font-weight: 600; }
.tabbar a { position: relative; }

.tab-badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 6px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: var(--primary-text);
    font-size: .7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.tabbar svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (min-width: 720px) {
    .tabbar { justify-content: center; gap: 24px; }
    .tabbar a { flex: 0 0 96px; }
}

.guest-container { max-width: 420px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) 16px 40px; }
.guest-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; font-weight: 700; font-size: 1.1rem; letter-spacing: .06em; text-transform: uppercase; }
.guest-brand img { display: block; width: 104px; height: 104px; }
.guest-links { text-align: center; margin-top: 16px; }

/* Bausteine */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.card-accent { border-color: var(--primary); box-shadow: inset 4px 0 0 var(--primary); }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.list-card { padding: 4px 16px; }
.stack > * + * { margin-top: 12px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.page-head h1 { margin-bottom: 8px; }
.section-title { font-size: 1.05rem; margin: 24px 0 10px; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; font-size: .95rem; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.notice { background: var(--warning-soft); color: var(--warning); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: .95rem; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger-outline { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn-block { display: flex; width: 100%; }

.link-button { background: none; border: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.icon-button { background: none; border: 0; color: var(--muted); font-size: 1rem; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; }
.icon-button:hover { background: var(--danger-soft); color: var(--danger); }

.badge, .chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--muted);
}

.chip { background: var(--primary-soft); color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.badge-mine { background: var(--primary); color: var(--primary-text); }
.badge-admin { background: var(--info-soft); color: var(--info); }
.status-draft { background: var(--surface-2); color: var(--muted); }
.status-unreleased { background: var(--warning-soft); color: var(--warning); }
.status-released { background: var(--success-soft); color: var(--success); }
.load-low { background: var(--surface-2); color: var(--muted); }
.load-medium { background: var(--info-soft); color: var(--info); }
.load-high { background: var(--warning-soft); color: var(--warning); }
.load-very_high { background: var(--danger-soft); color: var(--danger); }

.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; margin-bottom: 16px; }
.segmented a { flex: 1; text-align: center; padding: 8px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
.segmented a.active { background: var(--primary); color: var(--primary-text); }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li + li { border-top: 1px solid var(--border); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.list-card > .list-row + .list-row { border-top: 1px solid var(--border); }
.row-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; color: inherit; text-decoration: none; }
.is-inactive { opacity: .55; }

.details { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }

/* Termine */

.event-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
}

.event-card.is-mine { border-color: var(--primary); }
.event-card.is-draft { border-style: dashed; }

.event-date {
    flex: 0 0 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border-radius: 10px;
    padding: 6px 0;
    line-height: 1.1;
}

.event-date .dow, .event-date .mon { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.event-date .day { font-size: 1.35rem; font-weight: 700; }
.event-body { min-width: 0; flex: 1; }
.event-title { font-weight: 600; overflow-wrap: anywhere; }
.event-meta { color: var(--muted); font-size: .88rem; margin: 2px 0 8px; }
.event-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.event-card .event-tags { margin-bottom: 0; }
.event-when { font-size: 1.02rem; margin-bottom: 10px; }
.info-text { overflow-wrap: anywhere; }

.staffing { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.staffing .bar { width: 52px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.staffing .bar span { display: block; height: 100%; background: var(--success); }

.mine-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mine-card .card-title { margin-bottom: 2px; }

.slot-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.slot-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.slot-head h3 { font-size: 1rem; }
.slot-count { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--warning); }
.slot-count.is-full { color: var(--success); }

.people { list-style: none; margin: 0 0 10px; padding: 0; }
.people li { display: flex; align-items: center; justify-content: space-between; min-height: 38px; border-top: 1px solid var(--border); }
.people li:first-child { border-top: 0; }
.people li.is-me { font-weight: 600; }
.people li.free { color: var(--muted); font-style: italic; }
.people .chip { margin-left: 6px; }

.inline-form { display: flex; gap: 8px; }
.inline-form select { flex: 1; min-width: 0; }

.danger-zone { margin-top: 32px; }

/* Formulare */

.form .field { display: block; margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.field > span, .field > legend { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; padding: 0; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; min-width: 0; }
.field-hint { margin-top: -8px; }

input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], select, textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px; /* verhindert Zoom auf iOS */
}

textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.readonly { padding: 10px 12px; background: var(--surface-2); border-radius: 10px; overflow-wrap: anywhere; }
.form-error { display: block; color: var(--danger); font-size: .88rem; margin-top: 6px; }
p.form-error { margin: 10px 0 0; }

.choice-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.choice-list { display: grid; gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span { display: block; padding: 10px 6px; text-align: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .9rem; }
.choice-wide > span { text-align: left; padding: 10px 14px; }
.choice-wide small { display: block; color: var(--muted); font-size: .82rem; }
.choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--primary); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.counts { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; margin-bottom: 6px; }
.count-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; }
.count-row + .count-row, .counts .form-error + .count-row { border-top: 1px solid var(--border); }
.count-row input { width: 84px; text-align: center; }

.copy-field { display: flex; gap: 6px; margin-bottom: 4px; }
.copy-field input { flex: 1; min-width: 0; font-size: .85rem; min-height: 36px; }
