/* OTA Leitstand – Gestaltung in den Firmenfarben (Dunkelblau, Grün, Orange) */
:root {
  --blau: #143c64;
  --blau-hell: #1f4e79;
  --gruen: #50a028;
  --gruen-dunkel: #3d7d1e;
  --orange: #c55a11;
  --grund: #f3f5f8;
  --flaeche: #ffffff;
  --text: #1a2430;
  --text-leise: #5b6775;
  --linie: #d9dfe6;
  --rot: #b3261e;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #10161d;
    --flaeche: #1a232e;
    --text: #e8edf2;
    --text-leise: #9aa7b5;
    --linie: #2c3948;
    --blau-hell: #7fb2e0;
    --gruen: #6cc23f;
    --gruen-dunkel: #50a028;
    --orange: #f0935a;
    --rot: #ff8a80;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--grund);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--blau-hell); }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
p { margin: 0 0 .7rem; }
code { background: var(--grund); padding: .1rem .35rem; border-radius: 4px; word-break: break-all; }
code.gross { font-size: 1.3rem; padding: .4rem .7rem; display: inline-block; }

/* Kopf und Navigation */
.kopf {
  background: var(--blau); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top));
}
.marke { color: #fff; text-decoration: none; font-weight: 600; font-size: 1.1rem; }
.marke-ota { background: var(--gruen); color: #fff; padding: .1rem .45rem; border-radius: 5px; margin-right: .2rem; }
.konto { display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.konto a, .konto .link { color: #dbe6f1; }
.nav {
  background: var(--flaeche); border-bottom: 1px solid var(--linie);
  display: flex; gap: .2rem; padding: 0 .6rem; overflow-x: auto; position: sticky; top: 0; z-index: 5;
}
.nav a {
  padding: .7rem .8rem; text-decoration: none; color: var(--text-leise); white-space: nowrap;
  border-bottom: 3px solid transparent; font-weight: 500;
}
.nav a.aktiv { color: var(--text); border-bottom-color: var(--gruen); }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.kopfzeile { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .9rem; }
.pfad { margin: 0 0 .3rem; font-size: .9rem; color: var(--text-leise); }

/* Karten und Raster */
.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.karte.schmal { max-width: 460px; margin-left: auto; margin-right: auto; }
.karte.hinweis { border-color: var(--orange); }
.raster { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.raster .karte { margin-bottom: 0; }
.raster { margin-bottom: 1rem; }
.zweispaltig { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .zweispaltig { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; } }

/* Formulare */
.formular { display: grid; gap: .8rem; }
.formular.kompakt { gap: .5rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--linie); }
label { display: grid; gap: .25rem; font-size: .9rem; color: var(--text-leise); font-weight: 500; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--linie); border-radius: 7px;
  background: var(--flaeche); color: var(--text); min-height: 2.6rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--orange); outline-offset: 1px;
}
fieldset { border: 1px solid var(--linie); border-radius: 7px; padding: .5rem .8rem; margin: 0; }
legend { font-size: .9rem; color: var(--text-leise); padding: 0 .3rem; font-weight: 500; }
label.haken { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 400; padding: .25rem 0; font-size: 1rem; }
button, .knopf {
  background: var(--gruen-dunkel); color: #fff; border: 0; border-radius: 7px; padding: .6rem 1rem;
  font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; min-height: 2.6rem; justify-self: start;
}
button:hover, .knopf:hover { filter: brightness(1.08); }
button.link {
  background: none; color: var(--blau-hell); padding: 0; min-height: 0; font-weight: 400; text-decoration: underline;
}
.zeile { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
.zeile > label, .zeile > select { flex: 1 1 130px; }
.suche { display: flex; gap: .5rem; margin-bottom: .8rem; }
.suche input { flex: 1; }

.fehler { color: var(--rot); font-weight: 500; }
.erfolg { color: var(--gruen-dunkel); font-weight: 500; }
.leer { color: var(--text-leise); }
.klein { font-size: .85rem; color: var(--text-leise); }
.qr { background: #fff; padding: .5rem; border-radius: 8px; width: max-content; max-width: 100%; margin-bottom: .7rem; }
.qr svg { display: block; }

/* Reiter */
.reiter { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem; }
.reiter a {
  padding: .35rem .8rem; border: 1px solid var(--linie); border-radius: 999px; text-decoration: none;
  color: var(--text-leise); background: var(--flaeche); font-size: .9rem;
}
.reiter a.aktiv { background: var(--blau); border-color: var(--blau); color: #fff; }

/* Listen */
.liste, .aufgaben, .schlicht, .termine, .benutzer, .verlauf { list-style: none; margin: 0; padding: 0; }
.liste { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.karte .liste { border: 0; border-radius: 0; margin: 0 -1rem -1rem; }
.liste li + li { border-top: 1px solid var(--linie); }
.karte .liste li:first-child { border-top: 1px solid var(--linie); }
.liste a { display: grid; gap: .15rem; padding: .7rem 1rem; text-decoration: none; color: var(--text); }
.liste a:hover { background: var(--grund); }
.liste-haupt { font-weight: 600; }
.liste-neben { color: var(--text-leise); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.schlicht li { padding: .35rem 0; }
.schlicht li + li { border-top: 1px solid var(--linie); }

.marke-status { font-size: .78rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; white-space: nowrap; }
.s-offen { background: #fde9d9; color: #8a3d08; }
.s-in_arbeit { background: #dbe9f6; color: #143c64; }
.s-erledigt { background: #e2f1d9; color: #2f6316; }
.zaehler { font-size: .8rem; color: var(--orange); font-weight: 600; }
.ueberfaellig { color: var(--rot); font-weight: 600; }

/* Aufgaben */
.aufgaben li { display: flex; gap: .7rem; align-items: flex-start; padding: .45rem 0; }
.aufgaben li + li { border-top: 1px solid var(--linie); }
.aufgaben li > span { display: grid; min-width: 0; }
.haken-knopf {
  width: 1.7rem; height: 1.7rem; min-height: 0; padding: 0; border-radius: 6px; flex: none;
  background: var(--flaeche); border: 2px solid var(--text-leise); color: #fff; line-height: 1;
}
.erledigt .haken-knopf { background: var(--gruen-dunkel); border-color: var(--gruen-dunkel); }
.erledigt .aufgabe-titel { text-decoration: line-through; color: var(--text-leise); }

/* Verlauf */
.verlauf { display: grid; gap: .7rem; margin-bottom: 1rem; }
.verlauf li { background: var(--grund); border-radius: 10px; padding: .6rem .8rem; max-width: 92%; justify-self: start; }
.verlauf li.eigen { justify-self: end; background: #dcefd2; color: #1a2430; }
.verlauf li.eigen time { color: #4a5a4a; }
.verlauf li.system { background: none; padding: 0; max-width: 100%; justify-self: center; font-size: .85rem; color: var(--text-leise); text-align: center; }
.beitrag-kopf { font-size: .85rem; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.verlauf time { color: var(--text-leise); font-size: .8rem; }
.beitrag-text { margin: .2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.anhaenge { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.anhaenge img { width: 130px; height: 130px; object-fit: cover; border-radius: 8px; display: block; background: var(--linie); }
.anhaenge .datei { padding: .4rem .7rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 7px; }
.beitrag-form { border-top: 1px solid var(--linie); padding-top: .9rem; }

/* Termine, Benutzer, Daten */
.termine li { display: flex; gap: .9rem; padding: .5rem 0; align-items: flex-start; }
.termine li + li { border-top: 1px solid var(--linie); }
.termine li > span:nth-child(2) { flex: 1; min-width: 0; }
.termin-zeit { font-weight: 600; white-space: nowrap; min-width: 5.6rem; font-variant-numeric: tabular-nums; }
.benutzer li { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .6rem 0; }
.benutzer li + li { border-top: 1px solid var(--linie); }
.benutzer .inaktiv { opacity: .6; }
.aktionen { display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; }
.daten { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.daten dt { color: var(--text-leise); }
.daten dd { margin: 0; }

@media (max-width: 520px) {
  main { padding: .8rem 1rem; }
  .konto { gap: .7rem; }
  .konto a { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .anhaenge img { width: 100px; height: 100px; }
}
