/*
 * Gemeinsame Gestaltung fuer App und Backend.
 *
 * Ein Blatt fuer beide, weil sie dieselbe Anwendung sind. Die Unterschiede
 * haengen an body.bereich-app beziehungsweise .bereich-admin: die App ist fuer
 * den Daumen gebaut - grosse Ziele, eine Spalte, Platz fuer die Home-Leiste des
 * Telefons -, das Backend fuer Maus und breiten Schirm.
 */

:root {
    --grund: #f6f7f8;
    --flaeche: #ffffff;
    --linie: #dfe3e6;
    --schrift: #12181d;
    --schrift-still: #5d6b76;
    --akzent: #0f766e;
    --akzent-tief: #0b5d56;
    --warnung: #8a5a00;
    --warnung-flaeche: #fdf4e3;
    --fehler: #a02020;
    --fehler-flaeche: #fbeaea;
    --radius: 10px;
    --schatten: 0 1px 2px rgba(18, 24, 29, .05), 0 8px 24px -16px rgba(18, 24, 29, .35);
}

@media (prefers-color-scheme: dark) {
    :root {
        --grund: #0b1220;
        --flaeche: #131c2b;
        --linie: #24314a;
        --schrift: #e8eef5;
        --schrift-still: #93a3b8;
        --akzent: #2dd4bf;
        --akzent-tief: #14b8a6;
        --warnung: #e0b256;
        --warnung-flaeche: #2a2314;
        --fehler: #f08a8a;
        --fehler-flaeche: #2b1717;
        --schatten: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -16px rgba(0, 0, 0, .8);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--grund);
    color: var(--schrift);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }

/* --- Kopfleiste --------------------------------------------------------- */
.kopfleiste {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    padding-top: max(.75rem, env(safe-area-inset-top));
    background: var(--flaeche);
    border-bottom: 1px solid var(--linie);
    position: sticky;
    top: 0;
    z-index: 10;
}

.marke { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.marke-name { font-weight: 600; letter-spacing: -.01em; }
.marke-zusatz { font-size: .75rem; color: var(--schrift-still); }

.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.nutzer { font-size: .85rem; color: var(--schrift-still); display: flex; align-items: center; gap: .4rem; }
.mandant {
    font-size: .7rem; font-weight: 600; letter-spacing: .04em;
    padding: .1rem .35rem; border: 1px solid var(--linie); border-radius: 4px;
}

.inhalt {
    max-width: 64rem;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bereich-app .inhalt { max-width: 34rem; }

/* --- Bausteine ---------------------------------------------------------- */
.karte {
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 1rem;
}

.karte-mittig { text-align: center; }
.karte-warnung { border-color: var(--warnung); background: var(--warnung-flaeche); }

.seiten-titel { margin-bottom: 1rem; }
.text-still { color: var(--schrift-still); }

.knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    /* 44 px ist die kleinste Flaeche, die sich mit dem Daumen sicher trifft. */
    min-height: 44px;
    padding: .55rem 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--linie);
    background: var(--flaeche);
    color: var(--schrift);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.knopf:hover { border-color: var(--schrift-still); }
.knopf:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

.knopf-haupt { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf-haupt:hover { background: var(--akzent-tief); border-color: var(--akzent-tief); }
.knopf-still { color: var(--schrift-still); }
.knopf-gross { width: 100%; min-height: 56px; font-size: 1.05rem; }

.hinweis { padding: .6rem .8rem; border-radius: 8px; border: 1px solid var(--linie); }
.hinweis-fehler { border-color: var(--fehler); background: var(--fehler-flaeche); color: var(--fehler); }

.marke-klein, .marke {
    /* .marke ist oben die Wortmarke; hier die kleine Kennzeichnung. */
}

.marke:not(a) {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .03em;
    padding: .08rem .4rem;
    border: 1px solid var(--linie);
    border-radius: 4px;
    color: var(--schrift-still);
}

.schluessel {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: .82rem;
    color: var(--schrift-still);
    display: block;
}

.bezeichnung { font-weight: 500; }

/* --- Anmeldung ---------------------------------------------------------- */
.anmeldung {
    max-width: 22rem;
    margin: 3rem auto;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 1.5rem;
}

.anmeldung-titel { font-size: 1.25rem; }
.anmeldung-titel span { display: block; font-size: .85rem; font-weight: 400; color: var(--schrift-still); }

.formular { display: flex; flex-direction: column; gap: .9rem; margin-top: 1.25rem; }
.feld { display: flex; flex-direction: column; gap: .3rem; }
.feld-name { font-size: .82rem; color: var(--schrift-still); }

.feld input {
    /* 16 px verhindert, dass iOS beim Fokus hineinzoomt. */
    font: inherit;
    font-size: 16px;
    padding: .6rem .7rem;
    min-height: 44px;
    border: 1px solid var(--linie);
    border-radius: 8px;
    background: var(--grund);
    color: var(--schrift);
}

.feld input:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* --- Installationsseite (K1) -------------------------------------------- */
.installieren {
    max-width: 24rem;
    margin: 2rem auto;
    text-align: center;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 2rem 1.5rem;
}

.installieren-symbol { color: var(--akzent); margin-bottom: .75rem; }
.installieren-text { color: var(--schrift-still); }

.schritte { text-align: left; margin: 1.25rem 0 0; padding-left: 1.2rem; display: grid; gap: .4rem; }
.installieren-fussnote { margin-top: 1rem; font-size: .85rem; color: var(--schrift-still); }

/* --- Arbeitstag --------------------------------------------------------- */
.tag-titel { font-size: 1.35rem; }
.tag-text { color: var(--schrift-still); }
.tag-fussnote { margin: .75rem 0 0; font-size: .8rem; color: var(--schrift-still); }

.tag-kopf { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .75rem; }
.tag-marke { font-weight: 600; color: var(--akzent); }
.tag-seit { font-size: .85rem; color: var(--schrift-still); }

.laufend { border-left: 3px solid var(--akzent); padding-left: .75rem; }
.laufend-name { font-weight: 600; }
.laufend-projekt { font-size: .9rem; color: var(--schrift-still); }
.laufend-seit { font-size: .8rem; color: var(--schrift-still); margin-top: .2rem; }

.kacheln { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }

.kachel {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-height: 88px;
    padding: .9rem;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    text-decoration: none;
    color: inherit;
}

.kachel-name { font-weight: 600; }
.kachel-zusatz { font-size: .78rem; color: var(--schrift-still); }

.tag-fuss { display: flex; gap: .75rem; }
.tag-fuss-form { flex: 1; }
.tag-fuss .knopf { width: 100%; }

/* C2 - waehrend der Pause zeigt die App nur dies. */
.pause-schirm {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    text-align: center;
}

.pause-wort { font-size: 3rem; font-weight: 700; letter-spacing: .1em; color: var(--akzent); }
.pause-seit { color: var(--schrift-still); margin-bottom: 1.5rem; }
.pause-schirm form { width: 100%; max-width: 20rem; }

/* --- Backend ------------------------------------------------------------ */
.zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; }

.zahl {
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    display: flex;
    flex-direction: column;
}

.zahl-wert { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.zahl-name { font-size: .8rem; color: var(--schrift-still); }

.tabelle-rahmen { overflow-x: auto; margin: 0 -1rem -1rem; padding: 0 1rem 1rem; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .9rem; }

.tabelle th {
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--schrift-still);
    font-weight: 600;
    padding: .45rem .6rem;
    border-bottom: 1px solid var(--linie);
    white-space: nowrap;
}

.tabelle td { padding: .5rem .6rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.zahlenspalte { font-variant-numeric: tabular-nums; white-space: nowrap; }

.listen { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.liste-schlicht { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.liste-schlicht li { font-size: .9rem; }

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

/* --- Backend: Navigation, Listen, Formulare ----------------------------- */
.bereich-admin .inhalt { max-width: 78rem; }

.hauptnavigation { display: flex; flex-wrap: wrap; gap: .15rem; margin-left: 1rem; }

.nav-eintrag {
    padding: .35rem .7rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--schrift-still);
    font-size: .9rem;
    white-space: nowrap;
}

.nav-eintrag:hover { background: var(--grund); color: var(--schrift); }
.nav-aktiv { background: var(--grund); color: var(--schrift); font-weight: 600; }

.listen-kopf { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; }
.listen-kopf > div { flex: 1; min-width: 16rem; }
.listen-kopf .seiten-titel { margin-bottom: .25rem; }
.hinweis-text { font-size: .88rem; max-width: 52rem; margin: 0; }

.hinweis-erfolg { border-color: var(--akzent); color: var(--akzent); }
.hinweis-konflikt { border-color: var(--warnung); background: var(--warnung-flaeche); color: var(--warnung); }
.hinweis strong { display: block; margin-bottom: .15rem; }

.karte-flach { padding: 0; overflow: hidden; }
.karte-flach .tabelle-rahmen { margin: 0; padding: 0; }
.karte-flach .tabelle th:first-child, .karte-flach .tabelle td:first-child { padding-left: 1rem; }
.karte-flach .tabelle th:last-child, .karte-flach .tabelle td:last-child { padding-right: 1rem; }

.zeile-still td { opacity: .5; }
.spalte-aktion { text-align: right; white-space: nowrap; }
.visuell-versteckt {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.ja { color: var(--akzent); font-weight: 600; }
.nein { color: var(--schrift-still); }
.abweichung { font-weight: 600; }

.knopf-klein { min-height: 32px; padding: .25rem .7rem; font-size: .85rem; }
.knopf-gefahr { border-color: var(--fehler); color: var(--fehler); }
.knopf-gefahr:hover { background: var(--fehler-flaeche); border-color: var(--fehler); }

.formular-breit { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; }
.formular-breit .feld { min-width: 0; }
.formular-fuss { grid-column: 1 / -1; display: flex; gap: .75rem; padding-top: .5rem; border-top: 1px solid var(--linie); }

.feld select, .feld textarea {
    font: inherit; font-size: 16px;
    padding: .6rem .7rem; min-height: 44px;
    border: 1px solid var(--linie); border-radius: 8px;
    background: var(--grund); color: var(--schrift);
}

.feld select:focus-visible, .feld textarea:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
.feld-fehler input, .feld-fehler select, .feld-fehler textarea { border-color: var(--fehler); }
.feld-meldung { font-size: .8rem; color: var(--fehler); }
.feld-hinweis { font-size: .8rem; color: var(--schrift-still); }
.pflicht { color: var(--fehler); }

.mehrfach { display: grid; gap: .3rem; padding: .4rem 0; }
.kaestchen { display: flex; align-items: center; gap: .5rem; font-size: .92rem; cursor: pointer; }
.kaestchen input { width: 18px; height: 18px; accent-color: var(--akzent); }

.karte-gefahr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
    border-color: var(--fehler);
}
.karte-gefahr > div { flex: 1; min-width: 16rem; }
.karte-gefahr p { margin: .2rem 0 0; font-size: .85rem; }

.bereiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; }

.bereich-kachel {
    display: flex; flex-direction: column; gap: .1rem;
    padding: 1rem;
    background: var(--flaeche); border: 1px solid var(--linie);
    border-radius: var(--radius); box-shadow: var(--schatten);
    text-decoration: none; color: inherit;
}

.bereich-kachel:hover { border-color: var(--akzent); }
.bereich-zahl { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.bereich-name { font-size: .85rem; color: var(--schrift-still); }

/* --- Passwortmaske ------------------------------------------------------ */
.formular-schmal { max-width: 26rem; margin: 0 auto; }
.formular-schmal .formular-fuss { border-top: 0; padding-top: 0; }

a.nutzer { text-decoration: none; }
a.nutzer:hover { color: var(--schrift); }

/* --- Aufgaben in der App ------------------------------------------------ */
.projekt-titel { font-size: 1rem; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.projekt-kunde { font-size: .8rem; font-weight: 400; color: var(--schrift-still); }

.aufgabe { display: grid; gap: .75rem; }
.aufgabe-laeuft { border-color: var(--akzent); }
.aufgabe-kopf { display: flex; align-items: flex-start; gap: .75rem; }
.aufgabe-kopf > div { flex: 1; }
.aufgabe-name { font-weight: 600; }
.aufgabe-zusatz { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .8rem; color: var(--schrift-still); margin-top: .15rem; }
.aufgabe-laeuft-marke { font-size: .75rem; font-weight: 600; color: var(--akzent); white-space: nowrap; }
.aufgabe-aktionen { display: flex; flex-wrap: wrap; gap: .5rem; }
.aufgabe-aktionen > * { flex: 1; min-width: 8rem; }
.aufgabe .knopf { width: 100%; }

.marke-warnung { color: var(--warnung); border-color: var(--warnung); }

.unterbrechen summary { list-style: none; display: flex; }
.unterbrechen summary::-webkit-details-marker { display: none; }
.unterbrechen[open] summary { margin-bottom: .75rem; }
.unterbrechen .formular { margin-top: 0; }

.kachel-still { opacity: .5; pointer-events: none; }
.rueckfrage-form { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --- Bericht und Unterschrift (H1-H13) ---------------------------------- */
.unterschrift { display: grid; gap: .4rem; }

.unterschrift-flaeche {
    width: 100%;
    height: 160px;
    background: #fff;
    border: 1px dashed var(--linie);
    border-radius: var(--radius);
    /* Ohne das scrollt die Seite, sobald jemand auf der Flaeche wischt. */
    touch-action: none;
    cursor: crosshair;
}

.unterschrift-fuss { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.unterschrift-fehlt .unterschrift-flaeche { border-color: var(--fehler); border-style: solid; }

.bereich-app .tabelle { font-size: .85rem; }
.bereich-app .tabelle td, .bereich-app .tabelle th { padding: .35rem .4rem; }
.bereich-app .tabelle tfoot td { border-top: 1px solid var(--linie); border-bottom: 0; }

/* --- Material (E1-E5) --------------------------------------------------- */
.artikel { display: grid; gap: .6rem; padding: .75rem 0; border-top: 1px solid var(--linie); }
.artikel:first-of-type { border-top: 0; padding-top: 0; }
.artikel-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.artikel .formular { margin-top: 0; }

.scanner { display: grid; gap: .5rem; }
.scanner video {
    width: 100%; max-height: 60vh; border-radius: var(--radius);
    background: #000; object-fit: cover;
}

/* --- Fotos (D4-D7) ------------------------------------------------------ */
.fotos { display: grid; gap: .6rem; }
.foto-streifen { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.foto-streifen li { position: relative; }

.foto-streifen img {
    width: 64px; height: 64px; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--linie); display: block;
}

/* D6: die Kennzeichnung haengt am Bild, nicht an einer Meldung - sie soll auch
   in einem halben Jahr noch zu sehen sein. */
.foto-marke {
    position: absolute; left: 0; right: 0; bottom: 0;
    font-size: .6rem; font-weight: 600; text-align: center;
    padding: .05rem 0;
    background: var(--warnung-flaeche); color: var(--warnung);
    border: 1px solid var(--warnung); border-radius: 0 0 8px 8px;
}

.foto-knoepfe { display: flex; flex-wrap: wrap; gap: .5rem; }
.foto-form { display: flex; gap: .5rem; }
.foto-form label { cursor: pointer; }

/* --- Fahrten (F1-F7) ---------------------------------------------------- */
.fahrt-daten { margin: 0 0 .75rem; display: grid; gap: .4rem; }
.fahrt-daten > div { display: flex; justify-content: space-between; gap: 1rem; }
.fahrt-daten dt { font-size: .85rem; color: var(--schrift-still); }
.fahrt-daten dd { margin: 0; font-weight: 500; }

/* Die namentliche Liste aus F5 traegt mehrere Zeilen - sie darf nicht wie eine
   beilaeufige Meldung aussehen. */
.hinweis-sperre { display: grid; gap: .35rem; }
.hinweis-sperre ul { margin: 0; padding-left: 1.1rem; }
