/* Team-Board – Handy zuerst (360–430 px), Desktop ab 901 px mit Seitenleiste. Keine Inline-Stile (CSP style-src 'self'). */
:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --flaeche: #161616;
  --flaeche-2: #1f1f1f;
  --linie: #2c2c2c;
  --text: #f4f4f2;
  --text-2: #b9b8b0;
  --text-3: #8d8c85;
  --akzent: #ffcc00;
  --akzent-text: #0d0d0d;
  --gut: #34b36a;
  --gut-dunkel: #0f2a1a;
  --warnung: #e0a100;
  --fehler: #e5484d;
  --radius: 12px;
  --nav-hoehe: 64px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { scroll-padding-bottom: 90px; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; overflow-wrap: anywhere; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--akzent); }
.versteckt { display: none !important; }
.nur-lesegeraet { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* ---------- Anmeldung ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; padding: 24px; display: grid; gap: 16px; }
.login h1 { margin: 0; font-size: 22px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.logo-punkt { width: 28px; height: 28px; border-radius: 8px; background: var(--akzent); display: grid; place-items: center; color: var(--akzent-text); font-size: 15px; font-weight: 800; flex: none; }

/* ---------- Grundgerüst (Handy: Inhalt oben, Menü unten) ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
main { padding: 16px max(16px, env(safe-area-inset-left)) calc(var(--nav-hoehe) + 28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right)); min-width: 0; max-width: 980px; margin: 0 auto; outline: 0; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 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); }
.nav .logo { display: none; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--nav-hoehe); padding: 6px 2px; color: var(--text-2); text-decoration: none; font-size: 12px; position: relative; min-width: 0; }
.nav a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav a.aktiv { color: var(--akzent); }
.nav a.aktiv::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--akzent); }
.nav .zahl { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--akzent); color: var(--akzent-text); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.nav .unten { display: none; }
.nav-beschriftung { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- Bausteine ---------- */
.kopf { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.kopf h1, .kopf h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.kopf .rechts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.unterzeile { color: var(--text-2); margin: -10px 0 16px; font-size: 15px; }
h3 { margin: 0 0 10px; font-size: 16px; }
.abschnitt { margin-bottom: 26px; }
.abschnitt > h2 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.abschnitt > h2 .zaehler { background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: 99px; font-size: 13px; padding: 1px 9px; color: var(--text-2); font-weight: 600; }
.abschnitt.dringend > h2 .zaehler { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }

.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: 10px; cursor: pointer; text-align: center; text-decoration: none; color: var(--text); }
.knopf:hover { border-color: #4a4a4a; }
.knopf.primaer { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); font-weight: 600; }
.knopf.gut { background: var(--gut); color: #04170c; border-color: var(--gut); font-weight: 700; }
.knopf.warn { color: var(--akzent); border-color: #6b5700; }
.knopf.gefahr { color: #ff8b8e; border-color: #6a2224; }
.knopf.gross { min-height: 52px; font-size: 17px; width: 100%; }
.knopf.klein { min-height: 44px; font-size: 15px; padding: 0 14px; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf-reihe { display: flex; gap: 10px; flex-wrap: wrap; }
.knopf-reihe > .knopf { flex: 1 1 140px; }

.karte { min-width: 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px; }
.karte + .karte { margin-top: 12px; }
.karte.hervor { border-color: #6b5700; box-shadow: inset 4px 0 0 var(--akzent); }
.karte.ueberfaellig { box-shadow: inset 4px 0 0 var(--fehler); }
.karten-liste { display: grid; gap: 12px; }
.karten-liste > .karte + .karte { margin-top: 0; }

.feld { display: grid; gap: 6px; min-width: 0; }
.feld > span { font-size: 14px; color: var(--text-2); }
.formular { display: grid; gap: 16px; }
.formular .zeile { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
input[type=text], input[type=search], input[type=password], input[type=date], input[type=url], textarea, select {
  width: 100%; min-width: 0; min-height: 44px; background: var(--bg); border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px; font-size: 16px; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input[type=date] { display: block; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.haken { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.haken input { width: 24px; height: 24px; accent-color: var(--akzent); flex: none; }
.hinweis { color: var(--text-2); font-size: 14px; }
.hinweis.klein { font-size: 13px; color: var(--text-3); }
.hinweis-kasten { border: 1px solid #5a4a00; background: #17140a; border-radius: 10px; padding: 10px 12px; color: #e8d89a; font-size: 14px; }
.fehlertext { color: #ff8b8e; font-size: 15px; }
.fehlertext:empty { display: none; }
.leer { color: var(--text-3); padding: 22px 12px; text-align: center; border: 1px dashed var(--linie); border-radius: var(--radius); }
.ruhig { color: var(--text-3); }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; line-height: 1.2; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--linie); color: var(--text-2); max-width: 100%; }
.chip.team { background: var(--flaeche-2); }
.chip.prio-hoch { color: #ff9a9d; border-color: #6a2224; }
.chip.prio-niedrig { color: var(--text-3); }
.chip.befund { color: #86b6ef; border-color: #1c3d66; }
.chip.frist-ueber { color: #ff9a9d; border-color: #6a2224; font-weight: 600; }
.chip.freigabe-nein { color: var(--akzent); border-color: #6b5700; }
.chip.freigabe-ja { color: #6fd39a; border-color: #1d5a35; }
.status { font-weight: 600; }
.status-neu { color: var(--text-2); }
.status-sortiert { color: #86b6ef; border-color: #1c3d66; }
.status-wartet_auf_ja { color: var(--akzent); border-color: #6b5700; background: #17140a; }
.status-in_arbeit { color: #b69cf5; border-color: #3b2d6e; }
.status-bereit_zur_pruefung { color: #6fd39a; border-color: #1d5a35; }
.status-geprueft { color: #6fd39a; border-color: #1d5a35; }
.status-erledigt { color: var(--text-3); }
.status-abgelehnt, .status-abgebrochen { color: var(--text-3); text-decoration: line-through; }
.status-rueckfrage { color: #ffb86b; border-color: #6e4300; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Auftrags-Karte (Liste und «Heute») ---------- */
.auftrag { display: grid; gap: 8px; }
.auftrag .titel { font-weight: 600; font-size: 17px; color: var(--text); text-decoration: none; display: block; overflow-wrap: anywhere; }
.auftrag a.titel:hover { text-decoration: underline; }
.auftrag .auszug { color: var(--text-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.auftrag .grund { border-left: 3px solid var(--akzent); padding: 2px 0 2px 10px; color: var(--text); font-size: 15px; white-space: pre-line; }
.auftrag .id { color: var(--text-3); font-weight: 400; font-size: 14px; margin-right: 6px; }
.freigabe-aktionen { display: grid; gap: 10px; margin-top: 4px; }
.freigabe-aktionen textarea { min-height: 76px; }
.freigabe-knoepfe { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.freigabe-knoepfe .knopf { min-height: 54px; font-size: 17px; }

/* ---------- Detail ---------- */
.meta { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 0; }
.meta > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: baseline; border-bottom: 1px solid #222; padding-bottom: 8px; }
.meta > div:last-child { border-bottom: 0; padding-bottom: 0; }
.meta dt { color: var(--text-3); font-size: 14px; }
.meta dd { margin: 0; }
.beschreibung { white-space: pre-wrap; overflow-wrap: anywhere; }
.verlauf { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.verlauf li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--linie); margin-left: 6px; }
.verlauf li:last-child { padding-bottom: 0; border-left-color: transparent; }
.verlauf li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--linie); border: 2px solid var(--bg); }
.verlauf li.v-freigabe::before { background: var(--akzent); }
.verlauf li.v-kommentar::before { background: #86b6ef; }
.verlauf li.v-status::before { background: #6b6a63; }
.verlauf li.v-anhang::before { background: #6fd39a; }
.verlauf .kopfzeile { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; font-size: 14px; color: var(--text-3); }
.verlauf .kopfzeile b { color: var(--text-2); font-weight: 600; }
.verlauf .inhalt { white-space: pre-wrap; margin-top: 2px; }
.anhang-liste { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.anhang-liste li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: 10px; padding: 8px 8px 8px 12px; }
.anhang-liste a { overflow-wrap: anywhere; }
.status-knoepfe { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
details.einklappbar { border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); }
details.einklappbar > summary { min-height: 48px; display: flex; align-items: center; padding: 0 16px; cursor: pointer; color: var(--text-2); font-weight: 600; list-style-position: inside; }
details.einklappbar[open] > summary { border-bottom: 1px solid var(--linie); }
details.einklappbar > .inneres { padding: 16px; display: grid; gap: 14px; }

/* ---------- Filter ---------- */
.filter { display: grid; gap: 10px; margin-bottom: 14px; }
.filter .zeile { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.filter .zeile.eins { grid-template-columns: minmax(0, 1fr); }
.schnell { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; overscroll-behavior-x: contain; }
.schnell::-webkit-scrollbar { display: none; }
.schnell button { flex: none; min-height: 44px; padding: 0 16px; border-radius: 99px; background: var(--flaeche); border: 1px solid var(--linie); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.schnell button.aktiv { background: var(--flaeche-2); color: var(--text); border-color: var(--akzent); }

/* ---------- Tabellen: auf dem Handy als Karten, ab 901 px als Tabelle ---------- */
.tabelle { width: 100%; border-collapse: collapse; font-size: 15px; }
.tabelle thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tabelle, .tabelle tbody { display: block; width: 100%; }
.tabelle tr { display: block; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 4px 14px; margin-bottom: 12px; overflow: hidden; }
.tabelle td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; border-bottom: 1px solid #262626; text-align: right; min-width: 0; }
.tabelle td:last-child { border-bottom: 0; }
.tabelle td::before { content: attr(data-label); color: var(--text-3); font-size: 14px; text-align: left; flex: none; }
.tabelle td.karten-titel { display: block; text-align: left; font-weight: 600; font-size: 17px; padding: 12px 0 10px; }
.tabelle td.karten-titel::before { content: none; }
.tabelle td.aktionen-zelle { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; padding: 10px 0 8px; text-align: center; }
.tabelle td.aktionen-zelle::before { content: none; }
.tabelle td.aktionen-zelle .knopf { width: 100%; }
.tabelle td .chips { justify-content: flex-end; }

/* ---------- Dialog (Handy: Blatt von unten) ---------- */
.dialog-hg { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .7); display: flex; align-items: flex-end; justify-content: center; overscroll-behavior: contain; }
body:has(.dialog-hg) { overflow: hidden; }
.dialog { width: 100%; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 18px 18px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.dialog h2 { margin: 0; font-size: 20px; }
.dialog .knopf-reihe { position: sticky; bottom: -1px; background: var(--flaeche); padding-top: 4px; }
.token-feld { background: var(--bg); border: 1px solid var(--akzent); border-radius: 10px; padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; user-select: all; overflow-wrap: anywhere; }
pre.befehl { margin: 0; background: var(--bg); border: 1px solid var(--linie); border-radius: 10px; padding: 12px; font-size: 13px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

#toast-wurzel { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-hoehe) + 14px + env(safe-area-inset-bottom)); z-index: 80; display: grid; justify-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast { background: #262626; border: 1px solid #3a3a3a; padding: 12px 16px; border-radius: 10px; max-width: 100%; pointer-events: auto; }
.toast.fehler { border-color: #6a2224; color: #ffb3b5; }
.lade { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: dreh .7s linear infinite; vertical-align: -3px; }
@keyframes dreh { to { transform: rotate(360deg); } }

.protokoll { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }
.protokoll li { display: grid; gap: 2px; border-bottom: 1px solid #222; padding-bottom: 6px; }
.protokoll .zeit { color: var(--text-3); font-size: 13px; }
.protokoll .fehler { color: #ff9a9d; }

/* ---------- Querformat am Handy: wenig Höhe ---------- */
@media (max-height: 500px) {
  :root { --nav-hoehe: 52px; }
  .nav a { flex-direction: row; gap: 8px; font-size: 13px; min-height: 52px; }
  .nav a svg { width: 20px; height: 20px; }
  .nav .zahl { top: 4px; left: calc(50% + 28px); }
  .dialog { max-height: 96vh; max-height: 96dvh; border-radius: 14px 14px 0 0; }
  .login { place-items: start center; }
}

/* ---------- Ab 560 px: etwas mehr Luft ---------- */
@media (min-width: 560px) {
  .formular .zeile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .freigabe-knoepfe { grid-template-columns: 2fr 1fr 1fr; }
  .meta > div { grid-template-columns: 140px minmax(0, 1fr); }
}

/* ---------- Tablet quer / Desktop (ab 901 px): Seitenleiste, Tabellen ---------- */
@media (min-width: 901px) {
  :root { --nav-hoehe: 0px; }
  body { font-size: 15px; }
  .app { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
  .nav { position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100vh; display: flex; flex-direction: column; align-items: stretch; gap: 4px; border-top: 0; border-right: 1px solid var(--linie); padding: 20px 14px; }
  .nav .logo { display: inline-flex; padding: 0 8px 18px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 8px; font-size: 15px; }
  .nav a:hover { background: var(--flaeche-2); color: var(--text); }
  .nav a.aktiv { background: var(--flaeche-2); box-shadow: inset 3px 0 0 var(--akzent); }
  .nav a.aktiv::before { content: none; }
  .nav .zahl { position: static; margin-left: auto; }
  .nav .unten { display: grid; gap: 4px; margin-top: auto; }
  main { padding: 28px 36px 60px; max-width: 1040px; width: 100%; margin: 0; }
  .schnell { margin: 0; padding: 2px 0 6px; flex-wrap: wrap; overflow: visible; }
  .filter .zeile { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter .zeile.eins { grid-template-columns: minmax(0, 1fr); }
  .freigabe-knoepfe { grid-template-columns: auto auto auto; justify-content: start; }
  .freigabe-knoepfe .knopf { min-width: 150px; }
  .dialog-hg { align-items: center; padding: 24px; }
  .dialog { width: min(520px, 100%); border-radius: 16px; padding: 24px; }
  #toast-wurzel { bottom: 24px; }
  .tabelle, .tabelle tbody { display: table; }
  .tabelle tbody { display: table-row-group; }
  .tabelle thead { position: static; width: auto; height: auto; overflow: visible; clip-path: none; display: table-header-group; }
  .tabelle tr { display: table-row; background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
  .tabelle th { text-align: left; color: var(--text-3); font-weight: 500; font-size: 13px; padding: 8px; border-bottom: 1px solid var(--linie); }
  .tabelle td { display: table-cell; padding: 12px 8px; border-bottom: 1px solid #222; text-align: left; vertical-align: top; }
  .tabelle td::before { content: none; }
  .tabelle td.karten-titel { font-size: 15px; padding: 12px 8px; }
  .tabelle td.aktionen-zelle { display: table-cell; }
  .tabelle td.aktionen-zelle .knopf { width: auto; margin: 0 6px 6px 0; }
  .tabelle td .chips { justify-content: flex-start; }
  .karten-liste.zweispaltig { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.nav-aktion { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; background: none; border: 0; border-radius: 8px; color: var(--text-2); cursor: pointer; text-align: left; }
.nav-aktion:hover { background: var(--flaeche-2); color: var(--text); }

input[type=file] { width: 100%; min-height: 44px; font-size: 16px; padding: 6px; border: 1px solid var(--linie); border-radius: 10px; background: var(--bg); color: var(--text-2); }
input[type=file]::file-selector-button { min-height: 44px; padding: 0 14px; margin-right: 12px; border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche-2); color: var(--text); font: inherit; cursor: pointer; }
