/* AIA – dunkles HUD-Design. Mobil: Navigation unten. Ab 900 px: Seitenleiste. */
:root {
  color-scheme: dark;
  --bg: #05080f;
  --bg2: #0a1020;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-solid: #0e1628;
  --line: rgba(125, 211, 252, 0.14);
  --line-strong: rgba(125, 211, 252, 0.3);
  --text: #e2e8f0;
  --muted: #8b9bb4;
  --accent: #38bdf8;
  --accent-2: #7dd3fc;
  --accent-glow: rgba(56, 189, 248, 0.45);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --violet: #a78bfa;
  --radius: 14px;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 70% -10%, #0c1a33 0%, transparent 60%), radial-gradient(900px 600px at -10% 110%, #0b1630 0%, transparent 55%), var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--bad); }
.warn { color: var(--warn); }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.empty { color: var(--muted); font-style: italic; padding: 8px 0; }
.pad { padding: 8px 12px; }

/* ---------- Bedienelemente ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: rgba(30, 41, 59, 0.7); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: rgba(51, 65, 85, 0.8); border-color: var(--accent); }
.btn.primary { background: linear-gradient(180deg, #0ea5e9, #0284c7); border-color: #38bdf8; color: #fff; box-shadow: 0 0 18px -4px var(--accent-glow); }
.btn.primary:hover { box-shadow: 0 0 24px -2px var(--accent-glow); }
.btn.danger { border-color: rgba(248, 113, 113, 0.5); color: #fecaca; }
.btn.danger:hover { background: rgba(127, 29, 29, 0.5); border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 10px; cursor: pointer; font-size: 18px; line-height: 1; min-width: 40px; min-height: 40px; }
.icon-btn:hover { background: rgba(56, 189, 248, 0.1); }
.icon-btn.small { min-width: 26px; min-height: 22px; padding: 2px 6px; font-size: 11px; }
.icon-btn:disabled { opacity: .3; }

.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: rgba(2, 6, 23, 0.6); color: var(--text); font: inherit; min-width: 0;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15); }
textarea.input { resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; font-size: 14px; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.pill.running { color: var(--accent-2); border-color: var(--accent); background: rgba(56, 189, 248, 0.1); }
.pill.done { color: var(--ok); border-color: rgba(52, 211, 153, .5); }
.pill.failed, .pill.interrupted { color: var(--bad); border-color: rgba(248, 113, 113, .5); }
.pill.waiting_token, .pill.queued { color: var(--warn); border-color: rgba(251, 191, 36, .5); }
.pill.paused { color: var(--violet); border-color: rgba(167, 139, 250, .5); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.big { width: 14px; height: 14px; }
.status-dot.running { background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: blink 1.4s infinite; }
.status-dot.done { background: var(--ok); }
.status-dot.failed, .status-dot.interrupted { background: var(--bad); }
.status-dot.queued, .status-dot.waiting_token { background: var(--warn); }
.status-dot.paused { background: var(--violet); }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- Reaktor (Logo / Status) ---------- */
.reactor { position: relative; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: radial-gradient(circle, #e0f2fe 0 12%, #38bdf8 22%, rgba(56,189,248,.15) 46%, transparent 62%);
  box-shadow: 0 0 18px var(--accent-glow), inset 0 0 8px rgba(125, 211, 252, .6); border: 1px solid rgba(125, 211, 252, .5); }
.reactor i { position: absolute; inset: 4px; border-radius: 50%; border: 2px dashed rgba(125, 211, 252, .55); animation: spin 12s linear infinite; }
.reactor.small { width: 30px; height: 30px; }
.reactor.big { width: 92px; height: 92px; margin: 0 auto; }
.reactor.big i { inset: 10px; border-width: 3px; }
.reactor.thinking i { animation-duration: 1.6s; border-color: rgba(251, 191, 36, .8); }
.reactor.thinking { box-shadow: 0 0 26px rgba(251, 191, 36, .45), inset 0 0 8px rgba(251, 191, 36, .5); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Grundlayout ---------- */
#app { display: flex; height: 100dvh; }
#view { flex: 1; min-width: 0; height: 100%; overflow-y: auto; overscroll-behavior: contain; }
#view.view-chat, #view.view-gehirn { overflow: hidden; }

#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(5, 8, 15, 0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
#nav a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 10.5px; text-decoration: none; }
#nav a .ico { font-size: 20px; filter: grayscale(.6); transition: filter .15s, transform .15s; }
#nav a.active { color: var(--accent-2); }
#nav a.active .ico { filter: none; transform: translateY(-1px); }
#nav .brand { display: none; }
#nav a.desk { display: none; }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--accent); color: #001018; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; }
#view { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }

@media (min-width: 900px) {
  #nav { position: static; flex-direction: column; justify-content: flex-start; width: 210px; height: auto; padding: 16px 10px; gap: 4px; border-top: 0; border-right: 1px solid var(--line); background: rgba(5, 8, 15, 0.6); }
  #nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 14px; border-radius: 10px; font-size: 14.5px; }
  #nav a:hover { background: rgba(56, 189, 248, 0.07); text-decoration: none; }
  #nav a.active { background: rgba(56, 189, 248, 0.12); box-shadow: inset 2px 0 0 var(--accent); }
  #nav a .ico { font-size: 17px; }
  #nav .brand { display: flex; margin-bottom: 14px; padding: 8px 10px; }
  .brand-name { font-weight: 700; letter-spacing: .28em; color: var(--accent-2); text-shadow: 0 0 12px var(--accent-glow); }
  #nav a.desk { display: flex; }
  .badge { position: static; margin-left: auto; }
  #view { padding-bottom: 0; }
}
@media (max-width: 899px) {
  .hide-sm { display: none; }
}
@media (max-width: 1250px) {
  .hide-md { display: none; }
}

/* ---------- Anmeldung ---------- */
#login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; text-align: center; padding: 34px 26px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 0 60px -20px var(--accent-glow); }
.login-card h1 { margin: 6px 0 0; letter-spacing: .35em; font-weight: 700; color: var(--accent-2); text-shadow: 0 0 16px var(--accent-glow); }
.login-card p { margin: 0; }
.login-card h2 { margin: 6px 0 0; font-size: 18px; }
.device-code { font: 700 40px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; color: var(--accent-2); text-shadow: 0 0 16px var(--accent-glow); }
#extern-hint { position: fixed; top: calc(6px + env(safe-area-inset-top)); right: 8px; z-index: 50; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(5, 8, 15, .75); border: 1px solid var(--line); color: var(--muted); pointer-events: none; }
.geraet-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.geraet-row:last-child { border-bottom: 0; }
.geraet-row .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* ---------- Seiten ---------- */
.page { max-width: 980px; margin: 0 auto; padding: calc(18px + var(--safe-t)) 16px 40px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 650; }
h2.section { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 26px 0 10px; font-weight: 600; }
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0; }
.box h2 { margin: 0 0 12px; font-size: 18px; }
.box h3 { margin: 4px 0 10px; font-size: 15px; color: var(--accent-2); }
.box > summary { cursor: pointer; color: var(--accent-2); }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--line-strong); text-decoration: none; transform: translateY(-1px); }
.card .last { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.agent-card.running { border-color: rgba(56, 189, 248, .45); box-shadow: 0 0 22px -10px var(--accent-glow); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(2, 6, 23, .45); border: 1px solid var(--line); flex-wrap: wrap; }
.list-row.token.erschöpft { border-color: rgba(251, 191, 36, .35); }
.list-row.token.ungültig { border-color: rgba(248, 113, 113, .35); }
.order { display: flex; flex-direction: column; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 18px; margin: 14px 0; }
.meta-grid dt, .note-meta dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.meta-grid dd, .note-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.progress { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; font-size: 13.5px; }
.progress li { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px dashed rgba(125, 211, 252, .08); }
.progress time { color: var(--muted); font-family: var(--mono); font-size: 12px; flex: none; padding-top: 1px; }
.progress span { overflow-wrap: anywhere; white-space: pre-wrap; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.big-ico { font-size: 44px; margin-bottom: 8px; }
pre.code { background: rgba(2, 6, 23, .7); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; font-size: 13px; margin: 0; }
pre.secret { font-size: 15px; user-select: all; }

/* ---------- Markdown ---------- */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: .5em 0; }
.md ul, .md ol { padding-left: 1.3em; margin: .4em 0; }
.md h1, .md h2, .md h3, .md h4 { margin: .9em 0 .4em; line-height: 1.25; }
.md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.05em; }
.md code { background: rgba(2, 6, 23, .6); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.md pre { background: rgba(2, 6, 23, .75); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 8px; }
.md blockquote { margin: .5em 0; padding-left: 12px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.md a.wikilink, a.wikilink { color: #c4b5fd; border-bottom: 1px dashed rgba(196, 181, 253, .5); }

/* ---------- Hauptansicht: Chat + Gehirn im Hintergrund + Agenten-Leiste ---------- */
.home { position: relative; height: 100%; overflow: hidden; }
.brain-bg { position: absolute; inset: 0; opacity: 1; pointer-events: none; }
.home-veil { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 55% 65% at 45% 55%, rgba(5, 8, 15, .35) 0%, rgba(5, 8, 15, .1) 60%, transparent 100%),
              linear-gradient(180deg, rgba(5, 8, 15, .5) 0%, transparent 18%, transparent 80%, rgba(5, 8, 15, .7) 100%); }
.home-inner { position: relative; z-index: 1; height: 100%; display: flex; gap: 0; }
.home .chat { flex: 1; min-width: 0; max-width: 940px; margin: 0 auto; }
.home .bubble { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); background: rgba(13, 20, 38, .72); }
.home .msg.user .bubble { background: linear-gradient(180deg, rgba(14, 165, 233, .32), rgba(2, 132, 199, .26)); }
.home .chat-head { background: linear-gradient(180deg, rgba(5, 8, 15, .75), rgba(5, 8, 15, .35)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom-color: rgba(125, 211, 252, .08); }
.home .composer { background: rgba(5, 8, 15, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top-color: rgba(125, 211, 252, .08); }
.head-btn { font-size: 18px; }

.agent-rail { flex: none; width: 54px; display: flex; flex-direction: column; gap: 8px; padding: calc(12px + var(--safe-t)) 8px 12px;
  border-left: 1px solid rgba(125, 211, 252, .08); background: rgba(5, 8, 15, .35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: width .25s; overflow: hidden; }
.agent-rail.open { width: 270px; }
.agent-rail.busy:not(.open) { box-shadow: inset 2px 0 0 var(--accent); }
.rail-toggle { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 4px; border-radius: 10px; white-space: nowrap; }
.rail-toggle:hover { background: rgba(56, 189, 248, .08); color: var(--text); }
.rail-count { position: relative; font-size: 20px; }
.rail-count b { position: absolute; top: -6px; right: -10px; background: var(--accent); color: #001018; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; }
.agent-rail.busy .rail-count { animation: breathe 2.6s ease-in-out infinite; }
.rail-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-width: 250px; }
.rail-card { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; border-radius: 12px; cursor: pointer; color: var(--text);
  background: rgba(13, 20, 38, .72); border: 1px solid var(--line); transition: border-color .15s, transform .15s; }
.rail-card:hover { border-color: var(--line-strong); transform: translateX(-2px); }
.rail-card.running { border-color: rgba(56, 189, 248, .45); box-shadow: 0 0 18px -10px var(--accent-glow); }
.rail-card strong { font-size: 13.5px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rail-last { color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.rail-sep { margin-top: 6px; text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; }
.rail-empty { padding: 4px; }
.rail-all { margin-top: 4px; }
.agent-badge { display: none; }
@media (max-width: 899px) {
  .agent-rail { display: none; }
  .agent-badge:not([hidden]) { display: inline-flex; align-items: center; gap: 8px; align-self: center; margin: 8px auto 0; flex: none;
    padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(56, 189, 248, .5); background: rgba(13, 20, 38, .85); color: var(--text); font-size: 13px; cursor: pointer; backdrop-filter: blur(8px); }
  .chat-title { min-width: 0; flex: 1; }
  .chat-title .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-head { gap: 6px; }
  .chat-head .spacer { display: none; }
  .agent-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink 1.4s infinite; }
  .home .chat { position: relative; }
}

/* ---------- Overlay (Agenten-Popup, Gehirn) ---------- */
.overlay { position: fixed; inset: 0; z-index: 150; background: rgba(2, 6, 23, 0); transition: background .2s; display: flex; justify-content: flex-end; }
.overlay.open { background: rgba(2, 6, 23, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.overlay-card { display: flex; flex-direction: column; background: var(--panel-solid); border-left: 1px solid var(--line-strong); box-shadow: -30px 0 80px rgba(0, 0, 0, .55);
  width: min(560px, 100%); height: 100%; transform: translateX(30px); opacity: 0; transition: transform .2s, opacity .2s; }
.overlay.open .overlay-card { transform: none; opacity: 1; }
.overlay-head { display: flex; align-items: center; padding: calc(10px + var(--safe-t)) 12px 8px 18px; border-bottom: 1px solid var(--line); }
.overlay-head h3 { margin: 0; flex: 1; font-size: 17px; }
.overlay-body { flex: 1; min-height: 0; overflow-y: auto; }
.overlay-body .page { padding-top: 10px; }
.overlay-full .overlay-card { width: 100%; border-left: 0; }
.overlay-full .overlay-body { overflow: hidden; }
.overlay-full .brain { height: 100%; }

.sched-card.paused { opacity: .65; }
.warn-box { border-color: rgba(251, 191, 36, .45); }
.list-row.change.zurückgerollt, .list-row.change.abgelehnt, .list-row.change.fehlgeschlagen { border-color: rgba(248, 113, 113, .35); }
.list-row.change.aktiv { border-color: rgba(52, 211, 153, .3); }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; max-width: 920px; margin: 0 auto; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: calc(12px + var(--safe-t)) 16px 10px; border-bottom: 1px solid var(--line); }
.chat-title { display: flex; flex-direction: column; line-height: 1.2; }
.chat-title strong { letter-spacing: .12em; }
.call-btn { border-radius: 999px; }
.agent-strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.agent-chip { display: grid; grid-template-columns: auto auto 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 6px 12px; border-radius: 12px; border: 1px solid rgba(56, 189, 248, .35); background: rgba(56, 189, 248, .07); color: var(--text); min-width: 210px; max-width: 290px; flex: none; }
.agent-chip:hover { text-decoration: none; border-color: var(--accent); }
.agent-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink 1.4s infinite; }
.agent-chip.queued .dot, .agent-chip.waiting_token .dot { background: var(--warn); box-shadow: none; }
.agent-chip.paused .dot { background: var(--violet); box-shadow: none; animation: none; }
.agent-chip strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.agent-chip .last { grid-column: 1 / -1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.aia { align-self: flex-start; }
.bubble { padding: 10px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.msg.user .bubble { background: linear-gradient(180deg, rgba(14, 165, 233, .28), rgba(2, 132, 199, .22)); border-color: rgba(56, 189, 248, .4); border-bottom-right-radius: 5px; }
.msg.aia .bubble { border-bottom-left-radius: 5px; }
.msg.user .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .meta { font-size: 11px; color: var(--muted); margin: 3px 6px 0; }
.msg .meta .meldung { display: inline-block; font-size: 10.5px; padding: 0 7px; margin-right: 6px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--accent-2); }
.msg .meta .meldung.text { border-color: var(--line); color: var(--muted); }
.tools { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.tools summary { cursor: pointer; }
.tools ul { margin: 4px 0 0; padding-left: 18px; }
.live-tools .tool-line { font-size: 12.5px; color: var(--accent-2); opacity: .85; margin-top: 4px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.sys { align-self: center; font-size: 12.5px; color: var(--muted); text-align: center; max-width: 90%; padding: 4px 12px; border-radius: 999px; background: rgba(15, 23, 42, .6); }
.sys.quiet { opacity: .6; background: none; }
.agent-note { align-self: center; font-size: 13px; padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(15, 23, 42, .7); color: var(--text); }
.agent-note.done { border-color: rgba(52, 211, 153, .45); }
.agent-note.failed, .agent-note.stall { border-color: rgba(248, 113, 113, .45); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.welcome { margin: auto; text-align: center; max-width: 460px; padding: 20px 0; }
.welcome h2 { margin: 18px 0 6px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(15, 23, 42, .7); cursor: pointer; font-size: 13.5px; }
.chip:hover { border-color: var(--accent); }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: rgba(5, 8, 15, .6); }
.composer textarea { flex: 1; resize: none; max-height: 200px; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line-strong); background: rgba(2, 6, 23, .7); color: var(--text); font: inherit; line-height: 1.4; }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer .send { color: var(--accent-2); font-size: 20px; }
#dictate.rec { color: var(--bad); animation: blink 1s infinite; }

/* ---------- Anhänge ---------- */
.composer { flex-wrap: wrap; }
.composer.waiting .send { opacity: .5; }
.attach-tray { flex: 1 1 100%; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.attach-tray[hidden] { display: none; }
.att { position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 58px; max-width: 230px; padding: 0 30px 0 10px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(2, 6, 23, .75); }
.att.has-img { width: 58px; padding: 0; overflow: hidden; }
.att.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att.laedt img, .att.laedt .att-ico { opacity: .45; }
.att.fehler { border-color: rgba(248, 113, 113, .7); }
.att.fehler .att-size { color: var(--bad); }
.att-ico { font-size: 22px; flex: none; }
.att-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.att-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-size { font-size: 11px; color: var(--muted); }
.att-x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(15, 23, 42, .92); color: var(--text); font-size: 10px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.att-x:hover { border-color: var(--accent); }
.att-spin { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.att:not(.has-img) .att-spin { left: 21px; }
.msg-atts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; justify-content: flex-end; margin-bottom: 4px; }
.msg.aia .msg-atts { justify-content: flex-start; }
.msg-img { display: block; cursor: zoom-in; }
.msg-img img { display: block; max-width: min(260px, 64vw); max-height: 260px; border-radius: 12px; border: 1px solid var(--line-strong); object-fit: cover; background: rgba(2, 6, 23, .6); }
.msg-file { display: flex; align-items: center; gap: 8px; max-width: 260px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(13, 20, 38, .8); color: var(--text); }
.msg-file:hover { border-color: var(--accent); }
.chat.dropping { position: relative; }
.chat.dropping::after { content: "Dateien hier ablegen"; position: absolute; inset: 8px; z-index: 20; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: var(--radius); background: rgba(5, 8, 15, .78); color: var(--accent-2); font-size: 18px; pointer-events: none; }
.lightbox { position: fixed; inset: 0; z-index: 400; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; background: rgba(0, 0, 0, .88); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100% - 60px); border-radius: 8px; }
.toast a { text-decoration: underline; }

/* ---------- Aufwachwort ---------- */
.wake-btn.on { border-color: var(--line-strong); }
.wake-btn.on.hört { color: var(--accent-2); border-color: var(--accent); box-shadow: 0 0 14px -4px var(--accent-glow); animation: breathe 2.6s ease-in-out infinite; }
.wake-btn.on.tippen { color: var(--warn); border-color: rgba(251, 191, 36, .5); }
.wake-btn.on.fehler { color: var(--bad); border-color: rgba(248, 113, 113, .5); }
body.wake-on #nav .brand .reactor { box-shadow: 0 0 22px var(--accent), inset 0 0 8px rgba(125, 211, 252, .8); }

/* ---------- Telefonmodus ---------- */
.call {
  position: fixed; inset: 0; z-index: 100; display: flex;
  background: radial-gradient(circle at 50% 40%, #0c2440 0%, #05080f 62%); --level: 0; --c: 56, 189, 248;
}
.call-main {
  position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(28px + var(--safe-t)) 16px calc(30px + var(--safe-b));
}
.call[data-phase="denkt"] { --c: 251, 191, 36; }
.call[data-phase="spricht"] { --c: 125, 211, 252; }
.call[data-phase="stumm"] { --c: 100, 116, 139; }
.call-top { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.call-top strong { letter-spacing: .4em; font-size: 22px; color: var(--accent-2); text-shadow: 0 0 18px var(--accent-glow); }
.call-orb { position: relative; width: min(64vw, 280px); aspect-ratio: 1; border: 0; background: none; cursor: pointer; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.call-orb .core { position: absolute; inset: 28%; border-radius: 50%;
  background: radial-gradient(circle, #f0f9ff 0 10%, rgba(var(--c), 1) 30%, rgba(var(--c), .25) 62%, transparent 72%);
  box-shadow: 0 0 60px rgba(var(--c), .7), 0 0 120px rgba(var(--c), .35);
  transform: scale(calc(1 + var(--level) * .35)); transition: transform .08s, background .4s, box-shadow .4s; }
.call-orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(var(--c), .35); }
.call-orb .r1 { inset: 18%; border-style: dashed; animation: spin 14s linear infinite; }
.call-orb .r2 { inset: 8%; border-color: rgba(var(--c), .2); animation: spin 22s linear infinite reverse; border-style: dotted; border-width: 3px; }
.call-orb .r3 { inset: 0; border-color: rgba(var(--c), .12); }
.call[data-phase="hoert"] .core { animation: breathe 2.6s ease-in-out infinite; }
.call[data-phase="denkt"] .r1 { animation-duration: 1.4s; border-color: rgba(var(--c), .8); }
.call[data-phase="spricht"] .r3 { animation: ripple 1.3s ease-out infinite; }
.call[data-phase="spricht"] .r2 { animation: ripple 1.3s ease-out .45s infinite; }
@keyframes breathe { 50% { filter: brightness(1.25); } }
@keyframes ripple { from { transform: scale(.75); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
.call-phase { min-height: 24px; color: rgba(var(--c), 1); letter-spacing: .08em; font-size: 15px; }
.call-transcript { width: min(560px, 100%); min-height: 110px; text-align: center; }
.call-transcript p { margin: 6px 0; }
.call-transcript .you { color: var(--muted); font-style: italic; }
.call-transcript .him { color: var(--text); font-size: 17px; line-height: 1.45; }
.call-actions { display: flex; gap: 26px; }
.round { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(15, 23, 42, .85); font-size: 24px; cursor: pointer; }
.round.off { background: rgba(127, 29, 29, .6); }
.round.end { background: #dc2626; border-color: #ef4444; color: #fff; transform: rotate(135deg); font-size: 28px; box-shadow: 0 0 30px -6px rgba(239, 68, 68, .7); }

/* ---------- Gehirn ---------- */
.brain { display: flex; flex-direction: column; height: 100%; }
.brain-bar { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 12px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: relative; z-index: 5; }
.search-wrap { position: relative; flex: 1 1 220px; max-width: 360px; }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 60vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.search-results .result { display: block; width: 100%; text-align: left; padding: 8px 12px; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .result:hover { background: rgba(56, 189, 248, .08); }
.type-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.type-filter { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.type-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.type-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.type-chip.on { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.brain-main { position: relative; flex: 1; min-height: 0; }
#graph { position: absolute; inset: 0; }
.brain-stats { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); pointer-events: none; }
.note-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); overflow-y: auto; padding: 14px 18px 30px; background: rgba(8, 13, 26, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-left: 1px solid var(--line-strong); box-shadow: -20px 0 50px rgba(0, 0, 0, .4); z-index: 4; }
.note-panel h2 { margin: 6px 0 10px; font-size: 21px; }
.note-head { display: flex; align-items: center; }
.type-pill { padding: 2px 10px; border-radius: 999px; font-size: 12px; color: var(--c); border: 1px solid var(--c); }
.strength { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.strength .bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(148, 163, 184, .15); overflow: hidden; }
.strength .bar i { display: block; height: 100%; border-radius: 3px; }
.note-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 14px 0; font-size: 13px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tag { font-size: 12px; color: var(--accent-2); background: rgba(56, 189, 248, .08); padding: 2px 8px; border-radius: 6px; }
.note-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.note-body { border-top: 1px solid var(--line); padding-top: 12px; }
.backlinks { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.backlinks h4 { width: 100%; margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.trash-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 899px) {
  .note-panel { top: auto; left: 0; width: 100%; max-height: 68%; border-left: 0; border-top: 1px solid var(--line-strong); border-radius: 18px 18px 0 0; box-shadow: 0 -20px 50px rgba(0, 0, 0, .5); }
  .brain-bar .toggle { display: none; }
}

/* ---------- Einstellungen ---------- */
.settings .toc { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.settings .toc a { font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field .lbl { font-size: 13px; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); opacity: .85; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px 12px; }
.help { background: rgba(2, 6, 23, .45); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.help summary { cursor: pointer; color: var(--accent-2); }
.help ol { margin: 8px 0; padding-left: 20px; }
.help code { background: rgba(2, 6, 23, .7); padding: 2px 6px; border-radius: 5px; }
.settings form .input { flex: 1 1 200px; }

/* ---------- Dialoge & Hinweise ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 200; background: rgba(2, 6, 23, .7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
.modal { width: min(620px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.modal-head { display: flex; align-items: center; padding: 14px 16px 6px 20px; }
.modal-head h3 { margin: 0; flex: 1; font-size: 18px; }
.modal-body { padding: 8px 20px 14px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
#toasts { position: fixed; z-index: 300; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 12px); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(520px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transition: opacity .4s, transform .4s; pointer-events: auto; }
.toast.error { border-color: rgba(248, 113, 113, .6); }
.toast.warn { border-color: rgba(251, 191, 36, .6); }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (min-width: 900px) { #toasts { bottom: 20px; } }
body:has(.call) #toasts { bottom: auto; top: calc(16px + var(--safe-t)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* Sprechererkennung */
.help.warn { border-color: rgba(251, 191, 36, .5); }
.enroll-sentence { font-size: 18px; line-height: 1.45; margin: 6px 0; }
.meter { height: 6px; border-radius: 3px; background: rgba(148, 163, 184, .2); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent-2); transition: width .08s linear; }

/* ---------- Interaktionsfenster (panel.js): im Telefonat rechts, auf dem Handy als Blatt von unten ---------- */
.call-panel { display: none; flex-direction: column; width: min(460px, 44vw); min-height: 0; border-left: 1px solid var(--line-strong); background: rgba(8, 13, 26, .94); padding-top: var(--safe-t); }
.call.panel-open .call-panel { display: flex; }
.call-panel-btn { position: absolute; top: calc(14px + var(--safe-t)); right: 14px; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(15, 23, 42, .85); font-size: 20px; cursor: pointer; z-index: 2; }
.call.panel-open .call-panel-btn { border-color: var(--accent); box-shadow: 0 0 16px -4px var(--accent-glow); }
.pbadge { position: absolute; top: -3px; right: -3px; background: var(--accent); color: #001018; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.panel-btn { position: relative; }
.panel-btn .pbadge { top: 1px; right: 1px; }
@media (max-width: 899px) {
  .call-panel { display: flex; position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: 80dvh; border-left: 0; border-top: 1px solid var(--line-strong);
    border-radius: 18px 18px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, .6); padding: 0 0 var(--safe-b); z-index: 3;
    transform: translateY(105%); visibility: hidden; transition: transform .25s, visibility .25s; }
  .call.panel-open .call-panel { transform: none; visibility: visible; }
}
.panel { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.panel-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.pcard { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: rgba(15, 23, 42, .88); }
.pcard.st-offen.mail, .pcard.st-offen.frage { border-color: rgba(56, 189, 248, .55); }
.pcard.st-verworfen, .pcard.st-gesendet, .pcard.st-beantwortet, .pcard.st-hochgeladen { opacity: .72; }
.pcard.editing { border-color: var(--accent); }
.pc-head { display: flex; align-items: center; gap: 8px; }
.pc-ico { flex: none; }
.pc-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pc-fields { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 14px; }
.pc-field { display: contents; }
.pc-field span:last-child { overflow-wrap: anywhere; }
.pc-mailtext { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 42vh; overflow-y: auto; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(2, 6, 23, .6); font-size: 14.5px; }
.pc-text { max-height: 50vh; overflow-y: auto; }
.pc-files { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-img img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; }
.pc-link { overflow-wrap: anywhere; }
.pc-answer { margin: 0; color: var(--ok); }
.pc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pc-actions:empty { display: none; }
.pc-actions .btn { min-height: 40px; }
.pc-freerow { flex: 1 1 100%; }
.pc-free { flex: 1; }
.pc-ok { color: var(--ok); font-size: 14px; }
.pc-wait { display: inline-flex; align-items: center; gap: 8px; color: var(--accent-2); font-size: 14px; }
.pc-wait .att-spin { position: static; margin: 0; }
.pc-edit-row { display: flex; flex-direction: column; gap: 3px; }

/* 3D-Ansicht (stl3d.js): Canvas füllt die Fläche, Bedienung per Finger/Maus */
.pc-3d { position: relative; height: clamp(240px, 42vh, 560px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #060b17; }
.pc-3d.gross { position: fixed; inset: 0; z-index: 400; height: auto; border: 0; border-radius: 0; }
.pc-3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.pc-3d-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.pc-3d-btn { background: rgba(15, 23, 42, .85); }
.pc-3d-legend { position: absolute; top: 8px; left: 8px; max-width: 60%; display: flex; flex-wrap: wrap; gap: 6px; }
.pc-3d-part { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(15, 23, 42, .85); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.pc-3d-part i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pc-3d-part.off { opacity: .45; text-decoration: line-through; }
.pc-3d-note { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); }
.pc-3d-hint { position: absolute; left: 10px; bottom: 6px; font-size: 12px; color: var(--muted); pointer-events: none; }

/* PDF-Ansicht (pdfansicht.js): Seitenbilder untereinander, 1 Finger scrollt, 2 Finger zoomen */
.pc-pdf { position: relative; height: clamp(280px, 60vh, 900px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #1e293b; }
.pc-pdf.gross { position: fixed; inset: 0; z-index: 400; height: auto; border: 0; border-radius: 0; }
.pc-pdf-scroll { position: absolute; inset: 0; overflow: auto; touch-action: pan-x pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pc-pdf-pages { width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 8px; box-sizing: border-box; }
.pc-pdf-page { position: relative; width: 100%; background: #f8fafc; border-radius: 2px; box-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.pc-pdf-page::before { content: attr(data-n); position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; font-size: 22px; }
.pc-pdf-page.ok::before { content: none; }
.pc-pdf-page.fehler::before { content: '⚠ Seite ' attr(data-n); }
.pc-pdf-page img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.pc-pdf-tools { position: absolute; right: 14px; top: 8px; display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 12px; background: rgba(15, 23, 42, .85); }
.pc-pdf-btn { min-width: 36px; background: rgba(30, 41, 59, .9); }
.pc-pdf-nr, .pc-pdf-zoom { font-size: 13px; color: var(--muted); white-space: nowrap; padding: 0 4px; }
.pc-pdf-zoom { min-width: 3.4em; text-align: center; }
.pc-pdf-note { padding: 16px; text-align: center; color: var(--muted); }

/* Touch-Panel am Pi (nur dort gibt es #cards, Grundlage /p/panel.css des Werkzeugs aia-panel):
   3D-Modelle, PDFs und Mails über die volle Breite, Bedienelemente etwas kleiner */
#cards .pcard { gap: .55rem; padding: .85rem 1rem; }
#cards .pcard.mail, #cards .pcard.pc3d, #cards .pcard.editing { grid-column: 1 / -1; }
#cards .pcard.mail .pc-mailtext { max-height: 30vh; }
#cards .pc-head .pc-ico { font-size: 1.3rem; }
#cards .pc-head .pc-title { font-size: 1.15rem; }
#cards .pc-head .pc-x { width: 2.4rem; height: 2.4rem; min-width: 2.4rem; min-height: 2.4rem; font-size: 1rem; }
#cards .pc-actions { gap: .5rem; }
#cards .pc-actions .btn { flex: 0 1 auto; min-height: 3rem; padding: .3rem 1rem; font-size: 1rem; border-radius: 12px; }
#cards .pc-3d { height: 52vh; }
#cards .pcard.pc3d .msg-file { display: none; } /* Herunterladen ergibt im Kiosk keinen Sinn */
#cards .pc-3d.gross { height: auto; }
#cards .pc-3d-btn { min-height: 2.6rem; padding: .25rem .9rem; font-size: .95rem; border-radius: 10px; }
#cards .pc-3d-part { padding: .3rem .8rem; font-size: .85rem; }
#cards .pc-3d-part i { width: .7rem; height: .7rem; }
#cards .pc-3d-hint { font-size: .8rem; }
#cards .pcard.pcpdf { grid-column: 1 / -1; }
#cards .pc-pdf { height: 62vh; }
#cards .pc-pdf.gross { height: auto; }
#cards .pc-pdf-btn { min-height: 2.8rem; min-width: 2.8rem; padding: .25rem .8rem; font-size: 1.1rem; border-radius: 10px; }
#cards .pc-pdf-nr, #cards .pc-pdf-zoom { font-size: .95rem; }
/* Fingerscrollen übernimmt wischen.js (natives Touch-Scrollen greift am Pi nicht zuverlässig) – kein Doppel-Scrollen */
#cards .panel-list, #cards .pc-pdf-scroll { touch-action: none; }
#cards .panel-list.wischt, #cards .panel-list.wischt * { user-select: none; -webkit-user-select: none; cursor: grabbing; }
#top .chip { min-height: 2.2rem; padding: .3rem .85rem; font-size: .9rem; }

/* ---------- Meldungen (Inbox) ---------- */
.badge.warn { background: var(--warn); }
.mf-bar { margin: 12px 0 6px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; min-height: 40px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { background: rgba(56, 189, 248, .14); color: var(--accent-2); }
.seg-n { background: var(--accent); color: #001018; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: inline-grid; place-items: center; padding: 0 5px; }
.mf-zust { margin-bottom: 10px; }
.mlist { gap: 10px; }
.mrow { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.mrow.unread { border-color: rgba(56, 189, 248, .45); box-shadow: inset 3px 0 0 var(--accent); }
.mrow.unread.prio-wichtig { border-color: rgba(251, 191, 36, .5); box-shadow: inset 3px 0 0 var(--warn); }
.mrow.unread.prio-dringend { border-color: rgba(248, 113, 113, .6); box-shadow: inset 3px 0 0 var(--bad); }
.mrow.st-gelesen .mrow-title, .mrow.st-erledigt .mrow-title { font-weight: 500; }
.mrow.st-erledigt { opacity: .62; }
.mrow-head { display: flex; align-items: center; gap: 8px; }
.mrow-ico { flex: none; }
.mrow-title { overflow-wrap: anywhere; }
.mrow-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; color: var(--text); }
.mrow-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.mrow-link { overflow-wrap: anywhere; }
.mrow-actions .btn { min-height: 38px; }
.pill.st-neu { color: var(--accent-2); border-color: var(--accent); }
.pill.st-zugestellt { color: var(--violet); border-color: rgba(167, 139, 250, .5); }
.pill.st-erledigt { color: var(--ok); border-color: rgba(52, 211, 153, .5); }
