/* bTEL: Hausfarbe Rot (#DC2626, dunkler Ton #B91C1C), neutrale Grautoene (Werte wie app/src/ui/theme.ts).
   Kopfzeile hell: weiss mit rotem Akzentstreifen, dunkel: dunkelgrau mit rotem Streifen. */
/* Themen: Standard folgt dem System; html[data-theme=light|dark] erzwingt eines (Einstellungen). */
/* --primary = Flaeche (Schaltflaechen, Sprechblasen), --primary-fg = Rot fuer Text/Symbole auf --surface/--bg. */
:root {
  --bg: #fafafa; --surface: #ffffff; --surface-alt: #f4f4f5; --text: #18181b; --muted: #52525b; --border: #d4d4d8;
  --primary: #dc2626; --primary-dark: #b91c1c; --on-primary: #ffffff; --primary-fg: #b91c1c;
  --primary-soft: #fee2e2; --primary-faint: #fef2f2; --accent: #dc2626;
  --danger: #b91c1c; --on-danger: #ffffff;
  --success: #15803d; --on-success: #ffffff;
  --focus: #dc2626;
  --top-bg: #ffffff; --on-top: #18181b; --top-title: #b91c1c; --top-line: #dc2626; --top-hover: rgb(0 0 0 / .08);
  --reg-ok: #16a34a; --reg-wait: #a16207; --reg-bad: #dc2626;
  --p-online: #15803d; --p-away: #eab308; --p-away-line: #a16207; --p-dnd: #b91c1c; --p-busy: #b91c1c; --p-offline: #71717a;
  --on-pres: #ffffff; --on-away: #422006;
  color-scheme: light dark;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #121214; --surface: #1c1c1f; --surface-alt: #27272a; --text: #f4f4f5; --muted: #a1a1aa; --border: #3f3f46;
    --primary: #dc2626; --primary-dark: #b91c1c; --on-primary: #ffffff; --primary-fg: #f87171;
    --primary-soft: #451a1a; --primary-faint: #2a1616; --accent: #f87171;
    --danger: #f87171; --on-danger: #1f0a0a;
    --success: #4ade80; --on-success: #052e16;
    --focus: #f87171;
    --top-bg: #1c1c1f; --on-top: #f4f4f5; --top-title: #f87171; --top-line: #dc2626; --top-hover: rgb(255 255 255 / .12);
    --reg-ok: #4ade80; --reg-wait: #facc15; --reg-bad: #f87171;
    --p-online: #4ade80; --p-away: #facc15; --p-away-line: #facc15; --p-dnd: #f87171; --p-busy: #f87171; --p-offline: #8b8b94;
    --on-pres: #18181b; --on-away: #422006;
  }
}
:root[data-theme=dark] {
  --bg: #121214; --surface: #1c1c1f; --surface-alt: #27272a; --text: #f4f4f5; --muted: #a1a1aa; --border: #3f3f46;
  --primary: #dc2626; --primary-dark: #b91c1c; --on-primary: #ffffff; --primary-fg: #f87171;
  --primary-soft: #451a1a; --primary-faint: #2a1616; --accent: #f87171;
  --danger: #f87171; --on-danger: #1f0a0a;
  --success: #4ade80; --on-success: #052e16;
  --focus: #f87171;
  --top-bg: #1c1c1f; --on-top: #f4f4f5; --top-title: #f87171; --top-line: #dc2626; --top-hover: rgb(255 255 255 / .12);
  --reg-ok: #4ade80; --reg-wait: #facc15; --reg-bad: #f87171;
  --p-online: #4ade80; --p-away: #facc15; --p-away-line: #facc15; --p-dnd: #f87171; --p-busy: #f87171; --p-offline: #8b8b94;
  --on-pres: #18181b; --on-away: #422006;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* Die Seite selbst darf nie scrollen oder verschoben werden (auf dem Tablet rutschte die
   Gespraechsansicht sonst nach oben/links, Kopfzeile und Auflegen-Taste waren abgeschnitten).
   Gescrollt wird nur innerhalb von <main>. */
html { overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; width: 100%; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-text-size-adjust: 100%; overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--primary); }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.center { text-align: center; }
.grow { flex: 1; }
.ico svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- App-Schale ---------- */
#app {
  height: 100%; height: 100dvh; width: 100%; max-width: 100vw; display: flex; flex-direction: column; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.top {
  position: relative; display: flex; align-items: center; gap: .6rem; flex: none;
  padding: .35rem .75rem; min-height: 3rem; background: var(--top-bg); color: var(--on-top); border-bottom: 3px solid var(--top-line);
}
.top h1 { margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: .01em; color: var(--top-title); }
.icon-btn { width: 44px; height: 44px; margin-left: -.5rem; padding: 10px; background: none; border: 0; border-radius: 50%; color: inherit; }
.icon-btn:active { background: var(--top-hover); }
.self { flex: none; font-size: .85rem; white-space: nowrap; opacity: .95; }
.reg { display: inline-flex; align-items: center; gap: .4rem; min-width: 0; font-size: .85rem; font-weight: 600; }
#reg-text { max-width: 11rem; line-height: 1.15; overflow-wrap: anywhere; }
.dot { width: .7rem; height: .7rem; flex: none; border-radius: 50%; background: var(--reg-bad); box-shadow: 0 0 0 2px var(--top-bg); }
.reg[data-state=registered] .dot { background: var(--reg-ok); }
.reg[data-state=reconnecting] .dot { background: var(--reg-wait); }
.reg[data-state=error] .dot, .reg[data-state=off] .dot { background: var(--reg-bad); }
main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
#view-phone { min-height: 100%; display: flex; flex-direction: column; }
#panes { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#view-phone.convmode { height: 100%; min-height: 0; }
#view-phone.convmode .notice { display: none; }
.pane.chat-open { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: .5rem; }
.notice { min-height: 0; margin: 0; padding: 0 1rem; text-align: center; font-size: .9rem; color: var(--muted); }
.notice:not(:empty) { padding: .5rem 1rem; background: var(--surface-alt); }

.bottom {
  flex: none; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--border);
  padding: 0 0 env(safe-area-inset-bottom);
}
.nav-btn {
  position: relative; flex: 1 1 0; max-width: 6.5rem; min-width: 0; min-height: 56px; padding: .35rem .1rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  background: none; border: 0; color: var(--muted);
}
.nav-btn .ico { width: 24px; height: 24px; }
.nav-btn .lbl { font-size: .7rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn[aria-current=page] { color: var(--primary-fg); font-weight: 600; }
.nav-btn[aria-current=page]::before { content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }

/* ---------- Karten, Formulare, Tasten ---------- */
.card { max-width: 26rem; margin: 1.2rem auto; padding: 1.4rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; width: calc(100% - 2rem); }
h2 { margin: 0 0 .8rem; font-size: 1.3rem; font-weight: 600; }
label { display: block; margin: .8rem 0 .25rem; font-size: .9rem; color: var(--muted); }
label.check { display: flex; gap: .5rem; align-items: flex-start; color: var(--text); margin-top: 1rem; }
label.check input { width: 1.25rem; height: 1.25rem; margin-top: .1rem; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), .select {
  width: 100%; padding: .7rem .8rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: .6rem;
}
.msg { min-height: 1.2em; margin: .5rem 0; font-size: .9rem; color: var(--muted); }
.msg.error { color: var(--danger); }
.btn {
  min-height: 44px; padding: .6rem 1rem; background: var(--surface-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: .7rem; font-weight: 600;
}
.btn.primary { width: 100%; margin-top: 1rem; background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover, .btn.primary:active { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.green { background: var(--success); color: var(--on-success); border-color: var(--success); }
.btn.red { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.btn.small { min-height: 40px; padding: .4rem .8rem; }
.textlink { display: block; margin: .6rem auto; min-height: 44px; padding: .4rem .8rem; background: none; border: 0; color: var(--primary-fg); text-decoration: underline; }

.perm-banner:empty, .perm-banner:not(:has(.perm-item:not([hidden]))) { display: none; }
.perm-banner { flex: none; padding: .4rem .75rem 0; }
.perm-item { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .4rem; padding: .5rem .7rem; font-size: .88rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: .6rem; }
.perm-item p { margin: 0; flex: 1 1 12rem; }

/* ---------- Tastatur-Ansicht ---------- */
.pane { width: 100%; max-width: 32.5rem; margin: 0 auto; padding: 1rem 1rem 1.5rem; }
.pane-h { margin: .3rem 0 .8rem; }
.dialer { display: flex; flex-direction: column; align-items: center; }
.dialnum {
  width: 100%; min-height: 3.2rem; padding: .3rem .5rem !important; text-align: center; font-size: clamp(1.7rem, 7vw, 2.3rem);
  font-weight: 300; letter-spacing: .04em; background: transparent !important; border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 0 !important;
}
/* Fokus der Nummernzeile: kraeftige rote Unterlinie statt rotem Rahmen (der Rahmen wirkte wie eine Fehlermeldung) */
.paste-btn { margin: 0 auto; min-height: 36px; padding: .1rem .8rem; font-size: .9rem; }
/* Wahlfeld mit Tastatur-Symbol (Systemtastatur fuer die Namenssuche) rechts; nur auf Touch-Geraeten, am PC tippt man direkt */
.dialfield { position: relative; width: 100%; }
.dialfield .dialnum { padding-left: 3rem !important; padding-right: 3rem !important; }
.kbd-btn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; padding: 10px; background: none; border: 0; border-radius: 50%; color: var(--muted); touch-action: manipulation; }
.kbd-btn[aria-pressed="true"] { color: var(--primary-fg); background: var(--surface-alt); }
@media (hover: hover) and (pointer: fine) { .kbd-btn { display: none; } .dialfield .dialnum { padding-left: .5rem !important; padding-right: .5rem !important; } }
.dialnum:focus-visible { outline: none; border-bottom: 2px solid var(--primary) !important; }
.keypad { width: 100%; max-width: 21rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .1rem .4rem; margin-top: .6rem; }
.key {
  position: relative; height: clamp(64px, 11dvh, 88px); min-width: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--text); touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.key::before { content: ""; position: absolute; inset: 50% auto auto 50%; width: min(100%, 72px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--surface-alt); opacity: 0; transition: opacity .12s; }
.key:active::before { opacity: 1; background: var(--primary-soft); }
.key .k { position: relative; font-size: clamp(1.9rem, 8vw, 2.5rem); font-weight: 300; line-height: 1; }
.key .s { position: relative; font-size: .62rem; letter-spacing: .14em; color: var(--muted); min-height: .8em; margin-top: .15rem; }
.keypad.small { max-width: 17rem; }
.keypad.small .key { height: 56px; min-width: 56px; }
.keypad.small .key .k { font-size: 1.6rem; }
.dialrow { width: 100%; max-width: 21rem; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center; margin-top: .6rem; }
.side-btn { width: 64px; height: 64px; padding: 18px; background: none; border: 0; border-radius: 50%; color: var(--muted); touch-action: manipulation; }
.side-btn:active { background: var(--surface-alt); }
.round-btn { display: inline-grid; place-items: center; width: 72px; height: 72px; padding: 0; border: 0; border-radius: 50%; touch-action: manipulation; }
.round-btn .ico { width: 34px; height: 34px; }
.round-btn.green { background: var(--success); color: var(--on-success); }
.round-btn.red { background: var(--danger); color: var(--on-danger); }
.round-btn.hang .ico { transform: rotate(135deg); }
.round-btn.big { width: 76px; height: 76px; }
.round-btn:active { filter: brightness(.88); }
.parkrow { margin-top: 1rem; text-align: center; }
/* «Geparkten Anruf zurueckholen»: breite Konturtaste mit Symbol (kein gefuellter Kreis wie Auflegen, keine gefuellte Hauptschaltflaeche) */
.park-fetch { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; max-width: 21rem; min-height: 52px; padding: .6rem 1rem; background: var(--primary-faint); color: var(--primary-fg); border: 2px solid var(--primary); border-radius: .7rem; font-weight: 700; font-size: 1.02rem; }
.park-fetch .ico { width: 26px; height: 26px; flex: none; }
.park-fetch:active { background: var(--primary-soft); }
.park-info { margin: .4rem 0 0; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.placeholder { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 3rem 1rem; text-align: center; color: var(--muted); }
.placeholder h2 { margin: .5rem 0 0; color: var(--text); }
.placeholder p { margin: 0; }
.ico.big { width: 56px; height: 56px; color: var(--primary-fg); }

/* ---------- Verlauf ---------- */
.history { list-style: none; margin: 0; padding: 0; }
.history li { border-bottom: 1px solid var(--border); }
.hist-item { width: 100%; min-height: 56px; display: flex; align-items: center; gap: .8rem; padding: .5rem .2rem; text-align: left; background: none; border: 0; }
.hist-item .ico { width: 24px; height: 24px; flex: none; color: var(--muted); }
.hist-item.missed .ico, .hist-item.missed .who { color: var(--danger); }
.hist-item .ico.hist-origin { width: 18px; height: 18px; color: var(--muted); }
.hist-item .who { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.hist-item .when { flex: 0 1 auto; max-width: 48%; font-size: .8rem; color: var(--muted); text-align: right; overflow-wrap: anywhere; }

/* ---------- Gesprächsansicht ---------- */
.call { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 32.5rem; margin: 0 auto; padding: 1rem; }
.callhead { text-align: center; padding-top: 1rem; }
.peer { margin: 0; font-size: clamp(1.6rem, 6vw, 2rem); font-weight: 600; word-break: break-word; }
.callstate { margin: .25rem 0 0; color: var(--muted); }
.divert { margin: .2rem 0 0; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.duration { margin: .2rem 0 0; font-size: 1.5rem; font-variant-numeric: tabular-nums; font-weight: 300; }
.otherline { margin: .8rem 0 0; padding: .4rem .8rem; display: inline-block; max-width: 100%; font-size: .9rem; color: var(--muted); background: var(--surface-alt); border-radius: 2rem; }
.waiting { margin: 1rem 0 0; padding: .8rem; background: var(--surface); border: 2px solid var(--accent); border-radius: .8rem; }
.waiting p { margin: 0 0 .6rem; font-weight: 600; text-align: center; }
.waiting-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.waiting-btns .btn { flex: 1 1 8rem; }
.incoming { display: flex; justify-content: space-around; margin-top: auto; padding: 2rem 0 1rem; }
.incoming-btn, .hangwrap { display: flex; flex-direction: column; align-items: center; gap: .4rem; font-size: .85rem; }
.incoming-btn .round-btn { width: 80px; height: 80px; }
.active { flex: 1; display: flex; flex-direction: column; }
.net-banner { margin: .6rem 0 0; padding: .5rem .8rem; text-align: center; font-size: .9rem; background: var(--surface-alt); border-radius: .6rem; }
.net-banner p { margin: 0; }
.net-banner.warn { color: var(--danger); font-weight: 600; }
.net-banner .btn { margin-top: .5rem; }
.mic-level { display: block; width: 100%; height: .8rem; margin-top: .5rem; }
.mic-diag { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; }
.small-text.error { color: var(--danger); font-weight: 600; }
.cb-mic { font-size: .75rem; font-weight: 700; }
.xfer-status { margin: .8rem 0 0; padding: .5rem .8rem; text-align: center; font-size: .9rem; background: var(--surface-alt); border-radius: .6rem; }
.xfer-status.error { color: var(--danger); font-weight: 600; }
.panel { margin-top: .8rem; padding: .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: .8rem; }
.panel-h { margin: 0 0 .4rem; font-size: .9rem; color: var(--muted); }
.panel .keypad { margin-inline: auto; }
.xfer-input { text-align: center; font-size: 1.5rem !important; }
.xfer-btns { display: flex; gap: .5rem; margin-top: .6rem; }
.xfer-btns .btn { flex: 1; margin-top: 0; width: auto; }
.xfer-btns .btn.primary { flex: 2; margin-top: 0; }
.dtmflog { min-height: 1.6em; margin: 0; text-align: center; font-size: 1.3rem; letter-spacing: .15em; color: var(--muted); }
.small-text { margin: .5rem 0 0; font-size: .8rem; }
.select { appearance: auto; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem .4rem; max-width: 24rem; width: 100%; margin: 1.2rem auto 0; }
.tile { display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 0; padding: 0; background: none; border: 0; color: var(--text); touch-action: manipulation; }
.tile .ico { width: 64px; height: 64px; padding: 18px; border-radius: 50%; background: var(--surface-alt); transition: background .15s, color .15s; }
.tile .lbl { font-size: .8rem; text-align: center; line-height: 1.2; max-width: 100%; overflow-wrap: anywhere; }
.tile[aria-pressed=true] .ico { background: var(--primary-soft); color: var(--primary-fg); box-shadow: inset 0 0 0 2px var(--primary); }
.tile:active .ico { filter: brightness(.9); }
.tile:disabled { opacity: .4; }
.hint { margin: .8rem auto 0; max-width: 24rem; font-size: .82rem; text-align: center; color: var(--muted); }
/* Unten grosszuegig Abstand: Tablets blenden ihre Taskleiste ueber dem Seiteninhalt ein,
   ohne dass der Browser das als Sicherheitsabstand meldet. */
/* Die Auflegen-Taste klebt am unteren Rand des scrollbaren Bereichs: bei geoeffneten Bedienfeldern (Tastenfeld,
   Weiterleiten, Parken, Anklopfen) lag sie sonst unter dem sichtbaren Bereich (belegt im E2E-Test: Unterkante bei y = 904 von 740). */
.hangwrap { margin-top: auto; position: sticky; bottom: 0; z-index: 4; padding: .8rem 0 max(4.5rem, calc(env(safe-area-inset-bottom) + 2rem)); display: flex; justify-content: center; background: var(--bg); box-shadow: 0 -10px 10px -8px rgb(0 0 0 / .25); }

@media (min-width: 600px) {
  .keypad { max-width: 26rem; }
  .dialrow { max-width: 26rem; }
  .key { height: clamp(72px, 10dvh, 96px); }
  .tiles { max-width: 30rem; }
  .tile .ico { width: 72px; height: 72px; padding: 20px; }
}
@media (max-width: 359px) {
  .self { display: none; }
  #reg-text { max-width: 8rem; }
  .keypad { gap: 0; }
}
@media (max-height: 560px) {
  .callhead { padding-top: 0; }
  .keypad.small .key { height: 48px; }
}
/* ---------- Anwesenheit, Statusknopf ---------- */
.pres { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: middle; }
.pres-svg { display: block; width: 100%; height: 100%; }
.pres-svg circle { fill: var(--pc); }
.pres-svg .mark { fill: none; stroke: var(--pm); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pres-svg .fillmark { fill: var(--pm); stroke: none; }
.pres-online { --pc: var(--p-online); --pm: var(--on-pres); }
.pres-away { --pc: var(--p-away); --pm: var(--on-away); }
.pres-away circle { stroke: var(--p-away-line); stroke-width: 1; }
.pres-dnd { --pc: var(--p-dnd); --pm: var(--on-pres); }
.pres-busy { --pc: var(--p-busy); --pm: var(--on-pres); }
.pres-offline circle { fill: none; stroke: var(--p-offline); stroke-width: 2; }
.status-btn { flex: none; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; background: none; border: 0; border-radius: 50%; color: inherit; }
.status-btn:active { background: var(--top-hover); }
.status-btn .pres { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--top-bg); }

/* ---------- Listen: Team, Kontakte, Chat ---------- */
.pane .msg:empty { display: none; }
.pane-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin: .3rem 0 .6rem; }
.pane-bar .pane-h { margin: 0; }
.bar-btns { display: flex; gap: .4rem; flex-wrap: wrap; }
.sub-h { margin: 1rem 0 .2rem; font-size: .85rem; font-weight: 600; color: var(--muted); text-transform: none; }
.people { list-style: none; margin: 0; padding: 0; }
.people li { border-bottom: 1px solid var(--border); }
.person { width: 100%; min-height: 60px; display: flex; align-items: center; gap: .8rem; padding: .55rem .2rem; text-align: left; background: none; border: 0; }
.person .pres { width: 22px; height: 22px; }
.person .avatar { width: 40px; height: 40px; flex: none; padding: 8px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-fg); }
.pbody { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pname { font-weight: 600; overflow-wrap: anywhere; }
.pmeta, .pstat { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.pstat.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pright { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; font-size: .75rem; color: var(--muted); }
.unread { min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 11px; background: var(--danger); color: var(--on-danger); font-size: .75rem; font-weight: 700; }
.person.selfrow { background: var(--primary-faint); border-radius: .7rem; padding-inline: .6rem; margin-bottom: .4rem; }
.people li:has(.selfrow) { border-bottom: 0; }
.searchbox { margin: .2rem 0 .4rem; }
.detail { padding-top: .3rem; }
.detail-head { display: flex; align-items: center; gap: .8rem; margin: .6rem 0 1rem; }
.detail-head .pres { width: 30px; height: 30px; }
.detail-head h2 { margin: 0; font-size: 1.35rem; overflow-wrap: anywhere; }
.detail-head p { margin: .1rem 0 0; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.action-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0; }
.action-row .btn { flex: 1 1 8rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; }
.action-row .btn .ico { width: 20px; height: 20px; }
.linkrow { display: flex; align-items: center; gap: .7rem; min-height: 48px; padding: .3rem .2rem; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.linkrow .ico { width: 22px; height: 22px; flex: none; color: var(--primary-fg); }
.linkrow .k { display: block; font-size: .78rem; color: var(--muted); }
.btn-row { display: flex; gap: .5rem; margin-top: .8rem; }
.btn-row .btn { flex: 1; text-align: center; }
.btn-row .btn.primary { margin-top: 0; width: auto; }
.dial-name { min-height: 1.5em; margin: .2rem 0 0; text-align: center; font-size: .95rem; color: var(--muted); overflow-wrap: anywhere; }
.badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; background: var(--danger); color: var(--on-danger); font-size: .7rem; font-weight: 700; line-height: 1; }

/* ---------- Chat-Unterhaltung ---------- */
.conv { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.conv[hidden] { display: none; }
.conv-head { display: flex; align-items: center; gap: .4rem; flex: none; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.icon-btn.dark { color: var(--primary-fg); margin-left: -.4rem; }
.icon-btn.dark:active { background: var(--primary-soft); }
.conv-titles { min-width: 0; }
.conv-title { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.conv-sub { margin: 0; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .35rem; padding: .6rem .1rem; }
.day { align-self: center; margin: .4rem 0 .1rem; padding: .1rem .7rem; font-size: .75rem; color: var(--muted); background: var(--surface-alt); border-radius: 1rem; }
.bubble { max-width: 84%; padding: .4rem .7rem .3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; align-self: flex-start; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.bubble .who { display: block; font-size: .75rem; font-weight: 700; color: var(--primary-fg); }
.bubble .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .smsstat { display: block; font-size: .68rem; text-align: right; }
.bubble .smsstat[data-status="failed"] { font-weight: 700; }
.smstag { margin-left: .3rem; padding: 0 .35rem; font-size: .65rem; font-weight: 700; border: 1px solid var(--border); border-radius: .5rem; color: var(--muted); }
.composer.locked { opacity: .6; }
.bubble .time { display: block; margin-top: .1rem; font-size: .68rem; text-align: right; }
.older { align-self: center; }
.composer { display: flex; gap: .5rem; align-items: flex-end; flex: none; padding-top: .4rem; }
.composer textarea { flex: 1; min-width: 0; max-height: 8rem; padding: .6rem .9rem; resize: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 1.3rem; font: inherit; line-height: 1.35; }
.send-btn { width: 46px; height: 46px; flex: none; padding: 11px; background: var(--primary); color: var(--on-primary); border: 0; border-radius: 50%; }
.send-btn:disabled { opacity: .45; }
.conv-count { flex: none; min-height: 1.2em; margin: .1rem 0 0; font-size: .75rem; text-align: right; color: var(--muted); }
.conv-count.over { color: var(--danger); font-weight: 600; }
.pick-item { margin: 0; color: var(--text); width: 100%; min-height: 52px; display: flex; align-items: center; gap: .8rem; padding: .4rem .2rem; text-align: left; background: none; border: 0; }
.pick-item input { width: 1.25rem; height: 1.25rem; flex: none; }
.pick-item .avatar { width: 40px; height: 40px; flex: none; padding: 8px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-fg); }
button.pick-item { cursor: pointer; border-radius: .6rem; }
button.pick-item:hover { background: var(--surface-alt); }
label.pick-item { cursor: pointer; border-radius: .6rem; padding-inline: .5rem; }
label.pick-item:hover { background: var(--surface-alt); }
label.pick-item.on { background: var(--primary-faint); }
.pick-item input[type=checkbox] { accent-color: var(--primary); }
.pick-search-row { display: flex; align-items: center; gap: .8rem; margin: .4rem 0 .2rem; }
.pick-search-row input { flex: 1; min-width: 0; }
#pick-create { position: sticky; bottom: .8rem; }

/* ---------- Schublade und Unterseiten ---------- */
.backdrop { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / .45); }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 31; width: min(20rem, 86vw); display: flex; flex-direction: column; background: var(--surface); color: var(--text); box-shadow: 6px 0 24px rgb(0 0 0 / .3); transform: translateX(-102%); transition: transform .18s ease; }
.drawer.open { transform: none; }
.drawer-head { flex: none; padding: calc(.9rem + env(safe-area-inset-top)) 1rem .9rem; padding-left: calc(1rem + env(safe-area-inset-left)); background: var(--top-bg); color: var(--on-top); border-bottom: 3px solid var(--top-line); }
.dh-name { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--top-title); overflow-wrap: anywhere; }
.dh-line { margin: .1rem 0 .5rem; font-size: .88rem; opacity: .95; overflow-wrap: anywhere; }
.dh-status { display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: .2rem .8rem .2rem .5rem; background: var(--surface-alt); color: inherit; border: 0; border-radius: 2rem; }
.dh-status .pres { background: var(--surface); border-radius: 50%; }
.drawer-list { list-style: none; margin: 0; padding: .3rem .4rem calc(.6rem + env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; }
.dr-item { width: 100%; min-height: 48px; display: flex; align-items: center; gap: .8rem; padding: .4rem .7rem; text-align: left; background: none; border: 0; border-radius: .6rem; color: var(--text); font-size: 1rem; }
.dr-item:hover, .dr-item:focus-visible { background: var(--surface-alt); }
.dr-item .ico { width: 24px; height: 24px; flex: none; color: var(--primary-fg); }
.dr-item .lbl { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dr-version { flex: none; padding: .6rem 1rem calc(.8rem + env(safe-area-inset-bottom)); padding-left: calc(1rem + env(safe-area-inset-left)); border-top: 1px solid var(--border); }
.dr-ver-web { font-weight: 700; font-size: .95rem; color: var(--text); }
.dr-ver-sub { font-size: .78rem; color: var(--muted); }
.dr-item:disabled { opacity: .6; }
.soon { flex: none; padding: .05rem .5rem; font-size: .75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 1rem; }
.dr-switch { cursor: pointer; margin: 0; color: var(--text); }
.dr-switch input { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 2.75rem; height: 1.5rem; margin: 0; background: var(--border); border-radius: 1rem; transition: background .15s; }
.dr-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.5rem - 4px); height: calc(1.5rem - 4px); border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / .35); transition: transform .15s; }
.dr-switch input:checked { background: var(--primary); }
.dr-switch input:checked::after { transform: translateX(1.25rem); }
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.sheet-top { flex: none; display: flex; align-items: center; gap: .6rem; min-height: 3rem; padding: .35rem .75rem; background: var(--top-bg); color: var(--on-top); border-bottom: 3px solid var(--top-line); }
.sheet-top h2 { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--top-title); }
.sheet-body { flex: 1; min-height: 0; width: 100%; max-width: 32.5rem; margin: 0 auto; padding: 1rem 1rem 3rem; overflow-y: auto; overflow-x: hidden; }
.sheet-sec h3 { margin: 1.2rem 0 .3rem; font-size: 1rem; }
.sheet-sec h3:first-child { margin-top: 0; }
.sheet-sec p, .sheet-sec li { overflow-wrap: anywhere; }
.help p, .help li { font-size: .93rem; }
.about-name { font-size: 1.5rem; font-weight: 600; margin: 0 0 .2rem; }
.note { margin: 1rem 0 0; padding: .7rem .8rem; font-size: .86rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: .6rem; overflow-wrap: anywhere; }
.radios { margin: 0 0 .6rem; padding: 0; border: 0; }
.radio { display: flex; align-items: center; gap: .7rem; min-height: 48px; margin: 0; padding: .2rem .3rem; color: var(--text); font-size: 1rem; border-bottom: 1px solid var(--border); }
.radio input { width: 1.25rem; height: 1.25rem; flex: none; margin: 0; }
input[type=range] { width: 100%; margin: .3rem 0 .6rem; accent-color: var(--primary); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .5rem .8rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.qr-stage { margin: .8rem 0 0; background: #000; border-radius: .8rem; overflow: hidden; aspect-ratio: 4 / 3; }
.qr-stage:has(.qr-video[hidden]) { display: none; }
.qr-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; margin: 0; color: var(--text); font-size: 1rem; }
.status-pick { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Anmeldemaske: drei Wege, Link einfuegen, Erweitert; Konto & Sicherheit ---------- */
.login-card { max-width: 30rem; }
.login-card > h2 { margin-bottom: .2rem; }
.way { margin: 1rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--border); }
.way:first-of-type { border-top: 0; padding-top: 0; }
.way h3 { margin: 0 0 .5rem; font-size: 1.05rem; color: var(--primary-fg); }
.way .btn.primary { margin-top: .6rem; }
.bigcode { font-size: clamp(1.6rem, 8vw, 2.1rem) !important; letter-spacing: .12em; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
details.more { margin: 1rem 0 0; border-top: 1px solid var(--border); padding-top: .4rem; }
details.more > summary { min-height: 44px; display: flex; align-items: center; padding: .3rem 0; color: var(--primary-fg); font-weight: 600; cursor: pointer; }
details.more > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
details.more[open] > summary { margin-bottom: .2rem; }
.qr-box { display: grid; place-items: center; margin: .8rem 0; }
.qrsvg { width: min(100%, 16rem); height: auto; background: #fff; border-radius: .5rem; border: 1px solid var(--border); }
.secret-code { display: block; margin: .3rem 0; padding: .6rem .7rem; font: 600 1rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .05em; background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; overflow-wrap: anywhere; user-select: all; }
.rc-list { list-style: none; margin: .5rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .4rem; }
.rc-list li { padding: .5rem .6rem; font: 600 1rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; user-select: all; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn.primary { display: flex; }
#acc-disable.btn.red { width: 100%; margin-top: 1rem; }

/* Logo-Schriftzug: heller und dunkler Grund (gleiche Auswahlregeln wie die Farbvariablen oben). */
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .logo-light { display: none; }
  :root:not([data-theme=light]) .logo-dark { display: inline-block; }
}
:root[data-theme=dark] .logo-light { display: none; }
:root[data-theme=dark] .logo-dark { display: inline-block; }
.top h1 { display: flex; align-items: center; line-height: 0; }
.top h1 img { height: 2.1rem; width: auto; max-width: 100%; display: block; }
.top h1 .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .top h1 .logo-dark { display: block; } }
:root[data-theme=dark] .top h1 .logo-dark { display: block; }
.login-logo { margin: .2rem 0 1rem; line-height: 0; text-align: center; }
.login-logo img { width: min(15rem, 80%); height: auto; }

/* Herkunfts-Symbol je Kontakt (Firma, Eigenes, Nextcloud, Microsoft 365, Gerät) und Vorschläge im Wählfeld */
.origin { flex: none; display: inline-flex; flex-direction: column; align-items: center; gap: .1rem; min-width: 4.2rem; font-size: .7rem; color: var(--muted); }
.origin .ico { width: 18px; height: 18px; }
.origin.origins { flex-direction: row; gap: .3rem; min-width: 0; }
.num-src { display: block; font-size: .7rem; font-weight: normal; opacity: .85; margin-left: .4rem; }
.d-sources { font-size: .8rem; color: var(--muted); margin: 0; }
.reasons .reason { margin: .3rem 0; }
/* Vorschläge als Aufklappliste unter dem Wählfeld: liegt über Namenszeile und Ziffernblock, verschiebt nichts */
.suggest { position: absolute; top: calc(100% + .3rem); left: 0; right: 0; z-index: 20; margin: 0; max-height: min(60vh, 26rem); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: .8rem; box-shadow: 0 10px 28px rgb(0 0 0 / .18); padding: .2rem .6rem; text-align: left; }
.suggest.digits { max-height: 3.6rem; overflow: hidden; }
.suggest li:last-child { border-bottom: 0; }
.suggest-row { padding: 0; min-height: 52px; }
.suggest-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; padding: .4rem .2rem; background: none; border: 0; text-align: left; color: inherit; }
.suggest-row .btn { flex: none; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; }
.suggest-row .btn .ico { width: 20px; height: 20px; }
.suggest-pick .pname { overflow-wrap: normal; word-break: normal; }
.suggest-pick .pmeta { overflow-wrap: anywhere; }

/* Geraeteauswahl (docs/geraeteauswahl.md) */
.devpick { width: 100%; max-width: 22rem; margin: 0 auto .6rem; text-align: center; }
.devpick label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.devpick .select { width: 100%; }
.devpick .small-text { margin: .3rem 0 0; }

/* Waehllink: Bestaetigung bei call=1 ohne Erlaubnis, Liste erlaubter Herkunftsseiten */
.dial-link-box { margin: .4rem 0; padding: .5rem .75rem; border: 1px solid var(--border, #ccc); border-radius: .5rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.dial-link-box p { flex: 1 1 100%; margin: 0; overflow-wrap: anywhere; }
.dial-origins { list-style: none; margin: .3rem 0; padding: 0; }
.dial-origins li { display: flex; gap: .5rem; align-items: center; justify-content: space-between; padding: .2rem 0; overflow-wrap: anywhere; }

/* Kopfzeile: Handy-App einrichten (QR) */
.hdr-qr { flex: none; margin-left: 0; width: 40px; height: 40px; padding: 8px; }
.sheet-sec .note.first { margin-top: 0; }

/* Tasten (Selbstverwaltung) */
.keys h3 { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.keys .grp { margin: 0 0 1.2rem; }
.keys ul.klist { list-style: none; margin: .3rem 0; padding: 0; }
.keys .krow { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .25rem 0; border-bottom: 1px solid var(--border); }
.keys .kno { flex: none; min-width: 2rem; font-weight: 700; }
.keys .kdesc { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .92rem; }
.keys .kdesc small { display: block; color: var(--muted); }
.keys .klock { flex: none; font-size: .75rem; color: var(--muted); }
.keys .btn.small { padding: .3rem .6rem; }
.keys form.kform, .keys .xfer { margin: .6rem 0; padding: .7rem; background: var(--surface); border: 1px solid var(--border); border-radius: .6rem; }
.keys .xfer table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: .5rem; }
.keys .xfer td { padding: .2rem .3rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.keys .res-rejected { color: var(--danger); }
.keys details { margin: .3rem 0; }
.keys summary { cursor: pointer; padding: .4rem 0; }
.keys .tag { font-size: .72rem; padding: 0 .35rem; border: 1px solid var(--border); border-radius: .6rem; color: var(--muted); }

/* Passkeys in «Konto & Sicherheit» */
.pk-list { list-style: none; margin: .5rem 0; padding: 0; display: grid; gap: .4rem; }
.pk-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .5rem .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; }
.pk-list .pk-name { flex: 1 1 8rem; font-weight: 600; overflow-wrap: anywhere; }
.pk-list .pk-meta { flex: 1 1 100%; font-size: .85rem; color: var(--muted, inherit); }

/* Verwaltung (admin/ im iframe unter /verwaltung/, js/ui-verwaltung.js): Bereich der App-Navigation, fuellt den Inhaltsbereich; eigene CSS-Welt im iframe */
.verwaltung { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.verwaltung iframe { flex: 1; min-height: 0; width: 100%; border: 0; background: var(--bg); color-scheme: light dark; }
.verwaltung > .notice:not(:empty) { flex: none; }
/* Verwaltung vorne: die Telefon-Ansicht ist ausgeblendet (Zustand bleibt); main bleibt als Traeger des Anmeldedialogs (position: fixed) bestehen */
#app.vw-front > main { position: absolute; width: 0; height: 0; overflow: visible; }
#app.vw-front #view-phone { display: none; }
.bottom { order: 5; }
.nav-vw { border-left: 1px solid var(--border); }
.call-back-vw { margin: .5rem auto 0; display: inline-flex; align-items: center; gap: .4rem; }
.call-back-vw .ico { width: 20px; height: 20px; }

/* Gespraechsleiste: laufendes Gespraech waehrend die Verwaltung offen ist (Handy: schmale Leiste «Gespraech laeuft - zurueck», breit: mit Bedienung) */
.callbar { flex: none; display: flex; align-items: center; gap: .5rem; padding: .3rem .75rem; background: var(--success); color: var(--on-success); }
.cb-info { flex: 1 1 auto; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: .6rem; padding: 0; background: none; border: 0; color: inherit; text-align: left; }
.cb-dot { flex: none; width: .65rem; height: .65rem; border-radius: 50%; background: currentColor; }
.cb-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.cb-lead { font-size: .75rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; opacity: .85; }
.cb-line { display: flex; gap: .6rem; align-items: baseline; min-width: 0; font-weight: 600; }
.cb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-time { flex: none; font-variant-numeric: tabular-nums; font-weight: 500; opacity: .9; }
.cb-actions { flex: none; display: flex; gap: .4rem; }
.cb-btn { min-width: 44px; min-height: 44px; padding: 0 .75rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: transparent; color: inherit; border: 1px solid color-mix(in srgb, currentColor 45%, transparent); border-radius: 999px; font-size: .9rem; font-weight: 600; }
.cb-btn .ico { width: 20px; height: 20px; flex: none; }
.cb-btn .lbl { display: none; }
.cb-btn:disabled { opacity: .5; }
.cb-btn[aria-pressed=true] { background: var(--on-success); color: var(--success); border-color: var(--on-success); }
.cb-hang { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.cb-hang .ico { transform: rotate(135deg); }
.cb-opt { display: none; }
.callbar :focus-visible { outline-color: currentColor; }

/* Breite Bildschirme (wie 3CX): Navigation als Seitenleiste links, Inhalt (Telefon-Bereiche oder Verwaltung) rechts, Gespraechsleiste darueber */
@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: 5.75rem minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); }
  #app > .top { grid-area: 1 / 1 / 2 / 3; }
  #app > .perm-banner { grid-area: 2 / 1 / 3 / 3; }
  #app > .callbar { grid-area: 3 / 2 / 4 / 3; }
  #app > main, #app > .verwaltung { grid-area: 4 / 2 / 5 / 3; }
  #app > .bottom { grid-area: 3 / 1 / 5 / 2; order: 0; }
  #app:has(> #nav[hidden]) > main, #app:has(> #nav[hidden]) > .verwaltung, #app:has(> #nav[hidden]) > .callbar { grid-column: 1 / 3; }
  .bottom { flex-direction: column; justify-content: flex-start; padding: .4rem 0 0; border-top: 0; border-right: 1px solid var(--border); }
  .nav-btn { flex: none; max-width: none; width: 100%; min-height: 66px; gap: .2rem; }
  .nav-btn .lbl { font-size: .72rem; }
  .nav-btn[aria-current=page] { background: var(--primary-faint); }
  .nav-btn[aria-current=page]::before { top: 16%; bottom: 16%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .nav-vw { margin-top: auto; border-left: 0; border-top: 1px solid var(--border); }
  .callbar { padding: .35rem 1rem; }
  .cb-opt { display: inline-flex; }
  .cb-btn .lbl { display: inline; }
  .cb-ret { display: none; }
}
@media (max-width: 899px) { .cb-hang { padding: 0; width: 44px; } }
@media (max-width: 480px) { .nav-vw .lbl { font-size: .62rem; letter-spacing: -.01em; } .nav-btn { padding-left: 0; padding-right: 0; } }
/* Anmeldung fuer die Verwaltung als Dialog ueber der App (Telefon dahinter bleibt unveraendert): nur der Weg «E-Mail und Passwort» + zweiter Faktor */
#view-login.as-dialog { position: fixed; z-index: 60; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(26rem, calc(100vw - 1.5rem)); max-width: none; max-height: calc(100dvh - 1.5rem); margin: 0; overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .5), 0 14px 44px rgb(0 0 0 / .35); }
#view-login.as-dialog .login-logo, #view-login.as-dialog #login-revoked, #view-login.as-dialog #login-ways > .way:not(:first-child), #view-login.as-dialog #login-ways > details, #view-login.as-dialog #way-user-h { display: none; }
#view-login.as-dialog > h2 { font-size: 1.25rem; margin-bottom: .4rem; }
#view-login.as-dialog #login-msg:empty { display: none; }
#view-login.as-dialog { display: flex; flex-direction: column; }
#view-login.as-dialog > * { flex: none; }
#view-login.as-dialog > p:has(#login-back) { order: 90; margin: .6rem 0 0; text-align: center; }
#view-login.as-dialog > p:has(#login-privacy) { display: none; }
#view-login.as-dialog #user-msg:empty { display: none; }
#view-login.as-dialog:has(#mfa-step:not([hidden])) > p:has(#login-back), #view-login.as-dialog:has(#mfa-step:not([hidden])) #login-msg { display: none; }
#view-login.as-dialog #user-passkey { display: block; width: 100%; margin-top: .6rem; }
#view-login.as-dialog #user-forgot { display: block; margin: .6rem auto 0; }
#view-login.as-dialog #mfa-step { border-top: 0; padding-top: 0; margin-top: .6rem; }
@media (max-width: 30rem) { #view-login.as-dialog { top: auto; bottom: .75rem; left: .75rem; width: auto; transform: none; max-height: calc(100dvh - 1.5rem); } }
.vw-expired .btn { margin: .3rem .25rem 0; }
.vw-expired { margin: auto; max-width: 28rem; padding: 1.5rem 1rem; text-align: center; }
/* Absendernummer pro Anruf (GET /client/cli) */
.clipick { width: 100%; max-width: 22rem; margin: 0 auto .6rem; }
.clirow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem .5rem; min-width: 0; }
.clirow label { flex: none; font-size: .85rem; color: var(--muted); }
.clirow .select { flex: 1 1 13rem; min-width: 0; width: auto; }
.clipick .small-text { margin: .3rem 0 0; text-align: center; }
.pill { flex: none; display: inline-block; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--muted); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.pill.ok { color: var(--success); border-color: var(--success); }
.pill.bad { color: var(--danger); border-color: var(--danger); }

/* Anrufbehandlung je Status (Status-Seite, docs/status-anrufbehandlung.md) */
.pres-rules { margin-top: 1.2rem; border-top: 1px solid var(--border); padding-top: .6rem; }
.pres-rules summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.pr-row { display: grid; gap: .3rem; margin: .5rem 0; }
.pr-row select, .pr-row input { width: 100%; }

/* Store-Links im Dialog «Handy-App einrichten» */
.store-links { margin: .2rem 0 .6rem; font-size: .9rem; }
.store-links a { font-weight: 600; }
/* Handy: «Verwaltung» ist das längste Wort der Leiste – etwas kleiner statt abgeschnitten */
@media (max-width: 479px) { .nav-vw .lbl { font-size: .6rem; letter-spacing: -.02em; text-overflow: clip; } }

/* Kopfzeile: Anwesenheit und Verbindung zusammengelegt (Entscheid Andreas 30.11.2026). Verbunden: nur das Status-Symbol, «Bereit» bleibt
   für Screenreader; Verbindungsproblem: farbiger Ring am Status-Symbol und Text daneben. Ohne Status-Symbol bleibt die Anzeige wie bisher. */
.top:has(#status-btn:not([hidden])):has(#reg[data-state=registered]) #reg {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.top:has(#reg[data-state=reconnecting]) #status-btn .pres { box-shadow: 0 0 0 2px var(--top-bg), 0 0 0 4px var(--reg-wait); }
.top:has(#reg[data-state=error]) #status-btn .pres, .top:has(#reg[data-state=off]) #status-btn .pres { box-shadow: 0 0 0 2px var(--top-bg), 0 0 0 4px var(--reg-bad); }
.top:has(#status-btn:not([hidden])) #reg .dot { display: none; }
