@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=Barlow:wght@400;500;600;700&display=swap');

:root {
    --rot: #e30613;
    --rot-dunkel: #a30510;
    --schwarz: #17181a;
    --flaeche: #212327;
    --flaeche-hell: #2b2e33;
    --rand: #3a3d43;
    --weiss: #f5f6f7;
    --text-mute: #9aa0a8;
    --gruen: #2e9e4f;
    --orange: #f5941f;
    --kritisch: #ff3b30;
    --radius: 16px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background: var(--schwarz);
    background-image:
        linear-gradient(160deg, #1c1d20 0%, var(--schwarz) 45%),
        repeating-linear-gradient(135deg, rgba(227, 6, 19, 0.05) 0 22px, transparent 22px 44px);
    color: var(--weiss);
    font-family: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, .headline {
    font-family: 'Barlow Condensed', system-ui, sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: linear-gradient(180deg, var(--rot) 0%, var(--rot-dunkel) 100%);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar .headline {
    font-size: 26px;
    color: var(--weiss);
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar .headline .flamme {
    font-size: 22px;
}

.topbar .headline .titel-block {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.topbar .headline .wache {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    opacity: 0.85;
    margin-top: 3px;
}

.topbar .user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 18px;
    font-weight: 700;
}

.topbar .user .rolle-tag {
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

main {
    flex: 1;
    padding: 20px 20px 100px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

.navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--flaeche);
    border-top: 1px solid var(--rand);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.navbar a {
    flex: 1;
    text-align: center;
    padding: 12px 4px 10px;
    color: var(--text-mute);
    text-decoration: none;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-top: 3px solid transparent;
}

.navbar a .icon {
    font-size: 22px;
}

.navbar a.active {
    color: var(--weiss);
    border-top-color: var(--rot);
    background: rgba(227, 6, 19, 0.08);
}

.navbar a .badge {
    position: absolute;
    transform: translate(14px, -8px);
    background: var(--rot);
    color: white;
    border-radius: 999px;
    font-size: 11px;
    padding: 1px 6px;
    font-weight: 700;
}

.card {
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.tile {
    background: var(--flaeche-hell);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 92px;
    justify-content: center;
}

.tile:active {
    transform: scale(0.96);
}

.tile.selected {
    border-color: var(--rot);
    background: rgba(227, 6, 19, 0.15);
}

.tile .name {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: 0.02em;
}

.tile .sub {
    font-size: 13px;
    color: var(--text-mute);
}

/* Kachel, die zu einer anderen Seite fuehrt statt einen Artikel zu buchen. */
.tile.tile-link {
    background: transparent;
    border-style: dashed;
    color: inherit;
    text-decoration: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 12px;
    border: none;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    background: var(--flaeche-hell);
    color: var(--weiss);
    border: 1px solid var(--rand);
    min-height: 52px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(180deg, var(--rot) 0%, var(--rot-dunkel) 100%);
    border-color: var(--rot-dunkel);
    box-shadow: 0 4px 14px rgba(227, 6, 19, 0.4);
}

.btn-ghost {
    background: transparent;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
}

.keypad button {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid var(--rand);
    background: var(--flaeche-hell);
    color: var(--weiss);
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 28px;
    font-weight: 700;
}

.keypad button:active {
    background: var(--rot);
    border-color: var(--rot);
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
}

.pin-dots .dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--rot);
    background: transparent;
}

.pin-dots .dot.filled {
    background: var(--rot);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Barlow Condensed', sans-serif;
    text-transform: uppercase;
}

.badge-ok { background: rgba(46, 158, 79, 0.18); color: var(--gruen); }
.badge-warnung { background: rgba(245, 148, 31, 0.18); color: var(--orange); }
.badge-kritisch { background: rgba(255, 59, 48, 0.18); color: var(--kritisch); }

.saldo {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 24px;
}

.saldo.ok { color: var(--gruen); }
.saldo.warnung { color: var(--orange); }
.saldo.kritisch { color: var(--kritisch); }

.liste-zeile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    border-bottom: 1px solid var(--rand);
}

.liste-zeile:last-child {
    border-bottom: none;
}

input[type="text"], input[type="number"], select {
    background: var(--flaeche-hell);
    border: 1px solid var(--rand);
    color: var(--weiss);
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    width: 100%;
}

label {
    font-family: 'Barlow Condensed', sans-serif;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--text-mute);
    display: block;
    margin-bottom: 6px;
}

.feld {
    margin-bottom: 16px;
}

.hinweis {
    background: rgba(245, 148, 31, 0.12);
    border: 1px solid var(--orange);
    color: var(--orange);
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

.fehler {
    background: rgba(255, 59, 48, 0.12);
    border: 1px solid var(--kritisch);
    color: var(--kritisch);
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

.zentriert {
    text-align: center;
}

.leer {
    text-align: center;
    color: var(--text-mute);
    padding: 30px 10px;
}

.login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* justify-content: center wuerde bei vielen Personen (17 Kollegen im
       2-Spalten-Raster) hoeher als der Bildschirm werden - beim Zentrieren
       rutscht dann Logo/Titel unerreichbar nach oben aus dem sichtbaren
       Bereich. flex-start haelt den Anfang immer sichtbar und erreichbar. */
    justify-content: flex-start;
    min-height: 100vh;
    padding: 24px;
}

.login-screen .flamme-gross {
    font-size: 52px;
    margin-bottom: 6px;
}

.login-screen h1 {
    font-size: 34px;
    margin-bottom: 4px;
}

.login-screen .wache-login {
    font-family: 'Barlow Condensed', system-ui, sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--rot);
    font-size: 16px;
    margin-bottom: 10px;
}

/* Copyright + Haftungsausschluss, wird von api.js an <main> bzw. den
   Login-Bildschirm angehängt. Bewusst klein und unaufdringlich. */
.fusszeile {
    margin-top: 32px;
    padding-top: 12px;
    border-top: 1px solid var(--rand);
    font-size: 11px;
    color: var(--text-mute);
    text-align: center;
    width: 100%;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.fusszeile summary {
    cursor: pointer;
    list-style: none;
}

.fusszeile summary::-webkit-details-marker {
    display: none;
}

.fusszeile p {
    margin: 8px 0 0;
    line-height: 1.5;
    text-align: left;
}

.login-screen .untertitel {
    color: var(--text-mute);
    margin-bottom: 30px;
    font-size: 15px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Bisher war alles auf Tablet-Größen ausgelegt (grosse Touch-Flächen, feste
   px-Werte) - auf Handy-Breiten wirkte das gequetscht, weil z.B. der
   Topbar-Inhalt (Name + Rolle + Buttons) nie umgebrochen ist. Ab hier
   greifen kleinere, aber weiterhin gut antippbare Maße. */
@media (max-width: 600px) {
    .topbar {
        flex-wrap: wrap;
        row-gap: 8px;
        padding: 12px 14px;
    }

    .topbar .headline {
        font-size: 20px;
    }

    .topbar .headline .wache {
        font-size: 11px;
    }

    .topbar .user {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
        font-size: 14px;
        width: 100%;
    }

    .topbar .user .btn {
        padding: 6px 10px;
        min-height: auto;
        font-size: 13px;
    }

    main {
        padding: 14px 14px 92px;
    }

    .card {
        padding: 14px;
    }

    .grid {
        /* Feste 2 Spalten statt auto-fill/minmax: bei sehr langen Namen
           versuchte der Browser sonst eine dritte, zu schmale Spalte statt
           sie einfach schmaler zu machen - lief seitlich aus dem Bildschirm. */
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .tile {
        padding: 12px 8px;
        min-height: 76px;
    }

    .tile .name {
        font-size: 16px;
    }

    .btn {
        font-size: 15px;
        padding: 12px 16px;
        min-height: 46px;
    }

    .navbar a {
        font-size: 11px;
        padding: 10px 2px 8px;
        gap: 2px;
    }

    .navbar a .icon {
        font-size: 19px;
    }

    .login-screen h1 {
        font-size: 26px;
    }

    .keypad {
        max-width: 280px;
    }
}
