/* Otto Büro – ruhig, verlässlich, für eine Hand auf der Baustelle. */
:root {
  --akzent: #0f6e8c;
  --akzent-text: var(--akzent);
  --auf-akzent: #fff;
  --grund: #f3f5f6;
  --flaeche: #ffffff;
  --flaeche-2: #eef2f4;
  --text: #17222a;
  --text-2: #55636d;
  --linie: #dbe2e6;
  --rot: #c62828;
  --rot-flaeche: #fdecea;
  --schatten: 0 1px 2px rgb(16 32 40 / .06), 0 4px 14px rgb(16 32 40 / .06);
  --rund: 14px;
  --tabs-h: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --akzent-text: color-mix(in srgb, var(--akzent) 55%, #fff);
    --grund: #0f1519;
    --flaeche: #172026;
    --flaeche-2: #1f2a31;
    --text: #e6edf1;
    --text-2: #9aa9b2;
    --linie: #2a363e;
    --rot: #ef5350;
    --rot-flaeche: #3a1b1b;
    --schatten: 0 1px 2px rgb(0 0 0 / .4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button, textarea, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 5;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  padding-top: env(safe-area-inset-top);
}
.kopf-zeile {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
}
.marke { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marke > div { min-width: 0; }
.logo {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: var(--akzent); color: var(--auf-akzent);
  display: grid; place-items: center; font-weight: 800; font-size: 20px;
}
.firma { font-weight: 700; font-size: 17px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.unterzeile { font-size: 13px; color: var(--text-2); }

.notaus {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 48px; min-width: 56px; padding: 2px 0;
  background: none; border: 0; cursor: pointer;
}
.notaus-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.schalter {
  width: 46px; height: 28px; border-radius: 14px; background: var(--linie);
  position: relative; transition: background .2s;
}
.knubbel {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s;
}
.notaus[aria-checked="true"] .schalter { background: var(--rot); }
.notaus[aria-checked="true"] .knubbel { transform: translateX(18px); }
.notaus[aria-checked="true"] .notaus-label { color: var(--rot); }
.notaus-band {
  background: #c62828; color: #fff; font-weight: 700; text-align: center;
  padding: 8px 16px; font-size: 15px;
}

main { padding: 12px 16px 24px; max-width: 640px; margin: 0 auto; }

/* ---------- Hinweise ---------- */
.hinweise { display: grid; gap: 10px; }
.hinweise:has(> :not([hidden])) { margin-bottom: 14px; }
.hinweis {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund);
  padding: 12px 14px; font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.hinweis.aktion { flex-wrap: nowrap; padding: 8px 8px 8px 14px; }
.hinweis.aktion span { flex: 1 1 auto; font-size: 14px; line-height: 1.3; }
.hinweis.aktion .knopf { flex: none; min-height: 44px; padding: 0 14px; font-size: 15px; }
.hinweis.fehler { border-color: var(--rot); background: var(--rot-flaeche); }

/* ---------- Abschnitte ---------- */
.abschnitt {
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-2); margin: 22px 4px 10px; display: flex; align-items: center; gap: 8px;
}
.ansicht > .abschnitt:first-child { margin-top: 4px; }
.zahl {
  background: var(--akzent); color: var(--auf-akzent); border-radius: 10px;
  font-size: 12px; padding: 1px 8px; letter-spacing: 0;
}

/* ---------- Karten ---------- */
.karten { display: grid; gap: 14px; }
.karte {
  background: var(--flaeche); border-radius: var(--rund); box-shadow: var(--schatten);
  border: 1px solid var(--linie); overflow: hidden;
}
.karte-kopf { padding: 14px 16px 2px; }
.karte-art { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--akzent-text); display: flex; justify-content: space-between; gap: 8px; }
.etikett { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--flaeche-2); color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.karte-art time { color: var(--text-2); font-weight: 500; letter-spacing: 0; text-transform: none; }
.karte-titel { font-size: 18px; font-weight: 700; margin: 2px 0 0; line-height: 1.3; overflow-wrap: anywhere; }
.karte-text { padding: 4px 16px 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); font-size: 16px; }
.entwurf {
  margin: 12px 16px 0; background: var(--flaeche-2); border-radius: 10px;
  border-left: 4px solid var(--akzent); padding: 10px 12px;
}
.entwurf-meta { font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
.entwurf-meta b { color: var(--text); font-weight: 600; }
.entwurf-text { white-space: pre-wrap; margin-top: 8px; overflow-wrap: anywhere; max-height: 14em; overflow: auto; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 16px; }
.knopf {
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--linie);
  background: var(--flaeche); font-weight: 600; cursor: pointer; flex: 1 1 auto;
}
.knopf.haupt { background: var(--akzent); color: var(--auf-akzent); border-color: transparent; font-size: 18px; }
.knoepfe .knopf.haupt { flex: 2 1 100%; }
.knopf.leise { background: none; border-color: transparent; color: var(--text-2); font-weight: 500; }
.knopf:disabled { opacity: .55; }
.knopf:active { transform: scale(.98); }
a.knopf { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }
.leise.klein { background: none; border: 0; color: var(--akzent-text); font-weight: 600; min-height: 44px; padding: 0 8px; margin-left: auto; cursor: pointer; }

.aendern { padding: 12px 16px 0; display: grid; gap: 8px; }
.aendern label { font-weight: 600; font-size: 15px; }
.aendern-zeile { display: flex; gap: 8px; align-items: flex-end; }
textarea {
  width: 100%; border: 1px solid var(--linie); border-radius: 12px; background: var(--flaeche);
  padding: 12px; resize: none; min-height: 48px; font-size: 17px;
}
textarea:focus-visible, input:focus-visible, .knopf:focus-visible, .tab:focus-visible, .mikro:focus-visible, .notaus:focus-visible, .senden-rund:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--akzent) 50%, transparent); outline-offset: 2px;
}

.leer { text-align: center; padding: 30px 16px; color: var(--text-2); background: var(--flaeche); border-radius: var(--rund); border: 1px dashed var(--linie); }
.leer-gross { font-size: 19px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.laden { color: var(--text-2); padding: 20px 4px; }

/* ---------- Geräte ---------- */
.geraete { margin-top: 8px; }
.geraete summary { cursor: pointer; list-style: none; min-height: 44px; margin-bottom: 4px; }
.geraete summary::-webkit-details-marker { display: none; }
.geraete summary::after { content: "▸"; font-size: 14px; }
.geraete[open] summary::after { content: "▾"; }
.geraete-hilfe { margin: 0 4px 10px; color: var(--text-2); font-size: 14px; }
.geraete-liste { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.geraet {
  display: flex; align-items: center; gap: 10px; background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 12px; padding: 8px 8px 8px 14px;
}
.geraet > div { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.geraet-info { font-size: 13px; color: var(--text-2); }
.geraet .knopf { flex: none; min-height: 44px; padding: 0 14px; color: var(--rot); }
.geraet-link { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; margin: 10px 4px 0; }

/* ---------- Meldungen ---------- */
.meldungen { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.meldung {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px;
  padding: 10px 14px 10px 18px; position: relative; overflow: hidden;
}
.meldung::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--linie); }
.meldung.dringend { background: var(--rot-flaeche); border-color: color-mix(in srgb, var(--rot) 45%, transparent); }
.meldung.dringend::before { background: var(--rot); width: 6px; }
.meldung.brief::before { background: var(--akzent); }
.meldung.erinnerung::before { background: var(--akzent); }
.meldung-kopf { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.meldung.dringend .meldung-kopf { color: var(--rot); font-weight: 700; }
.meldung-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; font-size: 16px; }
.meldung.zu .meldung-text { max-height: 7.3em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.mehr { background: none; border: 0; color: var(--akzent-text); font-weight: 600; padding: 4px 0 0; min-height: 40px; cursor: pointer; }

/* ---------- Chat ---------- */
body.im-chat .hinweise { display: none; }
body.im-chat main { padding-bottom: 0; }
#ansicht-chat:not([hidden]) {
  display: flex; flex-direction: column;
  min-height: calc(100dvh - 70px - 12px - var(--tabs-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.chat-dock {
  position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); z-index: 4;
  background: var(--grund); padding: 8px 0 10px; margin: 0 -16px; padding-inline: 16px;
  border-top: 1px solid var(--linie);
}
.verlauf { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }
.blase {
  max-width: 85%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--flaeche); border: 1px solid var(--linie); align-self: flex-start; border-bottom-left-radius: 6px;
}
.blase.ich { align-self: flex-end; background: var(--akzent); color: var(--auf-akzent); border-color: transparent; border-radius: 18px; border-bottom-right-radius: 6px; }
.blase.warte { color: var(--text-2); font-style: italic; }
.blase.fehler { border-color: var(--rot); background: var(--rot-flaeche); }
.vorschlaege { display: flex; flex-wrap: wrap; gap: 8px; }
.vorschlag { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--linie); background: var(--flaeche); cursor: pointer; font-size: 15px; }
.eingabe { display: flex; gap: 8px; align-items: flex-end; }
.senden-rund {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--akzent); color: var(--auf-akzent); display: grid; place-items: center;
}
.senden-rund svg { width: 22px; height: 22px; fill: currentColor; }
.mikro-zone { display: grid; justify-items: center; gap: 4px; padding: 2px 0 10px; }
.mikro {
  width: 76px; height: 76px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--akzent); color: var(--auf-akzent); display: grid; place-items: center;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--akzent) 40%, transparent);
}
.mikro svg { width: 34px; height: 34px; fill: currentColor; }
.mikro.aufnahme { background: var(--rot); animation: puls 1.4s infinite; }
.mikro:disabled { opacity: .6; }
.mikro.klein { width: 48px; height: 48px; flex: none; box-shadow: none; }
.mikro.klein svg { width: 24px; height: 24px; }
.mikro-text { font-size: 14px; color: var(--text-2); }
@keyframes puls { 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--rot) 20%, transparent); } }
@media (prefers-reduced-motion: reduce) { .mikro.aufnahme { animation: none; } * { transition: none !important; } }

/* ---------- Gedächtnis ---------- */
.g-suche, .g-neu { display: flex; gap: 8px; margin: 8px 0; }
.g-suche input, .g-neu input, .g-feld {
  flex: 1 1 auto; min-width: 0; min-height: 48px; border: 1px solid var(--linie); border-radius: 12px;
  padding: 0 14px; background: var(--flaeche); font-size: 16px;
}
textarea.g-feld { padding: 10px 14px; width: 100%; resize: vertical; }
.g-neu input[type="date"] { flex: 0 0 auto; width: 9.5em; }
.g-suche .knopf, .g-neu .knopf { flex: none; min-height: 48px; padding: 0 16px; }
.g-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.g-zeile {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 12px 14px;
}
.g-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.g-meta { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.g-kurz { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-leer { color: var(--text-2); padding: 8px 4px; }
.g-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.knopf.klein { min-height: 44px; padding: 0 14px; font-size: 15px; }
.knopf.gefahr { color: var(--rot); }
.g-kunde { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; min-height: 44px; }
.g-name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.g-mehr { margin-top: 10px; }
.g-mehr > summary { cursor: pointer; color: var(--text-2); min-height: 44px; display: flex; align-items: center; }
.g-mehr > summary.abschnitt { margin: 22px 4px 10px; }
.g-titel { margin: 8px 4px 0; font-size: 22px; overflow-wrap: anywhere; }
.g-zahlung { margin: 6px 4px 0; font-weight: 600; }
.g-form { display: grid; gap: 10px; margin: 14px 0; }
.g-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.g-kunde-weg { margin-top: 22px; }
.zurueck { margin-left: -8px; }

/* ---------- Tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--flaeche); border-top: 1px solid var(--linie);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.tab {
  height: var(--tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 600; position: relative;
}
.tab svg { width: 26px; height: 26px; fill: currentColor; }
.tab[aria-current="page"] { color: var(--akzent-text); }
.punkt { position: absolute; top: 10px; left: calc(50% + 10px); width: 10px; height: 10px; border-radius: 50%; background: var(--rot); }

.toast {
  position: fixed; left: 16px; right: 16px; z-index: 7; margin: 0 auto; max-width: 480px;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px);
  background: var(--text); color: var(--grund); border-radius: 12px; padding: 12px 16px; font-weight: 600;
  box-shadow: 0 6px 20px rgb(0 0 0 / .25);
}

/* ---------- Kopplungsseite ---------- */
body.ohne-tabs { padding-bottom: 0; }
.koppeln { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.koppeln-box { width: 100%; max-width: 420px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); padding: 24px 20px; display: grid; gap: 14px; box-shadow: var(--schatten); }
.koppeln-box h1 { margin: 0; font-size: 22px; }
.koppeln-box p { margin: 0; color: var(--text-2); }
.koppeln-box label { font-weight: 600; }
.koppeln-box input { width: 100%; min-height: 52px; border: 1px solid var(--linie); border-radius: 12px; padding: 0 14px; background: var(--flaeche); font-size: 18px; }
.koppeln-box .knopf { width: 100%; }
.koppeln-fehler { color: var(--rot); font-weight: 600; }
