/* ============================================================================
   assets/css/mobil.css — Die mobile Version. EIGENSTÄNDIG.
   ----------------------------------------------------------------------------
   Diese Datei ist die EINZIGE, die die mobile Version lädt. Kein app.css,
   kein messlog.css, kein @media.

   Das heisst für dich:
     - Jeder Wert hier wirkt NUR am Telefon.
     - Am Bildschirm kann nichts kaputtgehen, egal was du änderst.
     - Umgekehrt kann keine Änderung am Bildschirm hier etwas zerlegen.

   Alle Farben stehen oben in einem Block. Wer das Aussehen ändern will,
   ändert dort — nicht verstreut im Text.

   KEINE HÖHE IN vh: In der als App verpackten Ansicht ist vh oft 0.
   ========================================================================== */

:root {
    --hg:        #f5f4f1;
    --flaeche:   #ffffff;
    --flaeche2:  #f8f7f4;
    --rand:      #e6e3dd;
    --fein:      #efedE8;
    --text:      #16140f;
    --leise:     #6b6459;
    --zart:      #a39b8e;

    --nav:       #151b22;
    --nav-text:  #93a2ae;
    --nav-hell:  #ffffff;

    --akz:       #c2410c;
    --akz-bg:    #fff3e8;
    --akz-tf:    #9a3412;

    --ok:        #15803d;
    --ok-bg:     #e7f5ec;
    --gefahr:    #b91c1c;
    --gefahr-bg: #fdeaea;

    --r:         12px;
    --r-s:       8px;
    --tap:       56px;          /* Mindesthöhe für alles Antippbare */
    --kopf:      60px;
    --leiste:    62px;
    --rand-x:    16px;          /* seitlicher Rand */
}

[data-theme="dunkel"] {
    --hg:        #12151a;
    --flaeche:   #1a1f26;
    --flaeche2:  #222831;
    --rand:      #2f3743;
    --fein:      #262d36;
    --text:      #e9e7e2;
    --leise:     #a49c8f;
    --zart:      #77706604;
    --zart:      #777066;
    --akz:       #e2703a;
    --akz-bg:    #33241a;
    --akz-tf:    #f0a06b;
    --ok:        #4ade80;
    --ok-bg:     #14291d;
    --gefahr:    #f87171;
    --gefahr-bg: #331a1a;
}

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

body {
    margin: 0;
    background: var(--hg);
    color: var(--text);
    font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    /* Platz für Kopf und Leiste, damit nichts darunter verschwindet. */
    padding: calc(var(--kopf) + env(safe-area-inset-top, 0px))
             0
             calc(var(--leiste) + env(safe-area-inset-bottom, 0px));
}
h1, h2 { margin: 0; font-weight: 650; }
p { margin: 0 0 .8em; }
a { color: inherit; text-decoration: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ Kopf */
.kopf {
    position: fixed; top: 0; left: 0; right: 0; z-index: 20;
    height: calc(var(--kopf) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--nav);
    display: flex; align-items: center;
}
.kopf h1 {
    flex: 1; text-align: center; color: var(--nav-hell);
    font-size: 1.05rem; font-weight: 650;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 0 .3rem;
}
.kopf-knopf {
    flex: none; width: 56px; height: 100%;
    display: grid; place-items: center;
    color: var(--nav-text);
}
.kopf-knopf svg { width: 22px; height: 22px; }
.kopf-knopf:active { color: var(--akz); }

/* --------------------------------------------------------------- Inhalt */
.inhalt { padding: 14px var(--rand-x) 20px; }
.inhalt h2 {
    font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--zart); margin: 1.6rem 0 .5rem;
}
.unter-titel { color: var(--leise); font-size: .92rem; margin: -4px 0 14px; }

.meldung {
    padding: .8rem 1rem; border-radius: var(--r);
    background: var(--akz-bg); color: var(--akz-tf);
    font-size: .93rem; font-weight: 600;
}
.meldung-erfolg { background: var(--ok-bg); color: var(--ok); }
.meldung-fehler { background: var(--gefahr-bg); color: var(--gefahr); }

.hinweis { padding: .75rem .9rem; border-radius: var(--r-s); font-size: .9rem; }
.hinweis-gefahr { background: var(--gefahr-bg); color: var(--gefahr); font-weight: 600; }

/* ------------------------------------------------------- Untere Leiste */
.leiste {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--leiste) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--nav);
    display: flex;
}
.leiste-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px;
    color: var(--nav-text); font-size: .66rem; font-weight: 650;
}
.leiste-tab svg { width: 21px; height: 21px; }
.leiste-tab.an { color: var(--akz); }

/* ---------------------------------------------------------- Startseite */
.gross {
    display: flex; align-items: center; gap: 14px;
    background: var(--akz); color: #fff;
    border-radius: var(--r); padding: 20px 18px;
    min-height: 88px;
}
.gross-text { flex: 1; }
.gross-text b { display: block; font-size: 1.25rem; font-weight: 700; }
.gross-text small { display: block; font-size: .85rem; opacity: .85; margin-top: 3px; }
.gross svg { width: 22px; height: 22px; flex: none; }

.zahlen { display: flex; gap: 8px; margin-top: 12px; }
.zahl {
    flex: 1; background: var(--flaeche); border: 1px solid var(--rand);
    border-radius: var(--r); padding: 14px 10px; text-align: center;
}
.zahl b { display: block; font-size: 1.7rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.zahl small { display: block; font-size: .72rem; color: var(--leise); margin-top: 2px; }
.zahl-offen b  { color: var(--akz); }
.zahl-gefahr b { color: var(--gefahr); }

.liste { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--r); overflow: hidden; }
.zeile {
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1rem; min-height: 52px;
    border-bottom: 1px solid var(--fein); font-size: .95rem;
}
.zeile:last-child { border-bottom: 0; }
.zeile-rechts { color: var(--leise); font-size: .88rem; display: flex; align-items: center; gap: 8px; }
.marke-entwurf {
    font-style: normal; font-size: .7rem; font-weight: 700;
    background: var(--akz-bg); color: var(--akz-tf);
    padding: 2px 8px; border-radius: 10px;
}

/* ------------------------------------------------------------ Fortschritt */
.fortschritt { margin-bottom: 14px; }
.fortschritt-text {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: .88rem; color: var(--leise); margin-bottom: 6px;
}
.fortschritt-text b { color: var(--text); font-variant-numeric: tabular-nums; }
.balken { height: 6px; border-radius: 3px; background: var(--fein); overflow: hidden; }
.balken span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

/* ---------------------------------------------------------------- Kacheln */
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kachel {
    position: relative;
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-radius: var(--r);
    padding: 14px 14px 12px;
    min-height: 96px;
    display: flex; flex-direction: column;
}
.kachel:active { background: var(--flaeche2); }
.kachel-label { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.kachel-bez {
    font-size: .78rem; color: var(--leise); margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kachel-fuss {
    margin-top: auto; padding-top: 8px;
    font-size: .8rem; color: var(--zart); font-variant-numeric: tabular-nums;
}
/* Der Punkt sagt den Stand. Leer = offen, gefüllt = erfasst. */
.punkt {
    position: absolute; top: 12px; right: 12px;
    width: 20px; height: 20px; border-radius: 50%;
    border: 1.6px solid var(--zart);
    display: grid; place-items: center;
}
.punkt svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 2.6; }
.kachel-ok   { border-color: var(--ok); }
.kachel-ok   .punkt { background: var(--ok); border-color: var(--ok); }
.kachel-ok   .kachel-fuss { color: var(--ok); font-weight: 650; }
.kachel-abw  { border-color: var(--gefahr); border-width: 2px; }
.kachel-abw  .punkt { background: var(--gefahr); border-color: var(--gefahr); }
.kachel-abw  .kachel-fuss { color: var(--gefahr); font-weight: 700; }
.kachel-teil .punkt { border-color: var(--akz); border-width: 2.4px; }

/* ------------------------------------------------------------- Messwerte */
.wert {
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-radius: var(--r);
    padding: 14px 16px 16px;
    margin-bottom: 12px;
}
.wert-raus { border-color: var(--gefahr); border-width: 2px; }
.wert-berechnet { background: var(--flaeche2); }
.wert-kopf { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.wert-name { font-size: 1rem; font-weight: 650; }
.wert-soll { font-size: .82rem; color: var(--leise); }
.wert-feld {
    display: block; width: 100%;
    font: inherit;
    font-size: 2.4rem;            /* gross genug, um im Vorbeigehen zu lesen */
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    text-align: right;
    letter-spacing: -.02em;
    padding: .4rem .6rem;
    border: 1px solid var(--rand);
    border-radius: var(--r-s);
    background: var(--flaeche2);
    color: var(--text);
    min-height: 68px;
}
.wert-feld:focus { outline: 2px solid var(--akz); outline-offset: -1px; }
.wert-raus .wert-feld { color: var(--gefahr); border-color: var(--gefahr); }
.wert-aus { color: var(--leise); }

.band {
    position: relative; height: 8px; margin-top: 12px;
    border-radius: 4px; background: var(--fein);
}
.band-soll { position: absolute; top: 0; bottom: 0; background: var(--ok-bg); border-radius: 4px; }
.band-ist  { position: absolute; top: -4px; width: 4px; height: 16px; border-radius: 2px; background: var(--text); }
.band-text {
    display: flex; justify-content: space-between;
    font-size: .74rem; color: var(--zart); margin-top: 6px;
    font-variant-numeric: tabular-nums;
}
.band-text span:nth-child(2) { font-weight: 650; }

/* ------------------------------------------------------ Reihen und Knöpfe */
.reihe {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: var(--tap);
    padding: 0 16px; margin-bottom: 10px;
    background: var(--flaeche); border: 1px solid var(--rand);
    border-radius: var(--r); color: var(--leise);
    font: inherit; font-size: .95rem; font-weight: 600;
    cursor: pointer;
}
.reihe svg { width: 20px; height: 20px; flex: none; }
.reihe:active { background: var(--flaeche2); }
.reihe-akz { color: var(--akz); border-color: var(--akz); background: var(--akz-bg); }

.knopf {
    display: flex; align-items: center; justify-content: center;
    width: 100%; min-height: 58px; margin-top: 6px;
    background: var(--akz); color: #fff;
    border: 0; border-radius: var(--r);
    font: inherit; font-size: 1.08rem; font-weight: 700;
    cursor: pointer; touch-action: manipulation;
}
.knopf:active { filter: brightness(.93); }

.foto-meldung { font-size: .88rem; font-weight: 600; margin: -4px 0 10px; }

/* ------------------------------------------------------------- Massnahme */
.massnahme {
    background: var(--flaeche); border: 1px solid var(--rand);
    border-radius: var(--r); margin-bottom: 12px; overflow: hidden;
}
.massnahme.noetig { border-color: var(--gefahr); background: var(--gefahr-bg); }
.massnahme > summary {
    min-height: var(--tap); display: flex; align-items: center;
    padding: 0 16px; font-weight: 650; cursor: pointer;
}
.massnahme.noetig > summary { color: var(--gefahr); }
.haken {
    display: flex; align-items: center; gap: 12px;
    min-height: 50px; padding: 0 16px;
    border-top: 1px solid var(--fein); font-size: .95rem;
}
.haken input { width: 22px; height: 22px; accent-color: var(--akz); flex: none; }
.massnahme textarea {
    width: 100%; border: 0; border-top: 1px solid var(--fein);
    padding: 12px 16px; font: inherit; font-size: 16px;
    background: transparent; color: var(--text); resize: none;
}
.massnahme textarea:focus { outline: 0; background: var(--flaeche2); }

/* ------------------------------------------------------------ Leere Seite */
.mitte { text-align: center; padding: 40px 10px; }
.mitte-text { color: var(--leise); margin-bottom: 20px; }

/* ------------------------------------------------------------- Fachchat */
.mbf { display: flex; flex-direction: column; gap: .8rem; }
.mbf-verlauf { display: flex; flex-direction: column; gap: .6rem; min-height: 260px; }
.mbf-start { color: var(--leise); font-size: .95rem; margin: 0; }
.mbf-z {
    padding: .75rem .95rem; border-radius: var(--r);
    font-size: 1rem; line-height: 1.5; white-space: pre-wrap;
    word-break: break-word; max-width: 92%;
}
.mbf-ich { align-self: flex-end; background: var(--akz); color: #fff; border-bottom-right-radius: 4px; }
.mbf-ki  { align-self: flex-start; background: var(--flaeche); border: 1px solid var(--rand); border-bottom-left-radius: 4px; }
.mbf-warte { align-self: flex-start; color: var(--leise); font-size: 1.4rem; letter-spacing: .2em; }
.mbf-fehler { align-self: flex-start; background: var(--gefahr-bg); color: var(--gefahr); }
.mbf-eingabe { display: flex; gap: .5rem; align-items: flex-end; }
.mbf-eingabe textarea {
    flex: 1; font: inherit; font-size: 16px; padding: .7rem .85rem;
    border: 1px solid var(--rand); border-radius: var(--r);
    background: var(--flaeche); color: var(--text); resize: none; min-height: 52px;
}
.mbf-senden {
    flex: none; width: 52px; height: 52px; border: 0; border-radius: var(--r);
    background: var(--akz); color: #fff; display: grid; place-items: center;
    cursor: pointer; touch-action: manipulation;
}
.mbf-senden svg { width: 22px; height: 22px; }
.mbf-senden[disabled] { opacity: .55; }

/* ---------------------------------------------------------------------------
   Anmeldung
   Eigene Seite ohne untere Leiste. Die Felder sind bewusst gross: Am Gerät in
   der Halle wird oft mit Handschuhen getippt.
   --------------------------------------------------------------------------*/
.anmelden {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 2rem 1rem 1rem;
    max-width: 26rem;
    margin: 0 auto;
}
.feld { display: flex; flex-direction: column; gap: .4rem; }
.feld > span {
    font-size: .875rem;
    font-weight: 600;
    color: var(--leise);
}
.feld input {
    /* 1rem = 16px: Darunter zoomt iOS beim Antippen hinein. */
    font-size: 1rem;
    padding: .85rem .9rem;
    min-height: 3rem;
    border: 1px solid var(--fein);
    border-radius: var(--r);
    background: var(--flaeche);
    color: var(--text);
    width: 100%;
    box-sizing: border-box;
}
.feld input:focus-visible {
    outline: 2px solid var(--akz);
    outline-offset: 1px;
    border-color: var(--akz);
}
