/* Schichtplan – Oberfläche */

:root {
    --bg: #0c0d10;
    --flaeche: #16181d;
    --flaeche-2: #1e2127;
    --linie: rgba(255, 255, 255, .08);
    --linie-stark: rgba(255, 255, 255, .16);
    --text: #f2f3f5;
    --text-leise: #8d919c;
    --akzent: #8b8dff;
    --akzent-weich: rgba(139, 141, 255, .16);
    --rot: #ff4d5e;
    --gruen: #4bd07f;
    --radius: 16px;
    --safe-oben: env(safe-area-inset-top, 0px);
    --safe-unten: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    overscroll-behavior-y: none;
}

body.app { height: 100dvh; overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

.zahl { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Login */

body.tor {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
}

.tor-box { width: 100%; max-width: 340px; text-align: center; }
.tor-logo { color: var(--akzent); margin-bottom: 18px; }
.tor-box h1 { font-size: 26px; margin-bottom: 6px; }
.tor-text { color: var(--text-leise); font-size: 14px; margin: 0 0 22px; }
.tor-fehler {
    background: rgba(255, 77, 94, .12);
    border: 1px solid rgba(255, 77, 94, .35);
    color: #ffb3bb;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    margin: 0 0 16px;
}
.tor-box form { display: grid; gap: 10px; }
.tor-box input[type=password] {
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: 14px;
    padding: 14px 16px;
    text-align: center;
}
.tor-merken { font-size: 14px; color: var(--text-leise); display: flex; gap: 8px; align-items: center; justify-content: center; }
.tor-box button {
    background: var(--akzent);
    color: #10111a;
    font-weight: 700;
    border-radius: 14px;
    padding: 14px;
}

/* ------------------------------------------------------------- Grundgerüst */

#wrap { display: flex; flex-direction: column; height: 100dvh; }

#ansicht {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: calc(var(--safe-oben) + 8px) 12px 24px;
}

#tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    background: rgba(18, 19, 24, .92);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--linie);
    padding: 6px 4px calc(var(--safe-unten) + 6px);
}
#tabs button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    color: var(--text-leise);
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 12px;
}
#tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tabs button.aktiv { color: var(--text); }
#tabs button.aktiv svg { stroke: var(--akzent); }

/* ------------------------------------------------------------------ Karten */

.karte {
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
}
.karte h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-leise); margin-bottom: 10px; }

.zeile { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--linie); }
.zeile:last-child { border-bottom: 0; }
.zeile .links { min-width: 0; }
.zeile .titel { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .unter { font-size: 12.5px; color: var(--text-leise); }
.zeile .wert { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.zeile.gross .wert { font-size: 19px; }

/* -------------------------------------------------------------- Kalender */

.monatskopf { display: flex; align-items: center; gap: 6px; margin: 4px 2px 12px; }
.monatskopf h1 { font-size: 27px; flex: 1; }
.monatskopf h1 small { display: block; font-size: 12px; font-weight: 600; color: var(--text-leise); letter-spacing: 0; }
.rundknopf {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    display: grid; place-items: center;
    color: var(--text);
}
.rundknopf svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.palette {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 2px 2px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.palette::-webkit-scrollbar { display: none; }
.pinsel {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px 7px 9px;
    border-radius: 999px;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    transition: transform .12s ease;
}
.pinsel .punkt { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.pinsel .std { color: var(--text-leise); font-weight: 500; font-size: 12px; }
.pinsel.gewaehlt { background: #fff; color: #14151a; border-color: #fff; }
.pinsel.gewaehlt .std { color: #52555e; }
.pinsel.radierer .punkt { background: none; border: 1.5px dashed var(--text-leise); }
.pinsel:active { transform: scale(.95); }

.hinweis-malen {
    font-size: 12.5px;
    color: var(--akzent);
    background: var(--akzent-weich);
    border-radius: 10px;
    padding: 7px 11px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}
.hinweis-malen button { color: var(--akzent); font-weight: 700; font-size: 12.5px; }

.wochentage {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 4px;
}
.wochentage span {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-leise);
    letter-spacing: .04em;
}
.wochentage span.we { color: #5f636e; }

.raster {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    touch-action: pan-y;
}
.raster.malmodus { touch-action: none; user-select: none; }

.tag {
    position: relative;
    min-height: 74px;
    background: var(--flaeche);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 4px 3px 3px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}
.tag.fremd { opacity: .38; }
.tag.we { background: #131418; }
.tag.heute .nummer { background: var(--text); color: #14151a; }
.tag.gewaehlt { border-color: var(--akzent); box-shadow: 0 0 0 1px var(--akzent) inset; }
.tag.ueberstunden::after {
    content: "";
    position: absolute;
    top: 5px; right: 5px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--rot);
    box-shadow: 0 0 0 2px var(--flaeche);
}
.tag .nummer {
    align-self: flex-start;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}
.tag .marke {
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.15;
    color: #17181c;
    border-radius: 5px;
    padding: 2.5px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}
.tag .marke.mit-ueb { box-shadow: 0 0 0 1.5px var(--rot); }
.tag .mehr { font-size: 10px; color: var(--text-leise); padding-left: 4px; }

.monatsleiste {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.kachel {
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: 14px;
    padding: 11px 12px;
}
.kachel .label { font-size: 11px; color: var(--text-leise); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kachel .zahl { font-size: 17px; font-weight: 700; margin-top: 3px; }
.kachel .zahl.plus { color: var(--gruen); }
.kachel .zahl.minus { color: var(--rot); }

/* ------------------------------------------------------------------ Sheet */

.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-hintergrund { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); animation: ein .18s ease; }
.sheet-inhalt {
    position: relative;
    width: 100%;
    max-height: 88dvh;
    overflow-y: auto;
    background: var(--flaeche-2);
    border-radius: 22px 22px 0 0;
    border-top: 1px solid var(--linie-stark);
    padding: 8px 16px calc(var(--safe-unten) + 20px);
    animation: hoch .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes ein { from { opacity: 0 } }
@keyframes hoch { from { transform: translateY(14%) } }

.griff { width: 38px; height: 4px; border-radius: 2px; background: var(--linie-stark); margin: 4px auto 12px; }
.sheet-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-kopf h2 { font-size: 20px; text-transform: none; letter-spacing: -.02em; color: var(--text); }
.sheet-kopf .neben { font-size: 13px; color: var(--text-leise); }

/* ---------------------------------------------------------------- Formular */

.feld { margin-bottom: 12px; }
.feld > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-leise); margin-bottom: 5px; }
.feld .hilfe { font-size: 12px; color: var(--text-leise); margin-top: 5px; line-height: 1.35; }
input[type=text], input[type=number], input[type=password], input[type=time], input[type=date], input[type=month], select, textarea {
    width: 100%;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: 12px;
    padding: 11px 13px;
    appearance: none;
}
textarea { min-height: 72px; resize: vertical; }
.paar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drei { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.schalter { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--linie); }
.schalter:last-of-type { border-bottom: 0; }
.schalter span { font-size: 14.5px; }
.schalter input { width: 46px; height: 28px; }

.knopfreihe { display: flex; gap: 8px; margin-top: 14px; }
.knopf {
    flex: 1;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: 13px;
    padding: 13px;
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    color: var(--text);
}
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #10111a; }
.knopf.gefahr { color: var(--rot); border-color: rgba(255, 77, 94, .3); }
.knopf.schmal { flex: 0 0 auto; padding: 13px 16px; }
.knopf:active { opacity: .75; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    font-size: 13.5px;
    font-weight: 600;
}
.chip .punkt { width: 10px; height: 10px; border-radius: 50%; }
.chip.an { background: #fff; color: #14151a; border-color: #fff; }

.schnellzeit { display: flex; gap: 6px; flex-wrap: wrap; }
.schnellzeit button {
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    font-size: 13.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.schnellzeit button.rot { color: var(--rot); }

.eintrag-karte {
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 10px;
}
.eintrag-kopf { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.eintrag-kopf .punkt { width: 12px; height: 12px; border-radius: 4px; }
.eintrag-kopf .name { font-weight: 700; flex: 1; }
.eintrag-kopf .geld { font-weight: 700; font-variant-numeric: tabular-nums; }
.eintrag-meta { font-size: 12.5px; color: var(--text-leise); margin-bottom: 9px; }
.eintrag-meta .ueb { color: var(--rot); font-weight: 700; }

.liste-leer { text-align: center; color: var(--text-leise); font-size: 14px; padding: 26px 10px; }

.balken { height: 6px; border-radius: 3px; background: var(--flaeche-2); overflow: hidden; margin-top: 6px; }
.balken i { display: block; height: 100%; background: var(--akzent); border-radius: 3px; }

.verlauf-zeile { display: grid; grid-template-columns: 74px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; }
.verlauf-zeile .m { font-size: 12.5px; color: var(--text-leise); font-weight: 600; }
.verlauf-zeile .b { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.verlauf-zeile .b i { display: block; height: 100%; background: linear-gradient(90deg, var(--akzent), #b7a6ff); }
.verlauf-zeile .g { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

#toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--safe-unten) + 84px);
    transform: translateX(-50%) translateY(20px);
    background: #eceef3;
    color: #14151a;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 16px;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 90;
    max-width: 86vw;
    text-align: center;
}
#toast.an { opacity: 1; transform: translateX(-50%) translateY(0); }

.zeilenliste { display: grid; gap: 8px; }
.art-zeile {
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: 14px;
    padding: 12px;
    width: 100%;
    text-align: left;
}
.art-zeile .punkt { width: 14px; height: 14px; border-radius: 5px; flex: 0 0 auto; }
.art-zeile .mitte { flex: 1; min-width: 0; }
.art-zeile .name { font-weight: 600; }
.art-zeile .meta { font-size: 12.5px; color: var(--text-leise); }
.art-zeile .geld { font-weight: 700; font-variant-numeric: tabular-nums; }
.art-zeile.inaktiv { opacity: .45; }

.farbwahl { display: flex; flex-wrap: wrap; gap: 8px; }
.farbwahl button { width: 32px; height: 32px; border-radius: 9px; border: 2px solid transparent; }
.farbwahl button.an { border-color: #fff; }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
