:root { --gelb:#F5A800; --marke:#002549; --bg:#f3f4f6; --fg:#14181f; --muted:#556070; --card:#fff; --line:#c9ced6; --accent:#002549; --accent-fg:#fff; --err:#b3261e; --ok:#1a7f37; --warn:#8a5a00; --schatten:0 8px 24px rgba(0,0,0,.18); color-scheme: light dark; }
/* Design: ohne Auswahl nach Gerät, sonst per data-design="hell" bzw. "dunkel" (siehe shared/theme.js) */
:root[data-design="hell"] { color-scheme: light; }
:root[data-design="dunkel"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-design="hell"]) { --bg:#12161c; --fg:#eef1f5; --muted:#a6b0be; --card:#1b212a; --line:#3a4350; --accent:#6db2f2; --accent-fg:#0a1420; --err:#ff8a80; --schatten:0 8px 24px rgba(0,0,0,.5); --ok:#6fdc8c; --warn:#ffc94d; }
}
:root[data-design="dunkel"] { --bg:#12161c; --fg:#eef1f5; --muted:#a6b0be; --card:#1b212a; --line:#3a4350; --accent:#6db2f2; --accent-fg:#0a1420; --err:#ff8a80; --schatten:0 8px 24px rgba(0,0,0,.5); --ok:#6fdc8c; --warn:#ffc94d; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--fg); font:18px/1.4 system-ui, "Segoe UI", sans-serif; }
[hidden] { display:none !important; }
h1 { margin:0 0 16px; font-size:1.4rem; }
h2 { font-size:1.1rem; margin:24px 0 8px; }
label { display:block; margin:12px 0 4px; font-weight:600; }
label.haken { display:flex; align-items:center; gap:12px; }
input, button, select, textarea { font:inherit; min-height:48px; border-radius:8px; }
input, select, textarea { width:100%; padding:8px 12px; border:1px solid var(--line); background:var(--bg); color:var(--fg); }
textarea { min-height:96px; resize:vertical; }
input[type="checkbox"], input[type="radio"] { width:26px; min-height:26px; flex:none; }
button { padding:8px 16px; border:0; background:var(--accent); color:var(--accent-fg); font-weight:600; cursor:pointer; }
button.zweit { background:transparent; color:var(--fg); border:1px solid var(--line); }
button.gefahr { background:transparent; color:var(--err); border:1px solid var(--err); }
:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
dialog h1[tabindex="-1"]:focus { outline:0; }   /* Überschrift bekommt beim Öffnen nur den Fokus, keinen Rahmen */
.fehler { color:var(--err); margin:4px 0 0; min-height:1.4em; }
.erfolg { color:var(--ok); margin:4px 0 0; min-height:1.4em; }
.klein { color:var(--muted); font-size:.9rem; }
.rot { color:var(--err) !important; font-weight:600; }
.warn { color:var(--warn) !important; font-weight:600; }
.leer { color:var(--muted); padding:16px 0; }

/* ---- Anmeldeseite ---- */
.login-seite { padding:16px; }
#login-box { width:100%; max-width:380px; margin:8vh auto 0; padding:24px; background:var(--card); border:1px solid var(--line); border-radius:10px; }
.login-kopf { margin:-24px -24px 20px; padding:24px; background:var(--marke); border-radius:10px 10px 0 0; text-align:center; }
.login-kopf img { display:inline-block; width:min(240px, 70%); height:auto; }
#login-box button { width:100%; margin-top:20px; }

/* ---- Suite: Leiste, Startseite, Modulmenü ---- */
body.shell { display:flex; flex-direction:column; height:100vh; height:100dvh; }
.leiste { position:relative; z-index:10; flex:none; display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:8px 16px; padding-top:calc(8px + env(safe-area-inset-top, 0px)); background:var(--marke); color:#fff; border-bottom:1px solid rgba(255,255,255,.15); }
.logo { display:flex; align-items:center; min-height:44px; border-radius:8px; }
.logo img { display:block; height:44px; width:auto; max-width:60vw; }
.leiste .module-btn { background:transparent; color:#fff; border:1px solid rgba(255,255,255,.55); }
.leiste .module-btn:hover, .leiste .module-btn[aria-expanded="true"] { background:rgba(255,255,255,.14); }
.leiste .logo:focus-visible, .leiste .module-btn:focus-visible { outline-color:#fff; }
.module-btn { display:flex; align-items:center; gap:8px; min-height:44px; }
.module-btn svg, .icon-btn svg, .panel-link svg, .kachel svg { width:24px; height:24px; flex:none; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.modulmenue { position:relative; }
.panel { color:var(--fg); position:absolute; right:0; top:calc(100% + 8px); width:min(340px, calc(100vw - 32px)); padding:8px; background:var(--card);
  border:1px solid var(--line); border-radius:12px; box-shadow:var(--schatten); }
.panel hr { border:0; border-top:1px solid var(--line); margin:8px 0; }
.panel-titel { padding:8px 12px 4px; color:var(--muted); font-size:.85rem; font-weight:600; text-transform:uppercase; letter-spacing:.04em; }
.panel-link { display:flex; align-items:center; gap:12px; min-height:56px; padding:8px 12px; border-radius:8px; color:var(--fg); text-decoration:none; }
.panel-link:hover, .kachel:hover { background:var(--bg); }
.panel-link[aria-current="page"] { background:var(--bg); box-shadow:inset 4px 0 0 var(--accent); }
.panel-link small { display:block; color:var(--muted); font-size:.85rem; }
.panel-fuss { display:grid; gap:8px; padding:4px 12px 8px; }
.panel-aktionen { display:flex; justify-content:flex-end; gap:8px; }
.icon-btn { display:grid; place-items:center; min-width:40px; padding:0; }
.icon-btn svg { width:22px; height:22px; }
.panel-fuss button { min-height:40px; }
.buehne { position:relative; flex:1; min-height:0; overflow:auto; }
#rahmen { position:absolute; inset:0 0 env(safe-area-inset-bottom, 0px) 0; width:100%; height:calc(100% - env(safe-area-inset-bottom, 0px)); border:0; background:var(--bg); }
.start { max-width:900px; margin:0 auto; padding:24px 16px 32px; }
.kacheln { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:12px; margin-top:16px; }
.kachel { display:grid; gap:6px; align-content:start; padding:20px; background:var(--card); border:1px solid var(--line); border-radius:12px; color:var(--fg); text-decoration:none; }
.kachel svg { width:32px; height:32px; color:var(--accent); }
.kachel span { color:var(--muted); font-size:.95rem; }

/* ---- Module (in der Suite eingebettet) ---- */
body.modul main { padding:16px 20px 32px; }   /* gesamte Breite des Bildschirms */
nav.tabs { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
nav.tabs button { background:transparent; color:var(--fg); border:1px solid var(--line); }
nav.tabs button[aria-current="page"] { background:var(--accent); color:var(--accent-fg); border-color:var(--accent); }

/* Menü links (Bereiche eines Moduls); auf schmalen Bildschirmen steht es oben */
.menuelayout { display:grid; grid-template-columns:240px minmax(0,1fr); gap:24px; align-items:start; }
.menuelayout.ohne-menue { grid-template-columns:minmax(0,1fr); }
.menuelayout > nav.tabs { flex-direction:column; flex-wrap:nowrap; gap:2px; margin:0; padding:8px; position:sticky; top:16px;
  background:var(--card); border:1px solid var(--line); border-radius:12px; }
.menuelayout > nav.tabs::before { content:"Menü"; padding:6px 12px 8px; font-size:.8rem; font-weight:700; letter-spacing:.08em;
  text-transform:uppercase; color:var(--muted); }
.menuelayout > nav.tabs button { width:100%; text-align:left; border:0; border-left:4px solid transparent; border-radius:8px;
  font-weight:500; }
.menuelayout > nav.tabs button:hover { background:var(--bg); }
.menuelayout > nav.tabs button[aria-current="page"] { background:color-mix(in srgb, var(--accent) 14%, transparent);
  color:var(--fg); border-left-color:var(--accent); font-weight:700; }
@media (max-width:719px) {
  .menuelayout { grid-template-columns:minmax(0,1fr); gap:0; }
  .menuelayout > nav.tabs { position:static; flex-direction:row; flex-wrap:wrap; margin-bottom:16px; padding:0; background:none; border:0; }
  .menuelayout > nav.tabs::before { display:none; }
  .menuelayout > nav.tabs button { width:auto; text-align:center; border:1px solid var(--line); }
  .menuelayout > nav.tabs button[aria-current="page"] { background:var(--accent); color:var(--accent-fg); border-color:var(--accent); }
}
.werkzeug { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.werkzeug input { flex:1 1 200px; width:auto; }
.werkzeug select { flex:1 1 180px; width:auto; }
ul { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.karte { display:block; width:100%; text-align:left; padding:12px 16px; background:var(--card); color:var(--fg); border:1px solid var(--line); font-weight:400; }
.karte strong { display:block; }
.karte span { display:block; color:var(--muted); font-size:.95rem; }
.karte span.rot { color:var(--err); }
.karte span.warn { color:var(--warn); }

.mitneu { display:flex; gap:8px; }
.mitneu select { flex:1 1 auto; width:auto; min-width:0; }
.suchwahl { position:relative; flex:1 1 auto; min-width:0; }
.suchliste { position:absolute; z-index:20; left:0; right:0; top:calc(100% + 2px); margin:0; padding:4px; list-style:none; max-height:260px; overflow-y:auto;
  background:var(--card); border:1px solid var(--line); border-radius:8px; box-shadow:0 6px 18px rgba(0,0,0,.2); }
.suchliste[hidden] { display:none; }
.suchliste li { padding:10px 12px; border-radius:6px; cursor:pointer; min-height:44px; display:flex; align-items:center; }
.suchliste li[aria-selected="true"] { background:var(--accent); color:var(--accent-fg); }
.suchliste li.gewaehlt { font-weight:700; }
.suchliste li.keine { color:var(--muted); cursor:default; }
.mitneu button { flex:none; white-space:nowrap; }

dialog { width:min(480px, calc(100% - 24px)); max-height:calc(100% - 24px); overflow:auto; padding:20px; background:var(--card); color:var(--fg); border:1px solid var(--line); border-radius:10px; }
dialog::backdrop { background:rgba(0,0,0,.5); }
.knoepfe { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.knoepfe button { flex:1 1 120px; }

.auftrag { display:grid; gap:10px; padding:16px; background:var(--card); border:1px solid var(--line); border-radius:10px; }
.auftrag h3 { margin:0; font-size:1.15rem; }
.auftrag p { margin:0; }
.auftrag a { color:var(--accent); }
.auftrag .knoepfe { margin-top:4px; }
.auftrag .knoepfe button { flex:1 1 140px; }
/* Karte und Navigation zu einem Ziel (shared/karte.js) */
.ziel { display:grid; gap:8px; }
.ziel p { margin:0; }
.kartenvorschau { border:1px solid var(--line); border-radius:8px; overflow:hidden; background:var(--bg); }
.karten-flaeche { position:relative; height:240px; display:grid; }
.kartenvorschau.klein .karten-flaeche { height:200px; }
.karten-flaeche iframe { width:100%; height:100%; border:0; display:block; pointer-events:none; }   /* nicht zoom- oder verschiebbar */
.karten-meldung { margin:auto; padding:12px; text-align:center; color:var(--muted); }
.karten-fuss { display:flex; flex-wrap:wrap; gap:4px 14px; padding:4px 10px; font-size:.8rem; color:var(--muted); }
.karten-fuss:empty { display:none; }
.karten-fuss a { color:var(--accent); }
.karten-fuss .warn { color:var(--warn); }
.navi-knopf { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:10px 16px; min-height:44px;
  border-radius:8px; background:var(--accent); color:var(--accent-fg) !important; font-weight:600; text-decoration:none; text-align:center; }
.navi-knopf small { font-weight:400; opacity:.85; }
.vorschau-feld { display:grid; gap:8px; }
#formular .leer { display:none; }
.hinweis { white-space:pre-wrap; padding:8px 12px; border-left:4px solid var(--accent); background:var(--bg); }

/* ---- Einstellungen ---- */
dialog h2 { margin:0 0 8px; }
dialog section + section { margin-top:20px; padding-top:20px; border-top:1px solid var(--line); }
fieldset { border:0; padding:0; margin:0; }
legend { padding:0; margin-bottom:8px; font-weight:600; }
.optionen { display:grid; gap:4px; }
.optionen label { margin:0; min-height:44px; font-weight:400; }

/* ---- Nachrichten (Chat) ---- */
.badge { display:inline-block; min-width:1.5em; margin-left:8px; padding:0 .45em; border-radius:999px; background:var(--err); color:#fff;
  font-size:.8rem; font-weight:700; line-height:1.5em; text-align:center; vertical-align:middle; }
.menuelayout > nav.tabs button { display:flex; align-items:center; justify-content:space-between; gap:8px; }

.chat-zweispaltig { display:grid; grid-template-columns:300px minmax(0,1fr); gap:16px; align-items:start; }
.chat-fahrer { max-height:calc(100vh - 160px); overflow:auto; }
.chat-fahrer-knopf { display:grid; gap:2px; width:100%; text-align:left; padding:10px 14px; background:var(--card); color:var(--fg);
  border:1px solid var(--line); border-left:4px solid transparent; font-weight:400; }
.chat-fahrer-knopf[aria-current="true"] { border-left-color:var(--accent); background:color-mix(in srgb, var(--accent) 12%, var(--card)); }
.chat-fahrer-kopf { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.chat-vorschau { color:var(--muted); font-size:.9rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-titel { margin:0 0 8px; }
.chat-zurueck { display:none; margin-bottom:8px; }

.chat { display:grid; gap:8px; }
.chat-verlauf { display:flex; flex-direction:column; gap:8px; height:calc(100vh - 280px); min-height:260px; overflow:auto;
  padding:12px; background:var(--bg); border:1px solid var(--line); border-radius:12px; }
.chat-blase { display:grid; gap:2px; max-width:min(80%, 640px); padding:8px 12px; border-radius:14px; border:1px solid var(--line); background:var(--card); }
.chat-blase.meine { align-self:flex-end; background:color-mix(in srgb, var(--accent) 16%, var(--card)); border-bottom-right-radius:4px; }
.chat-blase.andere { align-self:flex-start; border-bottom-left-radius:4px; }
.chat-absender { font-size:.85rem; font-weight:700; color:var(--muted); }
.chat-auftrag { font-size:.85rem; font-weight:600; color:var(--accent); text-decoration:underline; cursor:pointer; }
.auftragsleiste { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:12px;
  padding:10px 14px; background:var(--card); border:1px solid var(--line); border-radius:12px; }
.chat-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-zeit { font-size:.8rem; color:var(--muted); justify-self:end; }
.chat-schreiben { display:flex; gap:8px; align-items:flex-end; }
.chat-schreiben textarea { flex:1 1 auto; min-height:56px; }
.chat-schreiben button { flex:none; }

@media (max-width:719px) {
  .chat-zweispaltig { grid-template-columns:minmax(0,1fr); }
  .chat-zweispaltig .chat-rechts { display:none; }
  .chat-zweispaltig.mit-verlauf .chat-fahrer { display:none; }
  .chat-zweispaltig.mit-verlauf .chat-rechts { display:block; }
  .chat-zurueck { display:inline-block; }
  .chat-verlauf { height:calc(100vh - 340px); }
  .chat-blase { max-width:92%; }
}

/* ---- Tabellen (Listen der Module) ---- */
.tabelle-wrap { overflow-x:auto; background:var(--card); border:1px solid var(--line); border-radius:8px; }
.tabelle { width:100%; border-collapse:collapse; }
.tabelle th { position:sticky; top:0; text-align:left; padding:10px 14px; font-size:.85rem; font-weight:600; color:var(--muted);
  white-space:nowrap; background:var(--card); border-bottom:2px solid var(--line); }
.tabelle td { padding:10px 14px; vertical-align:top; border-bottom:1px solid var(--line); white-space:pre-line; overflow-wrap:break-word; }
.tabelle tbody tr:last-child td { border-bottom:0; }
.tabelle tbody tr:nth-child(even) { background:color-mix(in srgb, var(--fg) 4%, transparent); }
.tabelle tr.klick { cursor:pointer; }
.tabelle tr.klick:hover { background:color-mix(in srgb, var(--accent) 12%, transparent); }
.tabelle tr:focus-within { outline:3px solid var(--accent); outline-offset:-3px; }
.tabelle .zeilenlink { min-height:0; padding:0; border:0; background:none; color:inherit; font-weight:600; text-align:left; border-radius:0; }
.tabelle .zeilenlink:focus-visible { outline:0; }
@media (max-width: 760px) {
  .tabelle-wrap { background:none; border:0; overflow:visible; }
  .tabelle, .tabelle tbody { display:block; }
  .tabelle thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
  .tabelle tbody tr, .tabelle tbody tr:nth-child(even) { display:flex; flex-direction:column; margin-bottom:8px; padding:8px 16px; background:var(--card);
    border:1px solid var(--line); border-radius:8px; }
  .tabelle td { display:block; padding:2px 0; border:0; }
  .tabelle td:empty { display:none; }
  .tabelle td.karten-titel { order:-1; font-size:1.05rem; }
  .tabelle td.nur-tabelle { display:none; }
  .tabelle td:not(.karten-titel)::before { content:attr(data-label) ": "; color:var(--muted); font-size:.9rem; }
}

/* ---- Zeilenaktionen in Listen (liste.js: aktionen) ---- */
.tabelle td.aktionen-zelle { width:1%; white-space:nowrap; text-align:right; }
.aktionen { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.aktionen button { padding:6px 12px; }
.karte .aktionen { margin-top:8px; }
/* Ab zwei Aktionen: ein runder „+“-Knopf, der ein kleines Menü aufklappt */
.plusknopf { width:48px; height:48px; min-height:48px; padding:0; border-radius:50%; font-size:1.7rem; font-weight:500; line-height:1; }
.plusknopf[aria-expanded="true"] { background:var(--fg); color:var(--bg); }
.aktionsmenue { position:fixed; z-index:50; display:flex; flex-direction:column; gap:6px; min-width:max-content; padding:8px;
  background:var(--card); border:1px solid var(--line); border-radius:10px; box-shadow:var(--schatten); }
.aktionsmenue[hidden] { display:none; }
.aktionsmenue button { min-height:48px; text-align:left; white-space:nowrap; }
@media (max-width: 760px) {
  /* Karte zweispaltig: links der Text, rechts die Knöpfe bzw. das „+“ */
  .tabelle tbody tr:has(> td.aktionen-zelle) { display:grid; grid-template-columns:minmax(0, 1fr) auto; column-gap:12px; align-content:start; }
  .tabelle tbody tr:has(> td.aktionen-zelle) > td { grid-column:1; }
  .tabelle td.aktionen-zelle { grid-column:2 !important; grid-row:1 / span 50; align-self:start; width:auto; white-space:normal; }
  .tabelle td.aktionen-zelle::before { content:none; }
  .tabelle .aktionen:not(.mit-plus) { flex-direction:column; }
  .tabelle .aktionen:not(.mit-plus) button { min-height:44px; padding:6px 10px; font-size:.9rem; }
}

/* ---- Hinweis bei neuer Nachricht ---- */
.neu-hinweis { position:fixed; z-index:60; top:12px; left:50%; transform:translateX(-50%); display:flex; align-items:stretch;
  width:max-content; max-width:calc(100% - 24px); background:var(--accent); color:var(--accent-fg); border-radius:10px; box-shadow:var(--schatten); }
.neu-hinweis button { background:transparent; color:inherit; border-radius:10px; }
.neu-hinweis .neu-link { padding:10px 16px; font-size:1.05rem; }
.neu-hinweis .neu-zu { min-width:48px; padding:0 12px; font-size:1.4rem; border-left:1px solid color-mix(in srgb, var(--accent-fg) 30%, transparent); border-radius:0 10px 10px 0; }
@media (prefers-reduced-motion: no-preference) { .neu-hinweis { animation:neu-rein .25s ease-out; } }
@keyframes neu-rein { from { opacity:0; transform:translate(-50%, -12px); } }

/* ---- Überschriften im Menü, Haken in Tabellen ---- */
/* Überschriften der Menügruppen: Gelb der Marke mit dunkelblauer Schrift (auf hellem und dunklem Untergrund gut lesbar) */
nav.tabs .menue-gruppe { flex-basis:100%; margin:10px 0 2px; padding:3px 10px; border-radius:4px; font-size:.78rem; font-weight:700;
  letter-spacing:.06em; text-transform:uppercase; background:var(--gelb); color:var(--marke); }
.menuelayout > nav.tabs .menue-gruppe { margin-left:0; margin-right:0; }
@media (max-width: 760px) { .menuelayout > nav.tabs .menue-gruppe { flex-basis:auto; align-self:center; margin:8px 0 0; } }
.menuelayout > nav.tabs .menue-gruppe:first-of-type { margin-top:0; }
.listenmeldung { min-height:1.4em; margin:0 0 8px; font-size:.95rem; color:var(--muted); }
.listenmeldung.fehler { color:var(--err); font-weight:600; }
.tabelle th.mitte, .tabelle td.haken-zelle { text-align:center; }
.tabelle .tabellenhaken { width:22px; height:22px; margin:0; cursor:pointer; accent-color:var(--accent); }
.tabelle .tabellenhaken:disabled { cursor:default; }
@media (max-width: 760px) {
  .tabelle td.haken-zelle { display:flex; align-items:center; gap:10px; min-height:44px; text-align:left; }
  .tabelle td.haken-zelle input { order:1; }
  .tabelle td.haken-zelle::before { order:2; flex:1; }
}

/* ---- Gruppen in Tabellen (z. B. Konto | Rollen) ---- */
.tabelle .gruppenzeile th { padding:6px 14px 2px; font-size:.78rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--muted); border-bottom:0; }
.tabelle th.gruppen-anfang, .tabelle td.gruppen-anfang { border-left:2px solid var(--line); }
.tabelle .gruppenzeile th.gruppenkopf:empty { border-left:0; }
@media (max-width: 760px) { .tabelle td.gruppen-anfang { border-left:0; } .tabelle td.haken-zelle::before { content:attr(data-label); } }


/* ---- Auftragskarte der Fahrer (kompakt) ---- */
.a-kopf { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.a-nr { color:var(--muted); font-size:.9rem; white-space:nowrap; }
.a-ziel { display:grid; gap:2px; }
.a-ziel a.tel { justify-self:start; display:inline-flex; align-items:center; min-height:44px; font-weight:600; }
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip { padding:2px 10px; border-radius:999px; border:1px solid var(--line); background:var(--bg); font-size:.85rem; }
.chip.rot { border-color:var(--err); }
.chip.warn { border-color:var(--warn); }
.a-mehr summary { display:flex; align-items:center; justify-content:space-between; min-height:44px; padding:0 4px; cursor:pointer; font-weight:600; color:var(--accent); list-style:none; }
.a-mehr summary::-webkit-details-marker { display:none; }
.a-mehr summary::after { content:"▾"; transition:transform .15s; }
.a-mehr[open] summary::after { transform:rotate(180deg); }
.a-mehr > :not(summary) { margin-top:10px; }
button.gross { width:100%; min-height:52px; font-size:1.05rem; }
button.textknopf { background:none; border:0; min-height:44px; padding:0 4px; color:var(--muted); font-weight:500; text-decoration:underline; text-align:left; }
.umschalter, .filterknopf { display:none; }
.ico, .lbl-m { display:none; }
.ptr { position:fixed; z-index:50; top:0; left:50%; transform:translate(-50%, 0); padding:6px 14px; border-radius:999px; background:var(--accent); color:var(--accent-fg); font-size:.85rem; box-shadow:var(--schatten); pointer-events:none; }

/* ============================================================
   Handy (schmale Bildschirme): ruhigere Bedienung
   - einheitliche Größen: Knöpfe und Felder 44 px hoch, Schrift 16 px
   - Menü als feste Leiste unten, „Neu“ als runder Knopf
   - Formulare als Vollbild, Hinweise als Blatt von unten
   ============================================================ */
@media (max-width:719px) {
  :root { --unten:0px; }
  body.hat-leiste { --unten:60px; }
  body { font-size:16px; }
  html, body { overscroll-behavior-y:contain; }
  html { scroll-padding-bottom:calc(var(--unten) + 20px); }   /* Fokus und Scrollen enden über der Leiste */
  h1 { font-size:1.25rem; margin-bottom:12px; }
  input, button, select, textarea { min-height:44px; }
  button { padding:8px 14px; font-size:.95rem; }
  input, select, textarea { padding:8px 12px; font-size:16px; }   /* 16 px: iOS zoomt sonst beim Antippen */
  textarea { min-height:88px; }
  body.modul main { padding:12px 12px calc(var(--unten) + 84px); }
  .nur-desktop { display:none !important; }

  /* Menü unten */
  .menuelayout > nav.tabs.unten { position:fixed; left:0; right:0; top:auto; bottom:0; height:auto; z-index:30; display:flex; flex-wrap:nowrap; gap:0; margin:0; padding:0;
    overflow-x:auto; background:var(--card); border:0; border-top:1px solid var(--line); border-radius:0; box-shadow:0 -2px 10px rgba(0,0,0,.08); }
  .menuelayout > nav.tabs.unten .menue-gruppe { display:none; }
  .menuelayout > nav.tabs.unten button { flex:1 0 0; min-width:64px; min-height:60px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
    padding:6px 4px; position:relative; background:transparent; color:var(--muted); border:0; border-top:3px solid transparent; border-radius:0;
    font-size:.72rem; font-weight:600; text-align:center; }
  .menuelayout > nav.tabs.unten button[aria-current="page"],
  .menuelayout > nav.tabs.unten button.mit-aktiv { background:transparent; color:var(--accent); border-top-color:var(--accent); }
  .menuelayout > nav.tabs.unten .ico, .menuelayout > nav.tabs.unten .lbl-m { display:block; }
  .menuelayout > nav.tabs.unten .lbl-d { display:none; }
  .menuelayout > nav.tabs.unten .ico svg { display:block; width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
  .menuelayout > nav.tabs.unten .badge { position:absolute; top:4px; left:calc(50% + 6px); margin:0; min-width:1.3em; font-size:.7rem; line-height:1.3em; }
  /* Menüs innerhalb eines Bereichs (z. B. Stammdaten): eine Zeile zum Wischen statt mehrerer ungleicher Zeilen */
  .menuelayout > nav.tabs:not(.unten) { flex-wrap:nowrap; overflow-x:auto; gap:6px; margin:0 -12px 12px; padding:0 12px 4px; }
  .menuelayout > nav.tabs:not(.unten) button { flex:none; white-space:nowrap; }
  .menuelayout > nav.tabs:not(.unten) .menue-gruppe { display:none; }

  /* Umschalter Offen | Erledigt */
  .umschalter { display:grid; grid-template-columns:1fr 1fr; gap:0; margin-bottom:12px; border:1px solid var(--line); border-radius:10px; overflow:hidden; background:var(--card); }
  .umschalter button { border-radius:0; background:transparent; color:var(--fg); font-weight:500; }
  .umschalter button[aria-pressed="true"] { background:var(--accent); color:var(--accent-fg); font-weight:700; }

  /* Werkzeugleiste: Suche volle Breite, Filter eingeklappt, Neu als runder Knopf */
  .werkzeug { gap:8px; margin-bottom:12px; }
  .werkzeug input { flex:1 1 100%; }
  #filter { display:grid; grid-template-columns:1fr; gap:8px; }
  #filter select { width:100%; flex:none; display:none; }
  #filter.offen select { display:block; }
  .filterknopf { display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; text-align:left; font-weight:500; background:var(--card); }
  .filterknopf span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #neu { position:fixed; z-index:25; right:16px; bottom:calc(var(--unten) + 16px); width:56px; height:56px; min-height:56px; padding:0; border-radius:50%;
    font-size:0; box-shadow:0 4px 14px rgba(0,0,0,.3); }
  #neu::before { content:"+"; font-size:2rem; font-weight:400; line-height:1; }

  /* Karten und Listen */
  ul { gap:10px; }
  .auftrag { padding:14px; gap:8px; }
  .auftrag h3 { font-size:1.1rem; }
  .auftrag .navi-knopf { min-height:44px; padding:8px 14px; font-size:.95rem; }
  .auftrag .navi-knopf small { font-size:.8rem; }
  .karten-flaeche, .kartenvorschau.klein .karten-flaeche { height:180px; }
  .karte { padding:12px 14px; }
  .tabelle tbody tr, .tabelle tbody tr:nth-child(even) { padding:10px 14px; margin-bottom:10px; }

  /* Formulare: Vollbild mit fester Knopfleiste; Hinweise: Blatt von unten */
  dialog { width:100%; max-width:100%; margin:auto 0 0; max-height:92dvh; padding:16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-width:1px 0 0; border-radius:16px 16px 0 0; }
  dialog#dlg, dialog#dlg2 { height:100dvh; max-height:100dvh; margin:0; padding:0; border:0; border-radius:0; }
  dialog#dlg > form, dialog#dlg2 > form { display:flex; flex-direction:column; min-height:100%; padding:16px; }
  dialog#dlg form > div:first-of-type, dialog#dlg2 form > div:first-of-type { flex:0 0 auto; }
  dialog#dlg .knoepfe, dialog#dlg2 .knoepfe { position:sticky; bottom:0; margin:auto -16px 0; padding:10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background:var(--card); border-top:1px solid var(--line); z-index:5; }
  dialog#dlg .knoepfe button, dialog#dlg2 .knoepfe button { flex:1 1 40%; }
  #speichern, #speichern2 { flex:1 1 100% !important; order:-1; }
  .suchliste { max-height:40dvh; }
  .knoepfe button { flex:1 1 0; }

  .fehler:empty, .erfolg:empty { min-height:0; margin:0; }
  .listenmeldung:empty { display:none; }
  label { margin:10px 0 4px; }
  .a-ziel a.tel { min-height:36px; }

  /* Chat: Höhe berücksichtigt die Leiste unten */
  .chat-verlauf { height:calc(100dvh - 400px); min-height:200px; }
}


/* ---- Handy: Chat füllt den Bildschirm ----
   Eingabefeld und „Senden“ stehen immer ganz unten direkt über dem Menü, der Verlauf nimmt den Rest bis zur oberen Leiste ein.
   (Sobald ein Verlauf offen ist; die Fahrerliste der Disposition scrollt wie jede andere Liste.) */
@media (max-width:719px) {
  body.modul:has(.chat) { height:100dvh; overflow:hidden; }
  body.modul:has(.chat) main { height:100dvh; padding:8px 12px calc(var(--unten) + 8px); display:flex; flex-direction:column; overflow:hidden; }
  body.modul:has(.chat) .menuelayout { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; }
  body.modul:has(.chat) .menuelayout > .seite { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; }
  body.modul:has(.chat) .seite > h1 { flex:none; margin:0 0 6px; font-size:1.1rem; }
  .chat-zweispaltig.mit-verlauf { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; }
  body.modul:has(.chat-zweispaltig.mit-verlauf) .seite > h1 { display:none; }
  .chat-zweispaltig.mit-verlauf .chat-rechts { flex:1 1 auto; min-height:0; display:grid; grid-template-columns:auto minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); gap:6px 10px; align-items:center; }
  .chat-zweispaltig.mit-verlauf .chat-rechts > .chat { grid-column:1 / -1; min-height:0; height:100%; }
  .chat-zweispaltig.mit-verlauf .chat-titel { margin:0; font-size:1.05rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .chat-zweispaltig.mit-verlauf .chat-zurueck { margin:0; min-height:40px; }
  .chat { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; gap:6px; }
  .chat .chat-verlauf { flex:1 1 auto; height:auto; min-height:0; }
  .chat .chat-schreiben { flex:none; align-items:stretch; }
  .chat .chat-schreiben textarea { min-height:44px; height:48px; max-height:120px; resize:none; }
  .chat .chat-schreiben button { min-height:48px; align-self:stretch; padding:0 16px; }
  .chat .fehler { flex:none; margin:0; }
  /* Tastatur offen: Menü ausblenden, damit das Eingabefeld direkt über der Tastatur steht */
  body.modul:has(.chat-eingabe:focus) { --unten:0px; }
  body.modul:has(.chat-eingabe:focus) nav.tabs.unten { display:none; }
}


/* ---- Fahrerkarte zum Aufklappen ---- */
.a-kopfknopf { display:grid; gap:4px; width:100%; min-height:0; padding:0; background:none; color:inherit; border:0; border-radius:0; font-weight:400; text-align:left; cursor:pointer; }
.a-kopfknopf > span { display:block; }
.a-karte .a-kopf { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.a-karte .a-titel { font-size:1.1rem; }
.a-karte .a-ziel strong, .a-karte .a-ziel span { display:block; }
.a-karte .chips { display:flex; }
.a-karte .a-entl { color:var(--muted); font-size:.92rem; }
.a-karte .hinweis { padding:6px 10px; font-size:.95rem; }
.a-karte .a-weiter { display:flex; align-items:center; justify-content:flex-end; gap:6px; margin-top:2px; color:var(--accent); font-size:.85rem; font-weight:600; }
.a-karte .a-weiter::after { content:"▾"; }
.a-karte.offen .a-weiter::after { content:"▴"; }
.a-knoepfe, .a-karten { display:none; gap:10px; }
.a-karte.offen .a-knoepfe, .a-karte.offen .a-karten { display:grid; }
.a-karte.offen .a-knoepfe { margin-top:10px; padding-top:12px; border-top:1px solid var(--line); }
.a-karte.offen .a-karten { margin-top:10px; }
.a-knoepfe a.tel { display:flex; align-items:center; justify-content:center; min-height:44px; border:1px solid var(--line); border-radius:8px; font-weight:600; text-decoration:none; }
.a-knoepfe .navi-knopf { min-height:52px; padding:6px 14px; font-size:.95rem; }
.a-knoepfe .navi-knopf small { font-size:.8rem; }
.a-knoepfe button.gross { width:100%; }
@media (max-width:719px) {
  .auftrag.kompakt { padding:10px 12px; }
  .a-karte .a-titel { font-size:1rem; }
  .a-karte .chip { padding:1px 8px; font-size:.8rem; }
  .a-karte .a-weiter { font-size:.8rem; margin-top:0; }
}

/* PC: immer aufgeklappt; links Angaben und Karten, rechts die Knöpfe untereinander */
@media (min-width:720px) {
  .a-karte { display:grid; grid-template-columns:minmax(0,1fr) 300px; grid-template-rows:auto 1fr; gap:14px 28px; align-items:start; }
  .a-kopfknopf { grid-column:1; grid-row:1; cursor:default; }
  .a-kopfknopf .a-weiter { display:none; }
  .a-karte .a-knoepfe, .a-karte.offen .a-knoepfe { display:grid; grid-column:2; grid-row:1 / span 2; margin:0; padding:0; border:0; }
  .a-karte .a-karten, .a-karte.offen .a-karten { display:grid; grid-column:1; grid-row:2; grid-template-columns:repeat(auto-fit, minmax(280px, 1fr)); margin:0; }
}

/* Erledigt-Dialog: Dauer */
fieldset.dauer { border:0; padding:0; margin:12px 0 0; min-width:0; }
fieldset.dauer legend { font-weight:600; padding:0; margin-bottom:6px; }
.schnellwahl { display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; margin-bottom:10px; }
.schnellwahl button { padding:8px 6px; font-size:.95rem; min-height:44px; }
.dauer-felder { display:flex; gap:12px; }
.dauer-felder label { display:flex; align-items:center; gap:8px; margin:0; font-weight:500; flex:1 1 0; }
.dauer-felder input { width:100%; min-width:0; text-align:center; }

/* Aufträge derselben Baustelle (gleicher Kunde und Einsatzort, gleiches Leistungsdatum) */
.auftrag.im-verbund { border-left:6px solid var(--gelb); }
.a-karte .verbund { display:grid; gap:2px; padding:6px 10px; border-radius:6px; background:color-mix(in srgb, var(--gelb) 18%, var(--card)); font-size:.9rem; }
.a-karte .verbund strong { font-size:.95rem; }
.marke-text { font-weight:600; }
.verbund-liste { list-style:none; margin:0 0 12px; padding:0; display:grid; gap:8px; }
.verbund-liste li { padding:8px 12px; border:1px solid var(--line); border-left:6px solid var(--gelb); border-radius:8px; }

/* Menü beim Klick auf eine Zeile (z. B. Auftrag: Bearbeiten, Erledigt, Fahrauftrag drucken) */
.zeilenmenue { right:auto; }
.zeilenmenue .menue-titel { margin:0 4px 2px; font-size:.85rem; font-weight:600; color:var(--muted); white-space:nowrap; }

/* Stammdaten → REST API */
.ra-block { margin-bottom:28px; }
.ra-block h2 { margin:0 0 8px; font-size:1.15rem; }
.ra-block h3 { margin:20px 0 6px; font-size:1rem; }
.ra-neu { margin-top:16px; max-width:640px; }
.ra-neu .werkzeug input { flex:1 1 240px; }
.ra-einmalig { margin-top:12px; padding:12px 14px; border:2px solid var(--ok); border-radius:8px; background:var(--card); display:grid; gap:8px; max-width:760px; }
.ra-einmalig .ra-schluessel { flex:1 1 320px; font-family:ui-monospace, Consolas, monospace; }
.warn-kasten { padding:8px 12px; border-left:4px solid var(--warn); background:color-mix(in srgb, var(--gelb) 15%, var(--card)); }
.doku pre { margin:6px 0 10px; padding:10px 12px; background:var(--bg); border:1px solid var(--line); border-radius:6px; overflow-x:auto; font-size:.85rem; line-height:1.45; }
.doku code, .ra-block code { font-family:ui-monospace, Consolas, monospace; font-size:.9em; }
.doku-tabelle td { vertical-align:top; }
