/* Agent Studio — Design nach design.png (warmes Braun/Creme, Light + Dark). */
:root {
  --app-viewport-height: 100dvh;
  --app-viewport-width: 100vw;
  --sidebar-bg: #2b1d13;
  --sidebar-bg-2: #241811;
  --sidebar-text: #d9c7b6;
  --sidebar-text-dim: #9c8571;
  --sidebar-active: #3a2717;
  --sidebar-active-text: #f4ede4;

  --bg: #f7f1ea;
  --surface: #ffffff;
  --surface-2: #faf5ef;
  --card: #fbf6f0;
  --border: #ece0d3;
  --border-strong: #e0d0be;
  --text: #2c2218;
  --text-dim: #7c6a58;
  --muted: #9a8a78;

  --accent: #7b4a24;
  --accent-hover: #653c1d;
  --accent-soft: #f0e4d6;
  --accent-text: #ffffff;

  --ok: #3f7d4e;
  --warn: #b5852a;
  --err: #b4462f;
  --idle: #9a8a78;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
:root[data-theme="dark"] {
  --sidebar-bg: #38271c;
  --sidebar-bg-2: #302117;
  --sidebar-text: #dbc5b1;
  --sidebar-active: #59402dd9;
  --sidebar-active-text: #f6efe6;

  --bg: #33241b;
  --surface: #402d22;
  --surface-2: #39271d;
  --card: #473226;
  --border: #614630;
  --border-strong: #76553b;
  --text: #f3e9df;
  --text-dim: #d0baa6;
  --muted: #b49b84;

  --accent: #dda06c;
  --accent-hover: #ebb17f;
  --accent-soft: #62432db8;
  --accent-text: #2b1d15;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
/* Einheitliche, zurückhaltende Scrollleisten für Listen, Dialoge und Kalender. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--surface-2); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 999px; }
*::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: var(--border-strong); background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--accent); }
*::-webkit-scrollbar-corner { background: var(--surface-2); }
html, body { margin: 0; width: 100%; min-height: 100%; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-x: none;
  touch-action: manipulation;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font-family: inherit; }
body.app-shell-page { min-height: var(--app-viewport-height); overflow-x: hidden; overscroll-behavior-y: none; }
.app-tabbar { display: none; }

/* ---------- Auth popup ---------- */
.auth-language { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.auth-language button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.auth-page { min-height: var(--app-viewport-height); overflow-x: hidden; overflow-y: auto; }
.auth-ghost { position: fixed; inset: 0; display: grid; grid-template-columns: 248px 1fr; grid-template-rows: 78px 1fr; background: var(--bg); }
.auth-ghost::before { content: "◈  Agent Studio"; grid-row: 1 / 3; padding: 29px 25px; color: #f4ede4; font-size: 16px; font-weight: 700; background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2)); }
.auth-ghost::after { content: "Agents"; padding: 25px 28px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 22px; font-weight: 700; }
.auth-ghost div { grid-column: 2; width: min(320px, 30%); height: 136px; margin: 38px 0 0 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.auth-ghost div:nth-child(2) { margin-left: calc(30% + 48px); }
.auth-ghost div:nth-child(3) { margin-top: 198px; }
.auth-ghost div:nth-child(4) { margin-top: 198px; margin-left: calc(30% + 48px); }
.auth-overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 22px; overflow-y: auto; scroll-padding-block: 18px 96px; background: rgba(31, 21, 13, .56); backdrop-filter: blur(7px); }
.auth-card { width: 420px; max-width: 100%; min-width: 0; padding: 30px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 70px rgba(28, 17, 9, .34); animation: auth-enter .22s ease-out; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; color: var(--text); font-weight: 700; font-size: 15px; }
.auth-brand .brand-logo { width: 30px; height: 30px; }
.auth-card h1 { margin: 0 0 7px; font-size: 24px; letter-spacing: -.3px; }
.auth-card > p { margin: 0 0 24px; color: var(--text-dim); }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form label { margin-top: 7px; color: var(--text); font-size: 13px; font-weight: 600; }
.auth-form input { width: 100%; min-height: 48px; padding: 11px 13px; scroll-margin-block: 72px 110px; border: 1px solid var(--border-strong); border-radius: 8px; outline: none; background: var(--bg); color: var(--text); font: inherit; }
.auth-form input[type="password"] { padding-inline-end: 54px; }
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-form .btn { width: 100%; margin-top: 16px; min-height: 48px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-form .btn span { font-size: 18px; line-height: 1; }
.auth-message { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); font-size: 13px; }
.auth-message.success { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.auth-back { min-height: 44px; margin: 8px auto 0; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
@keyframes auth-enter { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; min-height: var(--app-viewport-height); }

.sidebar {
  width: 248px; flex-shrink: 0;
  position: sticky; top: 0; align-self: flex-start; z-index: 20;
  height: 100vh; height: var(--app-viewport-height);
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  transition: width .18s ease;
}
.sidebar > .brand, .sidebar > .user-menu, .sidebar > .build-version, .sidebar > .notification-center { flex-shrink: 0; }
.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .brand-text, .sidebar.collapsed .nav-item > span:not(.ic),
.sidebar.collapsed .user-meta { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; }
.sidebar.collapsed .nav-item .ic { display: inline-block; }
.sidebar.collapsed .nav-group-children { display: none; }
.sidebar-backdrop { display: none; }

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: radial-gradient(circle at 30% 30%, #a9673a, #6f3f1e);
  display: grid; place-items: center; color: #fff; font-weight: 700;
}
.brand-text b { display: block; color: var(--sidebar-active-text); font-size: 15px; }
.brand-text small { color: var(--sidebar-text-dim); font-size: 12px; }
.sidebar-toggle { border: 0; cursor: pointer; padding: 0; }
.sidebar-toggle svg { width: 20px; height: 20px; }
.sidebar-toggle:hover { filter: brightness(1.15); }
.sidebar-toggle:focus-visible { outline: 2px solid var(--sidebar-active-text); outline-offset: 3px; }
.sidebar.collapsed .brand { padding-inline: 0; justify-content: center; }
.sidebar.collapsed .nav-item { padding-inline: 0; }
.sidebar.collapsed .user-card { padding: 6px 0; justify-content: center; }
.sidebar.collapsed .sidebar-action-label, .sidebar.collapsed .build-version { display: none; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; flex: 1; min-height: 0; overflow-y: auto; }
/* Die Navigation bleibt auch im Light Mode Teil der dunklen Sidebar. */
.nav { scrollbar-color: var(--sidebar-text-dim) transparent; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background-color: var(--sidebar-text-dim); }
.nav::-webkit-scrollbar-thumb:hover { background-color: var(--sidebar-active-text); }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 9px;
  color: var(--sidebar-text); font-size: 14px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: #ffffff0d; color: var(--sidebar-active-text); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-active-text); font-weight: 600; }
.nav-item .ic { width: 18px; text-align: center; opacity: .85; }
.nav-item .ic .agent-channel-icon { width: 18px; height: 18px; vertical-align: middle; }
.nav-item.placeholder { opacity: .5; }

/* Versioned Markdown documentation, with independent navigation and reading rails. */
.documentation-page { width: 100%; min-height: calc(100dvh - 180px); }
.documentation-layout { display: grid; grid-template-columns: minmax(190px, 240px) minmax(0, 1fr) minmax(150px, 205px); gap: clamp(20px, 3vw, 42px); align-items: start; max-width: 1480px; margin: 0 auto; padding: 24px clamp(12px, 2vw, 28px) 56px; }
.documentation-sidebar { position: sticky; top: 12px; max-height: calc(100dvh - 150px); overflow-y: auto; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.documentation-sidebar input {
  display: block; width: 100%; min-height: 40px; margin-bottom: 14px; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 9px; appearance: none;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px;
  outline: none; box-shadow: none; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.documentation-sidebar input::placeholder { color: var(--muted); opacity: 1; }
.documentation-sidebar input:focus, .documentation-sidebar input:focus-visible {
  border-color: var(--accent); outline: none; background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.documentation-chapter-details > summary { display: none; cursor: pointer; }
.documentation-chapters h3 { margin: 18px 8px 6px; color: var(--muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.documentation-chapter { display: flex; flex-direction: column; gap: 4px; padding: 8px 9px; border-radius: 7px; color: var(--text-dim); text-decoration: none; font-size: 13px; }
.documentation-chapter:hover, .documentation-chapter.active { background: var(--accent-soft); color: var(--accent); }
.documentation-chapter small { line-height: 1.35; }
.documentation-article { min-width: 0; max-width: 850px; width: 100%; margin: 0 auto; padding: 18px clamp(12px, 2vw, 28px) 60px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.documentation-article-head { padding-bottom: 18px; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.documentation-article-head > p:first-child { color: var(--accent); font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.documentation-article-head h1 { margin: 8px 0; font-size: clamp(27px, 4vw, 38px); line-height: 1.15; }
.documentation-article-head p:last-child { color: var(--text-dim); }
.documentation-prose { line-height: 1.72; overflow-wrap: anywhere; }
.documentation-prose h2, .documentation-prose h3 { scroll-margin-top: 24px; line-height: 1.3; }
.documentation-prose h2 { margin-top: 36px; }
.documentation-prose h3 { margin-top: 26px; }
.documentation-prose a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.documentation-prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.documentation-prose th, .documentation-prose td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.documentation-prose th { background: var(--surface-2); }
.documentation-prose pre { max-width: 100%; overflow: auto; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); line-height: 1.5; }
.documentation-prose code { padding: 2px 4px; border-radius: 4px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.documentation-prose pre code { padding: 0; background: transparent; }
.documentation-prose .highlight .k, .documentation-prose .highlight .kn, .documentation-prose .highlight .kd { color: #8055a5; }
.documentation-prose .highlight .s, .documentation-prose .highlight .s1, .documentation-prose .highlight .s2 { color: #3f7d4e; }
.documentation-prose .highlight .c, .documentation-prose .highlight .c1, .documentation-prose .highlight .cm { color: #8c8176; font-style: italic; }
.documentation-prose .highlight .nf, .documentation-prose .highlight .na { color: #8b5a25; }
.documentation-prose .highlight .mi, .documentation-prose .highlight .m { color: #b4462f; }
.documentation-prose blockquote { margin-inline: 0; padding: 4px 16px; border-left: 3px solid var(--border-strong); color: var(--text-dim); }
.documentation-prose img { max-width: 100%; height: auto; }
.documentation-toc { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 7px; max-height: calc(100dvh - 160px); overflow-y: auto; padding: 8px 0; font-size: 12px; }
.documentation-toc[hidden] { display: none; }
.documentation-toc b { margin-bottom: 4px; }
.documentation-toc a { color: var(--text-dim); text-decoration: none; }
.documentation-toc a:hover { color: var(--accent); }
.documentation-toc .toc-level-3 { padding-left: 12px; }
@media (max-width: 1050px) { .documentation-layout { grid-template-columns: 210px minmax(0, 1fr); } .documentation-toc { display: none; } }
@media (max-width: 720px) { .documentation-layout { display: flex; flex-direction: column; gap: 12px; padding: 12px 8px 36px; } .documentation-sidebar { position: static; max-height: none; width: 100%; } .documentation-chapter-details > summary { display: list-item; padding: 4px 2px; font-weight: 650; } .documentation-chapters { max-height: 32vh; overflow: auto; } .documentation-article { padding: 16px; } }
.nav-group-toggle .nav-group-caret { margin-left: auto; transition: transform .16s ease; }
.nav-group-toggle[aria-expanded="true"] .nav-group-caret { transform: rotate(90deg); }
.nav-group-toggle.group-active { color: var(--sidebar-active-text); font-weight: 600; }
.nav-group-children { display: none; flex-direction: column; gap: 3px; }
.nav-group-children.expanded { display: flex; }
.nav-subitem { padding-left: calc(12px + var(--nav-depth, 1) * 18px); font-size: 13px; }
.nav-subitem .ic { font-size: 11px; opacity: .7; }

.agent-choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 18px; }
.agent-choice-card { display: flex; flex-direction: column; gap: 16px; padding: 22px; min-width: 0; }
.agent-choice-card-configurable { cursor: pointer; transition: background-color .15s ease; }
.agent-choice-card-configurable:hover, .agent-choice-card-configurable:focus-within,
.ai-providers-page .llm-provider-card:hover, .ai-providers-page .llm-provider-card:focus-visible, .ai-providers-page .llm-provider-card:has(:focus-visible) { background-color: color-mix(in srgb, var(--surface), black 5%); }
.agent-choice-open { border: 0; padding: 0; background: none; color: inherit; font: inherit; text-align: left; }
.agent-choice-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.agent-choice-heading { display: flex; align-items: center; gap: 14px; }
.agent-choice-heading h2 { margin: 0 0 4px; font-size: 18px; overflow-wrap: anywhere; }
.agent-choice-heading .agent-portrait { --agent-portrait-size: 48px; }
.agent-choice-description { margin: 0; color: var(--text-dim); line-height: 1.6; flex: 1; overflow-wrap: anywhere; }
.agent-choice-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.agent-choice-actions .agent-channel-icon { width: 18px; height: 18px; flex-basis: 18px; }
.agent-choice-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 10px; flex: 0 0 auto; min-width: 0; font-size: 12px; white-space: nowrap; }

.user-menu { position: relative; margin-top: 10px; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px; background: #ffffff0a;
  width: 100%; border: 0; color: inherit; text-align: left;
}
.user-card:hover { background: #ffffff14; }
.user-menu-popover { position: absolute; bottom: calc(100% + 8px); left: 0; width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); z-index: 70; }
.user-menu-popover a, .user-menu-popover button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: none; color: var(--text); text-align: left; font-size: 13px; }
.user-menu-popover a:hover, .user-menu-popover button:hover { background: var(--accent-soft); color: var(--accent); }
.profile-key-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.profile-key-actions [hidden] { display: none; }
.profile-account-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.profile-account-data > div { min-width: 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.profile-account-data small, .profile-account-data b { display: block; overflow-wrap: anywhere; }
.profile-account-data small { color: var(--text-dim); margin-bottom: 3px; }
.modal:has(.user-settings) { width: min(760px, calc(100vw - 24px)); }
.user-settings { display: grid; gap: 18px; }
.settings-section { padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.settings-section:last-child { padding-bottom: 0; border-bottom: 0; }
.settings-section h4 { margin: 0 0 12px; font-size: 15px; }
.settings-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.settings-section-heading .hint { margin: 0 0 10px; }
.settings-key-list { display: grid; gap: 8px; max-height: 240px; overflow-y: auto; margin: 8px 0 14px; }
.settings-key-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; }
.settings-key-main { min-width: 0; display: grid; gap: 4px; }
.settings-key-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.settings-key-main code { font-size: 12px; color: var(--text-dim); }
.settings-key-main small { color: var(--text-dim); overflow-wrap: anywhere; }
.settings-key-status { padding: 2px 7px; border-radius: 999px; font-size: 11px; background: var(--surface-2, var(--surface)); }
.settings-key-status.active { color: #237647; }
.settings-key-status.expired, .settings-key-status.revoked { color: var(--text-dim); }
.settings-key-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.settings-key-actions [hidden] { display: none; }
.settings-key-create { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px; }
.settings-key-create .field { margin: 0; }
.settings-key-create .hint { grid-column: 1 / 3; margin-top: -4px; }
.mcp-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mcp-card { min-width: 0; padding: 20px; }
.mcp-card h2 { margin: 0; font-size: 18px; }
.mcp-card h3 { margin: 18px 0 8px; font-size: 13px; }
.mcp-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.mcp-card-head p { margin: 5px 0 0; }
.mcp-wide { grid-column: 1 / -1; }
.mcp-status { display: inline-flex; align-items: center; width: fit-content; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.mcp-status.ready { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.mcp-status.blocked { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.mcp-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.mcp-facts > div { min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.mcp-facts small, .mcp-facts b { display: block; overflow-wrap: anywhere; }
.mcp-facts small { margin-bottom: 4px; color: var(--text-dim); }
.mcp-endpoint, .mcp-code { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.mcp-endpoint code, .mcp-code pre { min-width: 0; flex: 1; margin: 0; overflow: auto; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.mcp-tool-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.mcp-tool { min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.mcp-tool code { color: var(--accent); font-weight: 700; }
.mcp-tool p { margin: 7px 0 0; color: var(--text-dim); line-height: 1.45; }
.mcp-security-list { display: grid; gap: 0; margin-top: 12px; }
.mcp-security-list > div { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.mcp-audit-wrap { margin-top: 14px; overflow-x: auto; }
.mcp-audit-wrap code { font-size: 11px; }
.settings-secret { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px 12px; margin-top: 14px; padding: 12px; border: 1px solid var(--accent); border-radius: 9px; background: var(--accent-soft); }
.settings-secret[hidden] { display: none; }
.settings-secret code { overflow-wrap: anywhere; }
.settings-secret .hint { grid-column: 1 / -1; }
.settings-secret.copied { opacity: .72; }
.settings-api-example { display: grid; gap: 4px; margin: 12px 0 0; font-size: 12px; color: var(--text-dim); overflow-wrap: anywhere; }
.settings-api-example code { color: var(--text); }
.user-settings input, .user-settings select { max-width: 100%; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #8a5a34; display: grid; place-items: center; color: #fff; font-size: 12px; }
.user-meta b { display: block; color: var(--sidebar-active-text); font-size: 13px; }
.user-meta small { color: var(--sidebar-text-dim); font-size: 11px; }
.build-version { width: 100%; margin-top: 9px; color: var(--sidebar-text-dim); font-size: 10px; line-height: 1.35; text-align: center; }
.sidebar.collapsed .build-version { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.topbar .burger { background: none; border: none; font-size: 18px; color: var(--text-dim); padding: 4px 8px; border-radius: 8px; }
.topbar .burger:hover { background: var(--accent-soft); }
.page-title { font-size: 22px; font-weight: 700; margin: 0; }
.topbar-sub { color: var(--accent); font-size: 13px; }
.topbar-spacer { flex: 1; }

.theme-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.theme-toggle button { border: none; background: none; padding: 5px 9px; border-radius: 999px; font-size: 13px; color: var(--text-dim); }
.theme-toggle button.on { background: var(--accent-soft); color: var(--accent); }

.btn {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 9px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: none; border-color: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.danger {
  color: #a63827;
  border-color: #d99a8c;
  background: #fff0ec;
}
.btn.danger:hover:not(:disabled) {
  color: #842719;
  border-color: #c85d49;
  background: #f8d8d0;
}
.btn.danger:disabled { opacity: .58; }
:root[data-theme="dark"] .btn.danger {
  color: #ffd5cc;
  border-color: #a95344;
  background: #5b2b24;
}
:root[data-theme="dark"] .btn.danger:hover:not(:disabled) {
  color: #fff0ec;
  border-color: #dc7662;
  background: #74362c;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Content ---------- */
.content { padding: 24px 28px 60px; }
.content-heading { padding: 24px 28px 0; }
.content-heading[hidden] { display: none; }
.content-heading .page-title { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.content-subtitle { margin: 6px 0 0; color: var(--text-dim); font-size: 13px; }
.content-subtitle:empty { display: none; }
.content.content-messenger { padding: 0; min-height: 0; flex: 1; overflow: hidden; }
/* Messenger wie eine App: #app hat sonst nur min-height und wüchse mit einem langen
   Chat mit, sodass die Eingabe (Desktop/Querformat) unter den Rand rutscht. So
   scrollen Liste und Chat jeweils für sich, die Eingabe bleibt immer sichtbar. */
#app:has(.content.content-messenger) { height: var(--app-viewport-height); }
#app:has(.content.content-messenger) .main { min-height: 0; }
.content.content-messenger .ms-shell { min-height: 0; }

button.af-export, button.af-win-dlbtn { font: inherit; cursor: pointer; }
button.af-export:disabled, button.af-win-dlbtn:disabled { opacity: .65; cursor: wait; }

/* ---------- Messenger / Inbox ---------- */
.notification-center { position: relative; }
.notification-bell { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--accent); font-size: 22px; cursor: pointer; }
.notification-bell:hover { background: var(--accent-soft); }
.notification-bell #notificationBadge { position: absolute; top: -5px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; border: 2px solid var(--bg); border-radius: 999px; background: #b43e2e; color: white; font: 700 10px/1 var(--font); }
#notificationBadge[hidden] { display: none; }
.notification-popover { position: absolute; z-index: 120; top: calc(100% + 10px); right: 0; width: min(380px, calc(100vw - 24px)); max-height: min(540px, 70vh); overflow: auto; padding: 7px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 50px #1f120c30; }
.notification-popover-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 9px 11px; border-bottom: 1px solid var(--border); }
.notification-popover-head button { border: 0; background: none; color: var(--accent); font-size: 12px; cursor: pointer; }
.sidebar-notifications { margin-top: 10px; }
.sidebar-notifications .notification-bell { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; height: 40px; padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--sidebar-text); font: 13px var(--font); text-align: left; }
.sidebar-notifications .notification-bell:hover { background: #ffffff0d; color: var(--sidebar-active-text); }
.sidebar-bell-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-notifications .notification-popover { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; width: min(380px, calc(var(--app-viewport-width) - 32px)); }
.sidebar-notifications #notificationBadge { top: 2px; right: 2px; }
.sidebar.collapsed .sidebar-notifications .notification-bell { justify-content: center; padding-inline: 0; }
@media (max-width: 720px), (orientation: landscape) and (max-width: 1024px) and (pointer: coarse) {
  body.app-shell-page .main { padding-top: env(safe-area-inset-top); }
  .content-heading { padding: 14px max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
}
.ms-notification-item { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 11px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); text-align: left; cursor: pointer; }
.ms-notification-item:hover, .ms-notification-item.unread { background: var(--accent-soft); }
.ms-notification-item b { font-size: 13px; }
.ms-notification-item span { grid-column: 1 / -1; color: var(--text-dim); font-size: 12px; }
.ms-notification-item small { grid-column: 2; grid-row: 1; color: var(--muted); }
.ms-notification-empty { padding: 26px 12px; color: var(--muted); text-align: center; }

/* minmax(0, 1fr): Die eine Zeile füllt genau die Höhe. Sonst dehnt eine lange
   Kontaktliste die Zeile und schiebt die Chat-Eingabe unter den Rand. */
.ms-shell { height: 100%; min-height: 580px; display: grid; grid-template-columns: minmax(290px, 34%) 1fr; grid-template-rows: minmax(0, 1fr); background: var(--surface); }
.ms-list-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--surface); container-type:inline-size; }
/* Chat-Liste ausblenden (Desktop): Spalte entfällt, ein Symbol links im Chat blendet sie wieder ein. */
.ms-shell { position: relative; }
.ms-shell.list-hidden { grid-template-columns: 0 minmax(0, 1fr); }
.ms-shell.list-hidden .ms-list-panel { visibility: hidden; overflow: hidden; border-right: 0; }
.ms-listshow { position: absolute; top: 14px; left: 12px; z-index: 6; }
.ms-listshow[hidden] { display: none; }
.ms-shell.list-hidden .ms-chat-head { padding-left: 64px; }
@media (max-width: 720px) {
  .ms-listtoggle, .ms-listshow { display: none !important; }
  .ms-shell.list-hidden { grid-template-columns: 1fr; }
  .ms-shell.list-hidden .ms-list-panel { visibility: visible; border-right: 1px solid var(--border); }
  .ms-shell.list-hidden .ms-chat-head { padding-left: initial; }
}
.ms-list-top { display: flex; align-items: center; gap: 8px; padding: 14px 12px 6px 16px; }
.ms-list-title { flex: 1; margin: 0; color: var(--text); font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.ms-round.ms-new { background: var(--accent); color: var(--accent-text); font-size: 22px; }
.ms-round.ms-new:hover { background: var(--accent-hover, var(--accent)); }
.ms-list-head { display: flex; gap: 8px; padding: 4px 12px 8px; background: var(--surface); }
/* Fit the filters to the list column, including split-view landscape. */
.ms-chips { display: flex; flex-wrap: nowrap; gap: 3px; padding: 2px 7px 10px; border-bottom: 1px solid var(--border); min-width:0; overflow-x:auto; }
.ms-chip { flex: 1 0 auto; min-height:36px; padding: 7px clamp(4px,1.3cqi,9px); white-space:nowrap; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-dim); font: 600 clamp(10.5px,3.6cqi,12.5px)/1 var(--font); cursor: pointer; }
.ms-chip:hover { background: var(--surface-2); }
.ms-chip.active { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.ms-section { padding: 16px 16px 6px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.ms-start-chip { padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.ms-thread-preview.typing, .ms-chat-ident small.typing { color: var(--accent); font-weight: 700; }
.ms-search { flex: 1; position: relative; }
.ms-search::before { content: "⌕"; position: absolute; left: 12px; top: 8px; color: var(--muted); font-size: 18px; }
.ms-search input { width: 100%; min-height: 40px; padding: 8px 12px 8px 35px; border: 1px solid transparent; border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; }
.ms-search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 32%, transparent); border-color: var(--accent); }
.ms-round, .ms-back, .ms-attach, .ms-send, .ms-close { flex: 0 0 auto; display: grid; place-items: center; border: 0; cursor: pointer; }
.ms-round { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.ms-round:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.ms-thread-list { min-height: 0; flex: 1; overflow-y: auto; }
.ms-thread { width: 100%; min-height: 76px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px 13px; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.ms-thread:hover { background: var(--surface-2); }
.ms-thread.active { background: var(--accent-soft); }
.ms-avatar { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: #ead9c8; color: #70401e; font-weight: 800; font-size: 13px; }
.ms-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.ms-avatar { position: relative; flex-shrink: 0; }
.ms-avatar.ai { background: linear-gradient(145deg, #8b572c, #4b2d1a); color: #fff7ee; box-shadow: inset 0 0 0 2px #ffffff38; }
.ms-thread-main, .ms-thread-meta { min-width: 0; display: flex; flex-direction: column; }
.ms-thread-title { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.ms-thread-preview { margin-top: 4px; overflow: hidden; color: var(--text-dim); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ms-thread-meta { align-items: flex-end; gap: 8px; color: var(--muted); font-size: 10px; }
.ms-unread { min-width: 21px; height: 21px; display: grid; place-items: center; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 10px; }
.ms-empty-list { display: flex; flex-direction: column; gap: 7px; padding: 32px 22px; color: var(--text-dim); text-align: center; }
.ms-empty-list b { color: var(--text); }

.ms-chat-panel { min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; background: color-mix(in srgb, var(--bg) 82%, #eadbcf); }
/* WhatsApp-artiges Doodle-Muster, in Braun statt Grün (dezent, rein dekorativ). */
.ms-chat-panel::before { content: ""; position: absolute; inset: 0; opacity: .11; pointer-events: none; background-size: 180px 180px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180' fill='none' stroke='%237b4a24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 24h34a8 8 0 0 1 8 8v14a8 8 0 0 1-8 8H36l-10 8v-8h-6a8 8 0 0 1-8-8V32a8 8 0 0 1 8-8z'/%3E%3Crect x='118' y='16' width='24' height='40' rx='6'/%3E%3Cpath d='M126 50h8'/%3E%3Cpath d='M44 96l5 11 12 1-9 8 3 12-11-6-11 6 3-12-9-8 12-1z'/%3E%3Cpath d='M132 106c-4-7-16-5-16 4 0 8 16 18 16 18s16-10 16-18c0-9-12-11-16-4z'/%3E%3Ccircle cx='88' cy='66' r='4'/%3E%3Ccircle cx='164' cy='160' r='3'/%3E%3Cpath d='M70 150l36-15-13 31-7-12z'/%3E%3Ccircle cx='158' cy='78' r='9'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .ms-chat-panel::before { opacity: .07; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180' fill='none' stroke='%23f0c79c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 24h34a8 8 0 0 1 8 8v14a8 8 0 0 1-8 8H36l-10 8v-8h-6a8 8 0 0 1-8-8V32a8 8 0 0 1 8-8z'/%3E%3Crect x='118' y='16' width='24' height='40' rx='6'/%3E%3Cpath d='M126 50h8'/%3E%3Cpath d='M44 96l5 11 12 1-9 8 3 12-11-6-11 6 3-12-9-8 12-1z'/%3E%3Cpath d='M132 106c-4-7-16-5-16 4 0 8 16 18 16 18s16-10 16-18c0-9-12-11-16-4z'/%3E%3Ccircle cx='88' cy='66' r='4'/%3E%3Ccircle cx='164' cy='160' r='3'/%3E%3Cpath d='M70 150l36-15-13 31-7-12z'/%3E%3Ccircle cx='158' cy='78' r='9'/%3E%3C/svg%3E"); }
.ms-chat-head, .ms-messages, .ms-composer, .ms-chat-empty { position: relative; z-index: 1; }
.ms-chat-head { min-height: 66px; display: flex; align-items: center; gap: 10px; padding: 9px 15px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.ms-chat-head .ms-avatar { width: 42px; height: 42px; }
.ms-chat-ident { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.ms-chat-ident b, .ms-chat-ident small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-chat-ident b { font-size: 15px; }
.ms-chat-ident small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.ms-back { display: none; width: 36px; height: 36px; border-radius: 50%; background: transparent; color: var(--text); font-size: 20px; }
.ms-messages { min-height: 0; flex: 1; overflow-y: auto; padding: 22px max(22px, 6vw); overscroll-behavior: contain; scroll-behavior: auto; }
.ms-messages.ms-initial-positioning { visibility: hidden; }
.ms-history-more { display: flex; justify-content: center; margin-bottom: 16px; }
.ms-message-row { display: flex; margin: 3px 0; }
.ms-message-row.mine { justify-content: flex-end; }
.ms-bubble { position: relative; max-width: min(720px, 79%); padding: 8px 10px 6px; border-radius: 13px; color: #30231b; box-shadow: 0 1px 2px #311b0e20; overflow-wrap: anywhere; }
.ms-bubble.theirs { border-top-left-radius: 3px; background: #fffdfb; }
.ms-bubble.mine { border-top-right-radius: 3px; background: #e3c5a6; }
:root[data-theme="dark"] .ms-bubble { color: #f7eee6; }
:root[data-theme="dark"] .ms-bubble.theirs { background: #3b2b23; }
:root[data-theme="dark"] .ms-bubble.mine { background: #6d4427; }
.ms-bubble.agent { border-left: 3px solid #8a552b; }
.ms-sender { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; color: #875125; font-size: 11px; font-weight: 700; }
.ms-ai-label { padding: 1px 5px; border-radius: 999px; background: #875125; color: white; font-size: 8px; letter-spacing: .04em; text-transform: uppercase; }
.ms-text, .ms-markdown { font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.ms-markdown { white-space: normal; }
.ms-markdown > :first-child { margin-top: 0; }
.ms-markdown > :last-child { margin-bottom: 0; }
.ms-markdown table { display: block; max-width: 100%; overflow-x: auto; }
.ms-attachment { display: block; margin: 5px 0; padding: 8px; border-radius: 9px; background: #ffffff73; color: inherit; text-decoration: none; }
.ms-attachment img { display: block; max-width: min(440px, 100%); max-height: 360px; border-radius: 8px; object-fit: contain; }
.ms-message-meta { min-height: 14px; display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin: 3px 0 0 12px; color: #735d4d; font-size: 9px; }
.ms-message-meta .read { color: #217fa7; font-weight: 800; }
.ms-deleted { color: var(--muted); font-style: italic; }
.ms-artifacts { max-width: min(680px, 76vw); margin-top: 8px; }
.ms-artifacts .af-card { margin: 0; }
.ms-day { width: fit-content; margin: 4px auto 16px; padding: 5px 10px; border-radius: 8px; background: color-mix(in srgb, var(--surface) 86%, transparent); color: var(--muted); font-size: 11px; }
.ms-composer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 96%, transparent); }
/* Höhe steuert messaging.js (fitComposer): wächst mit jeder Zeile, max. halbe Chat-Höhe. */
.ms-composer textarea { width: 100%; min-height: 44px; resize: none; overflow-y: hidden; padding: 11px 15px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text); font: 14.5px/1.4 var(--font); }
.ms-composer textarea::placeholder { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ms-composer-notice { grid-column: 1 / -1; justify-self: end; padding: 0 8px 4px; color: var(--muted); font-size: 12px; text-align: right; }
.ms-composer-notice[hidden] { display: none; }
.ms-pending-files { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ms-pending-files[hidden] { display: none; }
.ms-file-chip { max-width: 240px; padding: 5px 10px; overflow: hidden; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ms-file-clear { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 19px; cursor: pointer; }
.ms-call { font-size: 17px; }
.ms-call:disabled { opacity: .5; cursor: wait; }
.ms-bubble.error { border-left: 3px solid var(--err); }
.ms-error-detail { margin-top: 7px; padding-top: 7px; border-top: 1px dashed color-mix(in srgb, var(--err) 45%, transparent); color: var(--err); font-size: 12px; line-height: 1.4; white-space: pre-wrap; }
:root[data-theme="dark"] .ms-error-detail { color: #f2a48f; }
:root[data-theme="dark"] .ms-message-meta { color: #dcc5b0; }
.ms-typing { display: flex; align-items: center; gap: 4px; padding: 13px 15px; }
.ms-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: msTyping 1.2s infinite ease-in-out; }
.ms-typing span:nth-child(2) { animation-delay: .15s; }
.ms-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes msTyping { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ms-typing span { animation: none; } }
.ms-composer textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 26%, transparent); border-color: var(--accent); }
.ms-attach, .ms-send { width: 42px; height: 42px; border-radius: 50%; }
.ms-attach { background: transparent; color: var(--muted); font-size: 25px; }
.ms-send { background: var(--accent); color: var(--accent-text); font-size: 17px; }
.ms-send:disabled { opacity: .5; }
.ms-chat-empty { height: 100%; display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; }
.ms-empty-icon { width: 82px; height: 82px; display: grid; place-items: center; border: 2px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 38px; }
.ms-chat-empty h2 { margin: 18px 0 5px; }
.ms-chat-empty p { margin: 0 0 18px; color: var(--text-dim); }

.ms-modal-backdrop { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; padding: 18px; background: #160d0873; backdrop-filter: blur(3px); }
.ms-modal { width: min(520px, 100%); max-height: min(760px, 90vh); display: flex; flex-direction: column; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 70px #180b0655; }
.ms-modal.small { width: min(440px, 100%); }
.ms-modal-head, .ms-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.ms-modal-head h3 { margin: 0; }
.ms-close { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 22px; }
.ms-group-title { margin: 14px 0 8px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); }
.ms-contact-list { min-height: 120px; max-height: 52vh; overflow-y: auto; }
.ms-contact { display: grid; grid-template-columns: auto 42px 1fr; align-items: center; gap: 10px; padding: 9px 5px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ms-contact input { width: 20px; height: 20px; accent-color: var(--accent); }
.ms-contact .ms-avatar { width: 40px; height: 40px; }
.ms-contact > span:last-child { display: flex; flex-direction: column; }
.ms-contact small { color: var(--muted); }
.ms-modal-foot { justify-content: flex-end; padding-top: 14px; }
.ms-settings { display: flex; flex-direction: column; padding: 12px 0; }
.ms-settings label { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 48px; border-bottom: 1px solid var(--border); }
.ms-settings input { width: 21px; height: 21px; accent-color: var(--accent); }
.ms-settings select { max-width: 190px; padding: 7px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }

/* Messenger: Wischen zum Löschen, Mehrfachauswahl, Menüs, Sendestatus */
.ms-push-banner { display: flex; align-items: center; gap: 9px; margin: 0 12px 10px; padding: 9px 10px 9px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: 12px; line-height: 1.35; }
.ms-push-text { flex: 1; min-width: 0; }
.ms-push-banner .btn { flex: 0 0 auto; }
.ms-push-close { flex: 0 0 auto; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.ms-thread.unread .ms-thread-title { color: var(--accent); font-weight: 800; }
.ms-thread.unread .ms-thread-preview { color: var(--text); font-weight: 600; }
.ms-thread.unread .ms-thread-meta time { color: var(--accent); font-weight: 700; }
:root[data-theme="dark"] .ms-thread.unread .ms-thread-title, :root[data-theme="dark"] .ms-thread.unread .ms-thread-meta time { color: #f0c79f; }
.ms-thread-item { position: relative; overflow: hidden; touch-action: pan-y; }
.ms-thread-item .ms-thread { position: relative; z-index: 1; background-color: var(--surface); }
.ms-thread-item .ms-thread:hover { background: var(--surface-2); }
.ms-thread-item .ms-thread.active { background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface); }
.ms-thread-item.recently-updated .ms-thread {
  background: linear-gradient(color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent) 12%, transparent)), var(--surface);
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--accent) 78%, transparent);
}
.ms-thread-item.recently-updated .ms-thread-title { color: var(--accent); }
.ms-thread-item.recently-updated .ms-thread.active {
  background: linear-gradient(color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent) 20%, transparent)), var(--surface);
}
.ms-thread-del { position: absolute; inset: 0 0 0 auto; width: 88px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: var(--err); color: #fff; font-size: 19px; cursor: pointer; opacity: 0; }
.ms-thread-del small { font-size: 11px; font-weight: 700; }
.ms-thread-item.swiping .ms-thread-del { opacity: 1; }
.ms-message-row { position: relative; align-items: center; margin: 1px 0; padding: 2px 0; border-radius: 10px; overflow: hidden; touch-action: pan-y; }
.ms-swipe-track { position: relative; display: flex; min-width: 0; max-width: min(720px, 79%); }
.ms-swipe-track > .ms-bubble { max-width: 100%; }
.ms-swipe-del { position: absolute; top: 50%; left: calc(100% + 12px); width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--err); color: #fff; font-size: 17px; cursor: pointer; opacity: var(--swipe-progress, 0); transform: translateY(-50%) scale(calc(.6 + .4 * var(--swipe-progress, 0))); pointer-events: none; }
.ms-message-row.swipe-open .ms-swipe-del { pointer-events: auto; }
.ms-chat-panel.selecting .ms-message-row { padding-left: 36px; cursor: pointer; }
.ms-select-dot { position: absolute; top: 50%; left: 5px; width: 22px; height: 22px; display: grid; place-items: center; margin-top: -11px; border: 2px solid var(--muted); border-radius: 50%; background: var(--surface); color: transparent; font-size: 12px; font-weight: 800; }
.ms-message-row.selected { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.ms-message-row.selected .ms-select-dot { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.ms-head-normal, .ms-head-select { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.ms-head-select, .ms-chat-head.selecting .ms-head-normal { display: none; }
.ms-chat-head.selecting .ms-head-select { display: flex; }
.ms-select-count { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; }
.ms-select-action { padding: 8px; border: 0; background: none; color: var(--accent); font: 700 13px var(--font); white-space: nowrap; cursor: pointer; }
.ms-round.ms-plain { background: transparent; color: var(--text); }
.ms-round.ms-danger { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.ms-round:disabled { opacity: .5; cursor: default; }
.ms-bubble-menu { position: absolute; top: 3px; right: 4px; width: 24px; height: 22px; border: 0; border-radius: 7px; background: inherit; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s; }
@media (hover: hover) and (pointer: fine) {
  .ms-bubble:hover .ms-bubble-menu, .ms-bubble-menu:focus-visible { opacity: 1; }
}
@media not all and (hover: hover) and (pointer: fine) {
  .ms-bubble-menu { display: none; }
}
/* Langes Drücken darf auf Touch-Geräten keine Textauswahl/Lupe auslösen (Kopieren gibt es im Menü). */
@media (pointer: coarse) {
  .ms-message-row, .ms-thread-item { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
.ms-menu { position: fixed; z-index: 400; min-width: 190px; display: flex; flex-direction: column; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 34px #1b0e0640; }
.ms-menu-item { padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: 500 14px var(--font); text-align: left; cursor: pointer; }
.ms-menu-item:hover, .ms-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.ms-menu-item.danger { color: var(--err); }
.ms-sheet h3 { margin: 0 0 6px; }
.ms-sheet-text { margin: 0 0 16px; color: var(--text-dim); line-height: 1.45; }
.ms-sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.ms-sheet-actions .btn { width: 100%; min-height: 44px; justify-content: center; }
.ms-sheet-form { display: flex; flex-direction: column; gap: 14px; }
.ms-sheet-input { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: 500 15px var(--font); }
.ms-sheet-input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.ms-sheet-actions.horizontal { flex-direction: row; justify-content: flex-end; }
.ms-sheet-actions.horizontal .btn { width: auto; min-width: 110px; }
.ms-jump { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); padding: 8px 14px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-text); font: 700 12px var(--font); box-shadow: 0 4px 14px #2a170b40; cursor: pointer; }
.ms-jump[hidden] { display: none; }
.ms-status.pending { opacity: .7; }
.ms-status.failed { color: var(--err); font-weight: 700; }
.ms-bubble.failed { box-shadow: 0 0 0 1px color-mix(in srgb, var(--err) 55%, transparent); }
.ms-failed-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 4px; }
.ms-link { padding: 2px 0; border: 0; background: none; color: var(--accent); font: 700 12px var(--font); text-decoration: underline; cursor: pointer; }
:root[data-theme="dark"] .ms-link { color: #f0c79f; }

/* ===== Chat-Design 2026-10: Glas, Wellen, frei wählbare Farben ===== */
/* Farben als Variablen: „Standard“ folgt hell/dunkel; eigene Wahl setzt
   messaging.js (applyAppearance) inline auf .ms-shell bzw. die Vorschau. */
.ms-theme {
  --ms-wall: #f8f5ef;
  --ms-wave: transparent;
  --ms-glass: rgba(255, 250, 244, .74);
  --ms-glass-border: rgba(120, 72, 36, .14);
  --ms-mine-bg: #f0e3d3;
  --ms-mine-fg: #392719;
  --ms-theirs-bg: rgba(255, 255, 255, .88);
  --ms-theirs-fg: #2f2118;
  --ms-theirs-border: rgba(120, 72, 36, .12);
}
:root[data-theme="dark"] .ms-theme {
  --ms-wall: #211a16;
  --ms-wave: transparent;
  --ms-mine-bg: #65432c;
  --ms-mine-fg: #fff5e9;
  --ms-glass: rgba(40, 27, 18, .62);
  --ms-glass-border: rgba(255, 226, 196, .10);
  --ms-theirs-bg: rgba(32, 22, 15, .80);
  --ms-theirs-fg: #f6ece2;
  --ms-theirs-border: rgba(255, 226, 196, .11);
}
.ms-shell .ms-chat-panel { background: var(--ms-wall); }
.ms-chat-panel::before, :root[data-theme="dark"] .ms-chat-panel::before {
  opacity: 1; background-image: none; background-color: var(--ms-wave);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 900' preserveAspectRatio='none' fill='none' stroke='black' stroke-width='1.1'%3E%3Cpath d='M-40 120 C 90 60, 190 198, 320 130 S 520 66, 640 140'/%3E%3Cpath d='M-40 134 C 90 71, 190 216, 320 144 S 520 77, 640 154'/%3E%3Cpath d='M-40 148 C 90 82, 190 234, 320 158 S 520 89, 640 168'/%3E%3Cpath d='M-40 162 C 90 93, 190 252, 320 172 S 520 100, 640 182'/%3E%3Cpath d='M-40 176 C 90 104, 190 270, 320 186 S 520 111, 640 196'/%3E%3Cpath d='M-40 190 C 90 115, 190 288, 320 200 S 520 122, 640 210'/%3E%3Cpath d='M-40 204 C 90 126, 190 305, 320 214 S 520 134, 640 224'/%3E%3Cpath d='M-40 218 C 90 137, 190 323, 320 228 S 520 145, 640 238'/%3E%3Cpath d='M-40 232 C 90 148, 190 341, 320 242 S 520 156, 640 252'/%3E%3Cpath d='M-40 246 C 90 159, 190 359, 320 256 S 520 168, 640 266'/%3E%3Cpath d='M-40 260 C 90 170, 190 377, 320 270 S 520 179, 640 280'/%3E%3Cpath d='M-40 274 C 90 181, 190 395, 320 284 S 520 190, 640 294'/%3E%3Cpath d='M-40 288 C 90 192, 190 413, 320 298 S 520 202, 640 308'/%3E%3Cpath d='M-40 302 C 90 203, 190 431, 320 312 S 520 213, 640 322'/%3E%3Cpath d='M-40 316 C 90 214, 190 449, 320 326 S 520 224, 640 336'/%3E%3Cpath d='M-40 330 C 90 225, 190 466, 320 340 S 520 236, 640 350'/%3E%3Cpath d='M-40 560 C 120 630, 240 476, 380 550 S 560 630, 660 530'/%3E%3Cpath d='M-40 573 C 120 641, 240 491, 380 563 S 560 641, 660 543'/%3E%3Cpath d='M-40 586 C 120 652, 240 507, 380 576 S 560 652, 660 556'/%3E%3Cpath d='M-40 599 C 120 663, 240 522, 380 589 S 560 663, 660 569'/%3E%3Cpath d='M-40 612 C 120 674, 240 538, 380 602 S 560 674, 660 582'/%3E%3Cpath d='M-40 625 C 120 685, 240 553, 380 615 S 560 685, 660 595'/%3E%3Cpath d='M-40 638 C 120 696, 240 568, 380 628 S 560 696, 660 608'/%3E%3Cpath d='M-40 651 C 120 707, 240 584, 380 641 S 560 707, 660 621'/%3E%3Cpath d='M-40 664 C 120 718, 240 599, 380 654 S 560 718, 660 634'/%3E%3Cpath d='M-40 677 C 120 729, 240 615, 380 667 S 560 729, 660 647'/%3E%3Cpath d='M-40 690 C 120 740, 240 630, 380 680 S 560 740, 660 660'/%3E%3Cpath d='M-40 703 C 120 751, 240 645, 380 693 S 560 751, 660 673'/%3E%3Cpath d='M-40 716 C 120 762, 240 661, 380 706 S 560 762, 660 686'/%3E%3Cpath d='M-40 729 C 120 773, 240 676, 380 719 S 560 773, 660 699'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 900' preserveAspectRatio='none' fill='none' stroke='black' stroke-width='1.1'%3E%3Cpath d='M-40 120 C 90 60, 190 198, 320 130 S 520 66, 640 140'/%3E%3Cpath d='M-40 134 C 90 71, 190 216, 320 144 S 520 77, 640 154'/%3E%3Cpath d='M-40 148 C 90 82, 190 234, 320 158 S 520 89, 640 168'/%3E%3Cpath d='M-40 162 C 90 93, 190 252, 320 172 S 520 100, 640 182'/%3E%3Cpath d='M-40 176 C 90 104, 190 270, 320 186 S 520 111, 640 196'/%3E%3Cpath d='M-40 190 C 90 115, 190 288, 320 200 S 520 122, 640 210'/%3E%3Cpath d='M-40 204 C 90 126, 190 305, 320 214 S 520 134, 640 224'/%3E%3Cpath d='M-40 218 C 90 137, 190 323, 320 228 S 520 145, 640 238'/%3E%3Cpath d='M-40 232 C 90 148, 190 341, 320 242 S 520 156, 640 252'/%3E%3Cpath d='M-40 246 C 90 159, 190 359, 320 256 S 520 168, 640 266'/%3E%3Cpath d='M-40 260 C 90 170, 190 377, 320 270 S 520 179, 640 280'/%3E%3Cpath d='M-40 274 C 90 181, 190 395, 320 284 S 520 190, 640 294'/%3E%3Cpath d='M-40 288 C 90 192, 190 413, 320 298 S 520 202, 640 308'/%3E%3Cpath d='M-40 302 C 90 203, 190 431, 320 312 S 520 213, 640 322'/%3E%3Cpath d='M-40 316 C 90 214, 190 449, 320 326 S 520 224, 640 336'/%3E%3Cpath d='M-40 330 C 90 225, 190 466, 320 340 S 520 236, 640 350'/%3E%3Cpath d='M-40 560 C 120 630, 240 476, 380 550 S 560 630, 660 530'/%3E%3Cpath d='M-40 573 C 120 641, 240 491, 380 563 S 560 641, 660 543'/%3E%3Cpath d='M-40 586 C 120 652, 240 507, 380 576 S 560 652, 660 556'/%3E%3Cpath d='M-40 599 C 120 663, 240 522, 380 589 S 560 663, 660 569'/%3E%3Cpath d='M-40 612 C 120 674, 240 538, 380 602 S 560 674, 660 582'/%3E%3Cpath d='M-40 625 C 120 685, 240 553, 380 615 S 560 685, 660 595'/%3E%3Cpath d='M-40 638 C 120 696, 240 568, 380 628 S 560 696, 660 608'/%3E%3Cpath d='M-40 651 C 120 707, 240 584, 380 641 S 560 707, 660 621'/%3E%3Cpath d='M-40 664 C 120 718, 240 599, 380 654 S 560 718, 660 634'/%3E%3Cpath d='M-40 677 C 120 729, 240 615, 380 667 S 560 729, 660 647'/%3E%3Cpath d='M-40 690 C 120 740, 240 630, 380 680 S 560 740, 660 660'/%3E%3Cpath d='M-40 703 C 120 751, 240 645, 380 693 S 560 751, 660 673'/%3E%3Cpath d='M-40 716 C 120 762, 240 661, 380 706 S 560 762, 660 686'/%3E%3Cpath d='M-40 729 C 120 773, 240 676, 380 719 S 560 773, 660 699'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.ms-shell .ms-chat-head {
  margin: 10px 10px 4px; padding: 9px 12px; border: 1px solid var(--ms-glass-border); border-radius: 24px;
  background: var(--ms-glass); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 10px 28px rgba(20, 10, 4, .18);
}
.ms-shell .ms-chat-head .ms-avatar { background: #f3e6d6; color: #6b3d1c; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.ms-shell .ms-chat-head .ms-avatar.ai { background: linear-gradient(145deg, #8b572c, #4b2d1a); color: #fff7ee; }
.ms-shell .ms-chat-head .ms-chat-ident b { font-size: 16px; }
.ms-shell .ms-chat-head .ms-chat-ident small { font-size: 11.5px; color: var(--text-dim); }
.ms-shell .ms-chat-head .ms-round { border: 1px solid var(--ms-glass-border); background: color-mix(in srgb, var(--surface) 35%, transparent); color: var(--text); }
.ms-shell .ms-chat-head .ms-call { color: var(--accent); }
.ms-shell .ms-chat-head .ms-call:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.ms-shell .ms-chat-head .ms-call:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ms-shell .ms-chat-head .ms-back { color: var(--text); }
.ms-shell .ms-day { padding: 5px 14px; border: 1px solid var(--ms-glass-border); border-radius: 999px; background: var(--ms-glass); color: var(--text-dim); font-size: 12px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.ms-shell.ms-theme .ms-bubble, .ms-design-preview.ms-theme .ms-bubble { padding: 9px 13px 7px; font-size: 15px; overflow-wrap: anywhere; }
.ms-shell.ms-theme .ms-bubble.mine, .ms-design-preview.ms-theme .ms-bubble.mine {
  border: 0; border-radius: 18px 18px 5px 18px; background: var(--ms-mine-bg); color: var(--ms-mine-fg);
  box-shadow: 0 6px 16px rgba(30, 14, 4, .22), inset 0 1px 0 rgba(255, 255, 255, .20);
}
.ms-shell.ms-theme .ms-bubble.theirs, .ms-design-preview.ms-theme .ms-bubble.theirs {
  border: 1px solid var(--ms-theirs-border); border-radius: 18px 18px 18px 5px; background: var(--ms-theirs-bg); color: var(--ms-theirs-fg);
  box-shadow: 0 6px 16px rgba(30, 14, 4, .14); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.ms-shell.ms-theme .ms-bubble.agent { border-left: 1px solid var(--ms-theirs-border); }
.ms-shell.ms-theme .ms-bubble .ms-text, .ms-shell.ms-theme .ms-bubble .ms-markdown { font-size: 15px; }
.ms-shell.ms-theme .ms-bubble .ms-message-meta { margin-top: 4px; color: inherit; opacity: .78; font-size: 10.5px; }
.ms-shell.ms-theme .ms-bubble .ms-message-meta .read { color: #5cb4ff; opacity: 1; }
.ms-shell.ms-theme .ms-bubble.mine .ms-message-meta .read { color: #6ec1ff; text-shadow: 0 0 1px rgba(0, 0, 0, .25); }
.ms-shell.ms-theme .ms-bubble .ms-sender { color: #c27a3c; font-size: 12px; }
:root[data-theme="dark"] .ms-shell.ms-theme .ms-bubble .ms-sender { color: #e09a5b; }
.ms-shell.ms-theme .ms-bubble.mine .ms-attachment, .ms-shell.ms-theme .ms-bubble.theirs .ms-attachment { background: rgba(255, 255, 255, .14); }
.ms-shell.ms-theme .ms-bubble .ms-bubble-menu { color: inherit; }
/* Schatten der Blasen nicht an der Zeile abschneiden (nur waagrecht fürs Wischen kappen). */
.ms-shell .ms-message-row { overflow: visible; overflow-x: clip; padding: 4px 0 8px; margin: -2px 0; }
.ms-shell.ms-theme .ms-bubble.error { border-left: 3px solid var(--err); }
.ms-shell.ms-theme .ms-bubble.failed { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--err) 70%, transparent); }
.ms-shell .ms-typing { border-radius: 18px 18px 18px 5px; background: var(--ms-theirs-bg); border: 1px solid var(--ms-theirs-border); }
/* Eingabe: schwebende Glasleiste mit Foto-Plus, Textpille (Büroklammer, Emoji) und leuchtendem Senden. */
.ms-shell .ms-composer {
  width: auto; box-sizing: border-box; display: block;
  margin: 4px 10px calc(10px + env(safe-area-inset-bottom)); padding: 0;
  border: 0; background: transparent; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.ms-ico { display: grid; place-items: center; width: 22px; height: 22px; }
.ms-ico svg { width: 100%; height: 100%; }
.ms-shell .ms-attach { width: 40px; height: 40px; border: 1px solid var(--ms-glass-border); background: color-mix(in srgb, var(--surface) 30%, transparent); color: var(--text); }
.ms-shell .ms-attach .ms-ico { width: 24px; height: 24px; }
/* Ein einzelnes, volle Breite nutzendes Eingabefeld (ChatGPT-Stil): Text oben,
   Werkzeugleiste darunter. Das Glas-Styling sitzt jetzt hier statt am Composer. */
.ms-input-pill {
  width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 6px 8px 6px 10px;
  border: 1px solid var(--ms-glass-border); border-radius: 26px; background: var(--ms-glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 10px 28px rgba(20, 10, 4, .18);
}
.ms-input-pill:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.ms-shell .ms-input-pill textarea, .ms-shell .ms-input-pill textarea:focus { width: 100%; box-sizing: border-box; min-height: 40px; max-height: 50vh; padding: 9px 8px 2px 8px; border: 0; outline: none; background: transparent; color: var(--text); font: 15.5px/1.45 var(--font); resize: none; }
.ms-input-tools { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ms-tools-right { display: flex; align-items: center; gap: 2px; }
.ms-pill-btn { width: 38px; height: 38px; margin: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); cursor: pointer; }
.ms-pill-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
/* Diktat wie bei einer Voice-Eingabe: Die Textpille wird während der Aufnahme zur
   Pegelanzeige. Die Balken kommen direkt vom Web-Audio-Analyser und reagieren
   damit sichtbar auf die Stimme; das Quadrat beendet und transkribiert. */
.ms-dictation[hidden] { display: none; }
.ms-input-pill.dictating { flex-direction: row; align-items: center; padding: 6px 8px 6px 12px; }
.ms-input-pill.dictating textarea,
.ms-input-pill.dictating .ms-input-tools { display: none; }
.ms-dictation { position: relative; flex: 1; min-width: 70px; height: 40px; overflow: hidden; }
.ms-dictation-wave { position: absolute; inset: 1px 0 10px; display: flex; align-items: center; justify-content: center; gap: 2px; }
.ms-dictation-wave span { width: 2px; height: 3px; flex: 1 1 2px; max-width: 3px; border-radius: 999px; background: color-mix(in srgb, var(--text) 66%, transparent); transition: height 70ms linear; }
.ms-dictation-status { position: absolute; right: 0; bottom: 0; left: 0; color: var(--muted); font-size: 9px; line-height: 10px; text-align: center; white-space: nowrap; }
.ms-dictation-stop[hidden] { display: none; }
.ms-input-pill.dictating .ms-dictation-stop { display: grid; width: 40px; height: 40px; flex: 0 0 40px; margin: 1px 1px 1px 5px; border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--surface) 72%, transparent); color: var(--text); }
.ms-stop-square { width: 14px; height: 14px; border-radius: 3px; background: currentColor; }
.ms-dictation-stop.recording { animation: msMicPulse 1.3s ease-in-out infinite; }
.ms-dictation-stop.busy { opacity: .5; cursor: progress; }
@keyframes msMicPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .45); } 50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, 0); } }
.ms-shell .ms-send { width: 46px; height: 46px; border: 0; background: linear-gradient(160deg, #f5b866 0%, #d9892c 100%); color: #3a2210; box-shadow: 0 0 18px rgba(242, 166, 80, .45), 0 4px 10px rgba(0, 0, 0, .2); }
.ms-shell .ms-send:disabled { display: grid; visibility: visible; opacity: .48; }
.ms-shell .ms-send .ms-ico { width: 21px; height: 21px; margin-left: 2px; }
.ms-emoji-panel { position: absolute; right: 60px; bottom: calc(100% + 10px); z-index: 5; width: min(320px, calc(100vw - 32px)); display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; border: 1px solid var(--ms-glass-border); border-radius: 18px; background: var(--surface); box-shadow: 0 12px 30px rgba(0, 0, 0, .25); }
.ms-emoji-panel[hidden] { display: none; }
.ms-emoji { aspect-ratio: 1; border: 0; border-radius: 10px; background: none; font-size: 22px; cursor: pointer; }
.ms-emoji:hover, .ms-emoji:focus-visible { background: var(--surface-2); outline: none; }
/* Chat-Design-Blatt */
.ms-design { gap: 12px; }
.ms-design-preview { display: flex; flex-direction: column; gap: 8px; padding: 18px 14px; border-radius: 16px; background: var(--ms-wall); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.ms-design-row { display: flex; }
.ms-design-row.mine { justify-content: flex-end; }
.ms-design-sections { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; }
.ms-design-section h4 { margin: 0 0 8px; color: var(--text-dim); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.ms-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px; }
.ms-swatch { position: relative; height: 54px; display: flex; align-items: flex-end; justify-content: center; padding: 0 2px 4px; border: 2px solid transparent; border-radius: 14px; background-clip: padding-box; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .10); color: #fff; font: 600 10px/1.1 var(--font); text-shadow: 0 1px 2px rgba(0, 0, 0, .55); cursor: pointer; overflow: hidden; }
.ms-swatch > span { padding: 2px 7px; border-radius: 999px; background: rgba(0, 0, 0, .38); color: #fff; text-shadow: none; }
.ms-swatch.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.ms-swatch.standard.wall { background: var(--ms-wall); }
.ms-swatch.standard.mine { background: var(--ms-mine-bg); }
.ms-swatch.standard.theirs { background: var(--ms-theirs-bg); color: var(--ms-theirs-fg); text-shadow: none; }
.ms-swatch.custom { background: conic-gradient(#f56565, #f6ad55, #f6e05e, #68d391, #4fd1c5, #63b3ed, #b794f4, #f56565); }
.ms-swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
@media (max-width: 720px) {
  .ms-shell .ms-chat-head { margin: 6px 6px 2px; border-radius: 20px; }
  .ms-shell .ms-composer { margin: 2px 6px calc(6px + env(safe-area-inset-bottom)); }
  .ms-design-backdrop { place-items: end center; padding: 0; }
  .ms-design { width: 100%; max-height: 88vh; border-radius: 20px 20px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media (max-width: 720px) {
  .content.content-messenger { height: calc(var(--app-viewport-height) - 121px - env(safe-area-inset-bottom)); }
  .ms-shell { min-height: 0; grid-template-columns: 1fr; }
  .ms-chat-panel { display: none; }
  .ms-shell.chat-open .ms-list-panel { display: none; }
  .ms-shell.chat-open .ms-chat-panel { display: flex; }
  .ms-back { display: grid; }
  .ms-messages { padding: 18px 10px; }
  .ms-bubble { max-width: 88%; }
  .ms-swipe-track { max-width: 88%; }
  .ms-composer { padding-left: 7px; padding-right: 7px; }
  .notification-popover { position: fixed; top: 64px; right: 8px; }
  .topbar { gap: 8px; }
  .page-title { font-size: 19px; }
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow);
}
.stat .icon { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.stat .label { color: var(--text-dim); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; margin: 2px 0; }
.stat .sub { color: var(--muted); font-size: 12px; }

/* ---------- Dashboard (kompakte Übersicht; Deep-Dive bleibt der Monitor) ---------- */
.dash { display: flex; flex-direction: column; gap: 20px; }
.dash-hello { font-size: 24px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 4px; color: var(--text); }
.dash-status { margin: 0; color: var(--text-dim); font-size: 14px; }
.dash-status.attn { color: var(--warn); }
.dash-status.err { color: var(--err); }

.dash-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.dash-panel { padding: 16px 18px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-head .section-title { margin: 0; }

.dash-sys { display: flex; flex-direction: column; margin-top: 6px; }
.dash-sys-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.dash-sys-row:last-child { border-bottom: 0; }
.dash-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; background: var(--idle); }
.dash-dot.ok { background: var(--ok); }
.dash-dot.warn { background: var(--warn); }
.dash-dot.err { background: var(--err); }
.dash-dot.neutral { background: var(--muted); }
.dash-sys-label { font-size: 14px; color: var(--text); font-weight: 600; }
.dash-sys-detail { font-size: 12px; color: var(--text-dim); }

.dash-list { display: flex; flex-direction: column; margin-top: 6px; }
.dash-item { display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.dash-item:last-child { border-bottom: 0; }
.dash-item-click { cursor: pointer; }
.dash-item-click:hover { background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 8px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.dash-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-item-name { font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-item-sub { font-size: 12px; color: var(--text-dim); }
.dash-item-meta { font-size: 12px; color: var(--muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.dash-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex-shrink: 0; }
.dash-badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.dash-badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.dash-badge.err { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }

.dash-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.dash-actions .btn { min-height: 42px; }
.dash-empty { color: var(--muted); font-size: 13px; padding: 14px 0; }

@media (max-width: 1000px) {
  .dash-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .dash-actions .btn { flex: 1 1 calc(50% - 5px); justify-content: center; }
}

/* Personal overview: work, conversations and activity belong to the current user. */
.overview { display: flex; flex-direction: column; gap: 18px; max-width: 1600px; margin: 0 auto; }
.overview-greeting { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 4px 0 0; }
.overview-hello { margin: 0; font-size: clamp(25px, 2.4vw, 34px); line-height: 1.25; letter-spacing: -.025em; overflow-wrap: anywhere; }
.overview-greeting > div:first-child { min-width: 0; }
.overview-subtitle { margin: 6px 0 0; color: var(--text-dim); font-size: 15px; }
.overview-hero-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.overview-hero-actions > .btn { display: inline-flex; align-items: center; gap: 9px; min-height: 46px; padding: 0 22px; }
.overview-refresh { width: 36px; height: 36px; border-radius: 50%; font-size: 21px; background: transparent; }
.overview-load-status { margin: 0; color: var(--text-dim); font-size: 13px; }
.overview-load-status[hidden], .overview-notice[hidden], .overview-manager[hidden] { display: none; }
.overview-notice { border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border)); border-radius: 10px; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--text); }
.overview-notice-content { display: flex; align-items: center; gap: 14px; padding: 12px 16px; font-size: 13px; }
.overview-notice-content > .agent-channel-icon { flex-shrink: 0; color: var(--accent); }
.overview-notice-content strong { color: var(--accent); }
.overview-notice-content > span { color: var(--text-dim); }
.overview-dismiss { margin-left: auto; padding: 0 5px; border: 0; background: none; color: var(--text-dim); font-size: 23px; }
.overview-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.overview-stat { display: flex; align-items: center; gap: 18px; padding: 19px 22px; text-align: left; color: var(--text); font: inherit; min-width: 0; }
.overview-stat:hover { border-color: var(--accent); }
.overview-stat-icon, .overview-row-icon { display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.overview-stat-icon { width: 52px; height: 52px; }
.overview-stat-icon .agent-channel-icon { width: 25px; height: 25px; }
.overview-stat-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.overview-stat-text strong { font-size: 28px; line-height: 1.2; }
.overview-stat-text > span { font-size: 13px; color: var(--text-dim); }
.overview-stat-arrow { margin-left: auto; color: var(--accent); font-size: 25px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.overview-panel { padding: 20px 22px 8px; min-width: 0; }
.overview-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 35px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.overview-panel h2 { margin: 0; color: var(--text); font-size: 17px; line-height: 1.4; }
.overview-link { display: inline-flex; align-items: center; gap: 10px; border: 0; padding: 4px 0; background: none; color: var(--accent); font: 600 12px var(--font); white-space: nowrap; }
.overview-work-row, .overview-conversation-row, .overview-message-row, .overview-activity-row { display: flex; align-items: center; gap: 14px; width: 100%; min-width: 0; padding: 16px 0; border-bottom: 1px solid var(--border); }
.overview-work-row:last-child, .overview-conversation-row:last-child, .overview-message-row:last-child, .overview-activity-row:last-child { border-bottom: 0; }
.overview-task-status { width: 126px; flex-shrink: 0; padding: 7px 9px; font-size: 11px; font-weight: 600; line-height: 1.4; border-radius: 8px; color: var(--accent); background: var(--accent-soft); }
.overview-task-failed, .overview-task-missed { background: color-mix(in srgb, var(--err) 11%, var(--surface)); color: var(--err); }
.overview-task-running { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); }
.overview-task-paused { background: var(--surface-2); color: var(--text-dim); }
.overview-row-text { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; text-align: left; }
.overview-row-text strong { color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.overview-row-text small, .overview-row-text .overview-preview { display: block; color: var(--text-dim); font-size: 12px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-work-row .btn, .overview-conversation-row .btn { min-width: 92px; min-height: 34px; flex-shrink: 0; color: var(--accent); background: transparent; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.overview-work-row .btn:hover, .overview-conversation-row .btn:hover { background: var(--accent-soft); }
.overview-message-row, .overview-activity-row { border-top: 0; border-right: 0; border-left: 0; border-radius: 0; background: transparent; text-align: left; color: var(--text); font: inherit; }
.overview-message-row:hover .overview-row-text strong, .overview-activity-row:hover .overview-row-text strong { color: var(--accent); }
.overview-avatar { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.overview-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.overview-presence-avatar { position: relative; display: inline-flex; width: 42px; height: 42px; flex-shrink: 0; }
.overview-unread-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }
.overview-message-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.overview-message-meta time, .overview-activity-row time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.overview-count { display: inline-block; border-radius: 999px; padding: 3px 9px; background: var(--accent-soft); color: var(--accent); font-size: 11px; white-space: nowrap; }
.overview-row-icon { width: 42px; height: 42px; }
.overview-warning { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--warn); font-size: 24px; }
.overview-manager .overview-panel-head { justify-content: flex-start; }
.overview-activity-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.overview-activity-icon { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; color: var(--accent); }
.overview-activity-icon .agent-channel-icon { width: 18px; height: 18px; }
.overview-activity-row { padding: 13px 0; }
.overview-empty, .overview-section-note { color: var(--text-dim); font-size: 12px; line-height: 1.65; }
.overview-empty { padding: 14px 0 18px; margin: 0; }
.overview-skeleton { height: 44px; margin: 8px 0; border-radius: 10px; background: linear-gradient(90deg, var(--surface-2, rgba(127,127,127,.12)) 25%, rgba(127,127,127,.22) 50%, var(--surface-2, rgba(127,127,127,.12)) 75%); background-size: 200% 100%; animation: overview-shimmer 1.2s linear infinite; }
.overview-skeleton-stat { height: 64px; margin: 0; }
@keyframes overview-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .overview-skeleton { animation: none; } }
.overview-section-note { margin: 13px 0 0; font-size: 11px; }
.overview button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 1150px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .overview-stat { padding: 16px; gap: 12px; }
  .overview-stat-icon { width: 42px; height: 42px; }
}
@media (max-width: 600px) {
  .overview { gap: 14px; }
  .overview-greeting { align-items: flex-start; flex-direction: column; gap: 12px; }
  .overview-hero-actions { width: 100%; justify-content: flex-end; }
  .overview-hero-actions > .btn { flex: 1; justify-content: center; }
  .overview-summary { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .overview-stat { padding: 13px 15px; }
  .overview-stat-text { flex-direction: row; align-items: baseline; gap: 10px; }
  .overview-stat-text strong { font-size: 25px; }
  .overview-panel { padding: 16px 14px 6px; }
  .overview-panel h2 { font-size: 15px; }
  .overview-panel-head { gap: 8px; }
  .overview-link { font-size: 11px; gap: 5px; }
  .overview-work-row { flex-wrap: wrap; gap: 10px; }
  .overview-task-status { width: auto; }
  .overview-work-row .overview-row-text { flex-basis: calc(100% - 145px); }
  .overview-work-row .btn { margin-left: auto; }
  .overview-conversation-row { flex-wrap: wrap; gap: 10px; }
  .overview-conversation-row .overview-row-text { flex-basis: calc(100% - 60px); }
  .overview-conversation-row .btn { margin-left: auto; }
  .overview-notice-content { flex-wrap: wrap; gap: 9px; }
  .overview-notice-content strong { flex: 1; }
  .overview-notice-content > span { order: 1; flex-basis: 100%; }
  .overview-activity-row { gap: 9px; }
  .overview-activity-row time { max-width: 70px; white-space: normal; text-align: right; }
}

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.conversation-bulk-bar {
  display: flex; align-items: center; gap: 10px; margin: -4px 0 14px; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--accent-soft);
}
.conversation-bulk-bar[hidden] { display: none; }
.conversation-select-all { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; cursor: pointer; }
.conversation-select-all input, .conversation-selection-cell input {
  width: 22px; height: 22px; margin: 0; accent-color: var(--accent); cursor: pointer;
}
.conversation-selection-count { color: var(--text); font-size: 13px; white-space: nowrap; }
.conversation-row.is-selected { background: var(--accent-soft); }
.conversation-swipe-action { display: none; }
.tele-pending { display: flex; flex-direction: column; gap: 8px; }
.tele-pending-row {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.tele-pending-when { font-weight: 700; color: var(--text); }
.tele-pending-relative { color: var(--accent); font-weight: 600; }
.switch input[type="checkbox"] { accent-color: var(--accent); }
.agent-channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.agent-channel-toggle { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; width: 100%; min-height: 52px; padding: 12px 16px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer;
  font: inherit; touch-action: manipulation; }
.agent-channel-toggle:hover { border-color: var(--accent); }
.agent-channel-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.agent-channel-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.agent-channel-name { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.agent-channel-state { flex-shrink: 0; font-size: 12px; }
.agent-channel-default { margin-top: 14px; }
.agent-channel-default[hidden] { display: none; }
.agent-channel-default .hint { margin-top: 8px; }
@media (max-width: 480px) {
  .agent-channel-grid { grid-template-columns: 1fr; }
  .agent-channel-default .agent-channel-toggle { flex-wrap: wrap; }
}
.search { flex: 1; min-width: 200px; position: relative; }
.search input {
  width: 100%; padding: 10px 12px 10px 34px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 13px;
}
.search::before { content: "🔍"; position: absolute; left: 11px; top: 9px; opacity: .5; font-size: 13px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 12px; text-transform: none; color: var(--text-dim); font-weight: 600; padding: 14px 16px; border-bottom: 1px solid var(--border); }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.cell-name { min-width: 0; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.cell-name .cn-name { flex: 0 0 200px; min-width: 200px; }

/* Agenten-Tabelle: bleibt im verfügbaren Hauptbereich, ohne dass rechts
   Actions verschwinden. Erst auf wirklich schmalen Viewports wird innerhalb
   des Panels horizontal gescrollt. */
.agents-panel { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.agents-table { --agent-action-size: 30px; min-width: 840px; table-layout: fixed; }
.agents-table th, .agents-table td { padding-left: 10px; padding-right: 10px; }
.agents-table th:nth-child(1), .agents-table td:nth-child(1) { width: 4%; text-align: center; }
.agents-table th:nth-child(2), .agents-table td:nth-child(2) { width: 32%; }
.agents-table th:nth-child(3), .agents-table td:nth-child(3) { width: 15%; }
.agents-table th:nth-child(4), .agents-table td:nth-child(4) { width: 7%; text-align: center; }
.agents-table th:nth-child(5), .agents-table td:nth-child(5) { width: 9%; text-align: center; }
.agents-table th:nth-child(6), .agents-table td:nth-child(6) { width: 13%; white-space: nowrap; }
.agents-table th:nth-child(7), .agents-table td:nth-child(7) { width: 20%; }
.agents-table th:nth-child(7) { text-align: right; }
.agent-actions-heading { display: inline-block; width: calc(3 * var(--agent-action-size) + 12px); text-align: left; }
.agents-table td:nth-child(3) { overflow-wrap: anywhere; line-height: 1.35; }
.agents-table .cell-name { width: 100%; }
.agents-table .cell-name .cn-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agents-table .cell-name .badge { flex: 0 0 auto; }
.agents-table .row-actions { flex-wrap: nowrap; justify-content: flex-end; }
.agents-table .iconbtn { flex: 0 0 var(--agent-action-size); }
.agents-table .row-actions .iconbtn { padding: 0; }
.agents-table .row-actions .agent-channel-icon { width: 14px; height: 14px; display: block; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--accent-soft); }
.kv { display: grid; gap: 6px; }
.kv-row { display: flex; gap: 12px; font-size: 13px; align-items: baseline; }
.kv-k { flex: 0 0 120px; color: var(--muted); }
.kv-v { flex: 1; min-width: 0; }
.llm-tiles, .agent-drops { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.llm-connection-health { position: relative; display: flex; margin-top: 10px; width: 100%; }
.llm-health-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 9px; font: inherit; font-size: 12px; color: var(--text-dim); background: var(--surface); cursor: default; }
.llm-health-pill.is-healthy { color: var(--success, #378449); border-color: currentColor; }
.llm-health-pill.is-failed { color: var(--err); border-color: currentColor; }
.llm-health-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.llm-health-pill .agent-channel-icon { width: 14px; height: 14px; }
.llm-health-info { display: none; position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(300px, 100%); box-sizing: border-box; padding: 12px; border: 1px solid var(--border-strong); border-radius: 10px; color: var(--text); background: var(--surface); box-shadow: 0 6px 24px #0002; font-size: 12px; line-height: 1.5; pointer-events: none; }
.llm-connection-health:hover .llm-health-info, .llm-connection-health:focus-within .llm-health-info { display: flex; flex-direction: column; gap: 4px; }
.llm-tile[tabindex]:focus-visible, .llm-health-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ai-providers-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; }
.ai-providers-header h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -.025em; }
.ai-providers-header p { margin: 6px 0 0; color: var(--text-dim); font-size: 15px; }
.ai-provider-create { flex-shrink: 0; min-height: 42px; padding-inline: 20px; }
.ai-default-bar { display: grid; grid-template-columns: max-content minmax(200px, 325px) auto 32px; justify-content: start; align-items: center; gap: 16px; padding: 14px 20px; margin-bottom: 32px; background: var(--accent-soft); border: 1px solid var(--border); border-radius: 9px; }
.ai-default-bar > label { font-weight: 650; margin-right: 28px; }
.ai-default-bar > select { width: 100%; min-width: 0; min-height: 42px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.ai-default-save { min-height: 42px; min-width: 130px; }
.ai-default-bar > [role="status"] { grid-column: 1 / -1; margin: 0; }
.ai-default-bar > [role="status"]:empty { display: none; }
.ai-default-help { position: relative; }
.ai-default-help summary { display: grid; place-items: center; width: 32px; height: 42px; cursor: pointer; list-style: none; border-radius: 6px; }
.ai-default-help summary::-webkit-details-marker { display: none; }
.ai-default-help summary:hover { background: var(--surface); }
.ai-default-help summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ai-default-help svg { width: 20px; height: 20px; }
.ai-default-help p { position: absolute; z-index: 5; right: 0; top: 100%; width: min(330px, 72vw); margin: 8px 0 0; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: 0 6px 24px #0002; line-height: 1.5; }
.ai-providers-section-head { display: flex; align-items: baseline; gap: 22px; margin: 32px 0 16px; }
.ai-providers-section-head h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.ai-providers-section-head p { margin: 0; color: var(--text-dim); font-size: 14px; }
.ai-providers-page .llm-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 366px)); gap: 18px; }
.ai-providers-page .llm-tile { padding: 18px 20px; border-left-width: 1px; }
.ai-providers-page .llm-tile-head { justify-content: flex-start; flex-wrap: wrap; gap: 12px; }
.ai-providers-page .llm-tile-head b { font-size: 18px; color: var(--text); }
.llm-default-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text); background: var(--surface); white-space: nowrap; }
.ai-providers-page .llm-tile-model { font-size: 16px; font-weight: 400; }
.ai-providers-page .llm-tile-actions { gap: 10px; }
.ai-providers-page .llm-tile-actions .iconbtn { width: 40px; height: 40px; }
.ai-providers-page .llm-tile-actions svg { width: 20px; height: 20px; }
.ai-providers-page .llm-tile-actions .danger { color: var(--err); }
.ai-providers-page .llm-provider-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); cursor: pointer; transition: background-color .15s ease; }
.ai-providers-page .llm-provider-card:hover, .ai-providers-page .llm-provider-card:focus-visible, .ai-providers-page .llm-provider-card:has(:focus-visible) { border-color: var(--border); box-shadow: var(--shadow); transform: none; }
.llm-provider-head { display: flex; align-items: flex-start; gap: 12px; min-height: 68px; }
.llm-provider-mark { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 48px; border-radius: 10px; background: linear-gradient(140deg, var(--accent), var(--accent-hover)); color: var(--accent-text); }
.llm-provider-mark svg { width: 28px; height: 28px; }
.llm-provider-logo { display: inline-block; width: 28px; height: 28px; flex: none; background: currentColor; -webkit-mask: var(--provider-logo) center / contain no-repeat; mask: var(--provider-logo) center / contain no-repeat; }
.brand-openai { --provider-logo: url("provider-icons/openai.0f50ad4f3a65.svg"); }
.brand-anthropic { --provider-logo: url("provider-icons/anthropic.2be3c6a56729.svg"); }
.brand-ollama { --provider-logo: url("provider-icons/ollama.a2b9e45c98ba.svg"); }
.brand-nvidia { --provider-logo: url("provider-icons/nvidia.89627ff020c9.svg"); }
.brand-groq { --provider-logo: url("provider-icons/groq.76a15bed8d33.svg"); }
.brand-cloudflare { --provider-logo: url("provider-icons/cloudflare.cb2d19981920.svg"); }
.llm-preset-picker { position: relative; font-weight: 400; }
.llm-preset-picker > summary { display: flex; align-items: center; gap: 10px; padding: 9px 11px; min-height: 42px; box-sizing: border-box; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; list-style: none; }
.llm-preset-picker > summary::-webkit-details-marker { display: none; }
.llm-preset-picker > summary::after { content: "⌄"; margin-left: auto; }
.llm-preset-options { position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 30; max-height: 300px; overflow-y: auto; padding: 6px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px #0002; }
.llm-preset-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 11px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.llm-preset-option:hover, .llm-preset-option:focus-visible { background: var(--accent-soft); outline: none; }
.llm-preset-picker .llm-provider-logo { width: 24px; height: 24px; }
.llm-preset-picker > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.llm-provider-identity { display: flex; flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; gap: 4px; }
.llm-provider-identity b { font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.llm-provider-identity > span:not(.llm-default-tag) { color: var(--text-dim); font-size: 12px; }
.llm-provider-controls { display: flex; flex: none; gap: 5px; }
.llm-provider-controls .iconbtn { width: 30px; height: 32px; padding: 6px; border-radius: 8px; }
.llm-provider-controls svg { width: 17px; height: 17px; }
.llm-provider-controls .iconbtn[aria-pressed="true"] { color: var(--success, #378449); }
.llm-provider-controls .danger:hover { color: var(--err); }
.llm-provider-model { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 18px 0; margin-top: 18px; }
.llm-provider-model > span { color: var(--text-dim); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.llm-provider-model strong { color: var(--text); font-size: 24px; line-height: 1.25; letter-spacing: -.025em; overflow-wrap: anywhere; }
.llm-provider-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; }
.llm-provider-footer .llm-connection-health { margin: 0; width: auto; min-width: 0; }
.llm-provider-footer .llm-health-pill { border: 0; border-radius: 0; padding: 0; background: transparent; font-size: 13px; text-align: left; }
.llm-provider-footer .llm-health-info { width: 260px; max-width: calc(100vw - 100px); }
.llm-provider-usage { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.llm-provider-usage svg { width: 18px; height: 18px; }
.llm-provider-card.is-disabled .llm-provider-mark { background: var(--text-dim); }
@media (max-width: 380px) { .llm-provider-head { flex-wrap: wrap; } .llm-provider-controls { margin-left: auto; } .llm-provider-footer { flex-wrap: wrap; } }
.ai-providers-page .agent-drops { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.ai-providers-page .agent-drop { min-width: 0; padding: 18px 20px; }
.ai-providers-page .agent-drop-head b { font-size: 16px; color: var(--text); }
.ai-providers-page .agent-drop > .hint { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; font-size: 15px; overflow-wrap: anywhere; }
.ai-providers-page .agent-drop-hint { margin-top: 16px; font-size: 12px; }
@media (max-width: 1100px) {
  .ai-default-bar { grid-template-columns: minmax(0, 1fr) auto 32px; }
  .ai-default-bar > label { grid-column: 1 / -1; margin: 0; }
  .ai-providers-page .agent-drops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .ai-providers-header { flex-direction: column; gap: 18px; }
  .ai-providers-header h1 { font-size: 26px; }
  .ai-provider-create { width: 100%; }
  .ai-default-bar { grid-template-columns: minmax(0, 1fr) 40px; padding: 16px; gap: 12px; }
  .ai-default-bar > select { grid-column: 1 / -1; }
  .ai-default-save { width: 100%; }
  .ai-default-help summary { width: 40px; min-height: 44px; }
  .ai-providers-section-head { align-items: flex-start; flex-direction: column; gap: 5px; }
  .ai-providers-page .agent-drops, .ai-providers-page .llm-tiles { grid-template-columns: minmax(0, 1fr); }
}
.llm-empty-state {
  grid-column: 1 / -1;
  min-height: 116px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 3%, var(--surface));
}
.ai-assignment-workspace { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.ai-assignment-workspace [hidden] { display: none !important; }
.ai-assignment-panel { min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 18px; background: color-mix(in srgb, var(--surface) 35%, transparent); container: ai-panel / inline-size; }
.ai-assignment-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.ai-assignment-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.ai-assignment-count { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 7px; box-sizing: border-box; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 14px; font-weight: 700; white-space: nowrap; }
.ai-assignment-toolbar { display: flex; gap: 10px; align-items: stretch; margin-bottom: 16px; }
.ai-assignment-search { display: flex; flex: 1; min-width: 0; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.ai-assignment-search > svg { flex: none; width: 19px; height: 19px; color: var(--text-dim); }
.ai-assignment-search input { width: 100%; min-width: 0; min-height: 42px; padding: 9px 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
.ai-assignment-search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.ai-assignment-select { min-width: 0; max-width: 47%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; }
.ai-provider-filters { position: relative; flex: none; }
.ai-provider-filters > summary { display: grid; place-items: center; width: 42px; height: 42px; box-sizing: border-box; list-style: none; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.ai-provider-filters > summary::-webkit-details-marker { display: none; }
.ai-provider-filters > summary svg { width: 20px; height: 20px; }
.ai-provider-filters > summary.has-filter { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.ai-provider-filter-menu { position: absolute; top: calc(100% + 6px); right: 0; width: 220px; max-width: calc(100vw - 80px); z-index: 30; padding: 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px #0002; }
.ai-provider-filter-menu .field:last-child { margin-bottom: 0; }
.ai-providers-page .ai-assignment-workspace .llm-tiles, .ai-providers-page .ai-assignment-workspace .agent-drops { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ai-providers-page .ai-assignment-workspace .llm-provider-card { display: flex; flex-direction: column; min-width: 0; padding: 16px; border-radius: 10px; }
.ai-assignment-workspace .llm-provider-head { min-height: 0; align-items: center; gap: 10px; }
.ai-assignment-workspace .llm-provider-mark { width: 42px; height: 44px; flex-basis: 42px; }
.ai-assignment-workspace .llm-provider-mark svg, .ai-assignment-workspace .llm-provider-mark .llm-provider-logo { width: 25px; height: 25px; }
.ai-assignment-workspace .llm-provider-identity b { font-size: 17px; }
.ai-assignment-workspace .llm-provider-identity > span:not(.llm-default-tag) { display: none; }
.llm-provider-grip { display: none; }
.ai-assignment-workspace .llm-provider-grip { display: inline-flex; flex: none; color: var(--text-dim); cursor: grab; }
.llm-provider-grip svg { width: 12px; height: 24px; stroke-width: 4; }
.ai-assignment-workspace .llm-provider-model { flex: 1; margin-top: 12px; padding: 0; border: 0; }
.ai-assignment-workspace .llm-provider-model > span { display: none; }
.ai-assignment-workspace .llm-provider-model strong { font-size: 16px; line-height: 1.4; font-weight: 400; letter-spacing: 0; color: var(--text-dim); }
.ai-assignment-workspace .llm-provider-footer { flex-wrap: wrap; padding-top: 18px; }
.ai-assignment-workspace .llm-provider-controls { gap: 3px; }
.ai-assignment-workspace .llm-provider-controls .iconbtn { width: 28px; height: 30px; padding: 5px; }
.ai-providers-page .ai-agent-card { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.ai-providers-page .ai-agent-card.drop-hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.ai-agent-picture { position: relative; display: grid; place-items: center; width: 48px; height: 56px; flex: 0 0 48px; border-radius: 10px; overflow: hidden; color: var(--accent); background: var(--accent-soft); font-size: 15px; font-weight: 600; }
.ai-agent-picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ai-agent-content { flex: 1; min-width: 0; }
.ai-agent-name { display: block; margin-bottom: 10px; font-size: 16px; color: var(--text) !important; overflow-wrap: anywhere; }
.ai-agent-assignment { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-agent-provider { display: flex; align-items: center; flex: 1; min-width: 0; gap: 8px; padding: 5px 8px 5px 5px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ai-agent-provider-logo { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 6px; background: var(--accent); color: var(--accent-text); }
.ai-agent-provider-logo .llm-provider-logo, .ai-agent-provider-logo svg { width: 21px; height: 21px; }
.ai-agent-card .llm-reset { flex: none; display: grid; place-items: center; width: 36px; height: 40px; padding: 7px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); background: var(--surface); }
.ai-agent-card .llm-reset svg { width: 20px; height: 20px; }
.ai-agent-drop-target { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 38px; box-sizing: border-box; padding: 6px 8px; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--text-dim); font-size: 12px; }
.ai-agent-drop-target > svg { width: 16px; height: 16px; flex: none; }
.ai-agent-drop-target > svg:last-child { margin-left: auto; }
.ai-agent-current-model { display: block; margin-top: 6px; color: var(--text-dim); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.ai-assignment-empty { padding: 20px 4px; margin: 0; color: var(--text-dim); font-size: 13px; }
@media (min-width: 901px) {
  #app:has(.ai-providers-page, .skills-page, .knowledge-page) { height: var(--app-viewport-height); }
  .main:has(.ai-providers-page, .skills-page, .knowledge-page) { min-height: 0; }
  .content:has(.ai-providers-page, .skills-page, .knowledge-page) { flex: 1; min-height: 0; overflow: hidden; padding-bottom: 24px; }
  .ai-providers-page, .skills-page, .knowledge-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
  .ai-providers-page > header, .skills-page > header, .knowledge-page > header, .ai-default-bar { flex: none; }
  .ai-assignment-workspace { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .ai-assignment-panel { display: flex; flex-direction: column; min-height: 0; }
  .ai-assignment-panel > :not(.llm-tiles, .agent-drops, .ai-assignment-scroll, .skill-agent-drops, .knowledge-agent-drops) { flex: none; }
  .ai-assignment-panel > :is(.llm-tiles, .agent-drops, .ai-assignment-scroll, .skill-agent-drops, .knowledge-agent-drops) { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; align-content: start; grid-auto-rows: max-content; align-items: start; padding: 2px; }
}
@container ai-panel (max-width: 380px) {
  .ai-assignment-toolbar:has(.ai-assignment-select) { flex-wrap: wrap; }
  .ai-assignment-toolbar .ai-assignment-select { width: 100%; max-width: none; }
  .ai-agent-picture { width: 40px; height: 46px; flex-basis: 40px; }
}
@media (max-width: 900px) { .ai-assignment-workspace { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .ai-assignment-workspace > .ai-assignment-panel:nth-child(2) { display: none; } }
@media (max-width: 560px) { .ai-assignment-panel { padding: 12px; } .ai-assignment-search input { font-size: 16px; } }
/* AI Provider: Baum, Graph, Zuordnung */
.ai-default-bar.is-compact { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; margin: 12px 0 0; padding: 0; border: 0; background: transparent; color: var(--text-dim); font-size: 12px; }
.ai-default-bar.is-compact > label { margin: 0; font-weight: 500; }
.ai-default-bar.is-compact > select { width: auto; max-width: min(280px, 100%); min-height: 32px; padding: 4px 8px; font-size: 12px; }
.ai-default-bar.is-compact .ai-default-save { min-width: 0; min-height: 32px; width: auto; }
.ai-default-bar.is-compact .ai-default-help summary { width: 28px; height: 32px; min-height: 32px; }
.ai-default-bar.is-compact .ai-default-help svg { width: 16px; height: 16px; }
.ai-default-bar.is-compact .ai-default-help p { top: auto; bottom: 100%; margin: 0 0 8px; }
.ai-default-bar.is-compact > [role="status"] { flex-basis: 100%; text-align: right; }
.llm-view-switch { display: inline-flex; margin-left: auto; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.llm-view-option { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-dim); font: inherit; font-size: 13px; cursor: pointer; }
.llm-view-option svg { width: 16px; height: 16px; }
.llm-view-option[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.llm-tree, .llm-tree-children { list-style: none; margin: 0; padding: 0; }
.llm-tree { display: flex; flex-direction: column; gap: 10px; }
.llm-tree-provider { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); padding: 6px; }
.llm-tree-children { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 2px 22px; }
.llm-tree-children[hidden] { display: none; }
.llm-tree-row { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 40px; padding: 2px 6px; border-radius: 8px; }
.llm-tree-row.is-provider { min-height: 44px; }
.llm-tree-row.is-model { cursor: grab; }
.llm-tree-row.is-model:hover, .llm-tree-row.is-model:focus-within { background: color-mix(in srgb, var(--surface), var(--text) 5%); }
.llm-tree-row.is-model.dragging { opacity: .5; }
.llm-tree-row.is-disabled { cursor: default; opacity: .62; }
.llm-tree-toggle { display: grid; place-items: center; flex: none; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; }
.llm-tree-toggle svg { width: 16px; height: 16px; transition: transform .15s ease; }
.llm-tree-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.llm-tree-toggle:disabled { visibility: hidden; }
.llm-tree-icon { display: grid; place-items: center; flex: none; width: 24px; height: 24px; color: var(--text); }
.llm-tree-icon svg, .llm-tree-icon .llm-provider-logo { width: 20px; height: 20px; }
.llm-tree-grip { display: inline-flex; flex: none; color: var(--text-dim); }
.llm-tree-grip svg { width: 12px; height: 20px; stroke-width: 4; }
.llm-tree-label { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); font-size: 15px; text-align: left; }
.llm-tree-row.is-provider .llm-tree-label { font-size: 16px; }
.llm-tree-label small { color: var(--text-dim); font-size: 11px; font-weight: 400; }
button.llm-tree-label { padding: 2px 0; border: 0; background: transparent; font: inherit; font-size: 15px; cursor: pointer; }
button.llm-tree-label:hover > span { text-decoration: underline; }
.llm-tree-count { display: inline-flex; align-items: center; gap: 4px; flex: none; min-width: 24px; height: 24px; justify-content: center; padding: 0 7px; box-sizing: border-box; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 12px; font-weight: 700; }
.llm-tree-count.is-agents { background: transparent; color: var(--text-dim); font-weight: 600; }
.llm-tree-count svg { width: 14px; height: 14px; }
.llm-node-dot { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text-dim); }
.llm-node-dot.is-healthy { background: var(--success, #378449); }
.llm-node-dot.is-failed { background: var(--err); }
.llm-node-dot.is-pending, .llm-node-dot.is-unsupported { background: var(--warn, #b5852a); }
.llm-node-dot.is-disabled { background: transparent; box-shadow: inset 0 0 0 2px var(--text-dim); }
.llm-tree-row .iconbtn, .llm-agent-head .iconbtn, .llm-agent-slot .iconbtn { display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 6px; }
.llm-tree-row .iconbtn svg, .llm-agent-head .iconbtn svg, .llm-agent-slot .iconbtn svg { width: 18px; height: 18px; }
.llm-tree-row.is-agent { min-height: 36px; }
.llm-tree-row.is-agent .ai-agent-picture { width: 26px; height: 30px; flex-basis: 26px; border-radius: 6px; font-size: 11px; }
.llm-tree-row.is-agent .llm-tree-label { font-size: 14px; }
.llm-role-tag { flex: none; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-dim); font-size: 11px; font-weight: 600; }
.llm-role-tag.is-primary { border-color: var(--accent); color: var(--accent); }
.llm-node-menu { position: relative; flex: none; }
.llm-node-menu > summary { display: grid; place-items: center; width: 32px; height: 32px; list-style: none; border-radius: 6px; color: var(--text); cursor: pointer; }
.llm-node-menu > summary::-webkit-details-marker { display: none; }
.llm-node-menu > summary svg { width: 18px; height: 18px; stroke-width: 3; }
.llm-node-menu > summary:hover, .llm-node-menu[open] > summary { background: var(--accent-soft); }
.llm-node-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; display: flex; flex-direction: column; min-width: 170px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px #0002; }
.llm-node-menu-list :is(button, a) { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
.llm-node-menu-list :is(button, a):hover { background: var(--accent-soft); }
.llm-node-menu-list button.danger { color: var(--err); }
.llm-node-menu-list svg { width: 16px; height: 16px; flex-shrink: 0; }
body.llm-dragging .llm-agent-card, body.llm-dragging .skill-graph-node.is-agent .skill-graph-circle { border-style: dashed; border-color: var(--accent); }
.llm-agent-head { display: flex; align-items: center; gap: 8px; }
.llm-agent-head .ai-agent-name { flex: 1; margin-bottom: 0; }
.llm-agent-slots { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.llm-agent-slot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.llm-agent-slot-label { flex: 0 0 82px; color: var(--text-dim); font-size: 11px; }
.llm-agent-slot .ai-agent-provider { padding: 6px 8px; font-weight: 600; }
.llm-agent-slot.is-fallback .ai-agent-provider { background: transparent; border: 1px dashed var(--border-strong); color: var(--text); font-weight: 500; }
.ai-providers-page .llm-agent-card .llm-reset, .ai-providers-page .llm-agent-card .llm-swap { width: 32px; height: 32px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 8px; }
.llm-assign-choice p { margin: 0 0 8px; }
.llm-picker { display: flex; flex-direction: column; gap: 10px; min-width: min(420px, 80vw); }
.llm-picker > .hint { margin: 0; }
.llm-picker input[type="search"] { font-size: 16px; }
.llm-picker-list { display: flex; flex-direction: column; gap: 4px; max-height: min(60vh, 460px); overflow-y: auto; }
.llm-picker-group h4 { margin: 10px 0 4px; color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.llm-picker-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.llm-picker-row:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.llm-picker-row:disabled { cursor: default; opacity: .55; }
.llm-picker-row .ai-agent-picture { width: 32px; height: 36px; flex-basis: 32px; border-radius: 8px; font-size: 12px; }
.llm-picker-text { display: flex; flex-direction: column; min-width: 0; }
.llm-picker-text small { color: var(--text-dim); font-size: 12px; }
@container ai-panel (max-width: 380px) {
  .llm-view-option span { display: none; }
  .llm-tree-children { padding-left: 10px; }
  .llm-agent-slot-label { flex-basis: 64px; }
}
@media (pointer: coarse) { .llm-tree-row.is-model { cursor: default; } .llm-tree-grip { display: none; } }
@media (max-width: 600px) {
  .llm-tree-row { gap: 6px; padding: 2px 4px; }
  .llm-tree-row.is-model .llm-default-tag { display: none; }
}
/* Skills: zwei Radialgraphen (Skills | Agenten) */
.ai-providers-header .page-title-inline { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 18px; row-gap: 4px; min-width: 0; }
.ai-providers-header .page-title-inline > p { margin: 0; }
.ai-assignment-heading .llm-view-switch { margin-left: auto; }
.skill-graph-holder[hidden], .skill-agent-drops[hidden], .ai-assignment-scroll[hidden] { display: none !important; }
.skill-graph-panel { display: flex; flex-direction: column; gap: 10px; }
.skill-graph-bar { position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 36px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 -6px 18px #0002; }
.skill-graph-bar:empty { display: none; }
.skill-graph-bar > b { font-size: 15px; }
.skill-graph-bar > .iconbtn { margin-left: auto; width: 32px; height: 32px; padding: 6px; }
.skill-graph-bar > .iconbtn svg { width: 16px; height: 16px; }
.skill-graph-bar .skill-assignment-list { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; order: 3; }
.skill-graph { position: relative; }
.skill-graph-viewport { display: flex; overflow: hidden; overscroll-behavior: contain; touch-action: pan-x pan-y; }
.skill-graph.is-zoomed .skill-graph-viewport { overflow: auto; cursor: grab; }
.skill-graph.is-panning .skill-graph-viewport { cursor: grabbing; user-select: none; }
.skill-graph-sizer { position: relative; flex: none; margin: auto; }
.skill-graph-zoom { position: absolute; top: 6px; right: 6px; z-index: 2; display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); overflow: hidden; }
.skill-graph-zoom button { min-width: 32px; height: 30px; padding: 0 8px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; cursor: pointer; }
.skill-graph-zoom button:hover, .skill-graph-zoom button:focus-visible { background: var(--accent-soft); }
.skill-graph-zoom .skill-graph-zoom-level { min-width: 52px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.skill-graph-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.skill-graph-lines { position: absolute; inset: 0; pointer-events: none; }
.skill-graph-edge { stroke: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); stroke-width: 2.5; stroke-dasharray: 8 7; }
.skill-graph-edge.is-active { stroke: var(--accent); stroke-dasharray: none; stroke-width: 3; }
.skill-graph-hub { position: absolute; display: grid; place-items: center; width: 132px; height: 132px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--accent); color: var(--accent-text, #fff); font-size: 22px; font-weight: 700; line-height: 1.15; text-align: center; padding: 12px; box-sizing: border-box; }
.skill-graph-node { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 108px; transform: translate(-50%, -38px); cursor: pointer; outline: none; }
.skill-graph-circle { position: relative; display: grid; place-items: center; width: 76px; height: 76px; border: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 50%; background: var(--accent-soft); color: var(--accent); box-sizing: border-box; transition: transform .15s ease, box-shadow .15s ease; }
.skill-graph-circle .ai-agent-picture { width: 100%; height: 100%; flex: none; border-radius: 50%; font-size: 20px; font-weight: 700; background: transparent; }
.skill-graph-face svg { width: 32px; height: 32px; }
.skill-graph-circle .org-presence-dot { right: 1px; bottom: 1px; width: 13px; height: 13px; border-width: 3px; }
.skill-graph-badge { position: absolute; top: -4px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.skill-graph-label { max-width: 108px; color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.2; text-align: center; overflow-wrap: normal; word-break: normal; hyphens: manual; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.skill-graph-node.is-imported .skill-graph-circle { border-style: dashed; }
.skill-graph-node.is-disabled { opacity: .5; cursor: default; }
.skill-graph-node:hover .skill-graph-circle, .skill-graph-node:focus-visible .skill-graph-circle { transform: scale(1.06); }
.skill-graph-node:focus-visible .skill-graph-circle { box-shadow: 0 0 0 3px var(--accent); }
.skill-graph-node.is-selected .skill-graph-circle { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
.skill-graph-node.is-linked .skill-graph-circle { border-color: var(--success, #378449); }
.skill-graph-node.dragging { opacity: .5; }
.skill-graph-node.drop-hover .skill-graph-circle, body.skill-dragging .skill-graph-node.is-agent .skill-graph-circle { border-style: dashed; border-color: var(--accent); }
.skill-graph-node.drop-hover .skill-graph-circle { transform: scale(1.12); background: var(--accent-soft); }
@media (max-width: 600px) { .ai-assignment-workspace.is-skill-graph > .ai-assignment-panel:nth-child(2), .ai-assignment-workspace.is-graph > .ai-assignment-panel:nth-child(2) { display: block; } }
.skill-graph-circle > .llm-node-dot { position: absolute; right: 1px; bottom: 1px; width: 15px; height: 15px; box-sizing: border-box; border: 3px solid var(--surface); }
.skill-graph-face .llm-provider-logo, .skill-graph-face > svg { width: 32px; height: 32px; }
/* Agenten verwalten: Graph nach Status */
.agent-management-page .cards.agents-summary { display: block; flex: none; margin: 10px 2px 0; padding: 0; text-align: right; color: var(--text-dim); font-size: 12px; }
.agents-summary b { color: var(--text); font-weight: 600; }
.agents-summary .is-running b { color: var(--accent); }
.agents-graph-panel { padding: 16px; }
.agents-graph-panel .skill-graph-node.is-agent { cursor: pointer; }
body.agent-status-dragging .skill-graph-node.is-group[data-topic="ready"] .skill-graph-circle, body.agent-status-dragging .skill-graph-node.is-group[data-topic="disabled"] .skill-graph-circle { border-style: dashed; transform: scale(1.06); }
.agents-graph-panel .skill-graph-hub.drop-hover, .agents-graph-panel .skill-graph-node.is-group.drop-hover .skill-graph-circle { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 35%, transparent); }
.agents-graph-panel[hidden], .agents-panel[hidden] { display: none !important; }
.agents-toolbar .llm-view-switch { margin-left: auto; }
.skill-graph-circle > .agent-status-dot { position: absolute; right: 1px; bottom: 1px; width: 15px; height: 15px; box-sizing: border-box; border: 3px solid var(--surface); border-radius: 50%; background: var(--text-dim); }
.agent-status-dot.status-running, .agent-status-face.status-running { --status: var(--accent); }
.agent-status-dot.status-ready, .agent-status-face.status-ready { --status: var(--success, #378449); }
.agent-status-dot.status-attention, .agent-status-face.status-attention { --status: var(--err); }
.agent-status-dot.status-outside, .agent-status-face.status-outside { --status: var(--warn, #b5852a); }
.agent-status-dot.status-disabled, .agent-status-face.status-disabled { --status: var(--text-dim); }
.skill-graph-circle > .agent-status-dot { background: var(--status, var(--text-dim)); }
.skill-graph-node.is-group:has(.agent-status-face) .skill-graph-circle { border-color: var(--status, var(--accent)); }
.skill-graph-node.is-group .agent-status-face { color: var(--status, var(--accent)); }
.skill-graph-node.is-group .skill-graph-circle:has(.agent-status-face.status-running) { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.skill-graph-node.is-group .skill-graph-circle:has(.status-ready) { border-color: var(--success, #378449); }
.skill-graph-node.is-group .skill-graph-circle:has(.status-attention) { border-color: var(--err); }
.skill-graph-node.is-group .skill-graph-circle:has(.status-outside) { border-color: var(--warn, #b5852a); }
.skill-graph-node.is-group .skill-graph-circle:has(.status-disabled) { border-color: var(--text-dim); border-style: dashed; }
.knowledge-view { min-width: 0; }
.knowledge-view .llm-tree { margin-top: 12px; }
.kb-tree-progress { padding: 2px 8px 6px 40px; }
body.kb-dragging .knowledge-agent-drop, body.kb-dragging .skill-graph-node.is-agent .skill-graph-circle { border-style: dashed; border-color: var(--accent); }
.skill-graph-bar .llm-agent-slots { flex-basis: 100%; order: 3; margin-top: 0; }
.skill-graph-hub.is-back { border: 0; font-family: inherit; font-weight: 700; cursor: pointer; }
.skill-graph-hub { overflow: hidden; overflow-wrap: normal; hyphens: manual; }
.skill-graph-label.is-long { display: block; font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.skill-graph-members { display: flex; flex-direction: column; align-items: center; max-width: 128px; margin-top: -2px; color: var(--text-dim); font-size: 11px; line-height: 1.3; }
.skill-graph-member { display: block; max-width: 128px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skill-graph-member.is-more { font-weight: 600; }
.skill-graph-hub.is-back:hover, .skill-graph-hub.is-back:focus-visible { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); outline: none; }
.skill-graph-node.is-group .skill-graph-circle { width: 92px; height: 92px; border-width: 4px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.skill-graph-node.is-group { transform: translate(-50%, -46px); }
.skill-graph-node.is-group .skill-graph-badge { min-width: 26px; height: 26px; line-height: 24px; font-size: 12px; }
.skill-graph-nav { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.skill-graph-nav:empty { display: none; }
.skills-header-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
@media (min-width: 1101px) {
  :is(.skills-page, .ai-providers-page) > .ai-providers-header { align-items: center; gap: 18px; }
  :is(.skills-page, .ai-providers-page) > .ai-providers-header .page-title-inline { flex-wrap: nowrap; align-items: center; }
  :is(.skills-page, .ai-providers-page) > .ai-providers-header .page-title-inline > p { white-space: nowrap; font-size: 14px; }
  .skills-header-actions { flex: none; flex-wrap: nowrap; }
}
.topic-editor { display: flex; flex-direction: column; gap: 6px; min-width: min(520px, 80vw); max-height: min(65vh, 620px); overflow-y: auto; }
.topic-editor h4 { margin: 12px 0 2px; color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.topic-editor-tools { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 6px; background: var(--surface); }
.topic-editor-tools .btn svg { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
.topic-editor-tools .hint { margin: 0; }
.topic-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 10px; }
.topic-editor-row > span { overflow-wrap: anywhere; font-size: 14px; }
.topic-editor-row input { min-height: 36px; font-size: 14px; }
.topic-editor-row :is(input, select).is-changed, .topic-group-row input.is-changed { border-color: var(--accent); background: var(--accent-soft); }
.topic-editor-row select { min-height: 36px; font-size: 14px; width: 100%; }
.topic-group-list { display: flex; flex-direction: column; gap: 6px; }
.topic-group-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.topic-group-row input, .topic-group-create input { width: 100%; min-height: 36px; box-sizing: border-box; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; }
.topic-group-create { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 4px; }
@media (max-width: 560px) { .topic-editor-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } .topic-editor-row :is(input, select), .topic-group-row input, .topic-group-create input { font-size: 16px; } }
.llm-empty-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.llm-empty-copy { min-width: 0; flex: 1; }
.llm-empty-copy b { display: block; margin-bottom: 4px; font-size: 14px; }
.llm-empty-copy p { max-width: 660px; margin: 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.llm-tile { background: color-mix(in srgb, var(--tile, var(--accent)) 9%, var(--card)); border: 1px solid color-mix(in srgb, var(--tile, var(--accent)) 30%, var(--border)); border-left: 6px solid var(--tile, var(--border)); border-radius: 10px; padding: 13px 15px; cursor: grab; user-select: none; transition: box-shadow .12s, transform .06s; }
.llm-tile:hover { box-shadow: 0 4px 16px color-mix(in srgb, var(--tile, #000) 25%, transparent); transform: translateY(-1px); }
.llm-tile:active { cursor: grabbing; }
.llm-tile.dragging { opacity: .5; box-shadow: none; }
/* Provider-Farben — verschiedene Brauntöne (dunkel → hell), themepassend. */
.p-ollama { --tile: #8a5a2c; }     /* warmes Mittelbraun */

.codex-device-code {
  display: block;
  width: 100%;
  margin: 10px 0 6px;
  padding: 10px;
  border: 1px dashed var(--accent, #8a5a2c);
  border-radius: 8px;
  background: #fffaf4;
  color: #5c3416;
  font: 700 1.15rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em;
  text-align: center;
  cursor: pointer;
}
.p-openai { --tile: #4e3320; }     /* dunkles Espresso */
.p-anthropic { --tile: #b5824e; }  /* Karamell */
.p-mock { --tile: #a2937f; }       /* helles Taupe */
.p-other { --tile: var(--accent); }/* Standard-Akzent */
/* E-Mail-Kacheln nutzen denselben warmbraunen Streifen wie Ollama-Kacheln. */
.email-tile, .email-agent-drop { --tile: #8a5a2c; }
.llm-tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.llm-tile-head b { font-size: 14px; color: color-mix(in srgb, var(--tile, var(--text)) 55%, var(--text)); }
.llm-provider-tag { color: #fff !important; background: var(--tile, var(--accent)) !important; }
.llm-provider-tag { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tile, var(--accent)); background: color-mix(in srgb, var(--tile, var(--accent)) 14%, transparent); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.llm-tile-model { font-size: 13.5px; font-weight: 600; margin: 2px 0 4px; }
.llm-tile-url { font-size: 11px; color: var(--muted); word-break: break-all; }
.llm-tile-actions { display: flex; gap: 4px; margin-top: 12px; }
.agent-drop { border: 1.5px dashed color-mix(in srgb, var(--tile, var(--border)) 45%, var(--border)); border-left: 6px solid var(--tile, var(--border)); background: color-mix(in srgb, var(--tile, var(--accent)) 7%, var(--card)); border-radius: 10px; padding: 12px 14px; transition: background .12s, border-color .12s; }
.agent-drop.drop-hover { border-style: solid; border-color: var(--tile, var(--accent)); background: color-mix(in srgb, var(--tile, var(--accent)) 16%, var(--card)); }
.agent-drop b { color: color-mix(in srgb, var(--tile, var(--text)) 45%, var(--text)); }
.agent-drop .llm-cur { font-weight: 600; color: var(--tile, var(--accent)); }
.agent-drop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-drop-hint { font-size: 11px; color: var(--muted); opacity: .7; margin-top: 4px; }
.email-agent-drop.channel-assigned { border-style: solid; }
.email-agent-drop.channel-assigned .llm-cur { color: var(--tile, var(--accent)); font-weight: 700; }
.email-assignment-address { display: block; margin-top: 2px; overflow-wrap: anywhere; }
.skill-tile, .skill-agent-drop { --tile: #8a5a2c; }
.skill-tile.skill-disabled { --tile: #9b8e7d; opacity: .72; }
.skill-key { width: fit-content; margin-top: 7px; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.skill-description { min-height: 54px; margin: 10px 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.skill-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.skill-agent-drop { min-height: 140px; display: flex; flex-direction: column; }
.knowledge-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.knowledge-tile {
  --tile: #71502f;
  min-width: 0;
  padding: 15px;
  border: 1px solid color-mix(in srgb, var(--tile) 28%, var(--border));
  border-left: 6px solid var(--tile);
  border-radius: 11px;
  background: color-mix(in srgb, var(--tile) 7%, var(--card));
  cursor: grab;
  user-select: none;
  transition: opacity .12s, box-shadow .12s, transform .06s;
}
.knowledge-tile:hover { box-shadow: 0 4px 16px color-mix(in srgb, var(--tile) 22%, transparent); transform: translateY(-1px); }
.knowledge-tile:active { cursor: grabbing; }
.knowledge-tile.dragging { opacity: .5; box-shadow: none; }
.knowledge-tile.knowledge-disabled { --tile: #9b8e7d; opacity: .78; }
.knowledge-tile-head, .knowledge-title, .knowledge-status-line { display: flex; align-items: center; gap: 8px; }
.knowledge-tile-head { justify-content: space-between; }
.knowledge-title { min-width: 0; }
.knowledge-title b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-definition { min-height: 38px; margin: 11px 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.knowledge-source { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; padding: 8px 9px; border-radius: 7px; background: var(--surface-2); font-size: 11px; }
.knowledge-source span { color: var(--muted); }
.knowledge-source b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-config { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.knowledge-config span { padding: 3px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-dim); font-size: 10.5px; }
.knowledge-status-line { margin: 10px 0 7px; }
.knowledge-status-line .hint:first-of-type { margin-left: auto; }
.knowledge-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.knowledge-metrics > div { padding: 7px; border-radius: 7px; background: var(--surface); text-align: center; }
.knowledge-metrics span, .knowledge-metrics b { display: block; }
.knowledge-metrics span { margin-bottom: 2px; color: var(--muted); font-size: 10px; }
.knowledge-metrics b { font-size: 12px; overflow-wrap: anywhere; }
.knowledge-agent-drop { --tile: #71502f; min-height: 156px; display: flex; flex-direction: column; }
.knowledge-assignment-list, .skill-assignment-list { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; min-height: 49px; margin-top: 11px; }
.agent-rag-summary { display: flex; flex-wrap: wrap; gap: 7px; min-height: 29px; }
.knowledge-assignment, .skill-assignment { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 5px 4px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 11.5px; }
.knowledge-assignment > span, .skill-assignment > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-assignment i, .skill-assignment i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--ok); }
.knowledge-assignment.inactive, .skill-assignment.inactive { color: var(--muted); opacity: .72; }
.knowledge-assignment.inactive i, .skill-assignment.inactive i { background: var(--idle); }
.knowledge-assignment small { font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.knowledge-assignment button, .skill-assignment button { width: 21px; height: 21px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.knowledge-assignment button:hover, .skill-assignment button:hover { background: var(--accent-soft); color: var(--err); }
.knowledge-agent-drop .agent-drop-hint, .skill-agent-drop .agent-drop-hint { margin-top: auto; padding-top: 10px; }
.llm-reset { background: transparent; border: 1px solid var(--border); border-radius: 6px; font-size: 11px; padding: 2px 8px; cursor: pointer; color: var(--muted); }
.llm-reset:hover { border-color: var(--accent); color: var(--accent); }
/* Kleine, wiederverwendbare Layout-Klassen (statt Inline-Styles). */
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.field-num { width: 90px; }
.switch-group { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 14px; }
/* Mail-Konto-Karte */
.mailcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.mailcard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.mailcard-account { display: flex; align-items: center; gap: 10px; font-size: 15px; min-width: 0; }
.mailcard-account b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailcard-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.mailcard-srv { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 13px; }
.mailcard-srv-k { flex: 0 0 52px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.mailcard-tag { margin-left: 8px; font-size: 10px; font-weight: 700; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); padding: 1px 6px; border-radius: 999px; letter-spacing: .03em; }
.mailcard-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mailcard-autosend { margin-top: 14px; }
.mailcard-poller { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.football-settings-form { display: flex; flex-direction: column; gap: 12px; }
.provider-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.football-settings-form .field { margin: 0; }
.football-key-source { margin-top: -7px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.football-ttl-grid { gap: 10px 14px; }
.football-ttl-grid input { width: 100%; }
.football-connection { padding: 9px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.football-connection.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.football-connection.error { color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); }
/* WhatsApp 24h-Servicefenster-Banner in der Conversation-Detailansicht */
.wa-window { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; border: 1px solid var(--border); }
.wa-window b { font-size: 13px; }
.wa-window.open { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); color: var(--ok); }
.wa-window.closed { background: color-mix(in srgb, var(--err) 12%, transparent); border-color: color-mix(in srgb, var(--err) 40%, var(--border)); color: var(--err); }
.wa-window span { color: var(--text); }
.section-title.gap { margin-top: 20px; }
.drawer-subhead { font-weight: 600; margin-top: 12px; margin-bottom: 2px; }
.hint.spaced { margin-top: 8px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.iconbtn { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; width: 30px; height: 30px; display: grid; place-items: center; color: var(--text-dim); }
.iconbtn:hover { background: var(--accent-soft); color: var(--accent); }
.iconbtn.danger:hover { color: var(--err); border-color: var(--err); }

.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot.idle { background: var(--idle); }
.dot.running { background: var(--warn); animation: pulse 1.2s infinite; }
.dot.error { background: var(--err); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; display: inline-block; }
.badge.enabled { background: #e4f0e5; color: var(--ok); }
.badge.disabled { background: #efe6da; color: var(--muted); }
.badge.status-success { background: #e4f0e5; color: var(--ok); }
.badge.status-never, .badge.status-failed { background: #f2e2dd; color: var(--err); }
.badge.status-running { background: #f6ecd6; color: var(--warn); }
.badge.status-idle { background: #ece8e2; color: var(--muted); }
:root[data-theme="dark"] .badge.enabled, :root[data-theme="dark"] .badge.status-success { background: #24422a; }
:root[data-theme="dark"] .badge.disabled { background: #2e2418; }
:root[data-theme="dark"] .badge.status-failed, :root[data-theme="dark"] .badge.status-never { background: #3d2018; }
:root[data-theme="dark"] .badge.status-running { background: #3a2f14; }
:root[data-theme="dark"] .badge.status-idle { background: #2a2825; }

/* Im Nachtmodus bleibt die App-Hülle dunkel, während Arbeitskacheln wie
   beleuchtete sandbeige Flächen wirken. Die lokalen Variablen sorgen dafür,
   dass auch Tabellen, Texte, Formfelder und verschachtelte Controls innerhalb
   dieser Kacheln automatisch den passenden dunklen Kontrast erhalten. */
:root[data-theme="dark"] :is(
  .stat,
  .panel,
  .llm-tile,
  .agent-drop,
  .knowledge-tile,
  .query-box,
  .answer-box,
  .football-rich,
  .bubble.assistant,
  .pending-attachment,
  .message-attachment
) {
  --surface: #e2cfb9;
  --surface-2: #d5bda3;
  --card: #dcc4aa;
  --border: #b99672;
  --border-strong: #9d7754;
  --text: #2d2118;
  --text-dim: #604c3b;
  --muted: #7a624e;
  --accent: #7b4a24;
  --accent-hover: #653c1d;
  --accent-soft: #ecdcc9;
  --accent-text: #fff;
  color: var(--text);
}
:root[data-theme="dark"] :is(
  .stat,
  .panel,
  .llm-tile,
  .agent-drop,
  .knowledge-tile,
  .query-box,
  .answer-box,
  .football-rich,
  .bubble.assistant,
  .pending-attachment,
  .message-attachment
) :is(.badge.enabled, .badge.status-success) { background: #e4f0e5; color: #356b42; }
:root[data-theme="dark"] :is(
  .stat,
  .panel,
  .llm-tile,
  .agent-drop,
  .knowledge-tile,
  .query-box,
  .answer-box,
  .football-rich,
  .bubble.assistant,
  .pending-attachment,
  .message-attachment
) :is(.badge.disabled, .badge.status-idle) { background: #cbb398; color: #654f3d; }
:root[data-theme="dark"] :is(
  .stat,
  .panel,
  .llm-tile,
  .agent-drop,
  .knowledge-tile,
  .query-box,
  .answer-box,
  .football-rich,
  .bubble.assistant,
  .pending-attachment,
  .message-attachment
) .badge.status-running { background: #f6ecd6; color: #896216; }
:root[data-theme="dark"] :is(
  .stat,
  .panel,
  .llm-tile,
  .agent-drop,
  .knowledge-tile,
  .query-box,
  .answer-box,
  .football-rich,
  .bubble.assistant,
  .pending-attachment,
  .message-attachment
) :is(.badge.status-failed, .badge.status-never) { background: #f2e2dd; color: #9b3927; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.placeholder-page { padding: 60px 20px; text-align: center; color: var(--muted); }
.placeholder-page .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- Forms / drawer / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30, 20, 12, .45); display: flex; justify-content: flex-end; z-index: 50; }
.overlay[hidden] { display: none; }
/* Drawer als Flex-Spalte: Kopf- und Fußzeile bleiben fix, nur der Body scrollt,
   damit auch lange Dialoge immer in den Viewport passen. */
.drawer { width: 560px; max-width: 92vw; background: var(--bg); height: 100%; display: flex; flex-direction: column; overflow: hidden; box-shadow: -8px 0 30px rgba(0,0,0,.2); }
.modal-center { align-items: center; justify-content: center; }
.modal { width: 520px; max-width: 92vw; background: var(--bg); border-radius: var(--radius); overflow: hidden; max-height: 90vh; display: flex; flex-direction: column; }
/* Native dialogs must use the app theme, not the browser's dialog colors. */
dialog.modal { margin: auto; padding: 0; border: 1px solid var(--border); color: var(--text); font: inherit; line-height: 1.5; box-shadow: 0 16px 48px rgba(30, 20, 12, .2); }
dialog.modal:not([open]) { display: none; }
dialog.modal::backdrop { background: rgba(30, 20, 12, .45); }
dialog.modal .modal-head h3 { color: var(--text); font-weight: 600; line-height: 1.35; }
dialog.modal .hint { color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.drawer-head, .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h3, .modal-head h3 { margin: 0; font-size: 17px; }
.drawer-body, .modal-body { padding: 20px 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.drawer-head, .modal-head, .modal-foot { flex: 0 0 auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.x { background: none; border: none; font-size: 20px; color: var(--text-dim); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13px; font-family: inherit;
}
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { color: var(--muted); font-size: 11px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); margin: 22px 0 10px; }
.monitor-section > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; color: var(--text-dim); font-size: 13px; font-weight: 700; }
.monitor-section > summary::-webkit-details-marker { display: none; }
.monitor-section > summary::before { content: "›"; font-size: 22px; }
.monitor-section[open] > summary::before { transform: rotate(90deg); }
.monitor-section > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.chip button { border: none; background: none; color: inherit; font-size: 14px; line-height: 1; }
.assign-row { display: flex; gap: 8px; margin-top: 10px; }
.assign-row select { flex: 1; }
.vision-status, .vision-composer-status { margin: 8px 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; }
.vision-status.ok, .vision-composer-status.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.vision-status.error, .vision-composer-status.error { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--border)); background: color-mix(in srgb, var(--err) 8%, transparent); }
.vision-status.warn { color: var(--warn); }
.upload-drop { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 16px; text-align: center; cursor: pointer; transition: .15s ease; }
.upload-drop:hover, .upload-drop.dragging { border-color: var(--accent); background: var(--surface-2); }
.upload-title { font-weight: 650; margin-bottom: 5px; }
.upload-actions { display: flex; justify-content: center; gap: 8px; margin: 12px 0 8px; }
.kb-progress { position: relative; width: 118px; height: 20px; overflow: hidden; border-radius: 999px; background: #e7eef8; color: #1d64a8; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.kb-progress-fill { position: absolute; inset: 0 auto 0 0; background: #79b8f3; transition: width .35s ease; }
.kb-progress-label { position: relative; z-index: 1; }
.kb-progress-success { background: #e3f5e7; color: #237b3d; }
.kb-progress-success .kb-progress-fill { background: #76c893; }
.kb-progress-failed { background: #fbe6e6; color: #b13a3a; }
.kb-progress-failed .kb-progress-fill { background: #ef8a8a; }

.switch { display: inline-flex; align-items: center; gap: 8px; }
.switch input { width: auto; }

/* ---------- Retrieval Debug ---------- */
.debug-grid { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin-bottom: 20px; }
.debug-grid .k { color: var(--text-dim); font-size: 12px; font-weight: 600; }
.debug-grid .v { font-size: 13px; word-break: break-word; }
.query-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.query-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.query-box .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.hit { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; }
.hit.used { border-color: var(--accent); }
.hit-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); flex-wrap: wrap; }
.hit-rank { font-weight: 700; color: var(--accent); }
.score-bar { height: 6px; border-radius: 3px; background: var(--border); flex: 1; min-width: 60px; max-width: 160px; overflow: hidden; }
.score-bar > i { display: block; height: 100%; background: var(--accent); }
.hit-meta { color: var(--text-dim); font-size: 12px; }
.hit-path { font-size: 12px; color: var(--accent); font-weight: 600; }
.hit-body { padding: 12px 14px; font-size: 12.5px; white-space: pre-wrap; color: var(--text); background: var(--surface); max-height: 220px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.used-flag { font-size: 11px; font-weight: 700; color: var(--ok); }
.answer-box { background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 16px 18px; white-space: pre-wrap; line-height: 1.5; }

/* ---------- RAG Settings: zweispaltig + Erklärungs-Panel ---------- */
.rag-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1040px) { .rag-layout { grid-template-columns: 1fr; } }
.rag-col-right { position: sticky; top: 12px; }
.rx-panel { padding: 4px 2px; }
.rx-item { display: flex; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.rx-item:last-child { border-bottom: none; }
.rx-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; background: var(--accent-soft); }
.rx-ic.purple { background: rgba(147, 112, 219, .16); }
.rx-ic.blue   { background: rgba(70, 130, 210, .15); }
.rx-ic.green  { background: rgba(63, 125, 78, .17); }
.rx-ic.orange { background: rgba(200, 120, 40, .16); }
.rx-ic.yellow { background: rgba(190, 150, 40, .18); }
.rx-ic.pink   { background: rgba(210, 90, 140, .15); }
.rx-ic.red    { background: rgba(185, 70, 50, .15); }
.rx-key { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.rx-desc { color: var(--text-dim); font-size: 12.5px; line-height: 1.45; }
.sim-scale { margin-top: 10px; max-width: 300px; }
.sim-bar { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #b7e0c0, #3f7d4e); }
.sim-marker { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ok); transform: translate(-50%, -50%); }
.sim-labels { display: flex; justify-content: space-between; margin-top: 6px; }
.sim-labels span { display: flex; flex-direction: column; }
.sim-labels .mid { align-items: center; }
.sim-labels .end { align-items: flex-end; }
.sim-labels b { font-size: 11px; color: var(--text-dim); font-weight: 700; }
.sim-labels small { font-size: 10px; color: var(--muted); }
.rx-reco { margin: 10px 12px 12px; padding: 12px 14px; background: var(--accent-soft); border-radius: 10px; }
.rx-reco-h { font-weight: 700; font-size: 12.5px; margin-bottom: 5px; }
.rx-reco-b { font-size: 11.5px; color: var(--text-dim); line-height: 1.6; }

/* ---------- Monitor ---------- */
.mon-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1000px) { .mon-grid { grid-template-columns: 1fr; } }
.mon-sys-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.mon-sys-row:last-child { border-bottom: none; }
.monitor-system-toolbar { margin-top: 18px; }
.monitor-system-panel { padding: 6px 4px; }
.monitor-system-panel[hidden] { display: none; }
.mon-sys { display: flex; flex-direction: column; }
.monitor-table-panel { container-type: inline-size; }
/* Entscheidend ist die tatsächlich verfügbare Inhaltsbreite, nicht nur die
   Viewportbreite: Im Landscape-Modus nimmt die Navigation einen Teil davon ein. */
@container (max-width: 760px) {
  .monitor-table-panel { overflow: hidden; }
  .monitor-table-panel > .monitor-card-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .monitor-card-table thead { display: none; }
  .monitor-card-table tbody { display: block; width: 100%; }
  .monitor-card-table tbody tr {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  .monitor-card-table tbody tr:last-child { border-bottom: 0; }
  .monitor-card-table tbody td {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: 100%;
    min-width: 0;
    padding: 5px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .monitor-card-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }
  .monitor-card-table tbody td[colspan] { display: block; padding: 0; }
  .monitor-card-table tbody td[colspan]::before { content: none; }
  .monitor-card-table .cell-name { min-width: 0; align-items: flex-start; flex-wrap: wrap; }
  .monitor-card-table .cell-name .cn-name { flex: 1 1 150px; min-width: 0; overflow-wrap: anywhere; }
  .monitor-card-table .badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
}
.mon-issues-toolbar { margin-bottom: 10px; }
.mon-err { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.mon-err:last-child { border-bottom: none; }
.mon-err-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mon-err-copy .badge { margin-right: 4px; }
.mon-err > .iconbtn { flex: 0 0 30px; margin-left: auto; }
.mon-err.warning .dot { animation: none; }

/* ---------- Conversations (Chat) ---------- */
.conv-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 18px; }
.conv-meta .k { color: var(--text-dim); font-size: 12px; font-weight: 600; }
.conv-meta .v { font-size: 13px; word-break: break-word; }
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 56vh; overflow-y: auto; }
.bubble { position: relative; max-width: 80%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.bubble-copy { position: absolute; top: 4px; right: 6px; opacity: 0; transition: opacity .12s; background: transparent; border: none; cursor: pointer; font-size: 14px; line-height: 1; color: inherit; padding: 2px 5px; border-radius: 5px; }
.bubble:hover .bubble-copy { opacity: .55; }
.bubble-copy:hover { opacity: 1; background: rgba(127,127,127,.18); }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.assistant.has-rich { width: min(940px, 96%); max-width: 96%; }
.bubble .b-meta { font-size: 11px; opacity: .8; margin-top: 7px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bubble .b-meta a { color: var(--accent); text-decoration: underline; }
.chat-input { display: flex; gap: 9px; margin-top: 14px; align-items: flex-end; }
.chat-input-shell {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; gap: 4px;
  min-height: 52px; padding: 5px 8px 5px 10px; border: 1px solid var(--border-strong);
  border-radius: 26px; background: var(--surface); box-shadow: 0 5px 18px rgba(61, 39, 21, .08);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.chat-input-shell:focus-within {
  border-color: var(--accent); background: color-mix(in srgb, var(--surface) 96%, var(--accent-soft));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 17%, transparent), 0 7px 20px rgba(61, 39, 21, .1);
}
.chat-message-input {
  flex: 1 1 auto; width: 100%; min-width: 0; min-height: 40px; max-height: 120px;
  padding: 9px 7px; resize: none; overflow-y: auto; border: 0 !important; outline: 0 !important;
  border-radius: 18px; background: transparent !important; color: var(--text) !important;
  box-shadow: none !important; font: inherit; font-size: 16px; line-height: 1.35;
  -webkit-text-fill-color: var(--text); caret-color: var(--accent); color-scheme: light dark;
}
.chat-message-input::placeholder { color: var(--muted); opacity: 1; -webkit-text-fill-color: var(--muted); }
.chat-attach-button, .chat-send-button {
  flex: 0 0 auto; display: grid; place-items: center; border: 0; cursor: pointer;
  touch-action: manipulation; transition: transform .12s ease, background .15s ease, opacity .15s ease;
}
.chat-attach-button {
  width: 40px; height: 40px; margin-bottom: 1px; border-radius: 50%;
  background: transparent; color: var(--accent); font-size: 25px; font-weight: 450; line-height: 1;
}
.chat-attach-button:hover { background: var(--accent-soft); }
.chat-send-button {
  width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 75%, #000);
}
.chat-send-button span { display: block; font-size: 23px; line-height: 1; transform: translateX(1px) rotate(-8deg); }
.chat-send-button:hover { background: var(--accent-hover, var(--accent)); transform: translateY(-1px); }
.chat-send-button:active, .chat-attach-button:active { transform: scale(.94); }
.chat-send-button:disabled, .chat-attach-button:disabled { opacity: .42; cursor: default; transform: none; box-shadow: none; }
.chat-composer { margin-top: 12px; padding: 8px 0 2px; border: 2px dashed transparent; border-radius: 18px; transition: .15s ease; }
.chat-composer.dragging { border-color: var(--accent); background: var(--accent-soft); }
.chat-composer .chat-input { margin-top: 0; }
.composer-hint { margin: 7px 2px 0; }
.pending-attachments, .message-attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 0 0 9px; }
.pending-attachment, .message-attachment { min-width: 0; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); white-space: normal; }
.message-attachment { grid-template-columns: 72px minmax(0, 1fr); margin-top: 8px; }
.pending-attachment.failed { border-color: var(--err); }
.pending-attachment img, .message-attachment img { width: 58px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.message-attachment img { width: 72px; height: 66px; }
.attachment-placeholder { width: 58px; height: 52px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-2); }
.pending-info, .attachment-caption { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 10.5px; }
.pending-info b, .attachment-caption b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.pending-attachment > button { border: 0; background: transparent; color: var(--text-dim); font-size: 19px; }
.attachment-status.failed, .pending-attachment.failed .attachment-status { color: var(--err); }
.source-images { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.source-images .hint { flex: 1 0 100%; }
.source-images img { width: 74px; height: 58px; border-radius: 7px; border: 1px solid var(--border); object-fit: cover; }
.cc-turn { display: flex; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; align-items: baseline; }
.cc-turn:last-child { border-bottom: none; }

/* ---------- Football Rich Results ---------- */
.football-rich { --football-blue: #2767cf; --football-orange: #d97706; --football-cyan: #0891b2; --football-red: #c2392b; --football-coral: #e76643; --football-green: #27844f; --football-gold: #c28a12; margin-top: 11px; border: 1px solid var(--border-strong); border-radius: 13px; overflow: hidden; background: var(--surface); color: var(--text); white-space: normal; box-shadow: 0 7px 24px rgba(35, 24, 14, .08); }
.football-title { min-height: 62px; padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface)); }
.football-title-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.football-title-main > div { min-width: 0; }
.football-title b { display: block; font-size: 15px; line-height: 1.25; }
.football-title small { display: block; margin-top: 2px; color: var(--text-dim); font-size: 11px; }
.football-updated { text-align: right; white-space: nowrap; }
.football-league-logo { width: 34px; height: 34px; object-fit: contain; flex: 0 0 34px; }
.football-league-logo.placeholder, .football-ball { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px; border-radius: 9px; background: color-mix(in srgb, var(--accent) 11%, var(--surface)); font-size: 18px; }
.football-logo { width: 23px; height: 23px; object-fit: contain; flex: 0 0 23px; }
.football-logo.placeholder { display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 12px; }
.football-table-wrap { width: 100%; overflow-x: auto; }
.football-table { min-width: 590px; table-layout: auto; font-variant-numeric: tabular-nums; }
.football-table th { padding: 8px 9px; color: var(--text-dim); background: var(--surface-2); font-size: 10px; font-weight: 700; letter-spacing: .035em; text-align: center; text-transform: uppercase; }
.football-table td { padding: 8px 9px; border-top: 1px solid var(--border); text-align: center; font-size: 12px; }
.football-table .football-pos { width: 46px; font-weight: 700; }
.football-table .football-team-col { min-width: 220px; text-align: left; }
.football-table .football-points { width: 52px; font-size: 13px; font-weight: 800; }
.football-team-button { width: 100%; min-width: 0; padding: 0; border: 0; display: flex; align-items: center; gap: 8px; background: transparent; color: inherit; text-align: left; }
.football-team-button:hover .football-team-name { color: var(--accent); text-decoration: underline; }
.football-team-name { min-width: 90px; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.football-badge { max-width: 128px; padding: 2px 6px; border-radius: 999px; overflow: hidden; color: #fff; font-size: 8px; font-weight: 750; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.football-badge.leader { padding: 0; background: transparent; font-size: 13px; }
.football-badge.champions_league, .football-badge.champions_league_qualification { background: var(--football-blue); }
.football-badge.europa_league { background: var(--football-orange); }
.football-badge.conference_league { background: var(--football-cyan); }
.football-badge.relegation { background: var(--football-red); }
.football-badge.relegation_playoff { background: var(--football-coral); }
.football-badge.promotion, .football-badge.promotion_playoff { background: var(--football-green); }
.football-table tbody tr[class*="football-zone-"] { box-shadow: inset 3px 0 transparent; }
.football-table tbody tr.football-zone-champions_league, .football-table tbody tr.football-zone-champions_league_qualification { box-shadow: inset 3px 0 var(--football-blue); }
.football-table tbody tr.football-zone-europa_league { box-shadow: inset 3px 0 var(--football-orange); }
.football-table tbody tr.football-zone-conference_league { box-shadow: inset 3px 0 var(--football-cyan); }
.football-table tbody tr.football-zone-relegation { box-shadow: inset 3px 0 var(--football-red); background: color-mix(in srgb, var(--football-red) 5%, transparent); }
.football-table tbody tr.football-zone-relegation_playoff { box-shadow: inset 3px 0 var(--football-coral); background: color-mix(in srgb, var(--football-coral) 5%, transparent); }
.football-table tbody tr.football-zone-promotion, .football-table tbody tr.football-zone-promotion_playoff { box-shadow: inset 3px 0 var(--football-green); }
.football-table tbody tr.football-leader { background: color-mix(in srgb, var(--football-gold) 12%, var(--surface)); box-shadow: inset 4px 0 var(--football-gold); }
.football-table tbody tr.football-focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -2px; }
.football-team-actions td { padding: 7px 12px 10px; background: var(--surface-2); }
.football-team-actions td > div { display: flex; flex-wrap: wrap; gap: 7px; padding-left: 40px; }
.football-group { padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.football-legend { display: flex; flex-wrap: wrap; gap: 7px 14px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); font-size: 10px; font-weight: 650; }
.football-legend .leader { color: var(--football-gold); }
.football-legend .champions_league, .football-legend .champions_league_qualification { color: var(--football-blue); }
.football-legend .europa_league { color: var(--football-orange); }
.football-legend .conference_league { color: var(--football-cyan); }
.football-legend .relegation { color: var(--football-red); }
.football-legend .relegation_playoff { color: var(--football-coral); }
.football-legend .promotion, .football-legend .promotion_playoff { color: var(--football-green); }
.football-count { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; }
.football-matches { display: grid; gap: 8px; padding: 10px; }
.football-match { padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; transition: border-color .12s, transform .12s, box-shadow .12s; }
.football-match.clickable:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-1px); box-shadow: var(--shadow); }
.football-match.live { border-color: color-mix(in srgb, var(--football-red) 45%, var(--border)); }
.football-match-head, .football-match-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-dim); font-size: 10px; }
.football-match-head { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.football-match-foot { padding-top: 8px; flex-wrap: wrap; }
.football-match-teams { padding: 7px 0 3px; }
.football-match-team { display: grid; grid-template-columns: 23px minmax(0, 1fr) 34px; align-items: center; gap: 9px; min-height: 30px; }
.football-match-name { overflow-wrap: anywhere; font-size: 13px; }
.football-match-score { justify-self: end; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.football-live { color: var(--football-red); font-size: 10px; font-weight: 850; letter-spacing: .03em; animation: football-pulse 1.7s ease-in-out infinite; }
.football-status { padding: 2px 7px; border-radius: 999px; background: var(--surface-2); font-weight: 700; }
.football-status.finished { color: var(--ok); }
.football-status.cancelled { color: var(--football-red); }
@keyframes football-pulse { 50% { opacity: .58; } }
.football-empty { padding: 24px; color: var(--text-dim); text-align: center; }
.football-details { padding-bottom: 10px; }
.football-details > .football-match { margin: 10px; }
.football-subtitle { margin: 13px 13px 6px; color: var(--text-dim); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.football-events, .football-stats, .football-lineups { margin: 0 10px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.football-event { min-height: 34px; padding: 7px 10px; display: grid; grid-template-columns: 42px 18px minmax(120px, 1fr) auto; align-items: center; gap: 7px; border-bottom: 1px solid var(--border); font-size: 11px; }
.football-event:last-child { border-bottom: 0; }
.football-event small { color: var(--text-dim); }
.football-red-card { color: var(--football-red); }
.football-event.yellow_card .football-event-icon { color: #d7a900; }
.football-event.substitution .football-event-icon { color: var(--football-cyan); }
.football-event.var .football-event-icon { color: var(--football-orange); }
.football-stats-head, .football-stat { min-height: 32px; padding: 6px 10px; display: grid; grid-template-columns: minmax(70px, 1fr) minmax(105px, 1.4fr) minmax(70px, 1fr); align-items: center; gap: 8px; text-align: center; font-size: 11px; }
.football-stats-head { background: var(--surface-2); }
.football-stat { border-top: 1px solid var(--border); }
.football-stat span { color: var(--text-dim); }
.football-section-empty { margin: 8px 10px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 9px; color: var(--text-dim); font-size: 11px; }
.football-lineups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.football-lineup-team { min-width: 0; padding: 10px 12px; }
.football-lineup-team + .football-lineup-team { border-left: 1px solid var(--border); }
.football-lineup-head { min-height: 30px; display: flex; align-items: center; gap: 8px; }
.football-lineup-head b { min-width: 0; overflow-wrap: anywhere; }
.football-formation { margin-left: auto; padding: 2px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 750; }
.football-coach { margin: 5px 0 9px 31px; color: var(--text-dim); font-size: 10px; }
.football-lineup-label { margin: 9px 0 5px; color: var(--text-dim); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.football-player-list { margin: 0; padding: 0; display: grid; gap: 2px; list-style: none; }
.football-player-list li { min-height: 25px; display: grid; grid-template-columns: 24px minmax(0, 1fr) 24px; align-items: center; gap: 6px; font-size: 10px; }
.football-player-list small { color: var(--text-dim); text-align: right; }
.football-shirt { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.football-lineup-empty { color: var(--text-dim); font-size: 10px; }

/* ---------- Token-Charts (pro Agent, Cloudflare-artig) ---------- */
.tok-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
.tok-card { padding: 14px 16px; --tok-output: #bd9871; }
.tok-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tok-head b { font-size: 14px; }
.tok-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: middle; }
.tok-dot.in { background: var(--accent); }
.tok-dot.out { background: #d9c9b3; }
:root[data-theme="dark"] .tok-dot.out { background: #6a583f; }
.tok-chart { display: flex; gap: 8px; height: 150px; position: relative; }
.tok-ymax { font-size: 10px; color: var(--muted); }
.tok-bars { flex: 1; min-width: 0; overflow: hidden; display: flex; align-items: flex-end; gap: 2px; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0 2px; }
.tok-slot { flex: 1; min-width: 2px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer; }
.tok-slot:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tok-bar {
  width: 100%;
  height: var(--bar-height, 0%);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(
    to top,
    var(--accent) 0 var(--input-share, 0%),
    var(--tok-output) var(--input-share, 0%) 100%
  );
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.tok-bar.is-empty { height: 1px; background: var(--border); box-shadow: none; }
.tok-slot:hover .tok-bar { outline: 1px solid var(--accent); }
.tok-card { overflow: visible; }
.tok-tip { position: absolute; left: 0; top: 2px; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; font-size: 11px; line-height: 1.5; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.22); opacity: 0; z-index: 30; }
.tok-tip::before { content: ""; position: absolute; right: 100%; top: 50%; transform: translateY(-50%); border: 6px solid transparent; border-right-color: var(--border); }
.tok-tip::after { content: ""; position: absolute; right: calc(100% - 1px); top: 50%; transform: translateY(-50%); border: 5px solid transparent; border-right-color: var(--surface); }
.tok-tip.left::before { right: auto; left: 100%; border-right-color: transparent; border-left-color: var(--border); }
.tok-tip.left::after { right: auto; left: calc(100% - 1px); border-right-color: transparent; border-left-color: var(--surface); }
.tok-tip.show { opacity: 1; }
.tok-tip-time { font-weight: 600; margin-bottom: 2px; }
.tok-tip-sum { margin-top: 2px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 2px; }
.tok-in { background: var(--accent); }
.tok-out { background: #d9c9b3; }
:root[data-theme="dark"] .tok-card { --tok-output: #a77d58; }
.tok-loading, .tok-error { grid-column: 1 / -1; padding: 14px; }
.tok-error { border: 1px solid color-mix(in srgb, var(--err) 45%, var(--border)); border-radius: var(--radius); color: var(--err); background: color-mix(in srgb, var(--err) 8%, var(--surface)); }

/* ---------- Datei-Browser ---------- */
.fs-path { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 10px; word-break: break-all; }
.fs-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.fs-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border: none; border-bottom: 1px solid var(--border); background: none; color: var(--text); font-size: 13px; }
.fs-row:last-child { border-bottom: none; }
.fs-row:hover { background: var(--surface-2); }
.fs-ic { width: 20px; text-align: center; flex-shrink: 0; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 10px; font-size: 13px; z-index: 100; box-shadow: var(--shadow); }
.toast.err { background: var(--err); color: #fff; }
.toast-quiet { position: fixed; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 100; max-width: min(320px, calc(100vw - 32px)); padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--muted); font-size: 12px; line-height: 1.5; pointer-events: none; }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { padding: 40px; text-align: center; color: var(--muted); }

/* Mobile App-Navigation: im Hochformat eine native Tab-Leiste, im Querformat
   eine schmale Seitenleiste. Die vollständige Navigation bleibt im Drawer. */
.app-tabbar {
  position: fixed; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-color: var(--border);
  box-shadow: 0 -8px 28px rgba(45, 30, 18, .10);
  backdrop-filter: saturate(1.35) blur(18px);
  -webkit-backdrop-filter: saturate(1.35) blur(18px);
}
.app-tab {
  min-width: 0; border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 4px; border-radius: 12px; font: inherit;
  text-decoration: none; cursor: pointer; touch-action: manipulation;
}
.app-tab > span { font-size: 19px; line-height: 1; }
.app-tab > b { max-width: 100%; font-size: 10.5px; line-height: 1.1; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tab.active, .app-tab.route-active, .app-tab.menu-open { color: var(--accent); }
.app-tab.active > span, .app-tab.route-active > span, .app-tab.menu-open > span {
  width: 36px; height: 25px; display: grid; place-items: center; border-radius: 999px;
  background: var(--accent-soft);
}

@media (max-width: 720px), (orientation: landscape) and (max-width: 1024px) and (pointer: coarse) {
  body { overflow-x: hidden; }
  body.mobile-nav-open { overflow: hidden; }
  #app, .main { min-height: var(--app-viewport-height); }
  .main { width: 100%; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }

  .app-tabbar {
    display: flex; align-items: stretch; justify-content: space-around;
    left: 0; right: 0; bottom: 0;
    min-height: calc(62px + env(safe-area-inset-bottom));
    padding: 5px max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
  }
  .app-tab { flex: 1 1 20%; }
  body.messenger-chat-open .app-tabbar { display: none; }
  body.messenger-chat-open .main { padding-bottom: 0; }
  /* Konversationsansicht wie ein nativer Chat: Der Bildschirm bleibt am Platz,
     während sich der Nachrichtenbereich mit der sichtbaren Viewport-Höhe
     verkleinert. So bleibt der Composer direkt über der iOS-Tastatur. */
  #app:has(.content.content-conversation-detail) {
    height: var(--app-viewport-height); min-height: var(--app-viewport-height);
  }
  #app:has(.content.content-conversation-detail) .main {
    height: var(--app-viewport-height); min-height: 0; overflow: hidden;
  }
  .content.content-conversation-detail {
    display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden;
  }
  .content-conversation-detail > .toolbar,
  .content-conversation-detail > .panel:not(.chat) { flex: 0 0 auto; }
  .content-conversation-detail .chat.panel {
    flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .content-conversation-detail > .chat-composer { flex: 0 0 auto; }
  /* Im offenen Chat folgt die Höhe immer der sichtbaren Fläche (Tastatur), nicht erst nach dem Umschalten von .app-keyboard-open:
     sonst wechselte das Layout mitten in der Tastatur-Animation von einem Höhenmodell zum anderen und sprang. */
  body.messenger-chat-open #app,
  body.messenger-chat-open .main { height: var(--app-viewport-height); min-height: var(--app-viewport-height); }
  body.messenger-chat-open .main { overflow: hidden; }
  body.messenger-chat-open .content.content-messenger { height: auto; min-height: 0; flex: 1; }
  html.app-keyboard-open .app-tabbar { transform: translateY(110%); pointer-events: none; }
  html.app-keyboard-open #app,
  html.app-keyboard-open .main { height: var(--app-viewport-height); min-height: var(--app-viewport-height); }
  html.app-keyboard-open .main { padding-bottom: 0; overflow: hidden; }
  html.app-keyboard-open .content:not(.content-messenger) { min-height: 0; flex: 1; overflow-y: auto; padding-bottom: 16px; }
  html.app-keyboard-open .content.content-messenger { height: auto; min-height: 0; flex: 1; }
  .chat-composer, .ms-composer { scroll-margin-bottom: max(12px, env(safe-area-inset-bottom)); }

  /* Mobile Navigation: Die Sidebar liegt geschlossen außerhalb des Viewports
     und blockiert den Inhalt nicht mehr. */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(86vw, 310px);
    max-width: 310px;
    height: 100vh;
    height: var(--app-viewport-height);
    padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    transform: translateX(-105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .2s ease, visibility 0s linear .2s;
    box-shadow: 12px 0 34px rgba(20, 12, 7, .3);
  }
  .sidebar.mobile-open { transform: translateX(0); visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .sidebar.collapsed { width: min(86vw, 310px); }
  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .nav-item > span:not(.ic),
  .sidebar.collapsed .user-meta,
  .sidebar.collapsed .build-version { display: block; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; }
  .sidebar.collapsed .nav-group-children.expanded { display: flex; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    border: 0;
    background: rgba(24, 15, 9, .48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }
  body.mobile-nav-open .sidebar-backdrop { opacity: 1; visibility: visible; pointer-events: auto; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 35;
    min-height: 56px;
    gap: 6px;
    padding: max(5px, env(safe-area-inset-top)) 8px 5px;
    flex-wrap: nowrap;
    box-shadow: 0 1px 0 var(--border);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.25) blur(16px);
    -webkit-backdrop-filter: saturate(1.25) blur(16px);
  }
  .topbar { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .topbar .burger { width: 38px; height: 38px; padding: 0; font-size: 18px; }
  .page-title { min-width: 0; max-width: calc(100vw - 166px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; letter-spacing: -.02em; }
  .topbar-spacer { min-width: 0; }
  .topbar-sub {
    position: absolute; left: max(52px, calc(env(safe-area-inset-left) + 44px)); right: 132px; bottom: 3px;
    overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap;
  }
  .topbar-sub:empty { display: none; }
  .theme-toggle { flex: 0 0 auto; }
  .theme-toggle button { min-width: 30px; min-height: 30px; padding: 4px 7px; }
  .notification-bell { width: 34px; height: 34px; font-size: 19px; }
  /* Der Erstellen-Button steht bereits neben der Suche; mobil nicht doppeln. */
  #createAgentBtn { display: none !important; }
  .nav-item, .user-card { min-height: 44px; }
  .btn { min-height: 42px; }
  .iconbtn { width: 40px; height: 40px; }

  .content {
    width: 100%;
    min-width: 0;
    padding: 10px max(9px, env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) max(9px, env(safe-area-inset-left));
  }
  .content.content-conversation-detail { padding-inline: max(5px, env(safe-area-inset-left)); }
  .content-conversation-detail > .toolbar { margin: 0 4px 7px; }
  .content-conversation-detail > .toolbar .btn { min-height: 34px; padding: 5px 10px; }
  .content-conversation-detail > .panel:not(.chat) { margin: 0 4px 8px !important; }
  .content-conversation-detail .conv-meta { grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr); gap: 5px 10px; }
  .content-conversation-detail .chat.panel {
    max-height: none; padding: 4px !important; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; overflow-x: hidden;
  }
  .content-conversation-detail .chat-composer { margin: 5px 4px 0; padding-top: 3px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
  .stat { min-width: 0; padding: 13px; gap: 10px; }
  .stat .icon { width: 36px; height: 36px; flex-basis: 36px; }
  .stat .label, .stat .sub { overflow-wrap: anywhere; }
  .stat .value { font-size: 21px; }

  .toolbar { align-items: stretch; gap: 8px; margin-bottom: 12px; }
  .toolbar .search, .toolbar > input, .toolbar > select { min-width: 0; flex: 1 1 150px; }
  .toolbar .btn { min-height: 42px; justify-content: center; }
  .toolbar > .btn[style*="margin-left"] { margin-left: 0 !important; }
  .panel { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .panel > table:not(.football-table) { min-width: 640px; }
  .agents-table { min-width: 900px; }
  .agents-table { --agent-action-size: 40px; }
  thead th, tbody td { padding: 11px 12px; }

  /* Primäre Listen werden wie native App-Karten dargestellt, nicht als
     verkleinerte Desktop-Tabelle. Football behält sein kompaktes Tabellenlayout. */
  .mobile-app-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .panel > .mobile-app-table, .mobile-app-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .mobile-app-table thead { display: none; }
  .mobile-app-table tbody { display: grid; width: 100%; gap: 10px; }
  .mobile-app-table tbody tr {
    display: block;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: 0 3px 12px rgba(45, 30, 18, .06);
  }
  .mobile-app-table tbody td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: 100%;
    min-width: 0;
    padding: 6px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .mobile-app-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }
  .mobile-app-table tbody td[colspan] { display: block; padding: 0; }
  .mobile-app-table tbody td[colspan]::before { content: none; }
  .mobile-app-table .cell-name { min-width: 0; flex-wrap: wrap; }
  .mobile-app-table .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .mobile-app-table .badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

  /* Conversation-Karten: horizontaler Wisch verschiebt die ganze Karte und
     legt die Löschaktion rechts frei. Vertikales Scrollen bleibt nativ. */
  .conversation-list-table tbody { overflow-x: clip; padding: 1px 0; }
  .conversation-list-table tbody tr.conversation-row {
    position: relative;
    touch-action: pan-y;
    transform: translateX(var(--conversation-swipe-x, 0));
    transition: transform .2s cubic-bezier(.2, .8, .2, 1), border-color .15s ease,
      background-color .15s ease;
    will-change: transform;
  }
  .conversation-list-table tbody tr.conversation-row.swipe-dragging { transition: none; }
  .conversation-list-table tbody tr.conversation-row:focus-visible {
    outline: 2px solid var(--accent); outline-offset: -2px;
  }
  .conversation-list-table .conversation-swipe-action {
    position: absolute; display: block; top: -1px; bottom: -1px; right: -113px;
    width: 112px; padding: 0; border: 0;
  }
  .conversation-list-table .conversation-swipe-action::before { content: none; }
  .conversation-swipe-delete {
    width: 100%; height: 100%; min-height: 54px; border: 0; border-radius: 0 13px 13px 0;
    background: var(--err); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
  }
  .conversation-list:not(.is-selecting) .conversation-selection-cell { display: none; }
  .conversation-list.is-selecting .conversation-row {
    --conversation-swipe-x: 0px !important;
    cursor: default !important;
  }
  .conversation-list.is-selecting .conversation-row.is-selected {
    border-color: var(--accent); background: var(--accent-soft);
  }
  .conversation-list.is-selecting .conversation-selection-cell input { width: 26px; height: 26px; }
  .conversation-bulk-bar {
    position: sticky; top: calc(62px + env(safe-area-inset-top)); z-index: 28;
    flex-wrap: wrap; box-shadow: 0 8px 22px rgba(45, 30, 18, .12);
  }
  .conversation-bulk-bar .btn { flex: 1 1 auto; justify-content: center; }

  /* Desktop-Spaltenbreiten müssen im mobilen Kartenmodus vollständig weg.
     Sonst bleiben Modell/Actions auf 15/20 Prozent der Kartenbreite hängen. */
  .agents-table.mobile-app-table tbody td,
  .agents-table.mobile-app-table tbody td:nth-child(n) {
    width: 100%;
    min-width: 0;
    max-width: none;
    text-align: left;
    white-space: normal;
  }
  .agents-table.mobile-app-table tbody td {
    grid-template-columns: 94px minmax(0, 1fr);
  }
  .agents-table.mobile-app-table .cell-name {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
  }
  .agents-table.mobile-app-table .cell-name .cn-name {
    flex: 1 1 150px;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
  }
  .agents-table.mobile-app-table .cell-name .badge {
    flex: 0 0 auto;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }
  .agents-table.mobile-app-table .agent-card-value {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }
  .agents-table.mobile-app-table .row-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .agents-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
  }
  .agents-toolbar .search { min-width: 0; }
  .agents-toolbar .agent-create-inline { white-space: nowrap; }

  /* Der Monitor bekommt auf Mobilgeräten ein echtes Kartenlayout. So müssen
     Status- und Sessiondaten nicht in einer abgeschnittenen 640px-Tabelle
     gelesen werden. */
  .mon-grid, .mon-grid > * { width: 100%; min-width: 0; }
  .monitor-table-panel { width: 100%; overflow: hidden; }
  .monitor-table-panel > .monitor-card-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .monitor-card-table thead { display: none; }
  .monitor-card-table tbody { display: block; width: 100%; }
  .monitor-card-table tbody tr {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  .monitor-card-table tbody tr:last-child { border-bottom: 0; }
  .monitor-card-table tbody td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: 100%;
    min-width: 0;
    padding: 5px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .monitor-card-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }
  .monitor-card-table tbody td[colspan] { display: block; padding: 0; }
  .monitor-card-table tbody td[colspan]::before { content: none; }
  .monitor-card-table .cell-name { min-width: 0; align-items: flex-start; flex-wrap: wrap; }
  .monitor-card-table .cell-name .cn-name { flex: 1 1 150px; min-width: 0; overflow-wrap: anywhere; }
  .monitor-card-table .badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .monitor-token-toolbar .section-title,
  .monitor-runs-toolbar .section-title { flex: 1 0 100% !important; }
  .monitor-token-toolbar > select { width: 100%; flex-basis: 100%; }
  .monitor-runs-toolbar > input,
  .monitor-runs-toolbar > select { max-width: none !important; flex: 1 1 calc(50% - 4px); }
  .monitor-runs-toolbar > .hint { flex: 1 0 100%; }
  .monitor-runs-toolbar > .btn { flex: 1 1 calc(50% - 4px); }
  .mon-sys-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 5px 10px;
  }
  .mon-sys-row > .dot { grid-row: 1 / span 2; margin-top: 4px; }
  .mon-sys-row > .hint { grid-column: 2; min-width: 0; overflow-wrap: anywhere; }
  .llm-tiles, .agent-drops, .tok-grid { grid-template-columns: minmax(0, 1fr); }
  .llm-tile, .agent-drop { touch-action: manipulation; }
  .llm-empty-state { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .llm-empty-state .btn { width: 100%; margin-left: 0; justify-content: center; }
  .mailcard { padding: 14px; }
  .mailcard-head { align-items: flex-start; flex-wrap: wrap; }
  .mailcard-account { max-width: 100%; }
  .mailcard-head > .badge { margin-left: 40px; }
  .mailcard-srv { align-items: flex-start; }
  .mailcard-srv > span:last-child { min-width: 0; overflow-wrap: anywhere; }
  .kv-row { align-items: flex-start; gap: 8px; }
  .kv-k { flex-basis: 92px; }
  .query-compare, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .rag-col-right { position: static; }
  .debug-grid { grid-template-columns: minmax(90px, .65fr) minmax(0, 1.35fr); gap: 8px 10px; }
  .assign-row { flex-wrap: wrap; }
  .assign-row select { flex: 1 0 100%; min-height: 42px; }
  .assign-row .btn { flex: 1; justify-content: center; }
  .form-actions { align-items: stretch; }
  .form-actions .btn { min-height: 42px; justify-content: center; }
  .field-num { width: 100%; }
  .field input, .field textarea, .field select, .search input, .toolbar input, .toolbar select, .auth-form input { font-size: 16px; }
  .btn, .iconbtn, .nav-item, .theme-toggle button, .x { touch-action: manipulation; }
  .wa-window { align-items: flex-start; flex-direction: column; gap: 5px; padding: 10px 12px; }

  .overlay { z-index: 90; }
  .drawer { width: 100%; max-width: none; height: 100vh; height: var(--app-viewport-height); }
  .modal-center { align-items: flex-end; }
  .modal { width: 100% !important; max-width: none; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .drawer-head, .modal-head { padding: 14px 16px; }
  .drawer-body, .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-foot .btn { min-height: 42px; flex: 1 1 120px; justify-content: center; }
  .x { width: 44px; height: 44px; }

  .chat { max-height: 62dvh; padding: 12px !important; }
  .bubble { max-width: 94%; }
  .bubble.assistant.has-rich { width: 100%; max-width: 100%; padding: 9px; }
  .bubble-copy { opacity: .45; }
  .chat-input { flex-wrap: nowrap; gap: 8px; }
  .chat-input-shell { flex: 1 1 auto; min-height: 50px; }
  .chat-message-input { min-height: 38px; font-size: 16px; }
  .chat-send-button { width: 50px; height: 50px; }
  .pending-attachments, .message-attachments { grid-template-columns: minmax(0, 1fr); }
  .pending-attachment { grid-template-columns: 52px minmax(0, 1fr) 34px; }
  .pending-attachment img, .attachment-placeholder { width: 52px; height: 48px; }
  .tok-card { min-width: 0; padding: 12px; overflow: visible; }
  .tok-head { align-items: flex-start; }
  .tok-head > b { flex: 1 0 100%; min-width: 0; overflow-wrap: anywhere; }
  .tok-chart { height: 132px; gap: 5px; }
  .tok-tip { max-width: calc(100% - 8px); white-space: normal; }
  .fs-list { max-height: 62dvh; }
  .toast { bottom: max(12px, env(safe-area-inset-bottom)); width: calc(100vw - 24px); text-align: center; }
  .auth-overlay {
    min-height: var(--app-viewport-height); height: var(--app-viewport-height);
    display: flex; align-items: flex-start; justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
             max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    overflow-y: auto;
  }
  .auth-card { width: min(440px, 100%); max-height: none; margin: auto 0; overflow: visible; }
  html.app-keyboard-open .auth-overlay {
    padding-bottom: max(88px, env(safe-area-inset-bottom));
  }
  html.app-keyboard-open .auth-card { margin: 0; }
  html.app-keyboard-open .auth-brand { margin-bottom: 12px; }
  html.app-keyboard-open .auth-card > p { margin-bottom: 12px; }
  input, textarea, select { font-size: 16px; }

  .football-title { align-items: flex-start; }
  .football-updated { display: none; }
  .football-table { min-width: 0; width: 100%; table-layout: fixed; }
  .football-table .football-hide-mobile { display: none; }
  .football-table th, .football-table td { padding: 8px 5px; font-size: 10px; }
  .football-table .football-pos { width: 34px; }
  .football-table .football-team-col { width: auto; min-width: 0; }
  .football-table .football-points { width: 38px; font-size: 12px; }
  .football-table th:nth-child(3), .football-table td:nth-child(3) { width: 32px; }
  .football-table th:nth-child(8), .football-table td:nth-child(8) { width: 39px; }
  .football-logo { width: 20px; height: 20px; flex-basis: 20px; }
  .football-team-button { gap: 5px; }
  .football-team-name { min-width: 0; font-size: 10.5px; }
  .football-badge:not(.leader) { width: 6px; height: 6px; flex: 0 0 6px; padding: 0; border-radius: 50%; color: transparent; }
  .football-team-actions td > div { padding-left: 0; }
  .football-event { grid-template-columns: 36px 14px minmax(100px, 1fr); }
  .football-event small { grid-column: 3; }
  .football-lineups { grid-template-columns: 1fr; }
  .football-lineup-team + .football-lineup-team { border-left: 0; border-top: 1px solid var(--border); }
}

@media (orientation: landscape) and (max-width: 1024px) and (pointer: coarse) {
  .main {
    padding: 0 0 0 calc(62px + env(safe-area-inset-left));
  }
  .app-tabbar {
    top: 0; right: auto; bottom: 0; left: 0;
    width: calc(62px + env(safe-area-inset-left));
    min-height: 0; height: var(--app-viewport-height);
    flex-direction: column; justify-content: center;
    padding: max(5px, env(safe-area-inset-top)) 5px max(5px, env(safe-area-inset-bottom)) env(safe-area-inset-left);
    border-top: 0; border-right: 1px solid var(--border);
    box-shadow: 8px 0 28px rgba(45, 30, 18, .08);
  }
  .app-tab { flex: 0 1 58px; width: 56px; }
  body.messenger-chat-open .main { padding-left: 0; }
  .app-tab > b { font-size: 9.5px; }
  html.app-keyboard-open .app-tabbar { transform: translateX(-110%); }
  .topbar { flex-wrap: nowrap; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
  .topbar { padding-left: 12px; }
  .topbar-sub { display: none; }
  #createAgentBtn { order: 0; width: auto; min-height: 38px; white-space: nowrap; }
  .content { padding-top: 10px; padding-left: 12px; }
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mon-grid { grid-template-columns: minmax(0, 1.4fr) minmax(230px, .8fr); gap: 12px; }
  .monitor-token-toolbar .section-title { flex: 1 1 auto !important; }
  .monitor-token-toolbar > select { width: auto; flex: 0 1 240px; }
  .tok-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-app-table tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agents-table tbody, .data-table tbody { grid-template-columns: minmax(0, 1fr); }
  .tok-chart { height: 116px; }
  .drawer { width: min(72vw, 620px); }
  .modal-center { align-items: center; }
  .modal { width: min(720px, calc(100vw - 24px)) !important; max-height: calc(var(--app-viewport-height) - 16px); border-radius: var(--radius); }
  .chat { max-height: 48dvh; }
  .chat-input { flex-wrap: nowrap; }
  .chat-input-shell { flex: 1 1 auto; }
}

@media (max-width: 430px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .knowledge-tiles { grid-template-columns: minmax(0, 1fr); }
  .toolbar .search, .toolbar > input, .toolbar > select { flex-basis: 100%; width: 100%; max-width: none !important; }
  .toolbar > .btn { flex: 1 1 100%; }
  .agents-toolbar { grid-template-columns: minmax(0, 1fr); }
  .agents-toolbar .agent-create-inline { width: 100%; justify-content: center; }
  .agents-table.mobile-app-table tbody td { grid-template-columns: 88px minmax(0, 1fr); }
  .debug-grid { grid-template-columns: minmax(0, 1fr); }
  .debug-grid .v { padding-bottom: 5px; }
  .conv-meta { grid-template-columns: minmax(0, 1fr); }
  .auth-overlay { place-items: center; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .auth-card { padding: 22px 18px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .auth-ghost { display: none; }
}

@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .auth-overlay { place-items: start center; }
  .auth-card { width: min(560px, 100%); max-height: none; padding: 14px 22px; }
  .auth-brand { margin-bottom: 9px; }
  .auth-card h1 { font-size: 20px; }
  .auth-card > p { margin-bottom: 9px; }
  .auth-form { gap: 3px; }
  .auth-form label { margin-top: 3px; }
  .auth-form .btn { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop { transition: none; }
}

/* ---------------- Sprachgespräche (Voice / Internet-Calls) ---------------- */
.voice-page { min-width: 0; }
.voice-studio-shell {
  --coffee-ink: #21110c;
  --coffee-dark: #34180f;
  --coffee-mid: #704127;
  --coffee-copper: #b87545;
  --coffee-gold: #e4b77d;
  --coffee-cream: #f2dfc3;
  position: relative;
  min-height: calc(var(--app-viewport-height) - 116px);
  overflow: hidden;
  border: 1px solid rgba(225, 177, 118, .35);
  border-radius: 22px;
  color: var(--coffee-cream);
  background:
    radial-gradient(circle at 8% 12%, rgba(185, 112, 67, .22), transparent 24%),
    radial-gradient(circle at 88% 4%, rgba(132, 73, 42, .25), transparent 24%),
    repeating-linear-gradient(132deg, rgba(255,255,255,.017) 0 1px, transparent 1px 9px),
    linear-gradient(145deg, #180c08 0%, #32170f 47%, #170b07 100%);
  box-shadow: inset 0 1px rgba(255,255,255,.08), 0 22px 60px rgba(22, 10, 6, .22);
}
.voice-studio-shell::before, .voice-studio-shell::after {
  content: ""; position: absolute; width: 112px; height: 112px; opacity: .25;
  background: radial-gradient(ellipse at 50% 50%, #c08452 0 26%, transparent 28%);
  filter: blur(.2px); transform: rotate(27deg); pointer-events: none;
}
.voice-studio-shell::before { top: -48px; right: 44px; }
.voice-studio-shell::after { left: -55px; bottom: 8%; }
.voice-studio-toolbar { position: relative; z-index: 5; display: flex; align-items: center;
  justify-content: space-between; padding: 18px 22px 0; }
.voice-studio-back, .voice-studio-friend { appearance: none; border: 0; color: #f4dfc4;
  background: transparent; font: inherit; cursor: pointer; padding: 9px 12px; border-radius: 999px; }
.voice-studio-back:hover, .voice-studio-friend:hover { background: rgba(255,255,255,.08); }
.voice-studio-friend { border: 1px solid rgba(226, 177, 119, .42); font-size: 13px; }
.voice-studio-hero { position: relative; min-height: 310px; display: grid; place-items: end center;
  isolation: isolate; padding: 24px 20px 0; }
.voice-studio-copy { position: absolute; z-index: 3; left: 28px; top: 34px; max-width: 310px; }
.voice-studio-kicker { color: #d39a65; font-size: 10px; font-weight: 800; letter-spacing: .24em; }
.voice-studio-copy h2 { margin: 7px 0 3px; color: #f7e6d0; font: 600 clamp(26px, 4vw, 42px)/1.05 Georgia, serif; }
.voice-studio-copy p { margin: 0; color: rgba(246, 222, 195, .68); font-size: 13px; }
.voice-studio-wave { position: absolute; z-index: 1; bottom: 70px; display: flex; align-items: center;
  gap: clamp(3px, .7vw, 8px); width: 40%; height: 110px; opacity: .68; }
.voice-studio-wave.wave-left { left: 2%; justify-content: flex-end; }
.voice-studio-wave.wave-right { right: 2%; transform: scaleX(-1); justify-content: flex-end; }
.voice-studio-wave i { display: block; width: 3px; height: var(--wave-height); border-radius: 999px;
  background: linear-gradient(#f1c28b, #8d4e2f); box-shadow: 0 0 9px rgba(226, 158, 94, .42);
  animation: coffee-wave 1.4s ease-in-out var(--wave-delay) infinite alternate; }
@keyframes coffee-wave { to { transform: scaleY(.42); opacity: .45; } }
.voice-studio-mic { position: relative; z-index: 2; width: 168px; height: 274px; filter: drop-shadow(0 22px 18px rgba(0,0,0,.48)); }
.voice-mic-capsule { position: absolute; z-index: 3; top: 0; left: 45px; width: 78px; height: 165px;
  border: 2px solid #edbd84; border-radius: 39px 39px 31px 31px;
  background: linear-gradient(90deg, #6d351f, #dda36e 17%, #7d4229 52%, #e4ad78 78%, #5d2a18);
  box-shadow: inset 0 0 14px rgba(255,224,179,.38), 0 0 0 2px #3b1b10; }
.voice-mic-grille { height: 88px; margin: 5px; border-radius: 33px 33px 17px 17px;
  border-bottom: 2px solid #5b2b1a;
  background-color: #a76742;
  background-image: radial-gradient(#3e2016 32%, transparent 35%), radial-gradient(#e4ac77 27%, transparent 31%);
  background-position: 0 0, 2px 2px; background-size: 4px 4px;
  box-shadow: inset 0 0 18px #3a190e, inset 7px 0 9px rgba(242,190,132,.32); }
.voice-mic-yoke { position: absolute; z-index: 2; top: 106px; left: 28px; width: 108px; height: 82px;
  border: 7px solid #ae6a3f; border-top: 0; border-radius: 0 0 55px 55px;
  box-shadow: inset 0 -2px #efbd84, 0 2px #3a180c; }
.voice-mic-yoke::before, .voice-mic-yoke::after { content: ""; position: absolute; top: -5px;
  width: 12px; height: 25px; border-radius: 5px; background: linear-gradient(90deg, #6a311d, #e3aa73); }
.voice-mic-yoke::before { left: -10px; } .voice-mic-yoke::after { right: -10px; }
.voice-mic-stem { position: absolute; z-index: 1; left: 78px; top: 176px; width: 13px; height: 72px;
  border-radius: 5px; background: linear-gradient(90deg, #542413, #ebb47b 48%, #6d321d); }
.voice-mic-base { position: absolute; left: 38px; bottom: 8px; width: 92px; height: 19px; border-radius: 50%;
  background: linear-gradient(#e0a56f, #6e321d 58%, #2d130b); box-shadow: 0 7px 8px rgba(0,0,0,.45); }
.voice-studio-agents { position: relative; z-index: 4; margin: -3px 18px 20px; padding: 7px;
  border: 1px solid rgba(77, 38, 22, .85); border-radius: 16px;
  background: linear-gradient(105deg, rgba(231,195,153,.94), rgba(172,112,73,.94) 48%, rgba(239,207,166,.94));
  box-shadow: inset 0 0 0 2px rgba(255,245,222,.5), 0 12px 28px rgba(0,0,0,.32); }
.voice-studio-loading, .voice-studio-agents .empty, .voice-studio-agents > .voice-error {
  padding: 24px; color: #422316; text-align: center; }
.voice-studio-agent { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center;
  gap: 20px; min-height: 78px; padding: 12px 14px; border-radius: 11px; color: #32190f;
  background: linear-gradient(100deg, rgba(251,231,200,.7), rgba(173,107,69,.2)); }
.voice-studio-agent + .voice-studio-agent { margin-top: 6px; border-top: 1px solid rgba(91,49,29,.2); }
.voice-studio-agent-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.voice-studio-agent-copy b { color: #3a1e13; font: 600 21px/1.1 Georgia, serif; }
.voice-studio-agent-copy span { color: #69422e; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-studio-ready { color: #78482d; font-size: 13px; white-space: nowrap; }
.voice-studio-ready.is-ready { color: #5d4324; }
.voice-studio-ready.is-missing { color: #8b352d; }
.voice-studio-speak { appearance: none; min-height: 42px; padding: 0 16px; border: 1px solid #9a5d38;
  border-radius: 999px; color: #5b321d; background: rgba(251,226,190,.64); font: inherit;
  font-size: 14px; font-weight: 600;
  cursor: pointer; box-shadow: inset 0 1px rgba(255,255,255,.62); }
.voice-studio-speak:hover:not(:disabled) { color: #fff4e5; background: #754229; transform: translateY(-1px); }
.voice-studio-speak:disabled { opacity: .48; cursor: not-allowed; }
.voice-hero { max-width: 720px; }
.voice-hero h2 { margin: 0 0 6px; }
.voice-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.voice-choice-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  text-align: left; padding: 18px; height: auto; min-height: 120px; border-radius: 14px; }
.voice-choice-ic { font-size: 26px; }
.voice-choice-btn b { font-size: 15px; }
.voice-live { padding: 18px; margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.call-status-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.call-timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.call-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--idle); display: inline-block; }
.call-dot.ok { background: #3fa45b; }
.call-dot.connecting { background: var(--warn); animation: pulse 1.2s infinite; }
.call-dot.warn { background: #d68a1e; }
.call-dot.err { background: var(--err); }
.call-peer { font-size: 15px; color: var(--text-dim); }
/* Ton-Symbolik: sichtbar machen, OB Stimme fließt (Gegenüber + eigenes Mikro). */
.call-meters { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.call-meter { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.cm-ico { font-size: 20px; width: 26px; text-align: center; filter: grayscale(1);
  opacity: .5; transition: filter .12s ease, opacity .12s ease, transform .12s ease; }
.cm-ico.live { filter: none; opacity: 1; transform: scale(1.14); }
.cm-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.cm-label { font-size: 12px; color: var(--text-dim); }
.cm-bars { display: flex; align-items: stretch; gap: 3px; height: 16px; }
.cm-bars i { flex: 1; border-radius: 2px; background: var(--border); opacity: .45;
  transition: background .07s linear, opacity .07s linear; }
.cm-bars i.on { background: #3fa45b; opacity: 1; }
.cm-bars i.hot { background: #d68a1e; }
.cm-state { font-size: 12px; color: var(--text-dim); min-width: 76px; text-align: right; }
/* Verbindungsweg-Badge: zeigt den real gewählten Pfad (direkt/TURN). */
.call-path { display: flex; align-items: center; gap: 10px; margin: 8px 0;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); }
.call-path-ico { font-size: 18px; }
.call-path-text { display: flex; flex-direction: column; line-height: 1.25; }
.call-path-main { font-size: 14px; font-weight: 600; color: var(--text); }
.call-path-sub { font-size: 12px; color: var(--text-dim); }
.call-path.direct { border-color: #3fa45b; }
.call-path.direct .call-path-main { color: #3fa45b; }
.call-path.turn { border-color: #d68a1e; }
.call-path.turn .call-path-main { color: #d68a1e; }
.call-path.failed { border-color: var(--err); }
.call-path.failed .call-path-main { color: var(--err); }
.call-path.searching .call-path-main { color: var(--text-dim); font-weight: 500; }
.call-debug-toggle { align-self: flex-start; background: none; border: none; padding: 2px 0;
  color: var(--text-dim); font-size: 12px; cursor: pointer; }
.call-debug-toggle:hover { color: var(--text); }
.voice-invite { display: flex; gap: 8px; }
.voice-link { flex: 1; min-width: 0; font-family: monospace; font-size: 12px; }
.call-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.call-ctrl.active, .voice-talk.active { background: var(--err); color: #fff; }
.call-vol { display: flex; align-items: center; gap: 6px; }
.voice-error { color: var(--err); font-size: 13px; padding: 8px 0; }
/* Session-Vorbereitung (Preload-Checkliste). Sichtbar bis „Bereit". */
.voice-prep { margin: 4px 0 10px; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2); }
.voice-prep-title { font-weight: 600; margin-bottom: 10px; }
.voice-prep-list { display: flex; flex-direction: column; gap: 6px; }
.vp-row { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: center;
  font-size: 14px; }
.vp-icon { text-align: center; font-weight: 700; }
.vp-icon.vp-pending { color: var(--muted); opacity: .6; }
.vp-icon.vp-loading { color: var(--warn, #d9a406); animation: vp-spin 1.1s linear infinite; }
.vp-icon.vp-ready { color: var(--ok, #1f9d55); }
.vp-icon.vp-skipped { color: var(--muted); }
.vp-icon.vp-error { color: var(--err); }
.vp-detail { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
@keyframes vp-spin { to { transform: rotate(360deg); } }
.voice-agent-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border); }
.voice-agent-row:last-child { border-bottom: 0; }
.voice-agent-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.voice-agent-status { font-weight: 600; }
.voice-transcript { min-height: 180px; max-height: 46vh; overflow-y: auto; display: flex;
  flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); }
.vt-line { display: flex; gap: 8px; font-size: 14px; }
.vt-role { flex: 0 0 auto; font-weight: 700; color: var(--text-dim); }
.vt-user { color: var(--text); }
.voice-talk { min-width: 140px; }

/* Prominenter Sprech-/Zuhör-Status ------------------------------------- */
.voice-orb-layout { position: relative; overflow: hidden; }
.voice-orb-layout::before { content: ""; position: absolute; inset: 68px 8% auto;
  height: 330px; pointer-events: none; opacity: .38; filter: blur(55px);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 28%, transparent), transparent 68%); }
.voice-orb-stage { min-height: clamp(230px, 35vh, 340px); display: grid; place-items: center;
  position: relative; isolation: isolate; }
.voice-state { --orb-a: #8ee8d1; --orb-b: #b8a8ff; --orb-c: #f4c8ff;
  width: clamp(205px, 27vw, 270px); aspect-ratio: 1; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 34px; border: 0; border-radius: 50%; color: var(--text); text-align: center;
  background: radial-gradient(circle at 48% 40%, color-mix(in srgb, var(--surface) 96%, white),
    color-mix(in srgb, var(--surface-2) 92%, black) 72%);
  box-shadow: inset 0 0 34px rgba(0,0,0,.11), 0 18px 56px rgba(0,0,0,.18);
  transition: transform .22s ease, filter .22s ease; }
.voice-state::before { content: ""; position: absolute; inset: -12px; border-radius: inherit;
  padding: 9px; background: conic-gradient(from 205deg, var(--orb-a), #e7f5ff, var(--orb-b),
    var(--orb-c), #fff5c8, var(--orb-a));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--orb-a) 58%, transparent)); }
.voice-state::after { content: ""; position: absolute; z-index: -1; inset: -28px;
  border-radius: inherit; opacity: .34; filter: blur(20px);
  background: conic-gradient(var(--orb-a), var(--orb-b), var(--orb-c), var(--orb-a)); }
.voice-state .vs-icon { font-size: 38px; line-height: 1; filter: grayscale(.2); }
.voice-state .vs-label { max-width: 180px; font-size: clamp(17px, 2vw, 22px); font-weight: 750; }
/* Zustände verändern Farbe und Bewegung des zentralen Voice-Orbs. */
.vs-idle, .vs-listening { --orb-a: #8ee8d1; --orb-b: #b8a8ff; --orb-c: #f4c8ff; }
.vs-user { --orb-a: #ff8c78; --orb-b: #ffcf70; --orb-c: #ff8fb8;
  animation: voice-orb-listen 1.05s ease-in-out infinite; }
.vs-processing { --orb-a: #f7cb70; --orb-b: #ff9e6d; --orb-c: #e9d58f;
  animation: voice-orb-think 1.8s linear infinite; }
.vs-agent { --orb-a: #77e7b0; --orb-b: #6fc8ff; --orb-c: #b39bff;
  animation: voice-orb-speak .82s ease-in-out infinite; }
.vs-error { --orb-a: #ff6d66; --orb-b: #d74343; --orb-c: #ffad8a; }
.vs-connecting, .vs-warn { --orb-a: #e3c17b; --orb-b: #d99b75; --orb-c: #c5a8ea; }
@keyframes voice-orb-listen { 50% { transform: scale(1.035); filter: saturate(1.18); } }
@keyframes voice-orb-think { 50% { transform: rotate(1.5deg) scale(1.018); } }
@keyframes voice-orb-speak { 50% { transform: scale(1.055); filter: brightness(1.08) saturate(1.2); } }
/* Mikrofon-Pegelanzeige im Orb */
.voice-meter { display: inline-flex; align-items: flex-end; gap: 4px; height: 24px; opacity: .3; }
.voice-meter.active { opacity: 1; }
.vm-bar { width: 4px; height: 20px; border-radius: 2px; background: currentColor;
  transform: scaleY(.12); transform-origin: bottom; transition: transform .08s linear; }
.voice-orb-layout .voice-transcript { position: relative; min-height: 150px; border-color: transparent;
  background: color-mix(in srgb, var(--surface-2) 54%, transparent); }
.voice-orb-layout > .call-controls { position: relative; align-self: center; justify-content: center;
  max-width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow);
  backdrop-filter: blur(14px); }
/* „Du · …"-Platzhalter, während du sprichst / verarbeitet wird */
.vt-pending .vt-dots { display: inline-flex; align-items: center; gap: 4px; }
.vt-pending .vt-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  display: inline-block; animation: vt-blink 1s infinite; }
.vt-pending .vt-dots i:nth-child(2) { animation-delay: .2s; }
.vt-pending .vt-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes vt-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* Gemeinsame Anrufseite auf Handy und Desktop: Gesprächsfläche im ganzen Fenster. */
body.call-standalone { display: flex; flex-direction: column; min-height: var(--app-viewport-height);
  background: var(--bg); overflow-y: auto; -webkit-text-size-adjust: 100%;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
           max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
/* Der direkte Call bleibt in derselben dunklen Café-Optik wie die Kontaktliste. */
body.call-standalone.call-direct {
  color-scheme: dark;
  padding: 0;
  background: radial-gradient(ellipse 90% 52% at 50% -8%, #68442d 0%, #2b1d13 55%, #160f0a 100%);
}
.call-page { width: 100%; max-width: 440px; margin: auto; }
.call-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 16px 18px 18px; box-shadow: 0 10px 40px rgba(60,40,20,.10); }
body.call-standalone.call-direct .call-page { max-width: none; margin: 0; min-height: var(--app-viewport-height); display: flex; }
body.call-standalone.call-direct .call-card { flex: 1; min-height: var(--app-viewport-height);
  border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
body.call-standalone.call-direct .call-view:not([hidden]) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.call-direct .call-card {
  background: rgba(55,37,25,.92);
  border-color: rgba(255,236,218,.12);
  box-shadow: 0 18px 45px rgba(18,10,5,.30);
}
/* WICHTIG: explizite display:flex-Regeln (Panel/Daten/Pfad) würden sonst das
   hidden-Attribut aushebeln → das Attribut hat hier IMMER Vorrang. */
body.call-standalone [hidden] { display: none !important; }

/* Kopfzeile: Zurück · Marke · Link teilen */
/* Kopf + Steuerleiste MÜSSEN über dem Agent-Avatar-Overlay liegen
   (.call-agent-canvas-host, z-index 20, auch bei fokussierter Kachel) — sonst
   fängt das transparente Overlay die Taps ab und „Lautsprecher/Mikro/…" sind
   nicht mehr bedienbar, obwohl sichtbar. */
.cc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  position: relative; z-index: 30; }
.cc-head-back { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text); font-size: 19px; line-height: 1; cursor: pointer; }
.cc-head-back:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.cc-head-brand { flex: 1; min-width: 0; font-size: 15px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-head-brand b { color: var(--text); font-weight: 700; }
.cc-head-logo { color: var(--accent); }
.cc-head-sep { color: var(--muted); }
/* Konferenz-Kopf: links Hinweis „Konferenz" + Teilnehmerzahl + Dauer. Nur im
   Konferenz-Modus sichtbar; verdrängt dann die normale Produkt-Zeile. */
.cc-conf-head { display: none; align-items: center; gap: 10px; flex: 1; min-width: 0; }
body.call-conference .cc-head-brand { display: none; }
body.call-conference .cc-conf-head { display: flex; }
/* Die Mobil-/Video-Layouts blenden .cc-head aus, um Platz zu sparen. Im
   Konferenz-Modus bleibt der Kopf („Konferenz · N Teilnehmer · Dauer") sichtbar. */
body.call-conference .cc-head { display: flex !important; }
body.call-conference {
  --call-safe-top: env(safe-area-inset-top, 0px);
  --call-safe-right: env(safe-area-inset-right, 0px);
  --call-safe-left: env(safe-area-inset-left, 0px);
}
/* Die volle Gesprächsfläche entfernt das Karten-Padding. Der Konferenz-Kopf braucht
   seinen eigenen Abstand zur Displaykante und zu Notch/Dynamic Island. */
body.call-standalone.call-has-video.call-conference .cc-head {
  padding: max(8px, var(--call-safe-top)) max(12px, var(--call-safe-right)) 0
           max(12px, var(--call-safe-left));
}
/* Auflegen OBEN RECHTS (nur Konferenz): rotes, abgerundetes Icon. Unten wird das
   Auflegen-Icon dann ausgeblendet (liegt jetzt im Kopf). */
.cc-head-hangup { display: none; flex: 0 0 auto; margin-left: auto; align-items: center;
  justify-content: center; width: 46px; height: 34px; border: 0; border-radius: 11px;
  background: #ff0038; color: #fff; cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 0, 56, .3); }
.cc-head-hangup:hover { filter: brightness(1.08); }
.cc-head-hangup:active { transform: scale(.95); }
body.call-conference .cc-head-hangup { display: inline-flex; }
body.call-conference .cc-head-hangup { margin-left: 0; }
.cc-conf-timer { display: none; flex: 0 0 auto; align-items: center; gap: 6px;
  margin-left: auto; padding: 5px 10px; border-radius: 999px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.call-conference .cc-conf-timer { display: inline-flex; }
body.call-conference #callTimer { display: none !important; }
body.call-conference .cc-cbtn-hangup { display: none; }
/* Konferenz nutzt denselben Hintergrund wie der Direkt-Call (dunkle Café-Optik) —
   KEINE eigene Flächenfarbe (bewusst nicht überschrieben, Nutzerwunsch). */
.cc-conf-head .cch-ico { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.cc-conf-head .cch-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.cc-conf-head .cch-main b { color: var(--text); font-weight: 800; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-conf-head .cch-sub { color: var(--text-dim); font-size: 12px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.cc-conf-head .cch-dot { color: var(--muted); }
.cc-head-share { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--accent);
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 999px; cursor: pointer; }
.cc-head-share:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }

/* Timer-Pille, Titel, Untertitel */
.cc-timer { display: flex; align-items: center; gap: 6px; width: fit-content; margin: 0 auto 9px;
  padding: 5px 14px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.cc-timer-ico { font-size: 12px; }
/* Die reine Daueranzeige darf die Kachel-Buttons darunter nicht abfangen. */
body.call-conference .cc-timer { pointer-events: none; }
.cc-title { font-size: 21px; font-weight: 800; text-align: center; letter-spacing: -.01em;
  line-height: 1.15; color: var(--text); margin: 0 0 5px; }
.cc-sub { text-align: center; color: var(--text-dim); font-size: 13px; line-height: 1.4; margin: 0 0 12px; }
.cc-hidden-dot { display: none; }   /* statusDot pflegt call.js, hier unsichtbar */

/* Direkter Konto-Call: eine einzige, reduzierte Ansicht fuer Klingeln,
   Verbinden und Gespraech. Die Bedienelemente bleiben unten, der Kontaktname
   bildet den ruhigen visuellen Mittelpunkt. */
.call-direct #liveView:not([hidden]) { min-height: min(620px, calc(var(--app-viewport-height) - 110px)); }
.call-direct #peerName { margin-top: clamp(58px, 16vh, 132px); font-size: clamp(28px, 7vw, 38px); }
.call-direct #statusText { margin-top: 8px; font-size: 16px; }
.call-direct #callTimer { margin-top: 10px; margin-bottom: 0; }
.call-direct .call-permission-settings { align-self: center; width: auto; margin-top: 14px; }
.call-direct #liveError { max-width: 360px; margin-inline: auto; text-align: center; }
.call-direct .cc-bar { margin-top: auto; padding-top: 34px; }
.call-direct .cc-cbtn-ring {
  background: #3b2a1f;
  border-color: rgba(255,236,218,.13);
}

/* Teilnehmer-Karten */
.cc-cards { display: flex; flex-direction: column; gap: 9px; margin-bottom: 10px; }
.cc-card { display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.cc-avatar { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; display: grid;
  place-items: center; font-size: 20px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); }
.cc-avatar-mic { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface-2));
  border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.cc-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cc-card-name { font-size: 15px; font-weight: 700; color: var(--text); }
.cc-state { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.cc-state-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.cc-state-dot.ok { background: var(--ok); }
.cc-state-dot.connecting { background: var(--warn); animation: pulse 1.2s infinite; }
.cc-state-dot.warn { background: var(--warn); }
.cc-state-dot.err { background: var(--err); }

/* Wellenform: nth-child gibt die Silhouette, call.js hellt Balken via .on/.hot auf. */
.cc-wave { display: flex; align-items: center; gap: 3px; height: 18px; }
.cc-wave i { flex: 1; min-width: 2px; max-width: 4px; height: 40%; border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  transition: background .1s ease, height .1s ease, opacity .1s ease; }
.cc-wave i:nth-child(3n)   { height: 72%; }
.cc-wave i:nth-child(3n+2) { height: 94%; }
.cc-wave i:nth-child(4n)   { height: 52%; }
.cc-wave i:nth-child(7n)   { height: 100%; }
.cc-wave i:nth-child(5n+1) { height: 34%; }
.cc-wave i.on { background: var(--accent); }
.cc-wave i.hot { background: color-mix(in srgb, var(--accent) 62%, var(--warn)); }

/* Verschlüsselungs-Pille */
.cc-secure { display: flex; align-items: center; gap: 9px; margin-bottom: 8px;
  padding: 9px 13px; border-radius: 11px; font-size: 12.5px;
  color: color-mix(in srgb, var(--ok) 45%, var(--text));
  background: color-mix(in srgb, var(--ok) 9%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--ok) 16%, var(--border)); }
.cc-secure-ico { color: var(--ok); font-size: 14px; }

/* Technische Details (aufklappbar) */
.cc-tech-toggle { display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 13px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text-dim); font: inherit; font-size: 13.5px; cursor: pointer; }
.cc-tech-toggle:hover { background: var(--surface-2); }
.cc-tech-ico { color: var(--accent); font-size: 11px; letter-spacing: -2px; }
.cc-tech-label { flex: 1; text-align: left; font-weight: 600; color: var(--text); }
.cc-tech-chevron { color: var(--muted); transition: transform .2s ease; }
.cc-tech-toggle.open .cc-tech-chevron { transform: rotate(180deg); }
.cc-tech-panel { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.cc-vol { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.cc-vol input { flex: 1; }

/* Runde Steuerleiste */
.cc-bar { display: flex; align-items: flex-start; justify-content: center; gap: 26px; margin-top: 14px;
  position: relative; z-index: 30; }   /* über dem Avatar-Overlay (siehe .cc-head) */
.cc-cbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0;
  background: transparent; color: var(--text-dim); font: inherit; font-size: 12.5px; cursor: pointer; }
.cc-cbtn-ring { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; color: var(--accent); background: var(--surface-2); border: 1px solid var(--border);
  transition: background .15s ease, transform .1s ease; }
.cc-media-icon { position: relative; display: grid; width: 27px; height: 27px; place-items: center; }
.cc-media-icon svg { width: 25px; height: 25px; overflow: visible; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cc-cbtn.media-off .cc-media-icon::after { content: ""; position: absolute; left: 50%; top: 50%;
  width: 30px; height: 2.4px; border-radius: 2px; background: currentColor;
  transform: translate(-50%, -50%) rotate(-45deg); }
.cc-cbtn:hover .cc-cbtn-ring { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.cc-cbtn:active .cc-cbtn-ring { transform: scale(.94); }
.cc-cbtn-label b { color: var(--accent); font-weight: 700; }
.cc-cbtn.media-off .cc-cbtn-ring,
.cc-cbtn.active .cc-cbtn-ring { color: var(--warn);
  background: color-mix(in srgb, var(--warn) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.cc-cbtn.active .cc-cbtn-label b { color: var(--warn); }
/* Anrufaktionen wie bei WhatsApp: dunkle Kreise mit weißen Symbolen; aktive
   Schalter werden hell. Stumm hat dabei ein rotes Mikrofon. */
#muteBtn .cc-cbtn-ring,
#spkBtn .cc-cbtn-ring,
#camBtn .cc-cbtn-ring,
#camSwitchBtn .cc-cbtn-ring,
#screenShareBtn .cc-cbtn-ring,
#addAgentBtn .cc-cbtn-ring { color: #fff; background: #0b0b0b; border-color: #333; }
#spkBtn.route-on .cc-cbtn-ring,
#camBtn[aria-pressed="true"] .cc-cbtn-ring,
#screenShareBtn[aria-pressed="true"] .cc-cbtn-ring { color: #0b0b0b; background: #fff; border-color: #fff; }
#muteBtn.media-off .cc-cbtn-ring { color: #ff0038; background: #fff; border-color: #fff; }
/* Lautsprecher wie in CallKit: AUS = halbtransparenter, leicht abgedunkelter grauer Kreis (iOS-
   Systemmaterial) mit weissem Symbol; AN = weisser Kreis mit dunklem Symbol (s. route-on).
   Nicht schaltbar (Browser) zusaetzlich gedimmt. */
#spkBtn:not(.route-on) .cc-cbtn-ring {
  color: #fff;
  background: rgba(120, 120, 128, .36);
  border-color: transparent;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
#spkBtn[aria-disabled="true"] .cc-cbtn-ring { opacity: .45; }
/* Die Symbole bezeichnen die Aktion; der helle Hintergrund zeigt ihren Zustand. */
#muteBtn .cc-media-icon::after,
#camBtn .cc-media-icon::after { content: none; }
#hangupBtn .cc-cbtn-ring { color: #fff; background: #ff0038; border-color: #ff0038; }
#hangupBtn:hover .cc-cbtn-ring { background: #e60032; }
.cc-cbtn.tv-connected .cc-cbtn-ring { color: #48d597;
  background: color-mix(in srgb, #48d597 17%, var(--surface-2));
  border-color: color-mix(in srgb, #48d597 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, #48d597 12%, transparent); }
.cc-cbtn.tv-connected .cc-cbtn-label { color: #48d597; font-weight: 700; }
.cc-cbtn-hangup .cc-cbtn-ring { color: #fff; background: var(--err); border-color: var(--err); }
.cc-cbtn-hangup:hover .cc-cbtn-ring { background: color-mix(in srgb, var(--err) 88%, #000); }
.cc-cbtn-hangup .cc-cbtn-label { color: var(--err); font-weight: 600; }
/* „+ Hinzufügen"-Picker (Agent/Avatar in den Anruf holen). */
.call-agent-picker { position: fixed; inset: 0; z-index: 200; display: grid; place-items: end center; padding: 0 0 max(16px, env(safe-area-inset-bottom)); background: rgba(10,8,6,.72); overscroll-behavior: contain; }
/* Karte: eigener (deckender) Hintergrund — --surface-1 ist auf der Call-Seite nicht definiert und ließ
   die Steuerleiste durch die Karte scheinen. Liste scrollt, Titel und „Abbrechen" bleiben stehen. */
.cap-card { width: min(100%, 380px); max-height: min(52vh, 440px, calc(100dvh - 32px - env(safe-area-inset-bottom))); min-height: 0; box-sizing: border-box; display: flex; flex-direction: column; padding: 12px 12px calc(10px + env(safe-area-inset-bottom)); border: 1px solid var(--border, rgba(255,236,218,.18)); border-top-left-radius: 20px; border-top-right-radius: 20px; color: var(--text, #f7eee6); background: var(--surface-1, #1c1410); box-shadow: 0 -20px 60px rgba(0,0,0,.45); overflow: hidden; }
.cap-title { flex: none; padding: 2px 6px 8px; font-size: 15px; font-weight: 760; }
.cap-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; display: grid; align-content: start; gap: 6px; padding-bottom: 2px; }
.cap-item { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border, rgba(255,236,218,.18)); border-radius: 12px; font-size: 14px; color: var(--text, #f7eee6); background: var(--surface-2, #39271d); text-align: left; }
.cap-item[disabled] { opacity: .5; }
.cap-av { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; font-size: 14px; font-weight: 800; color: #fff; background: linear-gradient(145deg, #86583b, #563722); }
.cap-name { flex: 1; min-width: 0; font-weight: 640; overflow-wrap: anywhere; }
.cap-warn { color: var(--warn, #e0a84a); font-size: 12px; }
.cap-empty { padding: 18px 8px; color: var(--text-dim, rgba(247,238,230,.7)); text-align: center; }
.cap-section { padding: 8px 6px 0; color: var(--text-dim, rgba(247,238,230,.7)); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.cap-close { flex: none; margin-top: 8px; min-height: 38px; border: 1px solid var(--border, rgba(255,236,218,.18)); border-radius: 12px; font-size: 14px; color: var(--text, #f7eee6); background: var(--surface-2, #39271d); font-weight: 700; }
/* Breite Fenster (Mac/Desktop): zentrierter Dialog statt Bottom-Sheet. */
@media (min-width: 700px) { .call-agent-picker { place-items: center; padding: 24px; } .cap-card { border-radius: 18px; max-height: min(52vh, 440px, calc(100dvh - 48px)); } }

/* Kontakt-Auswahl beim direkten „Nutzer anrufen" aus den Sprachgesprächen. */
.contact-pick-list { display: grid; gap: 8px; margin-top: 12px; max-height: 46vh; overflow-y: auto; }
.contact-pick-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: var(--surface-2); text-align: left; cursor: pointer; }
.contact-pick-item:hover { background: var(--surface-1); }
.contact-pick-item[disabled] { opacity: .5; cursor: default; }
.contact-pick-av { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; font-size: 16px; font-weight: 800; color: #fff; background: linear-gradient(145deg, #86583b, #563722); }
.contact-pick-name { flex: 1; min-width: 0; font-weight: 640; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-pick-note { color: var(--text-dim); font-size: 12px; }
/* Avatar-Kachel(n) hinzugefügter KI-Agenten im 1:1-Anruf: frei VERSCHIEBBAR +
   GRÖSSENVERSTELLBAR über den ConferenceCanvas. Overlay zwischen Kopf und
   Steuerleiste (die liegen höher → bleiben immer bedienbar). */
.call-agent-canvas-host { position: fixed; left: 0; right: 0; top: 128px; bottom: 116px; z-index: 20; }
.call-agent-canvas-host .conf-canvas { position: absolute; inset: 0; border: 0; background: transparent; }
/* Querformat-Telefon: Bei ~393–430px Höhe lassen top:128/bottom:116 nur einen
   sehr flachen, breiten Streifen übrig → die (einzelne) Agent-Kachel wird ein
   dünner Balken. Stattdessen eine richtige Kachel-Box RECHTS neben dem Kontakt. */
@media (orientation: landscape) and (max-height: 600px) {
  /* An den oberen Bildschirmrand gezogen (vorher top:54px): der Platz, den früher
     das Bild-in-Bild-Icon in der Ecke belegte, gehört jetzt der Agent-Kachel. */
  .call-agent-canvas-host { top: 10px; bottom: 82px; left: auto; right: 10px; width: min(42%, 360px); }
}

/* Konferenz-Darstellung (>= 3 Teilnehmer): Menschen UND Agenten liegen als Kacheln
   im SELBEN Grid → die Direkt-Video-Bühne wird ausgeblendet (kein Doppel), und das
   Grid nutzt die volle Fläche zwischen Kopf und Steuerleiste. Direkt (<= 3) bleibt
   unverändert: dunkles Layout OHNE Extra-Kacheln für Anrufer/Empfänger. */
body.call-conference #videoStage { display: none !important; }
body.call-conference .call-agent-canvas-host {
  left: max(10px, var(--call-safe-left)); right: max(10px, var(--call-safe-right));
  top: calc(56px + var(--call-safe-top)); bottom: 112px; width: auto;
}
@media (orientation: landscape) and (max-height: 600px) {
  /* Platz für den Konferenz-Kopf lassen (nicht top:10 wie bei der Einzel-Kachel),
     sonst verdeckt das Grid den „Konferenz · N Teilnehmer"-Kopf. */
  body.call-conference .call-agent-canvas-host { top: calc(50px + var(--call-safe-top)); bottom: 76px; }
}

/* Beibehaltene Basis-Elemente */
.call-view h1 { font-size: 22px; margin: 0 0 10px; }
.call-hint, .cc-sub { color: var(--text-dim); }
.call-label { display: block; margin: 14px 0; font-size: 13px; font-weight: 600; }
/* 16px verhindert das automatische Hineinzoomen von iOS beim Fokussieren. */
.call-label input, .call-label select { display: block; width: 100%; margin-top: 6px; font-size: 16px; }
.call-big { width: 100%; justify-content: center; min-height: 48px; margin-top: 12px; }
.call-error { color: var(--err); font-size: 13px; margin-top: 10px; }
.call-devices { margin-top: 4px; }
.call-quality { font-size: 12px; color: var(--text-dim); overflow-x: auto; margin: 0;
  max-height: 220px; overflow-y: auto; }
/* Live-Datenverbrauch (gesendet / empfangen / Rate) — bleibt erhalten */
.call-data { display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.call-data .cd-ico { font-size: 18px; }
.call-data .cd-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.call-data .cd-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.call-data .cd-label { font-size: 11px; color: var(--text-dim); }
.call-data .cd-val { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.call-data-summary { margin-top: 12px; font-size: 14px; color: var(--text-dim); }
.call-data-summary b { color: var(--text); font-variant-numeric: tabular-nums; }

/* --------- Video-Telefonie (Ergänzung; Audio-Layout unverändert) --------- */
/* Anrufart-Auswahl auf der Beitritts-Seite (Sprach- vs. Videoanruf). */
.call-type { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 6px; }
.call-type-opt { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; }
.call-type-opt .ct-ico { font-size: 22px; line-height: 1; }
.call-type-opt .ct-txt { display: flex; flex-direction: column; line-height: 1.2; }
.call-type-opt .ct-txt b { font-weight: 700; }
.call-type-opt .ct-txt span { font-size: 12px; color: var(--text-dim); }
.call-type-opt:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.call-type-opt.active { border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: 0 0 0 1px var(--accent) inset; }

/* Nicht-blockierender Hinweis (z. B. „mit Audio fortgefahren"). */
.call-note { margin-top: 10px; font-size: 13px; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
body.call-has-video { --call-note-bottom: 112px; }
body.call-has-video .call-note { position: fixed; z-index: 35; margin: 0;
  left: 50%; transform: translateX(-50%); bottom: calc(var(--call-note-bottom) + env(safe-area-inset-bottom, 0px));
  width: min(440px, calc(100% - var(--call-safe-left, 0px) - var(--call-safe-right, 0px) - 32px));
  box-sizing: border-box; pointer-events: none; }
body.call-conference:has(#liveNote:not([hidden])) .call-agent-canvas-host {
  bottom: calc(var(--call-note-bottom) + env(safe-area-inset-bottom, 0px) + var(--call-note-height, 56px) + 12px);
}

/* Video-Bühne: zwei Kacheln (Gegenüber + Eigenbild), Rollen per .swapped tauschbar. */
.call-stage { position: relative; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; margin: 2px 0 12px;
  border-radius: 16px; overflow: hidden; background: #111; border: 1px solid var(--border);
  touch-action: none; }
/* ADAPTIV (nur Desktop/Tablet, NICHT die mobilen Vollbild-Fälle unten): Sobald das
   JS das echte Seitenverhältnis des großen Videos als Inline-`aspect-ratio` setzt,
   richtet sich die Bühne danach — Breite schrumpft bei Bedarf und wird zentriert,
   in der Höhe gedeckelt. So füllt das Video den Rahmen ohne Beschnitt UND ohne
   schwarze Balken (Hoch- wie Querformat). Ohne gesetztes Verhältnis bleibt der
   16:9-Fallback oben aktiv. Auf dem Handy bleibt der Vollbild-Stage (cover) — die
   min-width/min-height-Grenze klammert die immersiven Mobile/Landscape-Modi aus,
   damit deren Vollbild nicht durch max-height gestaucht wird. */
@media (min-width: 561px) and (min-height: 601px) {
  .call-stage[style*="aspect-ratio"] { width: auto; margin-inline: auto; max-height: 72vh; }
}
.call-tile { position: absolute; overflow: hidden; background: #111; box-sizing: border-box;
  transition: inset .18s ease, width .18s ease, height .18s ease, border-radius .18s ease; }
/* Video IMMER vollständig in die Kachel einpassen (nie beschneiden/zoomen) –
   einheitlich für Raster, 1:1 und Eigenbild. Passt das Seitenverhältnis nicht
   zur Kachel (z. B. Querformat in Hochkant-Kachel), bleiben schmale schwarze
   Ränder statt eines Ausschnitts. In der adaptiven 1:1-Ansicht nimmt die Bühne
   ohnehin das Videoformat an, sodass dort keine Ränder entstehen. */
.call-tile-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #111; }
.call-mirror { transform: scaleX(-1); }          /* Eigenbild spiegeln (wie ein Spiegel) */

/* Technische Videofläche fürs Betriebssystem-PiP. Nicht display:none setzen:
   einige Mobilbrowser lassen nur ein tatsächlich gerendertes <video> in PiP zu. */
.call-pip-media { position: fixed; left: -2px; bottom: -2px; z-index: -1;
  width: 1px; height: 1px; opacity: .001; pointer-events: none; }

/* Standard: Gegenüber groß (Haupt), Eigenbild klein (PiP unten rechts). */
.call-remote-tiles { position: absolute; inset: 0; z-index: 1; }
.call-tile-remote { inset: 0; z-index: 1; }
.call-tile-local  { right: 12px; bottom: 12px; width: 30%; max-width: 150px; min-width: 92px;
  aspect-ratio: 3 / 4; z-index: 2; border-radius: 12px;
  border: 2px solid rgba(255,255,255,.7); box-shadow: 0 6px 18px rgba(0,0,0,.35); }

/* Agent im 1:1-Anruf: die Agent-Kachel (Canvas-Host, z-index 20) liegt als Overlay
   über der Bühne und verdeckte das Eigenbild. Das kleine Eigenbild bleibt deshalb
   darüber (unter Steuerleiste/Hinweisen, die höher liegen). */
body:not(.call-conference):has(#agentCanvasHost:not([hidden])) .call-stage:not(.swapped) .call-tile-local { z-index: 25; }

/* Getauscht (nach oben wischen): Eigenbild groß, Gegenüber klein. */
.call-stage.swapped .call-tile-remote { inset: auto; right: 12px; bottom: 12px;
  width: 30%; max-width: 150px; min-width: 92px; aspect-ratio: 3 / 4; z-index: 2;
  border-radius: 12px; border: 2px solid rgba(255,255,255,.7); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.call-stage.swapped .call-tile-local { inset: 0; right: auto; bottom: auto;
  width: 100%; height: 100%; max-width: none; min-width: 0; aspect-ratio: auto;
  z-index: 1; border: 0; border-radius: 0; box-shadow: none; }

/* Mehrere Menschen: jede participantId besitzt eine eigene, dauerhafte Kachel.
   Das lokale Bild bleibt als eigene PiP-Kachel erhalten; Remote-Kacheln werden
   als Grid gerendert und nie ueber einen einzelnen globalen Video-Slot ersetzt. */
.call-stage.call-multiparty .call-remote-tiles {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr); gap: 4px; padding: 4px; background: #09090c;
}
.call-stage.call-multiparty[data-remote-count="3"] .call-remote-tiles,
.call-stage.call-multiparty[data-remote-count="4"] .call-remote-tiles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.call-stage.call-multiparty[data-remote-count="5"] .call-remote-tiles,
.call-stage.call-multiparty[data-remote-count="6"] .call-remote-tiles,
.call-stage.call-multiparty[data-remote-count="7"] .call-remote-tiles {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.call-stage.call-multiparty .call-tile-remote,
.call-stage.call-multiparty.swapped .call-tile-remote {
  position: relative; inset: auto; right: auto; bottom: auto;
  width: auto; height: auto; max-width: none; min-width: 0; aspect-ratio: auto;
  z-index: 1; border: 0; border-radius: 10px; box-shadow: none;
}
.call-stage.call-multiparty .call-tile-remote .call-resize-handle { display: none; }
.call-stage.call-multiparty .call-tile-remote::after { display: none; }

/* Raster-Kacheln per LANGDRUCK aufnehmen und per Drag&Drop vertauschen. */
.call-stage.call-multiparty .call-tile-remote { cursor: grab; touch-action: none; }
.call-tile-remote.tile-lifted {
  z-index: 20; pointer-events: none; cursor: grabbing; border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,.6); transition: none; /* dem Finger ohne Nachlauf folgen */
}
.call-tile-remote.tile-drop-target {
  outline: 3px solid var(--accent, #6aa0ff); outline-offset: -3px; border-radius: 12px;
}
.call-tile-remote.tile-drop-target::before {
  content: ""; position: absolute; inset: 0; z-index: 6; border-radius: 10px;
  background: rgba(106,160,255,.16); pointer-events: none;
}

/* „Kamera aus"-Overlays füllen ihre jeweilige Kachel (Punkt 16). */
.call-remote-off, .call-local-off { position: absolute; inset: 0; }
.call-remote-off { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; background: radial-gradient(circle at 50% 40%, #2a2a30, #14141a); color: #e9e9ef; }
.call-remote-off .cro-avatar { width: 76px; height: 76px; border-radius: 50%; display: grid;
  place-items: center; font-size: 34px; background: rgba(255,255,255,.10); }
.call-remote-off .cro-name { font-size: 16px; font-weight: 700; }
.call-remote-off .cro-label { font-size: 13px; color: #b9b9c6; }
.call-local-off { display: grid; place-items: center; background: #1b1b22; color: #cfcfda;
  font-size: 12px; text-align: center; padding: 6px; }
/* Warte-/Verbindungs-Zustand (noch kein echter Peer): KEIN großer Initialen-Kreis
   in der Mitte — nur ein dezenter Online-/Verbindungs-Hinweis mit Statuspunkt. */
.call-tile-waiting .cro-avatar { display: none; }
.call-tile-waiting .cro-label { display: none; }
.call-tile-waiting .cro-name { font-size: 14px; font-weight: 600; color: #cfcfda;
  display: inline-flex; align-items: center; gap: 9px; }
.call-tile-waiting .cro-name::before { content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--warn, #f0a020); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn, #f0a020) 20%, transparent); }
.call-tile-waiting.call-online .cro-name::before { background: var(--ok, #35c759);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok, #35c759) 20%, transparent); }
/* Wenn das Gegenüber klein ist (getauscht), Platzhalter kompakter. */
.call-stage.swapped .call-remote-off .cro-avatar { width: 40px; height: 40px; font-size: 20px; }
.call-stage.swapped .call-remote-off .cro-name { font-size: 12px; }
.call-stage.swapped .call-remote-off .cro-label { display: none; }

/* Kurzer Tausch-Hinweis. */
.call-swap-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 3;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 999px;
  pointer-events: none; display: flex; align-items: center; gap: 6px; }

/* Die jeweils kleine Kamera lässt sich verschieben und am Griff unten rechts
   proportional skalieren. Video/Platzhalter fangen die Touch-Gesten nicht ab. */
.call-stage:not(.swapped) .call-tile-local,
.call-stage.swapped .call-tile-remote {
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-user-drag: none; will-change: left, top, width, height;
}
.call-tile-video, .call-remote-off, .call-local-off { pointer-events: none; -webkit-user-drag: none; }
.call-stage:not(.swapped) .call-tile-local::after,
.call-stage.swapped .call-tile-remote::after {
  content: ""; position: absolute; top: 6px; left: 50%; z-index: 4;
  width: 30px; height: 4px; transform: translateX(-50%); border-radius: 999px;
  background: rgba(255,255,255,.78); box-shadow: 0 1px 4px rgba(0,0,0,.4);
  pointer-events: none;
}
.call-tile.dragging, .call-tile.resizing { transition: none; }
.call-tile.dragging { cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.48); }
.call-resize-handle { display: none; position: absolute; left: 0; top: 0; z-index: 5;
  width: 38px; height: 38px; padding: 0; border: 0; border-radius: 0 0 14px 0;
  background: rgba(0,0,0,.28); cursor: nwse-resize; touch-action: none; }
.call-resize-handle::after { content: ""; position: absolute; left: 7px; top: 7px;
  width: 12px; height: 12px; border-left: 3px solid rgba(255,255,255,.92);
  border-top: 3px solid rgba(255,255,255,.92); border-radius: 3px 0 0 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.55)); }
.call-stage:not(.swapped) .call-tile-local .call-resize-handle,
.call-stage.swapped .call-tile-remote .call-resize-handle { display: block; }

/* „Benachrichtigen, wenn jemand beitritt" — dezenter Pill-Button beim Warten. */
.call-notify-btn { display: inline-flex; align-items: center; gap: 8px; align-self: center;
  margin: 8px auto 2px; padding: 8px 15px; border: 1px solid var(--border, rgba(127,127,127,.35));
  border-radius: 999px; background: var(--surface-2, rgba(127,127,127,.08)); color: inherit;
  font: inherit; font-size: 14px; cursor: pointer; }
.call-notify-btn:hover { background: rgba(127,127,127,.16); }
.call-notify-btn .cnb-ico { font-size: 16px; }
.call-notify-btn.done { color: #1a7f37; border-color: rgba(26,127,55,.42);
  background: rgba(26,127,55,.09); cursor: default; }
body.call-has-video .call-notify-btn { display: none; }   /* im Video-Modus nicht nötig */

/* Gemeinsame Video-/Anrufansicht: Das Kamerabild ist die vollflächige Bühne. Kopf, Timer
   und Bedienung schweben darüber. So entstehen weder seitliche schwarze Flächen
   noch ein künstlich verkleinertes Videofenster. */
@media screen {
  body.call-has-video:not(.call-immersive),
  body.call-has-video:not(.call-immersive) .call-page,
  body.call-has-video:not(.call-immersive) .call-card,
  body.call-has-video:not(.call-immersive) .call-view:not([hidden]) {
    height: var(--app-viewport-height); overflow: hidden; background: #000;
  }
  body.call-has-video:not(.call-immersive) .call-card {
    padding: 0; background: #000;
  }
  body.call-has-video:not(.call-immersive) .call-stage {
    position: fixed; inset: 0; z-index: 1; width: var(--app-viewport-width); height: var(--app-viewport-height);
    min-height: var(--app-viewport-height); margin: 0; border: 0; border-radius: 0;
    aspect-ratio: auto !important; background: #000;
  }
  body.call-has-video:not(.call-immersive) .cc-head {
    position: fixed; top: 0; left: 0; right: 0; z-index: 30; margin: 0;
    padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 30px
             max(16px, env(safe-area-inset-left));
    background: linear-gradient(to bottom, rgba(0,0,0,.72), rgba(0,0,0,.34) 62%, transparent);
  }
  body.call-has-video:not(.call-immersive) .cc-head-brand,
  body.call-has-video:not(.call-immersive) .cc-head-brand b { color: #fff; }
  body.call-has-video:not(.call-immersive) .cc-head-sep { color: rgba(255,255,255,.62); }
  body.call-has-video:not(.call-immersive) .cc-head-back {
    color: #fff; background: rgba(0,0,0,.28);
  }
  body.call-has-video:not(.call-immersive) .cc-head-share {
    color: #fff; border-color: rgba(255,255,255,.38); background: rgba(0,0,0,.32);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  body.call-has-video:not(.call-immersive) .cc-timer {
    position: fixed; top: calc(max(14px, env(safe-area-inset-top)) + 55px); left: 50%;
    z-index: 31; transform: translateX(-50%); margin: 0; color: #fff;
    background: rgba(0,0,0,.38); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  body.call-has-video:not(.call-immersive) .cc-secure,
  body.call-has-video:not(.call-immersive) .cc-title,
  body.call-has-video:not(.call-immersive) .cc-sub,
  body.call-has-video:not(.call-immersive) .cc-tech-toggle,
  body.call-has-video:not(.call-immersive) .cc-tech-panel { display: none; }
  body.call-has-video:not(.call-immersive) .cc-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0;
    display: flex; flex-wrap: nowrap;
    padding: 10px 6px max(12px, env(safe-area-inset-bottom)); gap: 0;
    background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.38) 72%, rgba(0,0,0,0));
  }
  /* Auf dem dunklen Overlay: helle, gut lesbare Beschriftung. */
  body.call-has-video:not(.call-immersive) .cc-cbtn {
    flex: 1 1 0; min-width: 0; width: auto; gap: 5px;
  }
  body.call-has-video:not(.call-immersive) .cc-cbtn-label,
  body.call-has-video:not(.call-immersive) .cc-cbtn-label b {
    color: #fff; font-size: 11px; line-height: 1.15; text-align: center;
  }
  body.call-has-video:not(.call-immersive) .cc-cbtn-ring {
    width: 48px; height: 48px; background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.30); backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  /* Eigenbild direkt oberhalb der einreihigen Bedienung. */
  body.call-has-video:not(.call-immersive) .call-tile-local {
    top: auto; bottom: calc(112px + env(safe-area-inset-bottom)); right: 12px;
    width: 27%; max-width: 112px; min-width: 88px;
  }
  body.call-has-video:not(.call-immersive) .call-swap-hint {
    bottom: calc(112px + env(safe-area-inset-bottom));
  }
  /* Mobile Regression: Die normale PiP-Regel darf die große lokale Kachel im
     getauschten Modus nicht wieder auf 27 % Breite reduzieren. */
  body.call-has-video:not(.call-immersive) .call-stage.swapped .call-tile-local {
    inset: 0; width: 100%; height: 100%; max-width: none; min-width: 0;
    aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none;
  }
  body.call-has-video:not(.call-immersive) .call-stage.swapped .call-tile-remote {
    inset: auto 12px calc(112px + env(safe-area-inset-bottom)) auto;
    width: 27%; height: auto; max-width: 112px; min-width: 88px; aspect-ratio: 3 / 4;
  }
}

/* Harte iPhone-Fallbackregel. call.js setzt diese Klasse nur während eines
   mobilen Videoanrufs und aktualisiert die beiden Maße aus visualViewport.
   Sie steht außerhalb aller Media-Queries und gewinnt bewusst gegen alte
   Flex-/aspect-ratio-Regeln, die sonst den hellen Streifen erzeugen. */
body.call-standalone.call-has-video.call-mobile-video-layout,
body.call-has-video.call-mobile-video-layout .call-page,
body.call-has-video.call-mobile-video-layout .call-card,
body.call-has-video.call-mobile-video-layout .call-view:not([hidden]) {
  width: 100% !important;
  height: var(--app-viewport-height) !important;
  min-height: var(--app-viewport-height) !important;
  max-height: none !important;
  overflow: hidden !important;
  background: #000 !important;
}
body.call-has-video.call-mobile-video-layout .call-page {
  max-width: none !important;
  margin: 0 !important;
}
body.call-has-video.call-mobile-video-layout .call-card { padding: 0 !important; }
body.call-has-video.call-mobile-video-layout .call-stage {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1 !important;
  width: var(--call-video-width, var(--app-viewport-width)) !important;
  height: var(--call-video-height, var(--app-viewport-height)) !important;
  min-width: var(--call-video-width, var(--app-viewport-width)) !important;
  min-height: var(--call-video-height, var(--app-viewport-height)) !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  aspect-ratio: auto !important;
  background: #000 !important;
}

/* Auf größeren Fenstern bleibt dieselbe Bedienleiste mittig gruppiert. */
@media (min-width: 561px) and (min-height: 601px) {
  body.call-standalone.call-has-video:not(.call-immersive) .cc-bar {
    gap: clamp(8px, 2vw, 24px); padding: 12px 18px max(16px, env(safe-area-inset-bottom));
  }
  body.call-standalone.call-has-video:not(.call-immersive) .cc-cbtn {
    flex: 0 1 auto; width: clamp(72px, 8vw, 112px);
  }
  body.call-standalone.call-has-video:not(.call-immersive) .cc-cbtn-label { font-size: 12px; }
  body.call-standalone.call-has-video:not(.call-immersive) .cc-cbtn-ring { width: 54px; height: 54px; }
  body.call-conference .call-agent-canvas-host { bottom: 128px; }
  body.call-has-video { --call-note-bottom: 140px; }
  body.call-has-video:not(.call-immersive) .call-tile-local,
  body.call-has-video:not(.call-immersive) .call-stage.swapped .call-tile-remote {
    width: 20%; max-width: 180px; min-width: 112px;
    bottom: calc(128px + env(safe-area-inset-bottom));
  }
}
/* Mehr Bedienelemente (Mikro · Kamera · Wechseln · Auflegen · Lautsprecher):
   enger setzen und bei Bedarf umbrechen, damit nichts überläuft. */
.cc-bar { flex-wrap: wrap; row-gap: 10px; }
body.call-has-video .cc-bar { gap: 18px; }

/* Handy (Hochformat): wie eine App — randlose Vollbild-Karte, Steuerung unten
   fixiert. Passt der Inhalt, sitzt die Leiste am unteren Rand; ist er zu hoch,
   scrollt die Karte sauber (nichts wird oben abgeschnitten). */
@media (max-width: 560px) {
  body.call-standalone { padding: 0; }
  .call-page { max-width: none; margin: 0; min-height: var(--app-viewport-height); display: flex; }
  .call-card { flex: 1; min-height: var(--app-viewport-height); border: 0; border-radius: 0; box-shadow: none;
    display: flex; flex-direction: column; overflow-y: auto;
    padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
             max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
  .call-view:not([hidden]) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .cc-bar { margin-top: auto; padding-top: 10px; }   /* Steuerung ans untere Ende */
  /* Die Video-Bühne wird im vorherigen Block vollflächig fixiert. Hier darf keine
     zweite Höhenregel stehen: Safari kombinierte sie sonst mit dem Flex-Layout
     und ließ unter dem Bild eine große helle Fläche frei. */
  body.call-has-video .cc-title, body.call-has-video .cc-sub,
  body.call-has-video .cc-secure { display: none; }   /* Video dominiert den Schirm */
}

/* Querformat / niedrige Höhe: Karten nebeneinander, Nebensächliches aus, kompakt. */
@media (orientation: landscape) and (max-height: 540px) {
  body.call-standalone { padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
                                 max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .call-page { max-width: 720px; }
  .call-card { min-height: auto; padding: 12px 16px; }
  .cc-sub, .cc-secure { display: none; }         /* spart Höhe, Essenzielles bleibt */
  .cc-timer { margin-bottom: 6px; }
  .cc-title { font-size: 18px; margin-bottom: 6px; }
  .cc-cards { flex-direction: row; gap: 8px; margin-bottom: 8px; }
  .cc-card { flex: 1 1 0; }
  .cc-bar { margin-top: 8px; gap: 20px; }
}

/* Handy im QUERFORMAT mit Video: die Kamera füllt die volle Fläche, die Steuerung
   schwebt als kompakte Leiste unten über dem Bild. Höhe ist knapp → Kopf/Timer/
   Nebensächliches aus. Gilt nicht in der immersiven Vollansicht (dort ist alles aus). */
@media (orientation: landscape) and (max-height: 600px) {
  body.call-has-video.call-standalone { padding: 0; }
  body.call-has-video .call-page { max-width: none; margin: 0; min-height: var(--app-viewport-height); display: flex; }
  body.call-has-video .call-card {
    flex: 1; min-height: var(--app-viewport-height); border: 0; border-radius: 0; box-shadow: none;
    display: flex; flex-direction: column; overflow: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }
  body.call-has-video .call-view:not([hidden]) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  body.call-has-video:not(.call-immersive) .cc-head,
  body.call-has-video:not(.call-immersive) .cc-timer,
  body.call-has-video:not(.call-immersive) .cc-title,
  body.call-has-video:not(.call-immersive) .cc-sub,
  body.call-has-video:not(.call-immersive) .cc-secure,
  body.call-has-video:not(.call-immersive) .cc-tech-toggle,
  body.call-has-video:not(.call-immersive) .cc-tech-panel,
  body.call-has-video:not(.call-immersive) #meters { display: none; }
  body.call-has-video:not(.call-immersive) .call-stage {
    flex: 1 1 auto; aspect-ratio: auto; min-height: 0; margin: 0;
  }
  body.call-has-video:not(.call-immersive) .cc-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0;
    flex-wrap: nowrap; gap: 16px; padding: 6px 14px max(6px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0));
  }
  body.call-has-video:not(.call-immersive) .cc-cbtn { flex: 0 1 auto; }
  body.call-has-video:not(.call-immersive) .cc-cbtn-label,
  body.call-has-video:not(.call-immersive) .cc-cbtn-label b { color: #fff; }
  body.call-has-video:not(.call-immersive) .cc-cbtn-ring {
    width: 42px; height: 42px; background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.30);
  }
  /* Eigenbild oben links — kompakt, da das Querformat niedrig ist. Frei
     verschiebbar und skalierbar bleibt es trotzdem. */
  body.call-has-video:not(.call-immersive) .call-tile-local {
    top: 10px; bottom: auto; left: 10px; right: auto; width: 20%; max-width: 132px; min-width: 78px;
  }
}
@media (max-width: 640px) { .voice-choice { grid-template-columns: 1fr; }
  .voice-studio-shell { min-height: calc(var(--app-viewport-height) - 88px); border-radius: 15px; }
  .voice-studio-toolbar { padding: 12px 12px 0; }
  .voice-studio-hero { min-height: 330px; padding-top: 82px; }
  .voice-studio-copy { left: 18px; right: 18px; top: 20px; max-width: none; text-align: center; }
  .voice-studio-mic { transform: scale(.88); transform-origin: bottom center; }
  .voice-studio-wave { width: 38%; bottom: 66px; opacity: .52; }
  .voice-studio-agents { margin: -2px 9px 10px; }
  .voice-studio-agent { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px; }
  .voice-studio-ready { grid-column: 1 / -1; grid-row: 2; }
  .voice-studio-speak { grid-column: 2; grid-row: 1; }
  .voice-agent-row { grid-template-columns: 1fr; }
  .voice-orb-stage { min-height: 235px; }
  .voice-state { width: min(66vw, 225px); }
  .voice-orb-layout > .call-controls { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .voice-state, .voice-studio-wave i { animation: none !important; transition: none; }
}
.voice-latency-debug {
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, rgba(127, 127, 127, .08));
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.voice-diagnostics-panel { padding: 20px; }
.voice-diagnostics-panel .section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:16px; }
.voice-diagnostics-panel h2 { margin:0 0 4px; }
.voice-diagnostics-controls { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:16px; }
.voice-diagnostics-controls select { min-width:min(360px, 100%); max-width:100%; text-overflow:ellipsis; }
.voice-diag-turn { padding:16px; margin:12px 0; }
.voice-diag-turn-head { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:14px; }
.voice-diag-metrics { display:grid; grid-template-columns:repeat(3,minmax(100px,1fr)); gap:12px; margin-bottom:16px; }
.voice-diag-metric { display:flex; flex-direction:column; gap:2px; }
.voice-diag-metric b { font-size:20px; }
.voice-diag-metric span,.voice-diag-turn-head .hint { color:var(--muted); }
.voice-diag-timeline { display:grid; gap:9px; }
.voice-diag-row { display:grid; grid-template-columns:minmax(90px,150px) minmax(0,1fr); gap:12px; align-items:center; }
.voice-diag-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.voice-diag-track { height:22px; position:relative; border-radius:7px; background:var(--surface-2,rgba(127,127,127,.12)); }
.voice-diag-event { position:absolute; top:4px; width:14px; height:14px; transform:translateX(-50%); border-radius:4px; background:#139c8c; }
.voice-diag-event.milestone { background:#8b5cf6; }
.voice-diag-interruption { margin-top:12px; color:#dc2626; }
.voice-diag-roster { padding:16px; margin:12px 0; }
.voice-diag-roster h3 { margin:0 0 10px; }
.voice-diag-person { border-top:1px solid var(--border,rgba(127,127,127,.2)); padding:9px 0; }
.voice-diag-person summary { cursor:pointer; font-weight:600; }
.voice-diag-person dl { display:grid; grid-template-columns:minmax(130px,190px) minmax(0,1fr); gap:5px 12px; margin:10px 0 2px; font-size:13px; }
.voice-diag-person dt { color:var(--muted); }
.voice-diag-person dd { margin:0; overflow-wrap:anywhere; }
@media(max-width:720px) { .voice-diagnostics-panel .section-head,.voice-diag-turn-head { align-items:flex-start; flex-direction:column; } .voice-diagnostics-controls { flex-direction:column; } .voice-diagnostics-controls select { width:100%; min-width:0; } .voice-diag-row { grid-template-columns:80px minmax(0,1fr); gap:8px; } }

/* ============================================================================
   Voice-Café — warmes Creme/Kaffee-Design für das Telefonieren (Voice-Call).
   Bewusst NUR unter .voice-cafe gescopet; der Rest der App bleibt unberührt.
   ========================================================================== */
.voice-cafe {
  --cafe-ink: #33251a;
  --cafe-ink-soft: rgba(51,37,26,.58);
  --cafe-ink-faint: rgba(51,37,26,.4);
  --cafe-line: rgba(51,37,26,.10);
  --cafe-line-2: rgba(51,37,26,.14);
  --cafe-cream: #fffdf9;
  --cafe-cream-2: #f8f0e5;
  --cafe-accent: #a97f52;
  --cafe-accent-2: #c99a63;
  --cafe-deep: #6f4c2c;
  --cafe-dark-a: #4a3423;
  --cafe-dark-b: #2e2118;
  --cafe-serif: 'Cormorant Garamond', Garamond, 'Times New Roman', serif;
  --cafe-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --cafe-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  font-family: var(--cafe-sans);
  color: var(--cafe-ink);
  font-weight: 300;
  background: linear-gradient(180deg, var(--cafe-cream), var(--cafe-cream-2));
  border: 1px solid var(--cafe-line);
  border-radius: 4px;
  box-shadow: 0 30px 70px -40px rgba(51,37,26,.45), 0 1px 0 rgba(255,255,255,.9) inset;
  padding: 0;
  overflow: hidden;
}
/* Dekorative Vorlagen-Ebene aus dem Standard-Orb-Layout hier neutralisieren. */
.voice-cafe.voice-orb-layout::before { content: none; }

/* --- Kopf: Serifen-Titel + Mono-Chips + Verbunden-Pille --- */
.voice-cafe .voice-cafe-head {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  padding: 24px 30px 18px; border-bottom: 1px solid rgba(51,37,26,.09);
}
.voice-cafe .vc-title {
  margin: 0; font-family: var(--cafe-serif); font-weight: 400;
  font-size: 36px; line-height: 1; letter-spacing: -.005em; color: var(--cafe-ink);
}
.voice-cafe .vc-chips { display: flex; gap: 8px; padding-bottom: 3px; flex-wrap: wrap; }
.voice-cafe .vc-chip {
  font-family: var(--cafe-mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--cafe-ink-soft);
  padding: 5px 10px; border: 1px solid var(--cafe-line-2); border-radius: 2px;
}
.voice-cafe .vc-head-right { margin-left: auto; }
.voice-cafe .vc-conn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 999px;
  background: rgba(255,252,247,.6); border: 1px solid rgba(51,37,26,.08);
  font-family: var(--cafe-mono); font-size: 10.5px; letter-spacing: .10em;
  text-transform: uppercase; color: var(--cafe-ink-soft);
}
.voice-cafe .vc-conn .call-dot { width: 6px; height: 6px; box-shadow: 0 0 0 3px rgba(169,127,82,.2); }
.voice-cafe .vc-conn .call-dot.ok { background: var(--cafe-accent); }

/* --- Zweispaltig: Orb links, Transkript rechts --- */
.voice-cafe .voice-cafe-live {
  display: grid; grid-template-columns: 1.05fr .95fr; align-items: stretch;
}
.voice-cafe .vc-orb-col {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 40px 30px 34px; border-right: 1px solid rgba(51,37,26,.09);
}
.voice-cafe .vc-scroll-col {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(240,228,211,.35), rgba(240,228,211,.12));
}

/* --- Orb: Glühen + rotierender Ring + atmende Creme-Scheibe --- */
.voice-cafe .voice-orb-stage {
  position: relative; width: 300px; max-width: 78vw;
  aspect-ratio: 1; height: auto; min-height: 0;  /* immer kreisrund */
  display: grid; place-items: center; margin: 0;
}
.voice-cafe .voice-orb-stage::before {
  content: ""; position: absolute; inset: -22px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cafe-accent-2), var(--cafe-deep), #d8b98e, #6f4c2c, var(--cafe-accent-2));
  filter: blur(32px); opacity: .55;
  animation: cafe-glow 6s ease-in-out infinite, spin 26s linear infinite; z-index: 0;
}
.voice-cafe .voice-orb-stage::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(216,185,142,.25), var(--cafe-accent-2), rgba(111,76,44,.9), #d8b98e, rgba(216,185,142,.25));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: spin 16s linear infinite; z-index: 1;
}
/* Die vorhandene Status-Pille wird zur inneren Creme-Scheibe. */
.voice-cafe .voice-state {
  position: relative; z-index: 2;
  width: 86%; height: 86%; border-radius: 50%;
  background: radial-gradient(120% 120% at 30% 20%, #fffdf9, #f2e6d6 68%, #e6d5c0);
  box-shadow: 0 24px 50px -26px rgba(51,37,26,.42), 0 2px 0 rgba(255,255,255,.95) inset, 0 0 0 1px rgba(51,37,26,.06) inset;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 0; animation: cafe-breathe 4.6s ease-in-out infinite;
}
.voice-cafe .voice-state::before,
.voice-cafe .voice-state::after { content: none; }  /* Standard-Ring/Glow entfernen */
.voice-cafe .voice-state .vs-icon {
  font-size: 30px; line-height: 1; filter: none; opacity: .85;
}
.voice-cafe .voice-state .vs-label {
  font-family: var(--cafe-serif); font-style: italic; font-weight: 400;
  font-size: 30px; letter-spacing: .01em; color: var(--cafe-ink); text-align: center;
  padding: 0 10px;
}
.voice-cafe .voice-meter { gap: 4px; height: 24px; }
.voice-cafe .voice-meter .vm-bar {
  width: 2px; border-radius: 2px; background: rgba(111,76,44,.5);
}
.voice-cafe .voice-meter.active .vm-bar { background: var(--cafe-deep); }

/* Zustandsfarben behutsam an die Kaffee-Palette angleichen. */
.voice-cafe .voice-state.vs-user .vs-label,
.voice-cafe .voice-state.vs-agent .vs-label { color: var(--cafe-ink); }
.voice-cafe .voice-state.vs-error { filter: none; }
.voice-cafe .voice-state.vs-error .vs-label { color: #8a3b2a; }

.voice-cafe .vc-hint {
  margin: 0; max-width: 340px; text-align: center;
  font-size: 14px; line-height: 1.6; color: var(--cafe-ink-soft); text-wrap: pretty;
}

/* --- Steuerleiste als Kaffee-Pillen --- */
.voice-cafe .vc-controls {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: wrap; margin: 0; padding: 0;
}
.voice-cafe .vc-controls .btn {
  font-family: var(--cafe-mono); font-size: 11px; letter-spacing: .13em;
  text-transform: uppercase; padding: 12px 22px; border-radius: 999px;
  border: 1px solid rgba(51,37,26,.18); background: transparent; color: var(--cafe-ink);
  box-shadow: none; transition: background .15s, border-color .15s;
}
.voice-cafe .vc-controls .btn:hover { background: rgba(51,37,26,.05); border-color: rgba(51,37,26,.34); }
.voice-cafe .vc-controls .btn.primary,
.voice-cafe .vc-controls .btn.voice-talk {
  border-color: transparent; color: #f0e4d3;
  background: linear-gradient(180deg, var(--cafe-dark-a), var(--cafe-dark-b));
  box-shadow: 0 12px 26px -16px rgba(51,37,26,.9);
}
.voice-cafe .vc-controls .btn.primary:hover,
.voice-cafe .vc-controls .btn.voice-talk:hover {
  background: linear-gradient(180deg, #5c4230, #3a2a1c);
}
.voice-cafe .vc-controls .btn.danger {
  border-color: transparent; color: #f0e4d3;
  background: linear-gradient(180deg, var(--cafe-dark-a), var(--cafe-dark-b));
}
.voice-cafe .vc-switch, .voice-cafe .vc-vol {
  font-family: var(--cafe-mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--cafe-ink-faint);
}
.voice-cafe .vc-vol input[type="range"] { accent-color: var(--cafe-accent); }

/* --- Transkript-Spalte --- */
.voice-cafe .vc-scroll-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px 12px; font-family: var(--cafe-mono); font-size: 10px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--cafe-ink-faint);
}
.voice-cafe .vc-scroll-live::before {
  content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--cafe-accent); margin-right: 7px; vertical-align: middle;
  animation: cafe-glow 1.5s ease-in-out infinite;
}
.voice-cafe .voice-transcript {
  flex: 1; min-height: 200px; max-height: 52vh; border: 0; border-radius: 0;
  background: transparent; padding: 4px 28px 22px; gap: 16px;
}
.voice-cafe .vt-line {
  flex-direction: column; gap: 6px; animation: cafe-rise .45s ease both;
}
.voice-cafe .vt-role {
  font-family: var(--cafe-mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: rgba(51,37,26,.36); min-width: 0;
}
.voice-cafe .vt-line > span:last-child {
  max-width: 92%; padding: 12px 16px; font-size: 14.5px; line-height: 1.6;
  text-wrap: pretty;
}
.voice-cafe .vt-user { align-items: flex-end; }
.voice-cafe .vt-user > span:last-child {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--cafe-dark-a), var(--cafe-dark-b));
  color: #f0e4d3; border: 1px solid transparent; border-radius: 18px 18px 5px 18px;
}
.voice-cafe .vt-assistant { align-items: flex-start; }
.voice-cafe .vt-assistant > span:last-child {
  align-self: flex-start; background: rgba(255,253,249,.9); color: var(--cafe-ink);
  border: 1px solid rgba(51,37,26,.12); border-radius: 18px 18px 18px 5px;
}
.voice-cafe .vt-pending .vt-dots i { background: var(--cafe-accent); }

/* --- Live-Bühne: Positionskontext für das Vorbereitungs-Overlay. --- */
.voice-cafe .vc-stage { position: relative; }

/* WICHTIG: Das Overlay setzt display:flex — das würde das `hidden`-Attribut
   (UA-Regel display:none) per Spezifität AUSHEBELN, sodass sich die Checkliste
   nach „ready" nie ausblendet und der Orb nie erscheint. Diese Regel stellt
   sicher, dass hidden gewinnt. */
.voice-cafe .voice-prep[hidden] { display: none !important; }

/* --- Vorbereitungs-Checkliste als OVERLAY über der Live-Fläche. --- */
/* Aus dem normalen Fluss genommen: die Panelhöhe ändert sich zwischen
   „Vorbereitung" und „Bereit" NICHT → beim Öffnen wird nichts abgeschnitten und
   nach dem Laden rutscht nichts hoch. */
.voice-cafe .voice-prep {
  position: absolute; inset: 0; z-index: 5; margin: 0;
  border: 0; border-radius: 0;
  background: linear-gradient(180deg, rgba(255,253,249,.97), rgba(248,240,229,.97));
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px clamp(22px, 4vw, 40px); text-align: center;
}
.voice-cafe .voice-prep .voice-prep-list { width: 100%; max-width: 340px; }
.voice-cafe .voice-prep .vp-row { justify-items: start; }
.voice-cafe .voice-prep-title {
  font-family: var(--cafe-serif); font-style: italic; font-weight: 400; font-size: 22px;
  color: var(--cafe-ink);
}
.voice-cafe .voice-prep .vp-label { color: var(--cafe-ink-soft); }
.voice-cafe .voice-prep .vp-detail { font-family: var(--cafe-mono); color: var(--cafe-ink-faint); }
.voice-cafe .voice-prep .vp-icon.vp-ready { color: #7d9a72; }
.voice-cafe .voice-prep .vp-icon.vp-loading { color: var(--cafe-accent); }
.voice-cafe .voice-prep .vp-icon.vp-pending { color: var(--cafe-ink-faint); }

.voice-cafe .voice-error { padding: 10px 30px 16px; color: #8a3b2a; }
.voice-cafe .voice-latency-debug { margin: 0 30px 18px; }

/* Café-eigene Animationen (kollidieren nicht mit vorhandenen). */
@keyframes cafe-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.018); } }
@keyframes cafe-glow { 0%,100% { opacity: .45; } 50% { opacity: .82; } }
@keyframes cafe-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Schmalere Viewports: einspaltig, Orb etwas kleiner. */
@media (max-width: 860px) {
  .voice-cafe .voice-cafe-live { grid-template-columns: 1fr; }
  .voice-cafe .vc-orb-col { border-right: 0; border-bottom: 1px solid rgba(51,37,26,.09); }
  .voice-cafe .voice-orb-stage { width: 240px; }
}

/* ============================================================================
   Voice-Café — Auswahlseite (Voice Studio) im warmen Creme-Look.
   ========================================================================== */
.voice-cafe-studio { display: flex; flex-direction: column; overflow: visible; }
.voice-cafe-studio .vcs-topbar { padding: 20px 30px 0; }
.voice-cafe-studio .vcs-back {
  display: inline-flex; align-items: center; gap: 9px; padding: 10px 18px 10px 14px;
  border-radius: 999px; background: rgba(255,252,247,.6); border: 1px solid rgba(51,37,26,.1);
  font-family: var(--cafe-sans); font-size: 13.5px; color: var(--cafe-ink); cursor: pointer;
}
.voice-cafe-studio .vcs-back:hover { background: #fffcf7; border-color: rgba(51,37,26,.24); }
.voice-cafe-studio .vcs-back span { opacity: .5; font-size: 15px; }

.voice-cafe-studio .vcs-hero {
  padding: 34px clamp(22px, 4vw, 54px) 28px; border-bottom: 1px solid rgba(51,37,26,.08);
}
.voice-cafe-studio .vcs-kicker {
  font-family: var(--cafe-mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--cafe-ink-faint); margin-bottom: 14px;
}
.voice-cafe-studio .vcs-title {
  margin: 0 0 12px; font-family: var(--cafe-serif); font-weight: 400;
  font-size: clamp(34px, 6vw, 52px); line-height: 1.04; letter-spacing: -.01em; color: var(--cafe-ink);
}
.voice-cafe-studio .vcs-sub {
  margin: 0; max-width: 440px; font-size: 15px; line-height: 1.6; color: var(--cafe-ink-soft); text-wrap: pretty;
}

.voice-cafe-studio .vcs-body {
  padding: 26px clamp(22px, 4vw, 54px) 40px; display: flex; flex-direction: column; gap: 14px;
}
.voice-cafe-studio .vcs-section-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--cafe-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--cafe-ink-faint);
}
.voice-cafe-studio .vcs-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px;
}
.voice-cafe-studio .vcs-loading,
.voice-cafe-studio .vcs-empty {
  grid-column: 1 / -1; padding: 22px; text-align: center;
  font-size: 14px; color: var(--cafe-ink-soft);
}

.voice-cafe-studio .vcs-card {
  display: flex; flex-direction: column; gap: 16px; padding: 24px 24px 22px;
  border: 1px solid rgba(51,37,26,.12); border-radius: 16px; background: rgba(255,253,249,.7);
  transition: border-color .15s, background .15s; min-width: 0;
}
.voice-cafe-studio .vcs-card:hover { border-color: rgba(169,127,82,.5); background: #fffdf9; }
.voice-cafe-studio .vcs-card-head { display: flex; align-items: center; gap: 14px; }
.voice-cafe-studio .vcs-avatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  background: radial-gradient(120% 120% at 32% 26%, #f0e0c8, #c99a63 65%, #8a5f38);
  box-shadow: 0 6px 14px -8px rgba(51,37,26,.6);
}
.voice-cafe-studio .vcs-avatars { display: flex; align-items: center; }
.voice-cafe-studio .vcs-avatar-b { width: 34px; height: 34px; flex-basis: 34px;
  background: radial-gradient(120% 120% at 32% 26%, #efe3d2, #b9a48c 70%, #7d6a55); }
.voice-cafe-studio .vcs-avatar-c { width: 34px; height: 34px; flex-basis: 34px; margin-left: -12px;
  background: radial-gradient(120% 120% at 32% 26%, #f4ebdd, #a08a70 70%, #63523f);
  box-shadow: 0 6px 14px -8px rgba(51,37,26,.5), 0 0 0 3px #fffdf9; }
.voice-cafe-studio .vcs-card-title {
  font-family: var(--cafe-serif); font-weight: 400; font-size: 26px; line-height: 1.15; color: var(--cafe-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.voice-cafe-studio .vcs-card-kicker {
  font-family: var(--cafe-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--cafe-ink-faint); margin-top: 4px;
}
.voice-cafe-studio .vcs-card-desc {
  margin: 0; font-size: 14px; line-height: 1.6; color: var(--cafe-ink-soft); text-wrap: pretty;
}
.voice-cafe-studio .vcs-card-meta {
  font-family: var(--cafe-mono); font-size: 11px; letter-spacing: .04em; color: var(--cafe-ink-soft);
  padding-top: 12px; border-top: 1px solid rgba(51,37,26,.08); overflow-wrap: anywhere;
}
.voice-cafe-studio .vcs-card-actions {
  margin-top: auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.voice-cafe-studio .vcs-btn {
  font-family: var(--cafe-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  padding: 12px 26px; border-radius: 999px; cursor: pointer; border: 1px solid transparent;
}
.voice-cafe-studio .vcs-btn-solid {
  background: linear-gradient(180deg, var(--cafe-dark-a), var(--cafe-dark-b)); color: #f0e4d3;
  box-shadow: 0 12px 26px -16px rgba(51,37,26,.9);
}
.voice-cafe-studio .vcs-btn-solid:hover { background: linear-gradient(180deg, #5c4230, #3a2a1c); }
.voice-cafe-studio .vcs-btn-solid[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.voice-cafe-studio .vcs-btn-ghost {
  background: transparent; border-color: rgba(51,37,26,.22); color: var(--cafe-ink);
}
.voice-cafe-studio .vcs-btn-ghost:hover { background: rgba(51,37,26,.05); border-color: rgba(51,37,26,.4); }
.voice-cafe-studio .vcs-card-note {
  font-family: var(--cafe-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--cafe-ink-faint);
}
.voice-cafe-studio .vcs-ready {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--cafe-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--cafe-ink-soft);
}
.voice-cafe-studio .vcs-ready-dot { width: 6px; height: 6px; border-radius: 50%; background: #7d9a72; }
.voice-cafe-studio .vcs-ready.is-missing { color: #8a3b2a; }
.voice-cafe-studio .vcs-ready.is-missing .vcs-ready-dot { background: #b5561f; }
.voice-cafe-studio .vcs-foot { margin: 4px 0 0; font-size: 13px; line-height: 1.6; color: var(--cafe-ink-faint); }

/* ============================================================================
   Voice-Café — Responsivität (Mobile primär, Landscape hohe Priorität) &
   garantiertes Scrollen (nichts wird unten abgeschnitten, auch beim Laden).
   ========================================================================== */
/* Panels dürfen beliebig hoch werden; die Seite scrollt. Kein Clipping durch
   die abgerundete Panel-Kante. */
.voice-cafe { overflow: visible; border-radius: 16px; }

/* Portrait / schmale Viewports: einspaltig, kompakter, Orb kleiner. */
@media (max-width: 760px) {
  .voice-cafe .voice-cafe-head { padding: 18px 18px 14px; gap: 10px; }
  .voice-cafe .vc-title { font-size: 28px; }
  .voice-cafe .vc-head-right { margin-left: 0; }
  .voice-cafe .voice-cafe-live { grid-template-columns: 1fr; }
  .voice-cafe .vc-orb-col { border-right: 0; border-bottom: 1px solid rgba(51,37,26,.09);
    padding: 26px 18px 24px; gap: 20px; }
  .voice-cafe .voice-orb-stage { width: 220px; }
  .voice-cafe .voice-state .vs-label { font-size: 26px; }
  .voice-cafe .voice-transcript { max-height: 46vh; padding: 4px 18px 20px; }
  .voice-cafe .vc-scroll-head { padding: 16px 18px 10px; }
  .voice-cafe .voice-prep { margin: 14px 18px; }
  .voice-cafe .voice-latency-debug { margin: 0 18px 16px; }
  .voice-cafe-studio .vcs-card { padding: 20px; }
}

/* Landscape / niedrige Höhe (Telefon quer): sehr kompakt, Orb klein, überall
   scrollbar. Höhere Priorität als reine Breite. */
@media (max-height: 560px) and (orientation: landscape) {
  .voice-cafe .voice-cafe-head { padding: 12px 20px 10px; }
  .voice-cafe .vc-title { font-size: 22px; }
  .voice-cafe .voice-cafe-live { grid-template-columns: 1.1fr .9fr; }
  .voice-cafe .vc-orb-col { padding: 16px 16px 14px; gap: 12px; }
  .voice-cafe .voice-orb-stage { width: 150px; }
  .voice-cafe .voice-state { gap: 6px; }
  .voice-cafe .voice-state .vs-icon { font-size: 20px; }
  .voice-cafe .voice-state .vs-label { font-size: 18px; }
  .voice-cafe .voice-meter { height: 16px; }
  .voice-cafe .vc-hint { display: none; }              /* Platz sparen quer */
  .voice-cafe .voice-transcript { max-height: none; }  /* im Fluss, Seite scrollt */
  .voice-cafe .vc-controls .btn { padding: 9px 16px; }
  .voice-cafe-studio .vcs-hero { padding: 16px 24px 14px; }
  .voice-cafe-studio .vcs-title { font-size: clamp(26px, 5vw, 34px); }
  .voice-cafe-studio .vcs-body { padding: 16px 24px 26px; }
}

/* Sehr schmale Telefone: Steuerleiste umbrechen lassen, Chips kompakt. */
@media (max-width: 440px) {
  .voice-cafe .vc-chip { font-size: 9.5px; padding: 4px 8px; }
  .voice-cafe .vc-controls { gap: 8px; }
  .voice-cafe .voice-orb-stage { width: 190px; }
}

/* Referenzstimmen-Upload im Agent-Editor (Voice-Cloning). */
.voice-add-box { margin: 8px 0 4px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2, rgba(127,127,127,.06)); }
.voice-profile-field audio { display: block; margin-top: 8px; max-width: 100%; }

/* ============================================================
   Users & Logs — im bestehenden Braun/Beige-Designsystem.
   ============================================================ */

/* ---- Monitor-Tabs (Übersicht | Logs) ---- */
.seg-tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 20px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2); }
.seg-tab { border: 0; background: none; color: var(--text-dim); font-weight: 600; font-size: 13px;
  padding: 7px 18px; border-radius: 999px; }
.seg-tab:hover { color: var(--text); }
.seg-tab.active { background: var(--accent); color: var(--accent-text); }
.mon-pane { display: block; }

/* ---- Status-Punkte (Active / Disabled) ---- */
.dot.ok { background: var(--ok); }
.dot.hollow { background: transparent; border: 1.5px solid var(--muted); }

/* ---- Users ---- */
.users-toolbar { align-items: center; }
:is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > select, :is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > input {
  box-sizing: border-box;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text);
  font: 400 14px var(--font);
  box-shadow: 0 1px 2px rgba(60, 40, 20, .04);
  transition: border-color .15s, box-shadow .15s;
}
:is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
:is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > select option { background: var(--surface); color: var(--text); }
:is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > input::placeholder { color: var(--muted); opacity: 1; }
:is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > select:hover, :is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > input:hover { border-color: var(--accent); }
:is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > select:focus-visible, :is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
:root[data-theme="light"] :is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > select { color-scheme: light; }
:root[data-theme="dark"] :is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > select { color-scheme: dark; }
@media (max-width: 720px) {
  :is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > select, :is(.users-toolbar, .logs-toolbar, .voice-diagnostics-controls) > input { font-size: 16px; }
}
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-avatar { flex: 0 0 auto; width: 34px; height: 34px; font-size: 12px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent); }
.user-avatar.lg { width: 52px; height: 52px; font-size: 18px; border-radius: 50%; }
.user-cell-text { min-width: 0; }
.user-cell-name { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.user-cell-email { color: var(--text-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.user-self-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; }
.user-status { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }

.badge.role-admin { background: var(--accent-soft); color: var(--accent); }

/* Eingehender Anruf in der angemeldeten App, an die iOS-Anrufansicht angelehnt. */
.global-incoming-overlay { position: fixed; inset: 0; z-index: 10000; display: grid;
  place-items: stretch; padding: 0; overflow: auto; background: #3d4247; }
.global-incoming-overlay[hidden] { display: none; }
.global-incoming-card { box-sizing: border-box; width: 100%; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 13vh) 24px
    calc(env(safe-area-inset-bottom) + 5vh); background: #3d4247; color: #fff; text-align: center; }
.global-incoming-brand { color: #aeb3b8; font-size: clamp(18px, 5vw, 24px); font-weight: 700; }
.global-incoming-card h1 { margin: 12px 0 0; color: #fff; font-size: clamp(38px, 10vw, 52px); line-height: 1.1; }
.global-incoming-card p { margin: 6px 0 0; color: #c5c9cd; font-size: 20px; }
.global-incoming-actions { display: flex; justify-content: space-around; align-items: center;
  gap: 40px; width: min(100%, 420px); margin: auto auto 0; }
.global-incoming-action { min-width: 124px; border: 0; background: transparent; cursor: pointer;
  color: #fff; font: inherit; font-size: 18px; }
.global-incoming-action span { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%;
  display: grid; place-items: center; color: white; }
.global-incoming-action svg { width: 30px; height: 30px; fill: none; stroke: currentColor;
  stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.global-incoming-action b { display: block; font-weight: 600; }
.global-incoming-action.accept span { background: #1452c2; }
.global-incoming-action.reject span { background: #c51f24; }
.global-incoming-action:disabled { opacity: .55; }
.global-incoming-error { margin: 14px auto 0; padding: 10px 12px; border-radius: 10px;
  color: #ffd6d0; background: rgba(0,0,0,.18); font-size: 13px; }
#globalIncomingSettings { margin: 12px auto 0; border: 1px solid rgba(255,255,255,.2);
  color: #fff; background: rgba(255,255,255,.08); }
@media (max-height: 600px) {
  .global-incoming-card { padding-top: calc(env(safe-area-inset-top) + 7vh); }
  .global-incoming-action span { width: 56px; height: 56px; }
}
.badge.role-user { background: var(--accent-soft); color: var(--accent); }

.users-empty { display: flex; flex-direction: column; align-items: center; }
.users-empty-title { font-weight: 600; color: var(--text); }

/* Benutzer-Detail-Drawer */
.user-drawer-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.user-drawer-id { min-width: 0; }
.user-drawer-name { font-size: 19px; font-weight: 700; color: var(--text); }
.perm-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.perm-item { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); }
.perm-item.off { color: var(--muted); }
.perm-mark { width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%;
  font-size: 11px; background: #e4f0e5; color: var(--ok); }
.perm-item.off .perm-mark { background: #efe6da; color: var(--muted); }
:root[data-theme="dark"] .perm-mark { background: #24422a; }
:root[data-theme="dark"] .perm-item.off .perm-mark { background: #2e2418; }

/* ---- Logs ---- */
.logs-toolbar { align-items: center; }
.logs-toolbar > select { min-width: 0; max-width: 100%; }
.logs-toolbar > input { flex: 1 1 200px; min-width: 0; max-width: 320px; }
.logs-toolbar > .log-live { min-height: 42px; }
.logs-toolbar > .hint { white-space: nowrap; }
@media (max-width: 480px) {
  .logs-toolbar > input { max-width: none; }
}
.log-live { display: inline-flex; align-items: center; gap: 7px; }
.log-live.on { border-color: var(--accent); color: var(--accent); }
.logs-panel { padding: 4px 0; }
.log-list { display: flex; flex-direction: column; }
.log-row { display: flex; align-items: flex-start; gap: 12px; padding: 9px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border); font-size: 13px; }
.log-row:last-child { border-bottom: 0; }
.log-row:hover { background: var(--surface-2); }
.log-time { flex: 0 0 auto; width: 92px; color: var(--text-dim); font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12px; padding-top: 1px; }
.log-pill { flex: 0 0 auto; min-width: 62px; text-align: center; font-size: 10px; font-weight: 700;
  letter-spacing: .04em; padding: 3px 7px; border-radius: 6px; }
.log-pill.log-info { background: #ece8e2; color: var(--text-dim); }
.log-pill.log-warning { background: #f6ecd6; color: var(--warn); }
.log-pill.log-error { background: #f2e2dd; color: var(--err); }
:root[data-theme="dark"] .log-pill.log-info { background: #2e2418; }
:root[data-theme="dark"] .log-pill.log-warning { background: #3a2f14; }
:root[data-theme="dark"] .log-pill.log-error { background: #3d2018; }
.log-src { flex: 0 0 auto; width: 66px; color: var(--muted); font-size: 11px; font-weight: 600;
  letter-spacing: .03em; padding-top: 2px; }
.log-copy { min-width: 0; flex: 1 1 auto; }
.log-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.log-agent { font-weight: 600; color: var(--text); }
.log-agent.muted { color: var(--muted); font-weight: 500; }
.log-msg { color: var(--text-dim); }
.log-detail { color: var(--muted); font-size: 12px; margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; }
.log-more { padding: 14px 0 4px; text-align: center; }

/* Log-Detail-Drawer */
.log-detail-msg { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 14px;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.log-detail-msg.log-error { border-color: var(--err); }
.log-json { margin: 8px 0 0; padding: 14px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); overflow-x: auto; font-size: 12px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; color: var(--text); }
.log-detail-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

@media (max-width: 620px) {
  /* Ohne flex-wrap konnte die Zeile nicht umbrechen → Quelle lag ÜBER dem
     Agentennamen. Jetzt: Zeile 1 = Zeit · Level · Quelle, Zeile 2 = Inhalt. */
  .log-row { flex-wrap: wrap; gap: 6px 10px; }
  .log-time { width: 78px; }
  .log-src { width: auto; padding-top: 1px; }
  .log-copy { flex-basis: 100%; }
  .perm-list { grid-template-columns: 1fr; }
}

/* ============================================================
   Avatar-Anruf (Version 1) — lokal gerendertes SVG-Gesicht mit
   audio-reaktivem Lip-Sync. Kein Server-Video, keine Kamera-Analyse.
   ============================================================ */
.voice-orb-stage.has-avatar { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.avatar-stage { position: relative; width: 100%; max-width: min(320px, 68vw); aspect-ratio: 1 / 1;
  display: grid; place-items: center; }
.avatar-face { width: 100%; height: 100%; display: block; }
.avatar-aura { fill: none; stroke: var(--border-strong); stroke-width: 3; opacity: .45;
  transition: stroke .3s ease, opacity .3s ease, stroke-width .3s ease; }
.avatar-skin { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.avatar-initials { fill: var(--accent); font-family: var(--font); font-weight: 700; font-size: 24px;
  letter-spacing: .04em; }
.avatar-eye { fill: var(--text); }
.avatar-lid { fill: var(--accent-soft); }          /* schließt das Auge farblich bündig */
.avatar-mouth { fill: #5b3826; }
:root[data-theme="dark"] .avatar-mouth { fill: #1c130d; }

.avatar-stage[data-avatar-state="listening"] .avatar-aura { stroke: var(--ok); opacity: .7; }
.avatar-stage[data-avatar-state="thinking"] .avatar-aura { stroke: var(--warn); opacity: .7; }
.avatar-stage[data-avatar-state="speaking"] .avatar-aura { stroke: var(--accent); opacity: .95; stroke-width: 4; }
.avatar-stage[data-avatar-state="interrupted"] .avatar-aura { stroke: var(--err); opacity: .85; }

/* Dezenter Aura-Puls in aktiven Zuständen; bei reduzierter Bewegung aus. */
@media (prefers-reduced-motion: no-preference) {
  .avatar-stage[data-avatar-state="listening"] .avatar-aura,
  .avatar-stage[data-avatar-state="speaking"] .avatar-aura {
    animation: avatar-aura-pulse 2.4s ease-in-out infinite;
  }
}
@keyframes avatar-aura-pulse { 0%,100% { opacity: .55; } 50% { opacity: .95; } }

/* Optionale, rein lokale Selbstansicht (gespiegelt wie ein Selfie). */
.avatar-selfview { position: absolute; right: 10px; bottom: 10px; width: 92px; height: 122px;
  object-fit: cover; border-radius: 12px; border: 2px solid var(--border-strong);
  background: #000; transform: scaleX(-1); box-shadow: var(--shadow); }

/* „Avatar"-Kennzeichnung auf der Sprach-Agent-Karte. */
.vcs-avatar-tag { margin-left: 8px; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 1px 7px; vertical-align: middle; }

@media (max-width: 560px) {
  .avatar-stage { max-width: min(260px, 74vw); }
  .avatar-selfview { width: 72px; height: 96px; }
}

/* Dezentes Bild-in-Bild-Icon, in die Video-Bühne eingeblendet (Human-to-Human).
   Ein Tipp löst PiP aus — der auf iOS einzige zuverlässige (Nutzergesten-)Weg. */
.call-pip-toggle { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; z-index: 6;
  width: 42px; height: 42px; display: grid; place-items: center; padding: 0;
  border: none; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .42);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3); cursor: pointer; transition: background .15s ease; }
.call-pip-toggle:hover { background: rgba(0, 0, 0, .6); }
.call-pip-toggle:active { transform: scale(.94); }
.call-pip-toggle.active { background: var(--accent); }
.call-pip-toggle[hidden] { display: none; }

/* --- Menschlicheres Avatar-Gesicht (V1: warme Hauttöne, Haar, Brauen, Wangen) --- */
.avatar-hair { fill: #5b3d28; }
:root[data-theme="dark"] .avatar-hair { fill: #402a1b; }
.avatar-skin { fill: #f3ddc6; stroke: #dcbb99; stroke-width: 1.5; }
:root[data-theme="dark"] .avatar-skin { fill: #e7cdb1; stroke: #caa886; }
.avatar-brow { fill: none; stroke: #5b3d28; stroke-width: 4; stroke-linecap: round; }
:root[data-theme="dark"] .avatar-brow { stroke: #402a1b; }
.avatar-eye { fill: #3a2a1c; }
.avatar-eye-hl { fill: #ffffff; opacity: .92; }
.avatar-lid { fill: #f3ddc6; }
:root[data-theme="dark"] .avatar-lid { fill: #e7cdb1; }
.avatar-cheek { fill: #e6957f; opacity: .34; }
.avatar-nose { fill: none; stroke: #cf9f7d; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.avatar-mouth { fill: #a1493b; }
.avatar-lip { fill: none; stroke: #a1493b; stroke-width: 2.4; stroke-linecap: round; opacity: .75; }

/* --- Avatar-Modus: KEIN Café-Orb; Avatar ist das Bild, Status als schlanke Zeile --- */
.voice-cafe .voice-orb-stage.has-avatar {
  width: auto; max-width: 100%; aspect-ratio: auto; height: auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px; animation: none;
}
.voice-cafe .voice-orb-stage.has-avatar::before,
.voice-cafe .voice-orb-stage.has-avatar::after { content: none; }   /* Ringe/Glow entfernen */
.voice-cafe .voice-orb-stage.has-avatar .avatar-stage { max-width: min(300px, 70vw); }
.voice-cafe .voice-orb-stage.has-avatar .voice-state {
  position: static; z-index: 2; width: auto; height: auto; border-radius: 999px;
  background: none; box-shadow: none; animation: none;
  flex-direction: row; gap: 8px; padding: 2px 6px;
}
.voice-cafe .voice-orb-stage.has-avatar .voice-state .vs-icon { font-size: 16px; opacity: .8; }
.voice-cafe .voice-orb-stage.has-avatar .voice-state .vs-label {
  font-family: var(--font); font-style: normal; font-weight: 600;
  font-size: 16px; letter-spacing: 0; color: var(--cafe-ink, var(--text)); max-width: none; padding: 0;
}
.voice-cafe .voice-orb-stage.has-avatar .voice-meter { display: none; }  /* Status als reiner Text */

/* Frau/Mann-Detailzüge + Foto-Modus-Ring (Audio-reaktiv statt Mundanimation). */
.avatar-lash { fill: none; stroke: #3a2a1c; stroke-width: 2; stroke-linecap: round; }
.avatar-stubble { fill: #4a3320; opacity: .13; }
:root[data-theme="dark"] .avatar-stubble { fill: #1c130c; opacity: .22; }
.avatar-photo-ring { fill: none; stroke: rgba(51,37,26,.16); }
.avatar-stage[data-avatar-state="speaking"] .avatar-photo-ring { stroke: var(--accent); }
.avatar-stage[data-avatar-state="listening"] .avatar-photo-ring { stroke: var(--ok); opacity: .8; }

/* =====================================================================
   Conference Room — freier Meeting-Canvas (additiv, warmes Studio-Design)
   ===================================================================== */
.conf-list { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.conf-list-head .conf-h1 { margin: 0 0 4px; font-size: 24px; color: var(--text); }
.conf-sub { margin: 0; color: var(--text-dim); }
.conf-create, .conf-existing { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.conf-create-title { font-weight: 650; color: var(--text); font-size: 15px; }
.conf-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.conf-input { padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; }
.conf-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.conf-agent-picker { display: flex; flex-direction: column; gap: 6px; }
.conf-agent-row { display: grid; grid-template-columns: auto 1fr auto minmax(120px, 180px);
  gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card); }
.conf-agent-name { font-weight: 600; color: var(--text); }
.conf-agent-meta { color: var(--muted); font-size: 12px; }
.conf-role { padding: 6px 9px; }
.conf-create-actions { display: flex; justify-content: flex-end; }
.conf-existing-row { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--border); }
.conf-empty { color: var(--muted); padding: 10px; text-align: center; font-size: 13px; }

.conf-btn, .conf-tool { padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s; }
.conf-btn:hover, .conf-tool:hover { background: var(--accent-soft); }
.conf-btn.primary, .conf-tool.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.conf-btn.primary:hover, .conf-tool.primary:hover { background: var(--accent-hover); }
.conf-btn.danger, .conf-tool.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, var(--border-strong)); }
.conf-tool.active { background: var(--ok); color: #fff; border-color: var(--ok); }
.conf-tool.ptt { background: var(--warn); color: #2b1d15; border-color: var(--warn); }

/* ---- Raum ---- */
.conf-room { display: flex; flex-direction: column; gap: 12px; height: calc(var(--app-viewport-height) - 120px); min-height: 460px; }

/* App-artige Vollflächen-Ansicht: Der Konferenzraum füllt exakt den Bereich
   zwischen Topbar und Tab-Leiste (Portrait) bzw. rechts der Seitenleiste
   (Landscape) — ohne Seiten-Scroll. Nur für die Konferenz-Route gesetzt
   (route() togglet `.content-flush` auf #content), damit andere Seiten weiter
   normal scrollen. So bleibt die Toolbar in JEDER Ausrichtung sichtbar. */
.content.content-flush { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.content-flush .conf-room { flex: 1 1 auto; height: auto; min-height: 0; }
.conf-room-head { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; }
.conf-room-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.conf-room-title h1 { margin: 0; font-size: 20px; color: var(--text); }
.conf-live { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.conf-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle); }
.conf-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.conf-timer { font-size: 13px; }
.conf-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 0 0 auto; }
.conf-text-bar { display: grid; grid-template-columns: auto minmax(160px,1fr) auto; gap: 8px;
  align-items: center; flex: 0 0 auto; }
.conf-text-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.conf-text-input { min-width: 0; }

.conf-stage { position: relative; flex: 1; display: flex; min-height: 0; gap: 10px; }
.conf-canvas-host { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; }
/* Transkript UND Routing/A2A-Debug sind IN-FLOW-Spalten neben der Bühne — nie
   ein deckendes Overlay. So bleibt der Avatar-Canvas in JEDEM Modus vollständig
   sichtbar; der Canvas flext nur schmaler und ordnet die Kacheln neu an. */
.conf-transcript { flex: 0 0 min(320px, 42%); min-width: 0; overflow: hidden;
  border-left: 1px solid var(--border); background: var(--surface);
  display: none; flex-direction: column; }
.conf-room.show-transcript .conf-transcript { display: flex; }
.conf-debug { flex: 0 0 min(410px, 46%); min-width: 0; overflow: hidden;
  border-left: 1px solid var(--border); background: var(--surface);
  display: none; flex-direction: column; }
.conf-room.show-debug .conf-debug { display: flex; }
.conf-debug-state { display: grid; gap: 4px; padding: 9px 12px; border-bottom: 1px solid var(--border);
  color: var(--text-dim); font-size: 12px; }
.conf-debug-value { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.conf-debug-agents { display: grid; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--border);
  max-height: 150px; overflow: auto; }
.conf-debug-agent { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 8px;
  color: var(--text); font-size: 12px; }
.conf-debug-agent code { color: var(--accent); }
.conf-debug-agent small { grid-column: 1 / -1; color: var(--muted); overflow-wrap: anywhere; }
.conf-debug-log { flex: 1; min-height: 0; overflow: auto; padding: 8px 10px; background: var(--surface-2); }
.conf-debug-line { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 7px; padding: 5px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent); font-size: 11px; }
.conf-debug-line code { color: var(--text-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.conf-debug-line.is-router code, .conf-debug-line.is-llm code { color: var(--accent); }
.conf-debug-line.is-task code, .conf-debug-line.is-agent code { color: var(--ok); }
.conf-debug-line.is-error code { color: var(--err); }
.conf-debug-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.conf-transcript-head { font-weight: 650; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.conf-transcript-body { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.conf-tl { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; font-size: 13px; }
.conf-tl-time { grid-row: span 2; color: var(--muted); font-size: 11px; }
.conf-tl-who { font-weight: 650; color: var(--text); }
.conf-tl.is-agent .conf-tl-who { color: var(--accent); }
.conf-tl-text { color: var(--text-dim); }

/* ---- Canvas ---- */
.conf-canvas { position: absolute; inset: 0; overflow: hidden; border: 1px solid var(--border);
  border-radius: var(--radius); background:
    radial-gradient(1200px 500px at 30% -10%, color-mix(in srgb, var(--accent-soft) 55%, transparent), transparent 70%),
    var(--card); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); touch-action: none; }
.conf-tile { position: absolute; box-sizing: border-box; display: flex; flex-direction: column;
  border: 2px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); overflow: hidden; cursor: grab; user-select: none; touch-action: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.conf-tile:active { cursor: grabbing; }
.conf-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.conf-tile-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center;
  justify-content: center; container-type: size; background: color-mix(in srgb, var(--card) 70%, var(--bg)); }
.conf-tile-stage canvas, .conf-tile-stage svg { width: 100%; height: 100%; object-fit: contain; }
/* Mensch-Kachel: Video der bestehenden Verbindung füllt die Kachel (ganzes Bild). */
.conf-tile-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  background: #111; display: block; }
.conf-human-profile { width: min(70cqw, 80cqh); aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.conf-human-profile[hidden] { display: none; }
.conf-initials { width: min(40cqw, 80cqh); flex: none; aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: clamp(16px, 4vw, 30px); color: var(--accent-text);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover)); }
.conf-tile-label { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border-top: 1px solid var(--border); }
.conf-tile-name { font-weight: 650; color: var(--text); font-size: 14px; display: inline-flex; align-items: baseline; gap: 6px; }
.conf-tile-mod { font-size: 10px; font-weight: 700; letter-spacing: .02em; padding: 1px 6px;
  border-radius: 999px; color: var(--accent-text); background: var(--accent);
  align-self: center; white-space: nowrap; }
.conf-tile-role { color: var(--muted); font-size: 12px; }
/* Moderator-Kachel bleibt ein normaler Teilnehmer, nur dezent hervorgehoben. */
.conf-tile.is-moderator { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); }
.conf-tile-status { margin-left: auto; font-size: 12px; color: var(--accent); min-height: 1em; }

/* Active Speaker — warmer Akzent-Rahmen + statischer Glow. Die Geometrie und
   auch die optisch wahrgenommene Kachelgroesse bleiben beim Sprechen stabil. */
.conf-tile.is-speaking { border-color: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 26%, transparent),
    0 6px 22px color-mix(in srgb, var(--ok) 22%, transparent); }
/* Denkt: klar ORANGE markiert (eigener Glow wie beim Sprechen, nur in --warn),
   damit „spricht" (grün) und „denkt" (orange) sofort unterscheidbar sind. */
.conf-tile.is-thinking { border-color: var(--warn); border-style: dashed;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 26%, transparent),
    0 6px 22px color-mix(in srgb, var(--warn) 22%, transparent); }
/* Wartet auf den Sprecher-Floor: Antwort ist fertig, aber ein anderer spricht
   (serielles Sprechen, Spec §9/§12). Bewusst NICHT grün (spricht) und nicht orange
   (denkt) — ruhig pulsierend in Akzentfarbe, damit „gleich dran" sofort lesbar ist. */
.conf-tile.is-waiting { border-color: var(--accent); border-style: dotted;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent),
    0 6px 22px color-mix(in srgb, var(--accent) 16%, transparent);
  animation: confWaitPulse 1.6s ease-in-out infinite; }
@keyframes confWaitPulse {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent),
    0 6px 18px color-mix(in srgb, var(--accent) 12%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent),
    0 6px 22px color-mix(in srgb, var(--accent) 20%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .conf-tile.is-waiting { animation: none; } }

/* Comic-Blasen (ZUSÄTZLICH zur Mundbewegung): Sprechblase beim Sprechen, Denkblase
   mit nachlaufenden Bläschen beim Denken. Ein/Aus rein über die Kachel-Zustandsklasse
   (gilt für Mensch UND Agent — dieselbe is-speaking/is-thinking-Logik). */
/* Status bubbles sit below the controls, keeping remove/focus/mute visible. */
.cbub { position: absolute; top: 42px; right: 6px; left: auto; bottom: auto; z-index: 6; display: none;
  align-items: center; gap: 5px; padding: 4px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 800; line-height: 1; letter-spacing: .01em;
  max-width: 64%; white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.4); pointer-events: none; }
.conf-tile.is-speaking .cbub-speak { display: inline-flex; }
.conf-tile.is-thinking  .cbub-think { display: inline-flex; }
.conf-tile.is-waiting   .cbub-wait  { display: inline-flex; }
/* spricht → gelbe Comic-Sprechblase mit Zipfel nach unten */
.cbub-speak { background: #ffd23f; color: #241a05; border: 2px solid #1b1405; }
.cbub-speak::after { content: ""; position: absolute; left: 20px; bottom: -8px;
  width: 0; height: 0; border: 7px solid transparent; border-top-color: #ffd23f;
  border-bottom: 0; }
.cbub-speak::before { content: ""; position: absolute; left: 18px; bottom: -11px;
  width: 0; height: 0; border: 9px solid transparent; border-top-color: #1b1405;
  border-bottom: 0; z-index: -1; }
.cbub-wave { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.cbub-wave i { width: 2.5px; height: 5px; background: #241a05; border-radius: 2px;
  animation: cbubWave .9s ease-in-out infinite; }
.cbub-wave i:nth-child(2) { animation-delay: .15s; }
.cbub-wave i:nth-child(3) { animation-delay: .3s; }
.cbub-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes cbubWave { 0%, 100% { height: 4px; } 50% { height: 13px; } }
/* denkt → helle Denkblase mit zwei nachlaufenden Bläschen (Zipfel als Kreise) */
.cbub-think { background: #f4f0ea; color: #3a3330; border: 2px solid #b8a894; border-radius: 16px; }
.cbub-think::before, .cbub-think::after { content: ""; position: absolute;
  background: #f4f0ea; border: 2px solid #b8a894; border-radius: 50%; }
.cbub-think::before { width: 9px; height: 9px; left: 12px; bottom: -8px; }
.cbub-think::after { width: 5px; height: 5px; left: 7px; bottom: -15px; }
/* wartet → ruhige Blase in Akzentfarbe (klar von spricht/denkt getrennt) */
.cbub-wait { background: color-mix(in srgb, var(--accent) 18%, #fff); color: #241a05;
  border: 2px solid var(--accent); }
:root[data-theme="dark"] .cbub-wait { background: color-mix(in srgb, var(--accent) 30%, #141414); color: #f2eadf; }
.cbub-wait::after { content: ""; position: absolute; left: 20px; bottom: -8px;
  width: 0; height: 0; border: 7px solid transparent;
  border-top-color: color-mix(in srgb, var(--accent) 18%, #fff); border-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .cbub-wave i { animation: none; height: 9px; } }
.conf-tile.is-queued { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); border-style: dotted; }
.conf-tile.has-error { border-color: var(--err); }

.conf-tile-controls { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0;
  z-index: 7; transition: opacity .15s; }
.conf-tile-agent .conf-tile-controls { opacity: 1; }
.conf-tile:hover .conf-tile-controls, .conf-tile:focus-within .conf-tile-controls { opacity: 1; }
.conf-ctl { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text); cursor: pointer;
  font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.conf-ctl:hover { background: var(--accent-soft); }
.conf-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 45%, var(--border-strong) 45%, var(--border-strong) 55%, transparent 55%,
    transparent 70%, var(--border-strong) 70%, var(--border-strong) 80%, transparent 80%); touch-action: none; }
.conf-canvas.has-focus .conf-tile { transition: all .22s ease; }

/* ---- Add-Teilnehmer-Overlay ---- */
.conf-overlay { position: fixed; inset: 0; background: rgba(20,12,6,.45); display: flex; align-items: center;
  justify-content: center; z-index: 1000; }
.conf-modal { width: min(520px, 92vw); max-height: 80vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.conf-modal-head { font-weight: 650; font-size: 16px; margin-bottom: 12px; color: var(--text); }
.conf-add-list { display: flex; flex-direction: column; gap: 8px; }
.conf-add-list .conf-agent-row { grid-template-columns: 1fr minmax(110px,160px) auto; }
.conf-modal-foot { display: flex; justify-content: flex-end; margin-top: 14px; }
/* Display-verbinden-Dialog */
.conf-display-help { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.conf-display-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px;
  font-weight: 650; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: var(--radius-sm); user-select: all; word-break: break-all; }
.conf-display-share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 6px; }
.conf-display-share-actions .conf-btn { flex: 1 1 150px; }
.conf-whatsapp-btn { color: #176b3a; border-color: color-mix(in srgb, #25d366 55%, var(--border));
  background: color-mix(in srgb, #25d366 10%, var(--surface)); }
.conf-whatsapp-btn:hover { background: color-mix(in srgb, #25d366 18%, var(--surface)); }
.conf-copy-fallback { position: fixed; left: -10000px; top: 0; width: 1px; height: 1px; opacity: 0; }
.conf-display-form { display: flex; gap: 8px; margin: 12px 0; }
.conf-display-form .conf-input { flex: 1; min-width: 0; }
.conf-display-active-head { font-weight: 650; color: var(--text); margin: 6px 0 6px; }
.conf-display-list { display: flex; flex-direction: column; gap: 6px; }
.conf-display-list .conf-agent-row { grid-template-columns: 1fr auto; }
.conf-display-available { min-height: 48px; margin-bottom: 10px; }
.conf-display-device { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.conf-display-searching { display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px; color: var(--muted); }
.conf-display-search-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%;
  background: var(--accent); animation: pulse 1.3s ease-in-out infinite; }
.conf-display-code-fallback { margin: 4px 0 14px; color: var(--muted); font-size: 13px; }
.conf-display-code-fallback summary { cursor: pointer; user-select: none; }

/* Mobile: Bühne + Panel STAPELN statt überdecken. Der Avatar-Canvas bleibt oben
   sichtbar (Kriterium: Routing/A2A ändert die Teilnehmerdarstellung nicht), das
   Transkript- bzw. Routing/A2A-Panel füllt darunter den Rest. */
@media (max-width: 720px) {
  .conf-room { height: calc(var(--app-viewport-height) - 96px); }
  .conf-stage { flex-direction: column; }
  .conf-canvas-host { flex: 1 1 45%; min-height: 140px; }
  .conf-transcript, .conf-debug { flex: 1 1 auto; width: auto;
    border-left: 0; border-top: 1px solid var(--border); }
  .conf-text-bar { grid-template-columns: minmax(0,1fr) auto; }
  .conf-text-label { display: none; }
}

/* Niedriger Viewport (Landscape-Phones): kein erzwungenes min-height (sonst
   überläuft der Raum den Bildschirm und die Toolbar rutscht unter die Faltkante).
   Die Höhe steuert der Flex-Fill unten (.content-flush). Die Toolbar wird zur
   kompakten, horizontal scrollbaren Leiste — bleibt immer sichtbar, app-artig. */
@media (max-height: 620px) {
  .conf-room { min-height: 0; gap: 8px; }
  .conf-room-title h1 { font-size: 17px; }
  .conf-toolbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: thin; padding-bottom: 2px; }
  .conf-tool { flex: 0 0 auto; padding: 7px 12px; min-height: 40px; }
}

/* =======================================================================
   Protokollagent — nativer SVG-Scene-Graph
   ======================================================================= */
.protocol-root { width: 100%; min-width: 0; }
.protocol-editor-root { height: calc(var(--app-viewport-height) - 79px); min-height: 520px;
  display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; }
.wb-landing-head { display: flex; justify-content: space-between; align-items: end; gap: 18px;
  padding: 22px 26px 10px; }
.wb-landing-head h2 { margin: 0 0 5px; font: 500 32px/1.05 "Cormorant Garamond", Georgia, serif; }
.wb-landing-head p { margin: 0; color: var(--text-dim); }
.wb-create-panel { margin: 10px 26px 18px; padding: 15px; }
.wb-create-row { display: grid; grid-template-columns: minmax(220px,1fr) minmax(220px,.8fr) auto;
  align-items: end; gap: 12px; }
.wb-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--text-dim); font-size: 12px; }
.wb-field > input:not([type="checkbox"]), .wb-field > textarea, .wb-field > select { width: 100%; min-width: 0;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); padding: 8px 9px; }
.wb-field > input[type="color"] { width: 100%; height: 37px; padding: 3px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); }
.wb-field > input[type="checkbox"] { width: 20px; height: 20px; margin: 7px 0; accent-color: var(--accent); }
.wb-onboarding { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.wb-onboarding-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 22px; }
.wb-onboarding p { margin: 3px 0 0; color: var(--text-dim); }
.wb-document-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 14px;
  padding: 0 26px 28px; }
.wb-document-card { position: relative; overflow: hidden; padding: 0; }
.wb-document-open { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  padding: 14px; border: 0; background: transparent; color: var(--text); text-align: left; }
.wb-document-open > span, .wb-document-open > small { color: var(--text-dim); }
.wb-document-preview { width: 100%; height: 108px; margin-bottom: 7px; position: relative; display: block;
  border: 1px solid var(--border); border-radius: 9px; background: #f8f7f4; overflow: hidden; }
.wb-document-preview i { position: absolute; color: #7b4a24; font-style: normal; }
.wb-document-preview i:nth-child(1) { left: 15px; top: 12px; font: 700 30px Georgia,serif; }
.wb-document-preview i:nth-child(2) { right: 28px; top: 19px; width: 43px; height: 43px;
  display: grid; place-items: center; border: 2px solid #a86d41; border-radius: 50%; font-size: 0; }
.wb-document-preview i:nth-child(3) { left: 17px; bottom: 10px; font-size: 29px; letter-spacing: 2px; }
.wb-card-delete { position: absolute; right: 8px; bottom: 8px; opacity: .62; }
.wb-empty { grid-column: 1/-1; }

.wb-editor-head { min-height: 52px; display: flex; align-items: center; gap: 9px; padding: 7px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface); }
.wb-title-input { min-width: 140px; max-width: 390px; border: 0; border-bottom: 1px solid transparent;
  outline: 0; padding: 5px 4px; background: transparent; color: var(--text); font-size: 16px; font-weight: 650; }
.wb-title-input:focus { border-color: var(--accent); }
.wb-head-spacer { flex: 1; }
.wb-save-status { color: var(--muted); font-size: 12px; }
.wb-protocol-badge { padding: 5px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 11px; }
.wb-protocol-badge.active { background: color-mix(in srgb,var(--err) 12%,var(--surface)); color: var(--err); }
.wb-workspace { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 260px; }
.wb-stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); background: var(--surface-2); }
.wb-tools { min-height: 47px; display: flex; align-items: center; gap: 4px; padding: 5px 9px;
  overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); }
.wb-tools > button, .wb-bg-tool { min-height: 34px; display: inline-flex; align-items: center; gap: 6px;
  flex: 0 0 auto; padding: 6px 9px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--text-dim); font-size: 12px; }
.wb-tools > button:hover, .wb-bg-tool:hover { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.wb-tools > button b { min-width: 15px; color: var(--accent); font-size: 17px; text-align: center; }
.wb-bg-tool { margin-left: auto; }
.wb-bg-tool input { width: 25px; height: 25px; padding: 0; border: 0; background: transparent; }
.wb-svg-host { min-height: 0; overflow: auto; display: grid; place-items: center; padding: 18px;
  background-color: color-mix(in srgb,var(--border) 36%,var(--surface-2));
  background-image: radial-gradient(var(--border-strong) .6px,transparent .6px); background-size: 12px 12px; }
.wb-svg { width: min(100%,1200px); height: auto; max-height: 100%; aspect-ratio: 1200/760;
  display: block; overflow: visible; background: #f8f7f4; border-radius: 3px;
  box-shadow: 0 10px 34px rgba(50,30,15,.14); touch-action: none; user-select: none; }
.wb-element { cursor: grab; }
.wb-element:active { cursor: grabbing; }
.wb-element-content { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center;
  padding: 7px; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.25; }
.wb-content-title { justify-content: flex-start; padding-top: 3px; line-height: 1.08; }
.wb-content-numbered_list, .wb-content-bullet_list { justify-content: flex-start; }
.wb-element-content ol, .wb-element-content ul { margin: 0; padding-left: 1.55em; }
.wb-element-content li { padding: 2px 0; }
.wb-selection { fill: none; stroke: #4185d6; stroke-width: 2; stroke-dasharray: 7 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.wb-resize { fill: #fff; stroke: #4185d6; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: nwse-resize; }
.wb-inspector { min-width: 0; padding: 12px; overflow-y: auto; border-left: 1px solid var(--border); background: var(--surface); }
.wb-inspector-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 13px; }
.wb-inspector-head span { color: var(--muted); font-size: 11px; }
.wb-inspector-empty { padding: 22px 8px; color: var(--muted); line-height: 1.55; text-align: center; }
.wb-inspector > .wb-field { margin-bottom: 10px; }
.wb-inspector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.wb-inspector-grid .wb-field { min-width: 0; }
.wb-inspector-actions { display: flex; gap: 7px; margin-top: 14px; }
.wb-inspector > .btn { width: 100%; margin: 5px 0; }
.wb-composer { border-top: 1px solid var(--border); background: var(--surface); padding: 8px 12px max(9px,env(safe-area-inset-bottom)); }
.wb-command-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: end; gap: 8px; }
.wb-command-row textarea { width: 100%; min-height: 40px; max-height: 100px; resize: vertical; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface-2); color: var(--text); }
.wb-mic { width: 42px; height: 40px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font-size: 18px; }
.wb-mic.recording { color: #fff; border-color: var(--err); background: var(--err); animation: wb-pulse 1s ease-in-out infinite; }
@keyframes wb-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb,var(--err) 20%,transparent); } }
.wb-feedback { margin: 5px 48px 0; min-height: 15px; color: var(--text-dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-transcript { margin: 5px 48px 0; color: var(--muted); font-size: 11px; }
.wb-transcript summary { cursor: pointer; width: max-content; }
.wb-transcript-body { max-height: 120px; overflow: auto; margin-top: 6px; padding: 7px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); }
.wb-transcript-body p { margin: 0; padding: 4px; border-bottom: 1px solid var(--border); }
.wb-dialog-layer { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center;
  padding: 20px; background: rgba(40,25,14,.38); backdrop-filter: blur(3px); }
.wb-artifact-dialog { width: min(480px,100%); max-height: 70vh; overflow: auto; padding: 16px; }
.wb-artifact-dialog h3 { margin-top: 0; }
.wb-artifact-row { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 3px 9px; padding: 10px;
  margin-bottom: 7px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); text-align: left; }
.wb-artifact-row small { grid-column: 1/-1; color: var(--muted); }

@media (max-width: 900px) {
  .protocol-editor-root { height: calc(var(--app-viewport-height) - 110px); min-height: 0; }
  .wb-workspace { grid-template-columns: minmax(0,1fr) 220px; }
  .wb-tools > button span, .wb-bg-tool > span { display: none; }
  .wb-bg-tool { margin-left: 0; }
}
@media (max-width: 720px) {
  .wb-landing-head { padding: 15px 14px 8px; }
  .wb-create-panel { margin: 8px 14px 14px; }
  .wb-create-row { grid-template-columns: 1fr; }
  .wb-onboarding { grid-template-columns: auto 1fr; }
  .wb-onboarding .btn { grid-column: 1/-1; }
  .wb-document-grid { padding: 0 14px 18px; }
  .wb-editor-head { padding-inline: 7px; }
  .wb-back { width: 36px; overflow: hidden; white-space: nowrap; padding-left: 11px; }
  .wb-title-input { min-width: 70px; flex: 1; }
  .wb-save-status { display: none; }
  .wb-protocol-badge { display: none; }
  .wb-workspace { display: block; position: relative; }
  .wb-stage { width: 100%; height: 100%; }
  .wb-inspector { position: absolute; right: 8px; top: 55px; bottom: 8px; width: min(260px,85vw);
    z-index: 8; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
  .wb-inspector:has(.wb-inspector-empty) { display: none; }
  .wb-svg-host { padding: 10px; }
  .wb-composer { padding-inline: 8px; }
  .wb-feedback, .wb-transcript { margin-inline: 50px 0; }
  .wb-command-row .btn { padding-inline: 10px; }
}

/* ===== Kommunikation (Direkt · Konferenz · Kontakte) ===== */
.comm-view { max-width: 720px; margin: 0 auto; }
.comm-view.comm-flush { max-width: none; margin: 0; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.comm-header { margin: 2px 0 12px; }
.comm-title { margin: 0; font-size: 22px; font-weight: 700; color: var(--text); }
.comm-sub { margin: 3px 0 0; color: var(--text-dim); font-size: 14px; }
.comm-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; margin-bottom: 16px; }
.comm-view.comm-flush .comm-header,
.comm-view.comm-flush .comm-tabs { flex: 0 0 auto; }
.comm-tab { flex: 1 1 0; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-dim); font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; transition: background .12s, color .12s; }
.comm-tab:hover { color: var(--text); }
.comm-tab.active { background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow); }
.comm-body { min-height: 0; }
.comm-view.comm-flush .comm-body { flex: 1 1 auto; display: flex; flex-direction: column; }
.comm-view.comm-flush .comm-body > * { flex: 1 1 auto; min-height: 0; }

/* Sprachsteuerung (Orchestrator 1:1 in der hellen Seite — tippen → sprechen) */
.comm-orch { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: border-color .12s, box-shadow .12s; }
.comm-orch:hover { border-color: var(--border-strong); }
.comm-orch.is-recording { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.comm-orch.is-recording .comm-orch-ic { background: var(--accent); color: var(--accent-text);
  animation: comm-orch-pulse 1.1s ease-in-out infinite; }
@keyframes comm-orch-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.comm-orch-ic { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-soft); font-size: 19px; }
.comm-orch-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.comm-orch-tx b { font-size: 15px; }
.comm-orch-hint { color: var(--text-dim); font-size: 12.5px; min-height: 1.15em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comm-orch-hint.err { color: var(--err); }
.comm-orch-go { flex: 0 0 auto; color: var(--muted); font-size: 20px; }

.comm-section-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin: 4px 2px 10px; }
.comm-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comm-section-head .comm-section-title { margin-bottom: 10px; }
.comm-btn-invite { flex: 0 0 auto; min-height: 34px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 999px; background: transparent; color: var(--accent); font: inherit; font-weight: 600;
  font-size: 13px; cursor: pointer; }
.comm-btn-invite:hover { background: var(--accent-soft); }

/* Einheitliche Ziel-Zeilen (Agent 🤖 / Person 👤) */
.comm-targets { display: flex; flex-direction: column; gap: 8px; }
.comm-target { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.comm-target-av { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; font-size: 19px; background: var(--surface-2); border: 1px solid var(--border); }
.comm-target-av-agent { background: var(--accent-soft); border-color: transparent; }
.comm-target-av { position: relative; overflow: hidden; }
.comm-target-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.comm-target-tx { flex: 1 1 auto; min-width: 0; }
.comm-target-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comm-target-sub { color: var(--text-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comm-target-call { flex: 0 0 auto; min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer;
  transition: background .12s; }
.comm-target-call:hover:not(:disabled) { background: var(--accent-hover); }
.comm-target-call:disabled { opacity: .5; cursor: not-allowed; }

.comm-me { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-bottom: 16px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); }
.comm-me-label { font-size: 12px; color: var(--muted); }
.comm-me-name { font-weight: 700; color: var(--text); font-size: 16px; }
.comm-btn-ghost { flex: 0 0 auto; min-height: 38px; display: inline-grid; place-items: center;
  padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 999px;
  color: var(--accent); font-weight: 600; background: transparent; }
.comm-btn-ghost:hover { background: var(--accent-soft); }
.comm-manage { display: inline-block; margin-top: 14px; padding: 0; border: 0; background: transparent;
  color: var(--accent); font: inherit; font-weight: 600; font-size: 14px; text-align: left; cursor: pointer; }
.comm-manage:hover { text-decoration: underline; }

/* Einladen / Teilen (Signup-Invite-Link → WhatsApp / Share / Kopieren) */
.comm-invite-result { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.comm-invite-ok { font-size: 13.5px; font-weight: 600; color: var(--text); }
.comm-invite-link { font-size: 12.5px; color: var(--text-dim); word-break: break-all;
  padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.comm-invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.comm-btn-share { flex: 1 1 auto; min-height: 40px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 999px; background: transparent; color: var(--accent); font: inherit; font-weight: 600;
  cursor: pointer; }
.comm-btn-share:hover { background: var(--accent-soft); }
.comm-btn-share.primary { background: var(--accent); border-color: transparent; color: var(--accent-text); }
.comm-btn-share.primary:hover { background: var(--accent-hover); }

.comm-empty, .comm-loading { padding: 18px 14px; color: var(--text-dim); text-align: center;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius); }

@media (max-width: 560px) {
  .comm-title { font-size: 20px; }
  .comm-tab { font-size: 14px; padding: 8px 8px; }
  .comm-target-call { padding: 0 14px; }
}

/* Wisch-zum-Löschen für Kontaktzeilen (rechts→links gibt „Löschen" frei) */
.comm-swipe-wrap { position: relative; overflow: hidden; border-radius: var(--radius); }
.comm-swipe-action { position: absolute; top: 0; right: 0; bottom: 0; width: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: var(--err); color: #fff; font: inherit; font-weight: 600; font-size: 12.5px;
  cursor: pointer; }
.comm-swipe-action span[aria-hidden] { font-size: 18px; }
.comm-swipe { position: relative; z-index: 1; touch-action: pan-y; transition: transform .18s ease; }
.comm-swipe.is-dragging { transition: none; }

/* Inline-Namensänderung (Modal) */
.comm-name-form { display: flex; flex-direction: column; gap: 8px; }
.comm-name-input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; }
.comm-name-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.comm-form-err { color: var(--err); font-size: 13px; }

/* Screen content stays complete and legible, including in portrait tiles. */
.is-screen-sharing .conf-tile-video, .is-screen-sharing .call-tile-video{object-fit:contain;background:#111;transform:none}

/* ======================================================================
   Audio-Steuerung + Audio-Diagnose im Call-Screen
   Vier getrennte Funktionen: Mikrofon | Lautsprecher (Route) | Ton | Auflegen.
   Jeder Zustand ist als Text UND Farbe lesbar (AKTIV / STUMM), nicht nur als Symbol.
   ====================================================================== */
.cc-cbtn-state { display: inline-block; margin-top: -1px; padding: 1px 7px; border-radius: 999px;
  font-size: 9px; font-weight: 800; letter-spacing: .05em; line-height: 1.55; text-transform: uppercase;
  color: #fff; background: rgba(255,255,255,.18); white-space: nowrap; }
.cc-cbtn-state[hidden] { display: none; }
.cc-cbtn-state.is-active { background: #1f9d55; }
.cc-cbtn-state.is-muted { background: #d92d20; }
.cc-cbtn-state.is-warn { background: #c77700; }
.cc-cbtn-state.is-idle { background: rgba(255,255,255,.22); }
/* Symbolpaare: normal ↔ durchgestrichen (nur eines ist sichtbar). */
#muteIco svg { display: none; }
#muteIco .ico-plain { display: block; }
#muteBtn.media-off #muteIco .ico-plain { display: none; }
#muteBtn.media-off #muteIco .ico-crossed { display: block; }
/* Built-in routes share the speaker glyph; highlight shows on/off. */
#spkIco .ico-speaker { display: block; }
#spkBtn[data-route="earpiece"] #spkIco .ico-speaker,
#spkBtn[data-route="speaker"] #spkIco .ico-speaker,
#spkBtn[data-route="bluetooth"] #spkIco .ico-bluetooth,
#spkBtn[data-route="headphones"] #spkIco .ico-headphones,
#spkBtn[data-route="airplay"] #spkIco .ico-speaker,
#spkBtn[data-route="car"] #spkIco .ico-speaker,
#spkBtn[data-route="usb"] #spkIco .ico-speaker,
#spkBtn[data-route="hdmi"] #spkIco .ico-speaker,
#spkBtn[data-route="other"] #spkIco .ico-speaker,
#spkBtn[data-route="unknown"] #spkIco .ico-speaker { display: block; }
#spkBtn.route-on .cc-cbtn-ring { border-color: #fff; }
#spkBtn[data-route="bluetooth"] .cc-cbtn-ring, #spkBtn[data-route="headphones"] .cc-cbtn-ring { border-color: #4ea1ff; color: #8cc4ff; }
#spkBtn.route-pending .cc-cbtn-ring { opacity: .6; }

/* --- Diagnose-Dock: immer direkt über der Steuerleiste, Panel wächst nach oben --- */
.ad-dock { position: fixed; left: 0; right: 0; bottom: var(--ad-bar-h, 120px); z-index: 38;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end;
  max-height: calc(var(--app-viewport-height, 100vh) - var(--ad-bar-h, 120px) - env(safe-area-inset-top, 0px) - 64px);
  padding: 0 10px 6px; pointer-events: none; }
.ad-dock[hidden] { display: none; }
.ad-dock > * { pointer-events: auto; }
.ad-toggle { align-self: flex-start; display: flex; align-items: center; gap: 8px; max-width: 100%;
  min-height: 30px; padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.24);
  background: rgba(14,10,7,.84); color: #fff; font: 600 12px/1.2 -apple-system, system-ui, sans-serif;
  cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.ad-toggle-title { white-space: nowrap; }
.ad-toggle-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500; opacity: .86; }
.ad-toggle-chev { flex: none; transition: transform .2s ease; }
.ad-toggle.open .ad-toggle-chev { transform: rotate(180deg); }
.cc-diag-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #777; }
.cc-diag-dot.sev-ok { background: #2ecc71; }
.cc-diag-dot.sev-info { background: #4ea1ff; }
.cc-diag-dot.sev-warn { background: #f5a524; }
.cc-diag-dot.sev-error { background: #ff4d4f; animation: ad-pulse 1.1s ease-in-out infinite; }
@keyframes ad-pulse { 50% { opacity: .35; } }
.ad-panel { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  margin-bottom: 6px; padding: 12px; border-radius: 16px; background: #0e0a07;
  border: 1px solid rgba(255,255,255,.16); box-shadow: 0 -12px 34px rgba(0,0,0,.5);
  color: #f3ece4; font: 12.5px/1.4 -apple-system, system-ui, sans-serif; }
.ad-panel[hidden] { display: none; }
.ad-panel h4 { margin: 12px 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #bfae9a; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.ad-lane-state { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 11.5px; }
.ad-lane-state.ad-ok { color: #4ade80; } .ad-lane-state.ad-info { color: #8cc4ff; }
.ad-lane-state.ad-warn { color: #fbbf24; } .ad-lane-state.ad-error { color: #ff7875; }
.ad-lane-state.ad-idle { color: #9a8c7c; }
.ad-verdict { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px;
  border-left: 4px solid #777; background: rgba(255,255,255,.06); }
.ad-verdict-ico::before { content: "●"; font-size: 14px; line-height: 1.2; color: #777; }
.ad-verdict-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ad-verdict-title { font-size: 13.5px; }
.ad-verdict-detail { color: #d9cdbf; font-size: 12px; }
.ad-verdict.ad-ok { border-color: #2ecc71; } .ad-verdict.ad-ok .ad-verdict-ico::before { color: #2ecc71; }
.ad-verdict.ad-info { border-color: #4ea1ff; } .ad-verdict.ad-info .ad-verdict-ico::before { color: #4ea1ff; }
.ad-verdict.ad-warn { border-color: #f5a524; } .ad-verdict.ad-warn .ad-verdict-ico::before { color: #f5a524; }
.ad-verdict.ad-error { border-color: #ff4d4f; background: rgba(255,77,79,.12); }
.ad-verdict.ad-error .ad-verdict-ico::before { color: #ff4d4f; }
/* Eine Messstufe: Name + Statuschip oben, Pegelbalken + Zahl darunter. */
.ad-stage { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "label chip" "meter num";
  gap: 3px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.ad-stage-label { grid-area: label; font-weight: 600; min-width: 0; }
.ad-stage-ico { display: inline-block; width: 1.5em; }
.ad-chip { grid-area: chip; justify-self: end; padding: 1px 8px; border-radius: 999px; font-size: 10px;
  font-weight: 800; letter-spacing: .04em; background: #4b4338; color: #fff; white-space: nowrap; }
.ad-meter { grid-area: meter; height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.ad-meter-none { height: 0; background: none; }
.ad-meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: #4ade80; transition: width .1s linear; }
.ad-num { grid-area: num; justify-self: end; min-width: 3em; font-size: 11px; color: #cdbfae; text-align: right;
  font-variant-numeric: tabular-nums; }
.ad-stage.ad-ok .ad-chip { background: #1f9d55; }
.ad-stage.ad-muted .ad-chip { background: #d92d20; } .ad-stage.ad-muted .ad-meter i { background: #6b6258; }
.ad-stage.ad-warn .ad-chip { background: #c77700; } .ad-stage.ad-warn .ad-meter i { background: #fbbf24; }
.ad-stage.ad-error .ad-chip { background: #e5484d; } .ad-stage.ad-error .ad-meter i { background: #ff7875; }
.ad-stage.ad-idle .ad-chip, .ad-stage.ad-unknown .ad-chip { background: #4b4338; }
.ad-stage.ad-info .ad-chip { background: #2f6fb5; }
.ad-agent-verdict { padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.06); margin-bottom: 4px; }
.ad-agent-verdict.ad-error { background: rgba(255,77,79,.14); } .ad-agent-verdict.ad-ok { background: rgba(46,204,113,.14); }
.ad-agent-verdict.ad-warn { background: rgba(245,165,36,.14); }
.ad-test { margin-top: 4px; padding: 8px 10px; border-radius: 12px; background: rgba(78,161,255,.1);
  border: 1px solid rgba(78,161,255,.28); }
.ad-test h4 { margin-top: 2px; }
.ad-test-hint { margin: 4px 0 8px; color: #d9cdbf; }
.ad-actions { display: flex; flex-wrap: wrap; gap: 8px; } .ad-actions-end { margin-top: 10px; justify-content: flex-end; }
.ad-btn { padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08);
  color: #fff; font: 600 12.5px/1.2 -apple-system, system-ui, sans-serif; cursor: pointer; }
.ad-btn.primary { background: #2f6fb5; border-color: #2f6fb5; }
.ad-btn[hidden] { display: none; }
.ad-facts { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.5fr); gap: 4px 12px; margin: 10px 0 0; }
.ad-facts dt { color: #a99b8a; } .ad-facts dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.ad-fact-ok { color: #4ade80; } .ad-fact-warn { color: #fbbf24; } .ad-fact-error { color: #ff7875; }
.ad-fact-muted { color: #ff9c8e; }
.ad-log-title { margin-top: 12px; }
.ad-log { list-style: none; margin: 0; padding: 6px 8px; max-height: 150px; overflow-y: auto; border-radius: 10px;
  background: rgba(0,0,0,.35); font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.ad-ev time { color: #8f8272; } .ad-ev-warn { color: #fbbf24; } .ad-ev-error { color: #ff7875; } .ad-ev-ok { color: #4ade80; }
.ad-report { width: 100%; min-height: 90px; margin-top: 8px; font: 11px ui-monospace, Menlo, monospace; }
@media (orientation: landscape) and (max-height: 540px) {
  .ad-panel { padding: 8px 10px; } .ad-log { max-height: 80px; }
}
/* Mehr Funktionen in der Leiste (Mikrofon | Route | Ton | Kamera | … | Auflegen): lange
   Beschriftungen kürzen statt ineinanderzulaufen. */
.cc-bar .cc-cbtn { min-width: 0; }
.cc-bar .cc-cbtn-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  /* Sieben Funktionen auf einem schmalen Telefon: Schrift verkleinern, statt zu kürzen. */
  body.call-standalone .cc-bar .cc-cbtn-label { font-size: 10px; letter-spacing: -.015em; }
  body.call-standalone .cc-bar .cc-cbtn-state { font-size: 8.5px; padding: 1px 5px; }
}

/* ===================================================================
   Artefakte / strukturierte Live-Ausgaben (web/static/web/artifacts.js)
   Deklarativ gerenderte Kacheln im Conversation-Chat. Vollständig über die
   bestehenden Design-Tokens gethemt (Hell/Dunkel automatisch).
   =================================================================== */
.artifact-stack { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 16px; }
.af-card {
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(60,40,20,.05), 0 10px 30px -14px rgba(60,40,20,.22);
  overflow: hidden; transition: transform .18s ease, box-shadow .18s ease;
}
.af-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(60,40,20,.06), 0 18px 40px -16px rgba(123,74,36,.38);
}
.af-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-soft), transparent);
}
.af-card-ident { display: flex; align-items: center; gap: 11px; min-width: 0; }
.af-card-icon {
  width: 32px; height: 32px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px; line-height: 1;
  background: var(--surface); color: var(--accent);
  border: 1px solid var(--border-strong); box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.af-card-titles { min-width: 0; }
.af-card-title { font-weight: 700; color: var(--text); font-size: 15px; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-card-sub { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-top: 1px; }
.af-card-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.af-export {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; text-decoration: none; color: var(--accent-text);
  background: var(--accent); border-radius: 999px; padding: 5px 12px; font-weight: 600;
  box-shadow: 0 2px 8px -2px rgba(123,74,36,.5); transition: background .15s ease, transform .15s ease;
}
.af-export:hover { background: var(--accent-hover); transform: translateY(-1px); }
.af-export-ic { font-size: 13px; }
.af-card-body { padding: 16px; }
.af-muted { color: var(--muted); }

/* text */
.af-text p { margin: 0 0 8px; line-height: 1.55; color: var(--text); }
.af-text p:last-child { margin-bottom: 0; }

/* table */
.af-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.af-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.af-table th, .af-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.af-table th { color: var(--text-dim); font-weight: 600; background: var(--card); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.af-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--card) 55%, transparent); }
.af-table tr:last-child td { border-bottom: none; }

/* stat_cards */
.af-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; }
.af-stat {
  text-align: center; padding: 16px 12px; border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(180deg, var(--card), var(--surface)); transition: transform .15s ease, box-shadow .15s ease;
}
.af-stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(60,40,20,.4); }
.af-stat-icon {
  width: 42px; height: 42px; margin: 0 auto 8px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
  background: var(--accent-soft); border: 1px solid var(--border);
}
.af-stat-value { font-size: 28px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.af-stat-label { font-size: 12px; color: var(--text-dim); margin-top: 3px; font-weight: 500; }
.af-stat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* order_list */
.af-order { display: flex; flex-direction: column; }
.af-order-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px dashed var(--border); }
.af-order-row:last-of-type { border-bottom: none; }
.af-order-name { color: var(--text); font-size: 15px; }
.af-order-note { color: var(--muted); font-size: 12px; margin-left: 8px; }
.af-order-qty {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); white-space: nowrap;
  background: var(--accent-soft); border-radius: 999px; padding: 3px 11px; font-size: 13px; min-width: 40px; text-align: center;
}
.af-order-total {
  display: flex; justify-content: space-between; align-items: center; margin-top: 12px;
  padding: 12px 14px; border-radius: 12px; background: var(--accent-soft);
  font-weight: 700; color: var(--text); font-size: 15px;
}
.af-order-total span:last-child { font-size: 20px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }

/* checklist */
.af-check { display: flex; flex-direction: column; gap: 2px; }
.af-check-row { display: flex; gap: 11px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.af-check-row:last-child { border-bottom: none; }
.af-check-box { font-size: 18px; line-height: 1; color: var(--accent); }
.af-check-row.done .af-check-box { color: var(--ok); }
.af-check-label { color: var(--text); }
.af-check-row.done .af-check-label { color: var(--muted); text-decoration: line-through; }
.af-check-note { color: var(--muted); font-size: 12px; margin-left: 8px; }

/* charts */
.af-chart { width: 100%; position: relative; }
.af-chart-svg { width: 100%; height: auto; max-height: 240px; display: block; }
.af-chart-val { fill: var(--text); font-size: 10px; font-weight: 700; }
.af-chart-axis { fill: var(--text-dim); font-size: 9px; }
.af-chart-point { cursor: pointer; stroke: var(--surface); stroke-width: 1.5; outline: none; }
.af-chart-point:hover, .af-chart-point:focus { r: 6; stroke: var(--text); stroke-width: 2; }
.af-chart-tooltip {
  position: absolute; z-index: 3; transform: translate(-50%, calc(-100% - 8px));
  max-width: min(240px, 78%); padding: 7px 10px; border-radius: 8px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow);
  font-size: 12px; font-weight: 700; line-height: 1.25; white-space: nowrap;
  pointer-events: none;
}
.af-chart-tooltip[hidden] { display: none; }
.af-pie { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.af-pie-chart { flex: 0 0 140px; filter: drop-shadow(0 6px 14px rgba(60,40,20,.18)); }
.af-pie-svg { width: 140px; height: 140px; display: block; }
.af-pie-legend { flex: 1 1 160px; display: flex; flex-direction: column; gap: 7px; }
.af-pie-legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); }
.af-pie-swatch { width: 13px; height: 13px; border-radius: 4px; flex: none; }
.af-pie-legend-label { flex: 1; }
.af-pie-legend-val { color: var(--text-dim); font-variant-numeric: tabular-nums; font-weight: 600; }

/* timeline */
.af-timeline { display: flex; flex-direction: column; }
.af-tl-row { display: flex; gap: 14px; }
.af-tl-marker { display: flex; flex-direction: column; align-items: center; }
.af-tl-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); margin-top: 3px; flex: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.af-tl-line { width: 2px; flex: 1; background: var(--border-strong); margin: 3px 0; }
.af-tl-row:last-child .af-tl-line { display: none; }
.af-tl-content { padding-bottom: 16px; }
.af-tl-time { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.af-tl-title { font-weight: 650; color: var(--text); }
.af-tl-desc { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.af-tl-row.done .af-tl-dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.af-tl-row.pending .af-tl-dot { background: var(--idle); box-shadow: 0 0 0 4px color-mix(in srgb, var(--idle) 24%, transparent); }

/* slide */
.af-slide {
  border: 1px solid var(--border-strong); border-radius: 14px;
  background: radial-gradient(120% 120% at 0% 0%, var(--accent-soft), var(--surface) 60%);
  padding: 24px 26px; min-height: 190px; aspect-ratio: 16 / 9; display: flex; flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 10px 26px -16px rgba(60,40,20,.4);
}
.af-slide-title { font-size: 23px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.af-slide-title::after { content: ""; display: block; width: 46px; height: 3px; margin-top: 8px; border-radius: 3px; background: var(--accent); }
.af-slide-sub { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.af-slide-metrics { display: flex; flex-wrap: wrap; gap: 26px; margin: auto 0; }
.af-slide-metric { text-align: center; }
.af-slide-metric-value { font-size: 32px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.af-slide-metric-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.af-slide-visuals {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px;
  flex: 1 1 auto; min-height: 0; margin-top: 14px; overflow: auto;
}
.af-slide-visual { min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); }
.af-slide-visual-title { margin-bottom: 7px; font-size: 13px; font-weight: 750; color: var(--text-dim); }
.af-slide-visual .af-stats { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; }
.af-slide-visual .af-stat { padding: 9px; min-height: 72px; }
.af-slide-visual .af-stat-value { font-size: 22px; }
.af-slide-visual .af-chart-svg { max-height: 230px; }
.af-slide-body { margin-top: 16px; color: var(--text); overflow: auto; }
.af-slide-bullets { margin: 0; padding-left: 20px; line-height: 1.7; }
.af-slide-heading { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.af-slide-paragraph { margin: 0 0 8px; line-height: 1.55; }

/* presentation */
.af-pres { display: flex; flex-direction: column; gap: 12px; }
.af-pres-nav { display: flex; align-items: center; justify-content: center; gap: 18px; }
.af-pres-btn {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 50%; width: 36px; height: 36px; font-size: 18px; cursor: pointer; line-height: 1;
  display: grid; place-items: center; transition: background .15s ease, color .15s ease, transform .15s ease;
}
.af-pres-btn:hover { background: var(--accent); color: var(--accent-text); transform: translateY(-1px); }
.af-pres-counter { font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 13px; min-width: 54px; text-align: center; font-weight: 600; }
.af-pres-dots { display: flex; justify-content: center; gap: 8px; }
.af-pres-dot { width: 9px; height: 9px; border-radius: 50%; border: none; background: var(--border-strong); cursor: pointer; padding: 0; transition: background .15s ease, transform .15s ease; }
.af-pres-dot:hover { transform: scale(1.2); }
.af-pres-dot.active { background: var(--accent); width: 22px; border-radius: 999px; }

/* Fallback (unbekannter/ungültiger Typ — kontrolliert, kein Crash) */
.af-fallback { font-size: 13px; }
.af-fallback-note { color: var(--warn); margin-bottom: 8px; }
.af-fallback-pre {
  margin: 0; padding: 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; overflow: auto; max-height: 260px; font-size: 12px; color: var(--text-dim);
}

/* ===================================================================
   Artefakt-Fenster (web/static/web/artifacts.js openWindow)
   Zoomt als Modal auf, zeigt die Visualisierungen eines Agenten und bietet
   Download als PDF/PowerPoint/Bild. Wird aus dem Notizblock-Icon der
   Avatar-Kachel (conference.js) geöffnet.
   =================================================================== */
.af-win-backdrop {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 24px;
  background: rgba(20, 12, 6, .55); opacity: 0; transition: opacity .2s ease;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.af-win-backdrop.open { opacity: 1; }
.af-win {
  width: min(900px, 96vw); max-height: 90vh; display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 18px; box-shadow: 0 30px 90px -22px rgba(0, 0, 0, .6); overflow: hidden;
  transform: scale(.9); opacity: 0;
  transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .22s ease;
}
.af-win-backdrop.open .af-win { transform: scale(1); opacity: 1; }
.af-win-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--accent-soft), transparent);
  flex: none;
}
.af-win-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; min-width: 0; }
.af-win-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-win-ic { font-size: 19px; }
.af-win-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.af-win-dl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.af-win-dl-label { font-size: 12px; color: var(--text-dim); }
.af-win-dlbtn {
  font-size: 12px; text-decoration: none; color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 12px; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.af-win-dlbtn:hover { background: var(--accent); color: var(--accent-text); }
.af-win-close {
  border: none; background: transparent; color: var(--text-dim); font-size: 20px; cursor: pointer;
  width: 34px; height: 34px; border-radius: 10px; line-height: 1; flex: none;
}
.af-win-close:hover { background: var(--accent-soft); color: var(--text); }
.af-win-body { padding: 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.af-win-empty {
  text-align: center; color: var(--text-dim); padding: 46px 16px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.af-win-empty-ic { font-size: 36px; opacity: .7; }
.af-win-loading { color: var(--text-dim); padding: 20px; text-align: center; }
/* Notizblock-Icon auf der Avatar-Kachel etwas hervorheben. */
.conf-ctl-artifacts { font-size: 15px; }
@media (max-width: 560px) {
  .af-win-head { flex-wrap: wrap; }
  .af-win-dl { width: 100%; }
}

/* ===================================================================
   Artefakte — neue Typen (action_items, status_board, grouped_list,
   key_value, callout, progress, line_chart) + Tabellen-Summen/Sortierung.
   =================================================================== */
/* table: Summenzeile, Sortier-Header, Ausrichtung */
.af-td-right { text-align: right; font-variant-numeric: tabular-nums; }
.af-td-center { text-align: center; }
.af-th-sort { cursor: pointer; user-select: none; }
.af-th-sort:hover { color: var(--accent); }
.af-sort-caret { color: var(--accent); font-size: 10px; }
.af-table-total td { border-top: 2px solid var(--border-strong); font-weight: 800; color: var(--accent); background: var(--accent-soft); }

/* action_items */
.af-ai { display: flex; flex-direction: column; gap: 2px; }
.af-ai-row { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.af-ai-row:last-child { border-bottom: none; }
.af-ai-status { flex: none; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.af-ai-status.open { background: var(--accent-soft); color: var(--accent); }
.af-ai-status.in-progress { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.af-ai-status.done { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.af-ai-main { flex: 1; min-width: 0; }
.af-ai-task { color: var(--text); font-weight: 550; }
.af-ai-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 3px; font-size: 12px; color: var(--text-dim); }

/* status_board (Kanban) */
.af-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.af-board-col { flex: 1 0 150px; min-width: 150px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.af-board-head { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.af-board-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.af-board-title { font-weight: 650; font-size: 13px; flex: 1; }
.af-board-count { font-size: 11px; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 1px 8px; }
.af-board-cards { display: flex; flex-direction: column; gap: 8px; }
.af-board-card { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; box-shadow: var(--shadow); }
.af-board-card-title { font-size: 13px; color: var(--text); }
.af-board-card-note { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

/* grouped_list */
.af-grouped { display: flex; flex-direction: column; gap: 14px; }
.af-group-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--accent); border-bottom: 2px solid var(--accent-soft); padding-bottom: 5px; margin-bottom: 4px; }
.af-group-sub { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.af-group-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px; border-bottom: 1px dashed var(--border); }
.af-group-row:last-child { border-bottom: none; }
.af-group-name { color: var(--text); }
.af-group-val { font-variant-numeric: tabular-nums; color: var(--text-dim); }

/* key_value / info_card */
.af-kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; }
.af-kv-row { display: contents; }
.af-kv-label { color: var(--text-dim); font-size: 13px; }
.af-kv-value { color: var(--text); font-weight: 550; }

/* callout / alert */
.af-card-bare { border: none; box-shadow: none; background: transparent; overflow: visible; }
.af-card-bare:hover { transform: none; box-shadow: none; }
.af-callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid; align-items: flex-start; }
.af-callout-ic { font-size: 18px; line-height: 1.3; flex: none; }
.af-callout-title { font-weight: 700; margin-bottom: 2px; }
.af-callout-text { font-size: 14px; line-height: 1.45; }
.af-callout-info { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: var(--border-strong); color: var(--text); }
.af-callout-warning { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--text); }
.af-callout-success { background: color-mix(in srgb, var(--ok) 13%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 42%, transparent); color: var(--text); }
.af-callout-error { background: color-mix(in srgb, var(--err) 13%, var(--surface)); border-color: color-mix(in srgb, var(--err) 45%, transparent); color: var(--text); }

/* progress / progress_bar */
.af-progress { display: flex; flex-direction: column; gap: 14px; }
.af-progress-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.af-progress-label { color: var(--text); font-weight: 550; }
.af-progress-val { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.af-progress-track { height: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.af-progress-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }

/* ===================================================================
   Artefakte — Typen Teil 2 (comparison, decision_log, activity_feed,
   schedule, matrix, flow, document).
   =================================================================== */
/* comparison */
.af-cmp-label { font-weight: 650; color: var(--text); }
.af-cmp td.af-td-center, .af-cmp th.af-td-center { text-align: center; }

/* decision_log */
.af-dlog { display: flex; flex-direction: column; gap: 12px; }
.af-dlog-item { border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 10px 10px 0; padding: 11px 14px; }
.af-dlog-decision { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.af-dlog-ic { color: var(--accent); }
.af-dlog-rationale { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.af-dlog-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* activity_feed */
.af-feed { display: flex; flex-direction: column; }
.af-feed-row { display: flex; gap: 11px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.af-feed-row:last-child { border-bottom: none; }
.af-feed-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.af-feed-dot.add { background: var(--ok); }
.af-feed-dot.remove { background: var(--err); }
.af-feed-main { flex: 1; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.af-feed-text { color: var(--text); }
.af-feed-time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* schedule */
.af-sched { display: flex; flex-direction: column; gap: 2px; }
.af-sched-date { font-weight: 700; color: var(--accent); margin: 10px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.af-sched-row { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--border); align-items: baseline; }
.af-sched-row:last-child { border-bottom: none; }
.af-sched-time { flex: none; min-width: 58px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.af-sched-main { display: flex; flex-direction: column; }
.af-sched-title { color: var(--text); }
.af-sched-note { font-size: 12px; color: var(--text-dim); }

/* matrix */
.af-mx th, .af-mx td { border: 1px solid var(--border); }
.af-mx-corner { background: var(--card); color: var(--text-dim); font-size: 11px; }
.af-mx-row { background: var(--card); color: var(--text); text-align: left; font-weight: 650; }
.af-mx-cell { min-width: 70px; }

/* flow / process */
.af-flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.af-flow-step { flex: 1 1 auto; min-width: 100px; background: var(--card); border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px; text-align: center; }
.af-flow-step.st-done { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.af-flow-step.st-in_progress { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 42%, transparent); }
.af-flow-label { font-weight: 650; color: var(--text); font-size: 14px; }
.af-flow-note { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.af-flow-arrow { display: flex; align-items: center; color: var(--accent); font-size: 20px; font-weight: 700; flex: none; }

/* document / report */
.af-doc { color: var(--text); line-height: 1.55; }
.af-doc-h { font-size: 19px; font-weight: 700; margin: 4px 0 8px; color: var(--text); }
.af-doc-sub { font-size: 15px; font-weight: 650; margin: 14px 0 6px; color: var(--accent); }
.af-doc-p { margin: 0 0 10px; }
.af-doc-ul { margin: 0 0 10px; padding-left: 20px; }
.af-doc-ul li { margin-bottom: 4px; }
.af-doc-embed { margin: 12px 0; }

@media (max-width: 720px) {
  /* Auf schmalen Displays soll der Inhalt dominieren. Die äußere Conversation-
     Karte, die Artefakt-Karte und die Folie brauchen nicht jeweils einen großen
     eigenen Innenrahmen. */
  .artifact-stack { gap: 7px; margin: 2px 0 8px; }
  .af-card { border-radius: 11px; box-shadow: 0 3px 12px rgba(60,40,20,.09); }
  .af-card:hover { transform: none; box-shadow: 0 3px 12px rgba(60,40,20,.09); }
  .af-card-head { gap: 7px; padding: 7px 8px; }
  .af-card-ident { gap: 7px; }
  .af-card-icon { width: 28px; height: 28px; border-radius: 8px; font-size: 14px; }
  .af-card-title { font-size: 13px; }
  .af-card-sub { font-size: 8.5px; }
  .af-export { gap: 4px; padding: 5px 8px; font-size: 10.5px; }
  .af-card-body { padding: 6px; }
  .af-slide { min-height: 150px; padding: 12px 13px; border-radius: 10px; box-shadow: none; }
  .af-slide-title { font-size: 18px; }
  .af-slide-title::after { width: 34px; height: 2px; margin-top: 5px; }
  .af-slide-sub { margin-top: 5px; font-size: 11px; }
  .af-slide-visuals { gap: 7px; margin-top: 8px; }
  .af-slide-visual { padding: 6px; border-radius: 8px; }
  .af-slide-body { margin-top: 9px; }
  .ms-chat-head { min-height: 52px; padding: 5px 8px; }
  .ms-chat-head .ms-avatar { width: 36px; height: 36px; }
  .ms-chat-head .ms-round { width: 34px; height: 34px; }
  .ms-messages { padding-top: 10px; }
}

/* User settings remain within the viewport even when the browser is zoomed. */
.modal:has(.user-settings) {
  width: min(760px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  box-sizing: border-box;
}
.modal:has(.user-settings) .modal-body { min-width: 0; overflow-x: hidden; }
.user-settings, .user-settings * { min-width: 0; box-sizing: border-box; }
.profile-account-data { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-key-create { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.settings-key-create .field { min-width: 0; }
.settings-key-create input { width: 100%; }
.settings-key-card { flex-wrap: wrap; }
.settings-key-main code, .settings-api-example code, .settings-api-example span { overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .mcp-layout, .mcp-facts, .mcp-tool-list { grid-template-columns: minmax(0, 1fr); }
  .mcp-wide { grid-column: auto; }
  .mcp-card { padding: 15px; }
  .mcp-endpoint, .mcp-code { flex-direction: column; }
  .mcp-endpoint .btn, .mcp-code .btn { width: 100%; }
  .modal:has(.user-settings) { width: calc(100vw - 16px) !important; max-width: calc(100vw - 16px) !important; }
  .user-settings { gap: 12px; }
  .profile-account-data { grid-template-columns: minmax(0, 1fr); gap: 7px; margin-bottom: 4px; }
  .profile-account-data > div { padding: 8px 10px; }
  .settings-key-create { grid-template-columns: minmax(0, 1fr); }
  .settings-key-actions { width: 100%; }
  .settings-key-actions .btn { flex: 1 1 auto; }
  .settings-secret { grid-template-columns: minmax(0, 1fr); }
  .settings-secret .hint { grid-column: auto; }
}

/* Native tasks reuse theme colors and adapt to narrow layouts. */
.work-task-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.work-task-toolbar > input, .work-task-toolbar > select { flex: 1 1 160px; min-width: 0; }
.work-management > [hidden], .work-task-toolbar > [hidden] { display: none !important; }
.work-task-actions { align-items: center; }
.work-task-views { display: flex; gap: 4px; margin-left: auto; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.work-task-views .btn { display: inline-flex; align-items: center; gap: 7px; }
.work-task-views svg { width: 17px; height: 17px; }
.work-task-filters { margin-top: 0; }
.work-task-calendar { min-width: 0; min-height: 0; }
.work-task-calendar .calendar-toolbar { margin-bottom: 12px; }
.work-task-readonly { width: 760px; }
.work-task-readonly pre { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (min-width: 901px) {
  .work-tasks-page .work-task-calendar { display: flex; flex: 1; flex-direction: column; overflow: hidden; }
  .work-task-calendar .calendar-layout { flex: 1; min-height: 0; align-items: stretch; }
  .work-task-calendar .calendar-grid-wrap { max-height: none; height: 100%; min-height: 0; }
  .work-task-calendar .calendar-detail { min-height: 0; overflow: auto; }
}
@media (max-width: 600px) {
  .work-task-actions { gap: 8px; }
  .work-task-views { margin-left: 0; width: 100%; max-width: 100%; }
  .work-task-views .btn { flex: 1; justify-content: center; min-width: 0; padding-inline: 7px; gap: 5px; font-size: 12px; }
  .work-task-filters > select { flex-basis: calc(50% - 10px); }
  .work-task-filters > input[type="search"] { flex-basis: calc(100% - 60px); }
  .work-task-calendar .calendar-grid-wrap { max-height: 60dvh; }
}
.work-task-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.work-task-card { padding: 16px; display: grid; gap: 10px; overflow-wrap: anywhere; }
.work-task-summary { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.work-run { margin: 12px 0; overflow-wrap: anywhere; }
.work-run-result { white-space: pre-wrap; font: inherit; max-height: 350px; overflow: auto; }
.work-tool-trace { margin: 12px 0; min-width: 0; }
.work-tool-trace summary { cursor: pointer; overflow-wrap: anywhere; }
.work-tool-step { margin: 10px 0 10px 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 0; }
.work-tool-step > summary { margin-bottom: 8px; }
.work-tool-json { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; font-size: 12px; }
.work-task-toolbar > input, .work-task-toolbar > select { min-height: 38px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.work-management { margin-top: 20px; min-width: 0; }
.agent-editor-panel-tasks .agent-editor-panel-heading { position: relative; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.agent-editor-panel-tasks .agent-editor-panel-heading h2 { margin: 0; }
.agent-task-settings { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.agent-task-retention-inline { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.agent-editor .agent-task-settings .agent-editor-switch { display: inline-flex; align-items: center; padding: 0; margin: 0; white-space: nowrap; gap: 8px; }
.agent-editor .agent-task-settings .agent-task-retention-inline input[type="number"] { flex: 0 0 64px; width: 64px; min-width: 0; max-width: 64px; height: 36px; padding: 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.agent-task-retention-inline input:disabled { opacity: .5; }
.agent-task-retention-inline .hint { margin: 0; }
@media (max-width: 480px) {
  .agent-editor .agent-task-settings .agent-task-retention-inline { gap: 5px; }
  .agent-editor .agent-task-settings .agent-editor-switch { font-size: 12px; gap: 6px; }
  .agent-editor .agent-task-settings .agent-task-retention-inline input[type="number"] { flex-basis: 52px; width: 52px; max-width: 52px; }
}
.agent-tasks-content .work-management { margin-top: 0; }
.agent-tasks-content .work-task-toolbar { margin-top: 0; gap: 8px; }
.agent-tasks-content .work-task-toolbar > select { flex: 0 1 160px; }
.agent-tasks-content .work-task-toolbar > input[type="search"] { flex: 1 1 200px; }
.agent-editor-panel-tasks .agent-editor-panel-heading > .work-task-actions { margin: 0 0 0 auto; gap: 8px; }
.agent-editor-panel-tasks .agent-task-settings { gap: 12px; }
.agent-editor-panel-tasks .work-task-toolbar .btn { min-height: 36px; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.agent-editor-panel-tasks .agent-task-settings .agent-editor-switch { font-size: 13px; }
.agent-editor-panel-tasks .work-task-filters { align-items: center; margin-bottom: 10px; }
.agent-editor-panel-tasks .work-task-filters > :is(input, select) { height: 36px; min-height: 36px; margin: 0; padding: 6px 10px; font-size: 13px; }
.agent-editor-panel-tasks .work-task-filters > .hint { margin: 0; font-size: 12px; }
.work-task-refresh { min-width: 40px; font-size: 20px; }
.work-task-empty td { width: auto !important; padding: 24px 12px; color: var(--text-dim); text-align: center; }
.work-task-table-wrap { width: 100%; min-width: 0; overflow-x: auto; }
.work-task-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.work-task-panel { overflow: clip; }
.work-task-table th { text-align: left; color: var(--text); font-size: 14px; font-weight: 700; line-height: 1.4; background: var(--surface-2); }
.work-task-table th, .work-task-table td { padding: 15px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.work-task-table th { padding-block: 19px; border-bottom: 2px solid var(--border-strong); }
.work-task-table td { overflow-wrap: break-word; word-break: normal; }
.work-task-table td:first-child { width: 30%; min-width: 170px; }
.work-task-table td:last-child, .work-task-table th:last-child { text-align: right; white-space: nowrap; }
.work-task-table .btn { white-space: nowrap; overflow-wrap: normal; }
@container (min-width: 761px) {
  .work-task-table th:nth-child(5), .work-task-table td:nth-child(5),
  .work-task-table th:last-child, .work-task-table td:last-child { width: 1%; }
  .work-task-table td:nth-child(5) .work-task-cell { min-width: max-content; }
}
.work-task-cell { min-width: 0; }
.work-task-cell > strong { font-size: 14px; }
.work-task-row { cursor: pointer; }
.work-task-row:hover { background: var(--surface-2); }
.work-task-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.work-task-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 5px 0; }
.work-task-subline { display: block; margin-top: 6px; }
.badge.work-status { display: inline-flex; align-items: center; gap: 5px; width: max-content; max-width: none; flex-shrink: 0; white-space: nowrap; overflow-wrap: normal; word-break: normal; vertical-align: middle; }
.work-status svg { flex: none; width: 13px; height: 13px; }
.work-status-pending, .work-status-queued { background: var(--accent-soft); color: var(--accent); }
.work-task-pages { justify-content: flex-end; align-items: center; margin-top: 16px; }

/* Personal calendar. The time grid stays a real week on narrow screens and
   scrolls horizontally; details then move below it instead of squeezing cards. */
.calendar-page, .calendar-overlap-dialog, .calendar-info-dialog { --calendar-success: #079b3e; --calendar-error: #df3028; --calendar-running: #f58a07; --calendar-recurring: #8844c6; --calendar-inactive: #747582; --calendar-hover-overlay: rgb(0 0 0 / 6%); }
:root[data-theme="dark"] :is(.calendar-page, .calendar-overlap-dialog, .calendar-info-dialog) { --calendar-hover-overlay: rgb(255 255 255 / 8%); }
.calendar-page { min-width: 0; container-type: inline-size; }
.calendar-toolbar { display: grid; gap: 12px; margin-bottom: 16px; }
.calendar-toolbar-main, .calendar-view-options, .calendar-view-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.calendar-toolbar-main, .calendar-view-options { justify-content: space-between; }
.calendar-toolbar-main .calendar-new { flex: 0 0 auto; width: auto; margin-left: auto; }
.calendar-view-controls { gap: 8px; }
.calendar-navigation, .calendar-filters, .calendar-detail-actions, .calendar-sources { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calendar-sources { padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.calendar-source { min-height: 34px; border: 0; background: transparent; color: var(--text-dim); }
.calendar-source.active { background: var(--accent); color: var(--accent-text); }
.calendar-day-count { min-height: 34px; border: 0; background: transparent; color: var(--text-dim); white-space: nowrap; }
.calendar-day-count.active { background: var(--accent); color: var(--accent-text); }
.calendar-navigation .btn { min-width: 42px; }
.calendar-range-label { min-width: 180px; padding: 10px 12px; border-radius: var(--radius-sm); text-align: center; }
.calendar-toolbar .calendar-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.calendar-toolbar .calendar-agent-filters { grid-template-columns: minmax(0, 1fr) minmax(140px, 190px); }
.calendar-toolbar .calendar-personal-filters { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
.calendar-toolbar .calendar-filters:has(> :not([hidden])) { padding-top: 12px; border-top: 1px solid var(--border); }
.calendar-toolbar .calendar-personal-filters:has(> :not([hidden])) { padding-top: 0; border-top: 0; }
.calendar-toolbar .calendar-personal-filters:not(:has(> :not([hidden]))) { display: none; }
.calendar-toolbar .calendar-filters [hidden] { display: none !important; }
.calendar-page .calendar-toolbar .calendar-filters :is(input, select) { width: 100%; min-width: 0; height: 40px; margin: 0; padding: 8px 12px; font-size: 14px; }
.calendar-toolbar .calendar-new { min-height: 40px; }
.calendar-filters select { min-height: 40px; min-width: 154px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.calendar-search { min-height: 40px; width: 190px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.calendar-layout { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 310px); align-items: start; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.calendar-loading { position: absolute; top: 60px; left: 12px; z-index: 9; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; }
.calendar-layout.agent-calendar-layout { grid-template-columns: minmax(0, 1fr); }
.calendar-grid-wrap { max-height: calc(100dvh - 245px); min-width: 0; overflow: auto; border-right: 1px solid var(--border); scrollbar-gutter: stable; }
.calendar-agenda { padding: 12px; }
.calendar-agenda-day + .calendar-agenda-day { margin-top: 20px; }
.calendar-agenda-day > h3 { position: sticky; top: -1px; z-index: 3; margin: 0; padding: 10px 4px; background: var(--surface); color: var(--text-dim); font-size: 13px; }
.work-task-calendar .calendar-agenda-day > h3 { padding: 14px 4px; color: var(--text); font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--border-strong); margin-bottom: 10px; }
.calendar-agenda-item { display: flex; align-items: center; gap: 8px; margin-top: 6px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface-2); }

.calendar-agenda-item.selected { outline: 1px solid var(--calendar-tone, var(--accent)); }
.calendar-agenda-open { display: grid; grid-template-columns: 130px 28px minmax(0, 1fr); align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 12px 10px; border: 0; border-radius: inherit; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.calendar-agenda-open:hover { background: var(--calendar-hover-overlay); }
.calendar-agenda-open:focus-visible { outline: 2px solid var(--calendar-tone, var(--accent)); outline-offset: -2px; }
.calendar-agenda-time { font-size: 12px; font-variant-numeric: tabular-nums; }
.calendar-agenda-copy { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.calendar-agenda-copy strong { font-size: 13px; }
.calendar-agenda-copy small { color: var(--text-dim); font-size: 11px; }
.calendar-agenda-item.has-leading-join { display: grid; grid-template-columns: 140px 28px minmax(0, 1fr); column-gap: 10px; }
.calendar-agenda-item.has-leading-join > .calendar-agenda-open { grid-column: 1 / -1; grid-row: 1; grid-template-columns: subgrid; }
.calendar-agenda-item.has-leading-join > .calendar-agenda-open > .calendar-agenda-time { grid-column: 1; }
.calendar-agenda-item.has-leading-join > .calendar-agenda-open > .calendar-agenda-copy { grid-column: 3; }
.calendar-agenda-item.has-leading-join > .calendar-leading-join { grid-column: 2; grid-row: 1; place-self: center; z-index: 1; }
.calendar-agenda-empty-day { margin: 0; padding: 4px 4px 10px; color: var(--text-dim); font-size: 12px; }
@container (max-width: 620px) {
  .calendar-agenda-open { grid-template-columns: 20px minmax(0, 1fr); gap: 6px 8px; padding: 10px 8px; }
  .calendar-agenda-time { grid-column: 1 / -1; }
  .calendar-agenda { padding: 8px; }
}
.agent-calendar-layout .calendar-grid-wrap { border-right: 0; }
.calendar-week { display: grid; grid-template-columns: 56px repeat(var(--calendar-days, 7), minmax(112px, 1fr)); grid-template-rows: 52px var(--calendar-hours-height, 720px); width: 100%; min-width: calc(56px + var(--calendar-days, 7) * 112px); }
.calendar-corner, .calendar-day-head { position: sticky; top: 0; z-index: 4; border-bottom: 1px solid var(--border); }
.calendar-corner { background: var(--surface-2); }
.calendar-day-head { display: grid; place-content: center; gap: 2px; border: 0; border-left: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; text-align: center; font-size: 12px; }
.calendar-day-head span { color: var(--text-dim); }
.calendar-day-head.today { color: var(--accent); background: var(--accent-soft); }
.calendar-day-head.selected { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); box-shadow: inset 0 -3px var(--accent); }
.calendar-day-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.calendar-hours { position: relative; background: var(--surface-2); }
.calendar-hours span { position: absolute; right: 8px; transform: translateY(-7px); color: var(--text-dim); font-size: 11px; }
.calendar-hours span:first-of-type { transform: translateY(6px); }
.calendar-hours span:last-of-type { transform: translateY(-100%); }
.calendar-now-line { position: absolute; z-index: 3; left: 0; right: 0; height: 2px; background: var(--err); pointer-events: none; }
.calendar-now-line::before { position: absolute; top: -3px; left: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); content: ""; }
.calendar-now-time { position: absolute; z-index: 3; right: 3px; padding: 2px 4px; border-radius: 4px; transform: translateY(-50%); background: var(--surface-2); color: var(--err); font-size: 11px; font-weight: 700; line-height: 16px; pointer-events: none; }
.calendar-day-body { position: relative; min-width: 0; border-left: 1px solid var(--border); background-color: var(--surface); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--calendar-hour-height) / 2 - 1px), color-mix(in srgb, var(--border) 55%, transparent) calc(var(--calendar-hour-height) / 2), transparent calc(var(--calendar-hour-height) / 2 + 1px), transparent calc(var(--calendar-hour-height) - 1px), var(--border) var(--calendar-hour-height)); }
.calendar-day-body.selected::before { position: absolute; z-index: 0; inset: 0; pointer-events: none; background: color-mix(in srgb, var(--accent-soft) 28%, transparent); content: ""; }
.calendar-entry { position: absolute; z-index: 1; left: 4px; right: 4px; overflow: hidden; padding: 5px 7px; border: 1px solid; border-radius: 7px; color: var(--text); text-align: left; font: inherit; line-height: 1.2; cursor: pointer; box-shadow: 0 1px 2px rgba(50, 30, 10, .05); }
.calendar-entry:hover { z-index: 2; box-shadow: inset 0 0 0 999px var(--calendar-hover-overlay), 0 1px 2px rgba(50, 30, 10, .05); }
.calendar-entry:focus-visible, .calendar-entry.selected { z-index: 2; outline: 2px solid var(--calendar-tone, var(--accent)); outline-offset: 1px; }
.calendar-overlap { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-content: start; align-items: center; gap: 2px; padding: 4px 6px; border-color: var(--accent); background: var(--accent-soft); }
.calendar-overlap .calendar-entry-copy { display: contents; }
.calendar-overlap strong { padding-right: 8px; font-size: 11px; }
.calendar-overlap .calendar-entry-glyph { margin: 0; }
.calendar-overlap .calendar-entry-time { grid-column: 1 / -1; margin: 0; line-height: 11px; }
.calendar-overlap > .calendar-overlap-arrow { position: absolute; top: 6px; right: 4px; font-size: 18px; }
.calendar-overlap-arrow { flex: 0 0 auto; color: var(--accent); font-size: 22px; line-height: 1; }
.calendar-overlap-list { display: grid; gap: 8px; }
.calendar-overlap-list .calendar-agenda-item { margin: 0; }
.calendar-overlap-list .calendar-agenda-open { grid-template-columns: 40px minmax(0, 1fr) 12px; gap: 12px; }
.calendar-overlap-list .calendar-agenda-copy { gap: 2px; }
.calendar-overlap-list .calendar-agenda-time { grid-column: auto; }
.calendar-overlap-list .calendar-entry-glyph { align-self: center; width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--calendar-tone, var(--accent)) 14%, var(--surface)); }
.calendar-overlap-list .calendar-entry-glyph .agent-channel-icon { width: 27px; height: 27px; }
.calendar-overlap-list .calendar-agenda-copy strong { font-size: 14px; }
.calendar-overlap-list .has-leading-join { grid-template-columns: 60px minmax(0, 1fr) 24px; column-gap: 0; }
.calendar-overlap-list .has-leading-join > .calendar-agenda-open > .calendar-agenda-copy { grid-column: 2; }
.calendar-overlap-list .has-leading-join > .calendar-agenda-open > .calendar-overlap-arrow { grid-column: 3; }
.calendar-overlap-list .has-leading-join > .calendar-leading-join { grid-column: 1; }
.calendar-detail > .calendar-overlap-list { margin-top: 16px; }
.calendar-overlap-date { margin: 0 0 12px; }
.calendar-overlap-dialog .modal-head { gap: 12px; }
.calendar-overlap-dialog .modal-head h3 { font-size: 15px; }
@media (max-width: 600px) {
  dialog.calendar-overlap-dialog { position: fixed; inset: auto 0 0; width: 100%; max-width: 100%; max-height: 82dvh; margin: 0 auto; border-radius: 18px 18px 0 0; }
  .calendar-overlap-dialog::before { content: ""; display: block; flex: 0 0 4px; width: 36px; margin: 8px auto 0; border-radius: 4px; background: var(--border-strong); }
  .calendar-overlap-dialog .modal-foot .btn { width: 100%; }
}
.calendar-entry-time, .calendar-entry small { display: block; overflow: hidden; color: inherit; font-size: 10px; opacity: .82; text-overflow: ellipsis; white-space: nowrap; }
.calendar-entry strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
/* Entry color identifies its source; execution state belongs to the icon. */
:is(.calendar-entry,.calendar-agenda-item):is(.event,.conference,.task) { --calendar-tone:var(--calendar-appointment-tone); border-color:color-mix(in srgb,var(--calendar-tone) 55%,var(--border)); background:color-mix(in srgb,var(--calendar-tone) 15%,var(--surface)); }
:is(.calendar-entry,.calendar-agenda-item).task { --calendar-tone:var(--calendar-task-tone); }
.calendar-agenda-item:is(.event,.conference,.task) { border-left-color:var(--calendar-tone); }
.calendar-detail { min-height: 500px; padding: 20px; background: var(--surface); }
.calendar-detail-head { border-bottom: 1px solid var(--border); padding-bottom: 15px; }
.calendar-detail h2 { margin: 8px 0 5px; font-size: 20px; overflow-wrap: anywhere; }
.calendar-detail h3 { margin: 20px 0 8px; font-size: 14px; }
.calendar-kind { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.calendar-kind.task.status-completed { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--ok); }
.calendar-kind.task.status-failed, .calendar-kind.task.status-missed { background: color-mix(in srgb, var(--err) 12%, var(--surface)); color: var(--err); }
.calendar-facts { display: grid; gap: 12px; margin: 18px 0; }
.calendar-facts > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; }
.calendar-facts dt { color: var(--text-dim); font-size: 12px; }
.calendar-icon-text { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; vertical-align: middle; }
.calendar-icon-text > .agent-channel-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.calendar-editor label .calendar-icon-text > .agent-channel-icon { width: 14px; height: 14px; flex-basis: 14px; color: var(--accent); }
.calendar-facts > div { grid-template-columns: 94px minmax(0, 1fr); }
.calendar-facts dt .agent-channel-icon { color: var(--accent); }
.calendar-facts dd { margin: 0; overflow-wrap: anywhere; }
.calendar-description p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.calendar-join { width: 100%; justify-content: center; margin-top: 18px; }
.calendar-detail-actions { margin-top: 20px; }
.calendar-empty-detail { display: grid; align-content: start; gap: 8px; }
.calendar-editor { display: grid; gap: 12px; }
.calendar-editor .field { margin: 0; }
.calendar-editor-description > summary { display: flex; align-items: center; justify-content: space-between; padding: 3px 0; color: var(--text-dim); cursor: pointer; list-style: none; font-size: 13px; }
.calendar-editor-description > summary::-webkit-details-marker { display: none; }
.calendar-editor-description > summary:hover { color: var(--accent); }
.calendar-editor-description > summary > .agent-channel-icon { width: 14px; height: 14px; transform: rotate(-90deg); }
.calendar-editor-description[open] > summary > .agent-channel-icon { transform: none; }
.calendar-editor-description > textarea { display: block; margin-top: 8px; }
.calendar-editor > .agent-editor-switch { margin: 0; }
.calendar-editor-top { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
.calendar-date-time { display: grid; grid-template-columns: minmax(0, 154px) 86px; gap: 6px; }
.calendar-editor .calendar-date-time :is(input, select) { padding: 9px 7px; font-size: 13px; min-height: 40px; }
.calendar-date-time input[type="date"] { cursor: pointer; }
.calendar-editor .field textarea { min-height: 64px; }
.calendar-editor input, .calendar-editor textarea, .calendar-editor select { width: 100%; min-width: 0; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.calendar-time-input { width: 86px; }
.calendar-date-time.is-past :is(input[type="date"], .studio-time-entry) { border-color: var(--err); }
.calendar-event-dialog [hidden] { display: none !important; }
.calendar-conference-create .btn { width: 100%; }
.calendar-conference-id { overflow-wrap: anywhere; margin: 0; }
.calendar-editor .agent-editor-switch-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; }
.calendar-conference-options { display: grid; gap: 6px; }
.calendar-conference-heading, .calendar-link-row { display: flex; align-items: center; gap: 8px; }
.calendar-conference-heading { flex-wrap: wrap; column-gap: 18px; row-gap: 0; }
.calendar-conference-heading .agent-editor-switch { margin: 0; padding: 0; min-height: 34px; gap: 7px; font-size: 13px; }
.calendar-conference-heading .calendar-help { margin-left: auto; }
.calendar-link-row > .agent-channel-icon { flex: 0 0 16px; width: 16px; height: 16px; color: var(--accent); }
.calendar-link-row input { flex: 1; min-width: 0; }
.calendar-link-row .btn { flex: 0 0 auto; }
.calendar-help { position: relative; flex: 0 0 auto; }
.calendar-help > summary { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--text-dim); cursor: pointer; list-style: none; font-size: 20px; }
.calendar-help > summary::-webkit-details-marker { display: none; }
.calendar-help > summary:hover, .calendar-help[open] > summary { background: var(--accent-soft); color: var(--accent); }
.calendar-help > summary:focus-visible { outline: 2px solid var(--accent); }
.calendar-help-content { position: absolute; z-index: 10; top: 36px; right: 0; width: min(340px, calc(100vw - 80px)); padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-dim); box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; }
.calendar-help-content p { margin: 0 0 8px; }
.calendar-help-content p:last-child { margin-bottom: 0; }
.calendar-entry:has(.calendar-entry-open) { padding: 0; }
.calendar-entry-open { display: flex; align-items: flex-start; gap: 6px; width: 100%; height: 100%; padding: 5px 7px; border: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; text-align: left; overflow: hidden; }
.calendar-entry-copy { flex: 1; min-width: 0; }
.calendar-entry-glyph { display: grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; color: var(--calendar-tone, var(--accent)); background: transparent; }
.calendar-entry-glyph .agent-channel-icon { width: 22px; height: 22px; }
.calendar-entry-glyph :is(.calendar-symbol-calendar-success, .calendar-symbol-calendar-failed) > path:first-child { fill: currentColor; stroke: none; }
.calendar-entry-glyph :is(.calendar-symbol-calendar-success, .calendar-symbol-calendar-failed) > path:last-child { fill: none; stroke: #fff; stroke-width: 2.2; }
.calendar-entry-glyph .calendar-symbol-play { fill: currentColor; stroke: currentColor; }
.calendar-entry-glyph .calendar-symbol-calendar-recurring { stroke-width: 2.8; }
.calendar-overlap > .calendar-entry-glyph { width: 20px; height: 20px; }
.calendar-overlap > .calendar-entry-glyph .agent-channel-icon { width: 18px; height: 18px; }
.calendar-entry.has-leading-join { display: grid; grid-template-columns: 30px minmax(0, 1fr); }
.calendar-entry.has-leading-join > .calendar-entry-open { grid-column: 2; grid-row: 1; min-width: 0; padding-left: 0; }
.calendar-entry.has-leading-join > .calendar-leading-join { grid-column: 1; grid-row: 1; align-self: start; justify-self: center; width: 26px; height: 26px; margin-top: 3px; z-index: 1; }
.calendar-entry.task .calendar-entry-open { padding: 4px 5px; gap: 4px; }
.calendar-entry.task .calendar-entry-time { line-height: 11px; }
.calendar-entry.task strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; line-height: 13px; }
.calendar-entry.task small { line-height: 11px; }
.calendar-entry.task .calendar-entry-glyph { margin-top: 2px; }
.calendar-leading-join { padding: 0; border: 0; text-decoration: none; cursor: pointer; }
.calendar-leading-join:hover { box-shadow: inset 0 0 0 100px var(--calendar-hover-overlay); border-radius: 6px; }
.calendar-leading-join:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.calendar-leading-join:disabled { opacity: .45; cursor: default; }
@container (max-width: 620px) {
  .calendar-agenda .has-leading-join { grid-template-columns: 46px minmax(0, 1fr); column-gap: 0; }
  .calendar-agenda .has-leading-join > .calendar-agenda-open > .calendar-agenda-time { grid-column: 2; grid-row: 1; }
  .calendar-agenda .has-leading-join > .calendar-agenda-open > .calendar-agenda-copy { grid-column: 2; grid-row: 2; }
  .calendar-agenda .has-leading-join > .calendar-leading-join { grid-column: 1; }
}
.calendar-entry:focus-within { z-index: 2; outline: 2px solid var(--accent); outline-offset: 1px; }
.calendar-participant-picker { display: grid; gap: 8px; }
.calendar-participant-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.calendar-participant-chip { max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.calendar-participant-search { display: flex; gap: 8px; align-items: center; }
.calendar-participant-search input { flex: 1; min-width: 0; }
.calendar-participant-search .btn { flex: 0 0 auto; }
.calendar-participant-results { display: grid; max-height: 190px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.calendar-person-result { display: grid; gap: 3px; width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; background: transparent; color: var(--text); font: inherit; text-align: left; }
.calendar-person-result:last-child { border-bottom: 0; }
.calendar-person-result:hover, .calendar-person-result:focus-visible { background: var(--accent-soft); }
.calendar-person-result small { color: var(--text-dim); }
.calendar-participant-picker > .hint { margin: 0; }
.calendar-delivery-status { overflow-wrap: anywhere; }
@media (max-width: 540px) {
  .calendar-participant-search { align-items: stretch; flex-direction: column; }
  .calendar-editor-top { grid-template-columns: 105px minmax(0, 1fr); gap: 8px; }
  .calendar-editor .calendar-date-time :is(input, select) { font-size: 16px; }
  .calendar-editor .calendar-time-input input { font-size: 16px; }
}
.calendar-editor-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.agent-calendar-content .calendar-page { margin-top: 12px; }
.agent-calendar-content .calendar-grid-wrap { max-height: 430px; }
.agent-calendar-content .calendar-detail { min-height: 250px; }
.agent-editor-panel-heading.agent-calendar-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 12px; }
.agent-calendar-heading-copy { flex: 1 1 260px; min-width: 0; }
.agent-calendar-heading-actions:empty { display: none; }
.agent-calendar-heading .agent-calendar-heading-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; flex: 1 1 440px; }
.agent-calendar-heading .calendar-navigation { flex-wrap: nowrap; gap: 6px; }
.agent-calendar-heading .calendar-range-label { min-width: 0; padding: 4px 6px; white-space: nowrap; font-size: 13px; }
.agent-calendar-heading .calendar-desktop-views { grid-column: 1; grid-row: 2; justify-content: flex-start; }
.agent-calendar-heading .calendar-new { grid-column: 2; grid-row: 1 / 3; }
.agent-calendar-heading .btn { min-height: 34px; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.agent-calendar-heading .calendar-navigation .btn { min-width: 34px; }
/* Keep the agent editor toolbar to two rows at desktop widths. */
.agent-calendar-page .calendar-toolbar-main:empty { display: none; }
.agent-calendar-page:not(.calendar-compact) .calendar-toolbar { gap: 8px; margin-bottom: 12px; }
.agent-calendar-page:not(.calendar-compact) .calendar-toolbar-main { gap: 8px; }
.agent-calendar-page:not(.calendar-compact) .calendar-navigation { gap: 6px; flex-wrap: nowrap; }
.agent-calendar-page:not(.calendar-compact) .calendar-range-label { min-width: 0; padding: 4px 6px; white-space: nowrap; }
.agent-calendar-page:not(.calendar-compact) .calendar-toolbar .btn { min-height: 34px; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.agent-calendar-page:not(.calendar-compact) .calendar-navigation .btn { min-width: 34px; }
.agent-calendar-page:not(.calendar-compact) .calendar-view-options { gap: 8px; }
.agent-calendar-page:not(.calendar-compact) .calendar-view-options > .calendar-view-controls { flex: 1; min-width: 0; gap: 8px; }
.agent-calendar-page:not(.calendar-compact) .calendar-day-counts { flex-wrap: nowrap; }
.agent-calendar-page:not(.calendar-compact) .calendar-agent-filters { flex: 1 1 260px; }
.agent-calendar-page:not(.calendar-compact) .calendar-filters:has(> :not([hidden])) { padding-top: 0; border-top: 0; }
.agent-calendar-page:not(.calendar-compact) .calendar-filters :is(input, select) { height: 36px; min-height: 36px; padding: 6px 10px; font-size: 13px; }
.agent-calendar-page:not(.calendar-compact) .calendar-mobile-actions:empty { display: none; }
@media (max-width: 1060px) {
  .calendar-layout { grid-template-columns: minmax(0, 1fr) 270px; }
  .calendar-detail { padding: 16px; }
  .calendar-filters select { min-width: 130px; }
  .calendar-search { width: 150px; }
}
@media (max-width: 820px) {
  .calendar-toolbar { align-items: stretch; flex-direction: column; }
  .calendar-navigation, .calendar-filters { justify-content: space-between; }
  .calendar-navigation { flex-wrap: wrap; }
  .calendar-range-label { flex: 1; min-width: 0; }
  .calendar-filters select { flex: 1 1 140px; }
  .calendar-search { flex: 1 1 160px; }
  .calendar-new { flex: 1 1 auto; }
  .calendar-layout { grid-template-columns: minmax(0, 1fr); }
  .calendar-grid-wrap { border-right: 0; border-bottom: 1px solid var(--border); }
  .calendar-detail { min-height: auto; }
}
@media (max-width: 600px) {
  .calendar-page { margin-inline: -2px; }
  .calendar-navigation { gap: 6px; }
  .calendar-navigation .btn { min-width: 38px; padding-inline: 9px; }
  .calendar-range-label { font-size: 12px; padding-inline: 7px; }
  .calendar-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .calendar-filters select, .calendar-search { width: 100%; min-width: 0; }
  .calendar-new { grid-column: 1 / -1; width: 100%; }
  .calendar-grid-wrap { max-height: calc(100dvh - 275px); }
  .calendar-week { grid-template-columns: 46px repeat(var(--calendar-days, 7), minmax(116px, 1fr)); grid-template-rows: 48px var(--calendar-hours-height, 720px); width: 100%; min-width: calc(46px + var(--calendar-days, 7) * 116px); }
  .calendar-entry { left: 3px; right: 3px; padding: 4px 5px; }
  .calendar-entry strong { font-size: 11px; }
  .calendar-detail { padding: 15px; }
  .calendar-editor-times { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 540px) {
  .calendar-toolbar-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .calendar-toolbar-main .calendar-navigation { display: grid; grid-template-columns: 36px 36px auto minmax(0, 1fr); gap: 6px; }
  .calendar-toolbar-main .calendar-navigation .btn { min-width: 0; padding-inline: 8px; }
  .calendar-toolbar-main .calendar-range-label { min-width: 0; padding-inline: 0; font-size: 12px; }
  .calendar-toolbar-main .calendar-new { width: 100%; margin: 0; }
  .calendar-view-options, .calendar-view-controls { width: 100%; gap: 8px; }
  .calendar-view-controls .calendar-day-counts { flex: 1 1 260px; flex-wrap: nowrap; }
  .calendar-day-counts .calendar-day-count { flex: 1; min-width: 0; padding-inline: 8px; }
  .calendar-toolbar .calendar-filters { grid-template-columns: minmax(0, 1fr); }
  .calendar-toolbar .calendar-agent-filters { grid-template-columns: minmax(0, 1fr) minmax(110px, .65fr); }
}
/* Keep the page controls and column headings visible while task rows scroll. */
@media (min-width: 761px) and (min-height: 600px) {
  #app:has(.work-tasks-page) { height: var(--app-viewport-height); }
  .main:has(.work-tasks-page) { min-height: 0; }
  .content:has(.work-tasks-page) { flex: 1; min-height: 0; overflow: hidden; padding-bottom: 24px; }
  .route-view.work-tasks-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
  .work-tasks-page > .work-management { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .work-tasks-page .work-task-toolbar, .work-tasks-page .work-management > .hint { flex: none; }
  .work-tasks-page .work-task-table-wrap { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; }
  .work-tasks-page .work-task-table { border-collapse: separate; border-spacing: 0; }
  .work-tasks-page .work-task-table th { position: sticky; top: 0; z-index: 2; }
}
.work-task-dialog { width: min(860px, calc(100vw - 32px)) !important; max-width: calc(100vw - 32px); max-height: calc(var(--app-viewport-height, 100dvh) - 32px); margin: auto; padding: 0; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); }
.work-task-dialog::backdrop { background: rgba(30, 20, 12, .45); }
.work-task-dialog [hidden] { display: none !important; }
.work-task-dialog input, .work-task-dialog select, .work-task-dialog textarea { width: 100%; box-sizing: border-box; min-width: 0; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.work-task-instructions { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.work-task-date-shortcuts { margin: 0 0 12px; flex-wrap: wrap; }
.studio-time-control { width: 100px; max-width: 100%; font-size: 14px; }
.studio-time-entry { display: flex; justify-content: center; align-items: center; min-height: 40px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums; }
.studio-time-control .studio-time-entry input { flex: 0 0 2ch; width: 2ch; min-width: 0; min-height: 30px; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; font-variant-numeric: tabular-nums; text-align: center; outline: 0; box-shadow: none; }
.studio-time-entry:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.studio-time-entry:has([aria-invalid="true"]) { border-color: var(--err); }
.studio-time-trigger { flex: 0 0 20px; width: 20px; height: 30px; padding: 0; margin-left: 2px; border: 0; background: transparent; color: var(--text-dim); font: inherit; cursor: pointer; }
.studio-time-trigger:hover { color: var(--accent); }
.studio-time-popover { display: none; position: fixed; inset: auto; width: 210px; max-width: calc(100vw - 16px); margin: 0; padding: 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: 14px/1.3 var(--font, sans-serif); box-shadow: 0 8px 28px rgb(0 0 0 / 18%); z-index: 9999; }
.studio-time-popover:popover-open, .studio-time-popover.is-open { display: grid; }
.studio-time-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.studio-time-column-label { display: block; margin-bottom: 6px; text-align: center; font-size: 12px; color: var(--text-dim); }
.studio-time-options { height: 168px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scroll-snap-type: y proximity; border-radius: 6px; }
.studio-time-options button { display: block; width: 100%; min-height: 34px; padding: 6px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-variant-numeric: tabular-nums; text-align: center; cursor: pointer; scroll-snap-align: center; }
.studio-time-options button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.studio-time-options button:hover:not(:disabled) { background: var(--surface-2); }
.studio-time-options button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.studio-time-options button:disabled { opacity: .3; cursor: default; }
.studio-time-popover .studio-time-apply { width: 100%; margin-top: 8px; min-height: 30px; }
@media (max-width: 600px) { .studio-time-control .studio-time-entry input { font-size: 16px; } }
.work-date-picker { display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.work-date-picker input { flex: 1; min-width: 0; }
.work-calendar-button { flex: 0 0 44px; font-size: 22px; padding: 0; }
.work-task-schedule > .hint { margin: 0 0 16px; }
.work-task-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px; margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.work-task-facts dt { color: var(--text-dim); font-size: 12px; margin-bottom: 5px; }
.work-task-facts dd { margin: 0; overflow-wrap: anywhere; }
.work-history { min-width: 0; }
.work-history-list { display: grid; gap: 12px; }
.work-history-entry { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.work-history-entry > summary { display: flex; align-items: center; gap: 12px; padding: 16px; cursor: pointer; list-style: none; }
.work-history-entry > summary::-webkit-details-marker { display: none; }
.work-history-entry > summary::before { content: "›"; color: var(--text-dim); font-size: 22px; }
.work-history-entry[open] > summary::before { transform: rotate(90deg); }
.work-history-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.work-history-body { padding: 0 16px 16px; min-width: 0; }
.work-history-entry > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) {
  .work-task-facts { grid-template-columns: minmax(0, 1fr); }
  .work-task-dialog .modal-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

@container (max-width: 760px) {
  .work-task-table td:first-child { width: 100%; min-width: 0; }
  .work-task-table td:last-child { text-align: left; }
}

/* SIP activation and call handling are regular controls, not expert options. */
.field label.sip-setting-toggle {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  min-height: 44px; margin: 0; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  color: var(--text); font-size: 13px;
}
.field .sip-setting-toggle input[type="checkbox"] {
  flex: 0 0 20px; width: 20px; height: 20px; padding: 0; margin: 0;
  accent-color: var(--accent);
}
.field label.sip-setting-toggle:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft);
}

/* SIP connections: compact overview with expandable call history. */
.sip-connection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 20px; align-items: start; }
.sip-connection-card { min-width: 0; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.sip-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sip-card-head h3 { margin: 0; overflow-wrap: anywhere; }
.sip-endpoint { overflow-wrap: anywhere; margin-bottom: 6px; }
.sip-connection-card > .hint { margin: 6px 0; }
.sip-connection-tools { margin-top: 18px; padding: 14px 0; border-top: 1px solid var(--border); }
.sip-connection-tools > summary, .sip-call > summary { cursor: pointer; border-radius: var(--radius-sm); }
.sip-connection-tools > summary:focus-visible, .sip-call > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.sip-connection-tools > summary { color: var(--text-dim); font-weight: 600; }
.sip-call-list { margin-top: 8px; border-top: 1px solid var(--border); }
.sip-call-list h4 { margin: 18px 0 12px; }
.sip-call { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.sip-call > summary { display: flex; align-items: center; gap: 10px; padding: 14px; list-style: none; }
.sip-call > summary::-webkit-details-marker { display: none; }
.sip-call > summary::before { content: "›"; color: var(--text-dim); font-size: 22px; }
.sip-call[open] > summary::before { transform: rotate(90deg); }
.sip-call-identity { display: grid; gap: 5px; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.sip-call > summary > .badge { flex-shrink: 0; }
.sip-call-body { padding: 0 14px 14px; border-top: 1px solid var(--border); }
.sip-facts { display: grid; gap: 12px; margin: 16px 0; }
.sip-facts > div { display: grid; gap: 4px; min-width: 0; }
.sip-facts dt { color: var(--text-dim); font-size: 12px; }
.sip-facts dd { margin: 0; overflow-wrap: anywhere; }
.sip-call-body h4 { font-size: 14px; }
.sip-events { padding-left: 20px; font-size: 13px; line-height: 1.7; }
.sip-error { margin: 12px 0; padding: 12px; border: 1px solid var(--border-strong); border-left: 3px solid var(--err); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); overflow-wrap: anywhere; }
.sip-error pre, pre.sip-error { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.sip-history-note { font-size: 12px; }
@media (max-width: 600px) {
  .sip-connection-card { padding: 16px; }
  .sip-call > summary { flex-wrap: wrap; padding: 12px; }
  .sip-call-identity { flex-basis: calc(100% - 35px); }
  .sip-call > summary > .badge { margin-left: 22px; }
}

/* Imported skill packages and connection bindings. */
.skills-page .skill-tiles, .skills-page .skill-agent-drops { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.skills-page .skill-import-zone { flex-direction: row; align-items: center; gap: 12px; padding: 14px; margin-bottom: 12px; border-width: 1px; border-radius: 8px; background: transparent; color: var(--text-dim); font-size: 13px; }
.skills-page .skill-import-zone svg { width: 23px; height: 23px; flex: none; color: var(--accent); }
.skills-page .skill-tile { min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); box-shadow: none; transform: none; cursor: pointer; }
.skills-page .skill-tile:hover { background: color-mix(in srgb, var(--surface), black 5%); box-shadow: none; transform: none; }
.skill-row-head { display: flex; align-items: flex-start; gap: 12px; }
.skill-grip { flex: none; align-self: center; color: var(--text-dim); cursor: grab; }
.skill-grip svg { width: 10px; height: 22px; stroke-width: 4; }
.skill-row-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.skill-row-icon svg { width: 23px; height: 23px; }
.skill-row-copy { min-width: 0; flex: 1; }
.skill-row-copy b { font-size: 14px; overflow-wrap: anywhere; }
.skills-page .skill-description { min-height: 0; margin: 4px 0 0; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.skill-source { flex: none; max-width: 30%; padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; overflow-wrap: anywhere; }
.skills-page .skill-tile-foot { margin-top: 8px; padding-left: 32px; font-size: 12px; }
.skill-state, .skill-usage { display: inline-flex; align-items: center; gap: 7px; }
.skill-state { color: var(--ok); }
.skill-state i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.skill-state.inactive { color: var(--muted); }
.skill-usage { color: var(--text-dim); }
.skill-usage svg { width: 19px; height: 19px; }
.skills-page .skill-agent-drop { display: flex; flex-direction: row; align-items: flex-start; min-height: 0; min-width: 0; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.skills-page .skill-agent-drop.drop-hover { border-color: var(--accent); background: var(--accent-soft); }
.skills-page .skill-agent-drop.is-editable { cursor: pointer; }
.skills-page .skill-agent-drop.is-editable:hover:not(.drop-hover) { border-color: var(--border-strong, var(--accent)); }
.skills-page .skill-agent-drop.is-editable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skill-agent-content { min-width: 0; flex: 1; }
.skills-page .agent-drop-head { align-items: center; gap: 8px; }
.skills-page .agent-drop-head b { color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.skill-agent-description { margin: 5px 0 0; color: var(--text-dim); font-size: 12px; overflow-wrap: anywhere; }
.skills-page .skill-assignment-list { min-height: 0; margin: 10px 0; gap: 6px; }
.skills-page .skill-assignment-entry { width: auto; max-width: 100%; }
.skills-page .skill-assignment { padding: 5px 6px 5px 10px; font-size: 12px; box-sizing: border-box; }
.skills-page .agent-drop-hint { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-top: 10px; border: 1px dashed var(--border-strong); border-radius: 7px; font-size: 12px; color: var(--text-dim); }
.skills-page .agent-drop-hint svg { width: 17px; height: 17px; flex: none; }
.skills-page .skill-results { margin: 10px 0 0; font-size: 12px; }
@media (max-width: 560px) {
  .skills-page .skill-row-head { gap: 8px; flex-wrap: wrap; }
  .skills-page .skill-row-copy { flex-basis: calc(100% - 80px); }
  .skills-page .skill-source { margin-left: 24px; max-width: none; }
  .skills-page .skill-agent-drop { gap: 9px; padding: 10px; }
}
.skill-import-zone { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 22px; margin-bottom: 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.skill-import-zone.drop-hover { border-color: var(--accent); background: var(--accent-soft); }
.skill-import-zone { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.skill-import-zone:hover, .skill-import-zone:focus-visible { border-color: var(--accent); color: var(--text); }
.ai-assignment-panel.is-file-drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.skill-import-preview textarea { width: 100%; box-sizing: border-box; }
.modal:has(.skill-import-form) { width: 720px; }
.modal:has(.skill-details, .football-settings) { width: 720px; }
.modal-head:has(.modal-head-actions) { flex-wrap: wrap; gap: 10px; }
.modal-head:has(.modal-head-actions) h3 { flex: 1; min-width: 0; }
.modal-head-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.modal-head-actions .agent-editor-switch { padding: 0; gap: 8px; font-size: 12px; white-space: nowrap; }
.skill-import-error { color: var(--err); white-space: pre-wrap; overflow-wrap: anywhere; }
.skill-assignment-entry { width: 100%; min-width: 0; }
.agent-skill-cards { display: grid; gap: 12px; margin-bottom: 20px; min-width: 0; }
.agent-skill-card-shell { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-right: 12px; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.agent-skill-card-shell > .agent-skill-card { border: 0; margin: 0; padding: 0; background: transparent; }
.agent-skill-actions { display: flex; flex-wrap: wrap; align-items: center; flex-shrink: 0; gap: 8px; margin: 0 0 12px auto; }
.agent-skill-remove { min-height: 44px; }
.agent-skill-static { flex: 1 1 220px; min-width: min(220px, 100%); padding: 16px; overflow-wrap: anywhere; min-height: 76px; box-sizing: border-box; }
.agent-skill-static .hint { margin: 6px 0 0; }
.agent-skill-confirm { border: 1px solid var(--border); padding: 0; color: var(--text); margin: auto; width: min(440px, calc(100vw - 32px)) !important; max-width: calc(100vw - 32px); border-radius: var(--radius); box-shadow: 0 16px 48px rgba(0, 0, 0, .2); }
.agent-skill-confirm::backdrop { background: rgba(30, 20, 12, .45); }
.agent-portrait-dialog { width: min(560px, calc(100vw - 32px)) !important; }
.agent-portrait-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.agent-portrait-choice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.agent-portrait-choice img, .agent-portrait-none { width: 88px; height: 88px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.agent-portrait-none { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 26px; font-weight: 600; }
.agent-portrait-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.agent-portrait-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 480px) {
  .agent-portrait-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.agent-skill-card { min-width: 0; }
.agent-skill-cards > .agent-skill-card { margin: 0; padding: 0; background: var(--surface); }
.agent-skill-card > summary { padding: 16px; min-height: 44px; box-sizing: border-box; overflow-wrap: anywhere; }
.agent-skill-card-title { font-size: 15px; }
.agent-skill-card-status { display: block; margin: 6px 0 0; color: var(--text-dim); font-size: 12px; font-weight: 400; }
.agent-skill-card > .skill-binding-body { padding: 0 16px 16px; min-width: 0; }
.agent-skill-card-footer { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.skill-connection-picker { margin: 12px 0; }
.skill-connection-picker > summary { cursor: pointer; color: var(--accent); padding: 10px 0; min-height: 44px; box-sizing: border-box; }
.skill-connection-option > .form-actions { margin: 0; flex-wrap: wrap; }
@media (max-width: 760px) {
  .agent-skill-card .skill-connection-option { align-items: flex-start; }
  .agent-skill-card .skill-connection-option > .form-actions { width: 100%; }
  .agent-skill-card .skill-connection-option > .form-actions .btn { flex: 1 1 130px; white-space: normal; }
}
.skill-binding-note { margin: 5px 0 10px; font-size: 12px; }
.skill-connection-binding { margin: 8px 0 14px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.skill-connection-binding > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.skill-connection-binding > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skill-binding-body { padding-top: 8px; }
.skill-binding-section { margin-top: 16px; }
.skill-binding-section > h4 { margin: 0 0 10px; font-size: 14px; }
.skill-binding-section + .skill-binding-section { padding-top: 16px; border-top: 1px solid var(--border); }
.skill-binding-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.skill-binding-toolbar select { flex: 1 1 220px; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.skill-script-permission .agent-editor-switch { padding-left: 0; }
.skill-script-technical > summary, .skill-connection-advanced > summary { cursor: pointer; color: var(--text-dim); font-size: 12px; padding-block: 8px; }
.skill-connection-dialog { width: min(580px, calc(100vw - 24px)) !important; max-width: calc(100vw - 24px); max-height: calc(var(--app-viewport-height) - 24px); }
.skill-connection-dialog [hidden] { display: none !important; }
.skill-connection-dialog .modal-head { gap: 16px; }
.skill-connection-dialog .modal-head h3 { min-width: 0; overflow-wrap: anywhere; }
.skill-connection-dialog .modal-foot { flex-wrap: wrap; }
.skill-connection-dialog .field input, .skill-connection-dialog .field select { min-height: 42px; font-size: 14px; }
.skill-connection-dialog .modal-body > .hint { margin-top: 0; }
.skill-connection-dialog .skill-connection-advanced { border-top: 1px solid var(--border); padding-top: 4px; }
.skill-connection-dialog .skill-connection-advanced[open] > summary { margin-bottom: 8px; }
.skill-schema-cache { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.skill-schema-cache h4 { font-size: 14px; margin: 0 0 8px; }
.skill-schema-cache .field input { max-width: 160px; }
@media (max-width: 600px) {
  .skill-binding-toolbar select { flex-basis: 100%; }
  .skill-binding-toolbar .btn { flex: 1 1 120px; }
}
.skill-connection-options { display: grid; gap: 8px; }
.skill-connection-option { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.skill-connection-choice { display: flex; gap: 10px; align-items: center; min-width: 0; cursor: pointer; flex: 1 1 170px; }
.skill-connection-choice input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--accent); }
.skill-connection-choice span { min-width: 0; overflow-wrap: anywhere; }
.skill-connection-choice small { display: block; color: var(--text-dim); margin-top: 4px; }
.personal-email-account-heading { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.personal-email-connection-status { white-space: nowrap; }
.personal-email-account-summary { cursor: default; }
:root[data-theme="dark"] .personal-email-connection-status.enabled { color: color-mix(in srgb, var(--ok) 45%, white); }
:root[data-theme="dark"] .personal-email-connection-status.status-failed { color: color-mix(in srgb, var(--err) 45%, white); }
.skill-connection-editor:not(:empty) { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.skill-connection-editor input:not([type="checkbox"]), .skill-connection-editor select, .skill-import-preview textarea { width: 100%; min-width: 0; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.skill-instructions { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.skill-operation-list { display: grid; gap: 10px; }
.skill-operation-list code { overflow-wrap: anywhere; }
.skill-connection-choice[hidden], .field[hidden] { display: none; }

.skill-script-settings { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.skill-upload-names { overflow-wrap: anywhere; }

/* Agent editor: scoped dialog layout shared by browser and Capacitor. */
.agent-editor-overlay { align-items: center; justify-content: center; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); height: var(--app-viewport-height); box-sizing: border-box; overflow: hidden; }
.agent-editor { width: min(1220px, 100%); height: min(900px, calc(var(--app-viewport-height) - 48px)); max-height: 100%; min-width: 0; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 24px 80px #0003; overflow: hidden; }
.agent-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 28px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.agent-editor-heading { display: flex; align-items: center; gap: 16px; min-width: 0; }
.agent-editor-heading > div { min-width: 0; }
.agent-editor-heading h2 { margin: 0; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.agent-editor-heading p { margin: 5px 0 0; }
.agent-editor-head-actions { display: flex; align-items: center; gap: 22px; flex-shrink: 0; }
.agent-editor-with-section-title > .agent-editor-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.agent-editor-with-section-title .agent-editor-heading { align-items: flex-start; }
.agent-editor-with-section-title .agent-editor-head-actions { align-self: center; }
.agent-editor-with-section-title .agent-editor-panel-heading { margin-bottom: 12px; }
.agent-editor-with-section-title .agent-editor-panel-heading:empty,
.agent-editor-with-section-title .agent-editor-panel-heading:has(> .agent-calendar-heading-actions:only-child:empty) { display: none; }
.agent-editor-with-section-title .agent-calendar-heading-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.agent-editor-with-section-title .agent-calendar-heading .calendar-new { margin-left: auto; }
.agent-editor-head .x { min-width: 44px; min-height: 44px; border-left: 1px solid var(--border); padding-left: 18px; }
.agent-editor-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); flex: 1 1 auto; min-height: 0; }
.agent-editor-nav { display: flex; flex-direction: column; gap: 6px; padding: 16px; overflow: auto; overscroll-behavior: contain; border-right: 1px solid var(--border); background: var(--surface-2); }
.agent-editor-nav button { display: flex; align-items: center; gap: 12px; border: 0; border-radius: 8px; min-height: 48px; padding: 12px; background: transparent; color: var(--text); text-align: left; font: inherit; font-size: 14px; cursor: pointer; flex-shrink: 0; }
.agent-editor-nav button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.agent-editor-tab-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; }
.agent-editor-content { min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 28px 32px; scroll-padding-block: 20px; }
.agent-editor-panel { outline: none; }
.agent-editor-panel[hidden] { display: none; }
.agent-editor-panel-heading { margin-bottom: 24px; }
.agent-editor-panel-heading h2 { margin: 0 0 8px; font-size: 27px; letter-spacing: -.5px; }
.agent-editor-panel-heading p { margin: 0; font-size: 14px; }
.agent-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.agent-voice-layout { display: grid; gap: 16px; min-width: 0; }
.agent-voice-card { padding: 16px 18px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); min-width: 0; }
.agent-voice-card-heading { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; font-size: 16px; }
.agent-voice-step { display: inline-grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.agent-voice-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.agent-voice-play-row { align-items: start; }
.agent-voice-preview-button { min-height: 44px; width: 100%; margin: 0; }
.agent-voice-preview-audio { width: 100%; margin-top: 8px; }
.agent-voice-notice { padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--accent-soft); color: var(--text); font-size: 13px; line-height: 1.5; }
.agent-voice-check-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.agent-voice-check-row .hint { margin: 0; }
.agent-voice-advanced.agent-editor-disclosure { margin-top: 0; }
.agent-voice-advanced > summary { flex-wrap: wrap; gap: 8px 18px; }
.agent-voice-advanced > summary small { margin: 0; }
.agent-voice-layout [hidden] { display: none !important; }
.agent-voice-layout > .hint { margin: 0; }
@media (max-width: 760px) {
  .agent-voice-card { padding: 14px; }
  .agent-voice-card-head { align-items: flex-start; gap: 10px; }
  .agent-voice-preview-button { width: 100%; }
  .agent-voice-check-row { gap: 10px; }
}
.agent-editor .field { min-width: 0; margin-bottom: 18px; }
.agent-model-check { display: grid; gap: 10px; margin-bottom: 24px; }
.agent-model-check > .btn { justify-self: start; }
.agent-editor .field > label { color: var(--text); font-size: 13px; font-weight: 500; }
.agent-editor input:not([type="checkbox"]):not([type="file"]), .agent-editor textarea, .agent-editor select { min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); color: var(--text); padding: 10px 12px; font: inherit; font-size: 14px; line-height: 1.5; }
.agent-editor textarea { min-height: 120px; resize: vertical; }
.agent-editor .hint { color: var(--text-dim); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.agent-editor-section-title { margin: 24px 0 12px; font-size: 14px; font-weight: 600; }
.agent-editor-panel[id$="-knowledge"] > div > .agent-editor-section-title:first-child { margin-top: 0; }
.agent-capability-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.agent-editor-switch { position: relative; display: inline-flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px; box-sizing: border-box; cursor: pointer; font-size: 14px; color: var(--text); }
.agent-editor-switch-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.agent-editor-switch-track { position: relative; width: 42px; height: 24px; flex: 0 0 42px; border-radius: 20px; background: var(--border-strong); transition: background .15s; }
.agent-editor-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px #0002; transition: transform .15s; }
.agent-editor-switch-input:checked + .agent-editor-switch-track { background: var(--accent); }
.agent-editor-switch-input:checked + .agent-editor-switch-track::after { transform: translateX(18px); }
.agent-editor-switch-input:focus-visible + .agent-editor-switch-track { outline: 2px solid var(--accent); outline-offset: 4px; }
.agent-editor-switch-input:disabled + .agent-editor-switch-track { opacity: .6; }
.agent-capability-grid .agent-editor-switch + .agent-editor-switch { border-left: 1px solid var(--border); }
.agent-editor-disclosure, .agent-editor-jump, .agent-editor-action-card { margin-top: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.agent-editor-disclosure > summary { display: flex; gap: 16px; align-items: center; min-height: 72px; padding: 16px 18px; cursor: pointer; list-style: none; }
.agent-editor-disclosure > summary::-webkit-details-marker { display: none; }
.agent-editor-disclosure > summary::after { content: "›"; margin-left: auto; font-size: 24px; color: var(--text-dim); }
.agent-editor-disclosure[open] > summary::after { transform: rotate(90deg); }
.agent-editor-disclosure-with-switch > summary > strong { flex: 1; min-width: 0; }
.agent-editor-disclosure-with-switch > summary > .agent-channel-copy { flex: 1; min-width: 0; }
.agent-editor-disclosure-with-switch > summary > .agent-editor-switch { flex: none; padding: 0; }
.agent-editor-disclosure-with-switch > summary::after { margin-left: 0; }
.agent-editor-channel-toggle { display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 16px 18px; box-sizing: border-box; }
.agent-editor-channel-toggle > strong { flex: 1; min-width: 0; }
.agent-editor-channel-toggle > .agent-channel-copy { flex: 1; min-width: 0; }
.agent-editor-channel-toggle > .agent-editor-switch { flex: none; padding: 0; }
.agent-editor-disclosure-with-switch > summary::after,
.agent-editor-channel-toggle::after { width: 16px; flex: 0 0 16px; }
.agent-channel-edit { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 8px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-dim); cursor: pointer; }
.agent-channel-edit > .agent-channel-icon { width: 18px; height: 18px; }
.agent-channel-edit:hover:not(:disabled) { background: var(--surface-2); color: var(--accent); }
.agent-channel-edit:disabled { opacity: .4; cursor: default; }
.mcp-integration-row { margin-top: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.mcp-integration-row > .agent-channel-icon { width: 22px; height: 22px; flex: 0 0 22px; }
.mcp-row-actions { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.mcp-row-actions .agent-editor-switch { padding: 0; gap: 0; }
.server-monitoring-settings { display: grid; gap: 18px; }
.server-monitoring-settings > .hint { margin: 0; }
.server-monitoring-group { display: grid; gap: 10px; min-width: 0; padding-top: 14px; border-top: 1px solid var(--border); }
.server-monitoring-group h3 { margin: 0; font-size: 15px; }
.server-monitoring-profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 10px; }
.server-monitoring-profiles > .agent-editor-action-card { margin: 0; }
.server-monitoring-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 6px 12px; }
.server-monitoring-tools > .agent-editor-switch { justify-content: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.mcp-connection-test { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mcp-connection-result { margin: 0; font-size: 13px; }
.mcp-connection-result.success { color: var(--success, #287a46); }
.mcp-connection-result.error { color: var(--danger, #b43b2e); }
.mcp-connection-result.checking { color: var(--text-dim); }
.server-key-drop { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px; border: 1px dashed var(--border-strong); border-radius: 8px; }
.server-key-drop.drop-hover, .server-key-drop:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.server-key-drop .hint { overflow-wrap: anywhere; }
.server-key-paste { margin-top: 10px; }
.server-key-paste summary { cursor: pointer; color: var(--text-dim); font-size: 13px; }
.server-key-paste textarea { margin-top: 8px; }
.server-read-command-list { display: grid; gap: 6px; }
.server-read-command-add, .server-read-command { display: flex; align-items: center; gap: 10px; }
.server-read-command-add select, .server-read-command > span { flex: 1; min-width: 0; }
.server-read-command-add select { min-height: 40px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.server-read-command { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.server-read-command-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.server-monitoring-group > summary { cursor: pointer; font-size: 15px; font-weight: 600; }
.server-monitoring-group > .hint { margin: 0; }
.agent-call-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.agent-call-filters > .field { flex: 1 1 160px; min-width: 0; margin-bottom: 0; }
.agent-call-results { display: grid; gap: 10px; }
.agent-history-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.email-settings-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.email-automation-summary { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-weight: 600; }
.email-automation-permissions { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 12px 0; }
.email-automation-permissions .hint { margin: 6px 0 0; }
.email-automation-options { min-width: 0; margin: 20px 0 12px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
.email-automation-options legend { padding: 0 6px; font-weight: 600; }
.email-automation-options:disabled { opacity: .55; }
.email-automation-options > .hint { margin: 0 0 14px; }
.email-automation-limits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.email-automation-limits .field label { min-height: 2.8em; display: flex; align-items: flex-end; }
.email-automation-limits .field input { width: 100%; box-sizing: border-box; }
.email-settings-tabs .btn { flex: 1 1 180px; white-space: normal; min-height: 44px; }
.whatsapp-agent-settings > .email-settings-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.whatsapp-transport-selection { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: -10px 0 18px; }
.whatsapp-transport-choice { display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: pointer; }
.whatsapp-transport-choice input { appearance: none; width: 18px; height: 18px; min-height: 0; flex: 0 0 18px; margin: 0; padding: 0; border: 2px solid var(--border-strong); border-radius: 50%; background: var(--surface); box-shadow: none; cursor: pointer; }
.whatsapp-transport-choice input:checked { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.whatsapp-transport-choice input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.whatsapp-transport-choice input:disabled { opacity: .5; cursor: wait; }

.agent-calls .sip-error:empty { display: none; }
.agent-calls > button[hidden] { display: none; }
.agent-editor-disclosure strong, .agent-editor-jump strong { display: block; font-size: 14px; font-weight: 600; }
.agent-editor-disclosure small, .agent-editor-jump small { display: block; margin-top: 5px; color: var(--text-dim); font-size: 12px; line-height: 1.4; }
.agent-editor-disclosure .agent-channel-copy strong { font-size: 16px; }
.agent-channel-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.agent-channel-address { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: 13px; font-weight: 500; color: var(--text); }
.agent-channel-address:empty { display: none; }
.agent-editor-disclosure .agent-channel-copy > small { font-size: 14px; }
.agent-editor-disclosure-icon { display: inline-grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 7px; font-size: 23px; background: var(--surface-2); }
.agent-editor-disclosure-body { padding: 0 18px 2px; }
.agent-editor-jump { width: 100%; display: flex; align-items: center; gap: 16px; text-align: left; padding: 16px 18px; color: var(--text); font: inherit; cursor: pointer; }
.agent-editor-jump > span:last-child { margin-left: auto; font-size: 24px; }
.agent-editor-action-card { padding: 18px; }
.agent-editor-action-card h3 { margin: 0; font-size: 16px; }
.agent-editor-action-card p { overflow-wrap: anywhere; }
.agent-editor-statuses { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-editor-foot { display: flex; gap: 12px; align-items: center; flex: 0 0 auto; padding: 16px 28px; border-top: 1px solid var(--border); background: var(--surface-2); }
.agent-editor-foot-note { margin-right: auto; }
.agent-editor-foot .btn { min-height: 44px; min-width: 120px; justify-content: center; }
.agent-editor-save-error:empty { display: none; }
.agent-editor-error { color: var(--err); overflow-wrap: anywhere; }
.agent-editor button:focus-visible, .agent-editor summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.agent-face { position: relative; display: inline-grid; place-items: center; width: 100%; height: 100%; flex: none; overflow: hidden; border-radius: 50%; background: var(--accent-soft); color: var(--text); font-size: 13px; font-weight: 600; vertical-align: middle; }
.agent-face img { position: absolute; width: 100%; height: 100%; inset: 0; object-fit: cover; }
.agent-face-lg { font-size: 18px; }
.agent-face-xl { font-size: 30px; }
.agent-list-identity { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.agent-list-identity .cn-name { overflow-wrap: anywhere; }
.agent-photo-picker { display: flex; align-items: center; gap: 24px; padding: 20px; border: 1px solid var(--border); border-radius: 9px; }
.agent-photo-preview { flex-shrink: 0; }
.agent-photo-edit { position: relative; display: inline-flex; width: fit-content; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.agent-photo-edit::after { content: "✎"; position: absolute; left: 0; bottom: 0; display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); color: var(--surface); font-size: 17px; pointer-events: none; }
.agent-photo-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.agent-photo-actions { min-width: 0; }
.agent-photo-actions p { margin: 0 0 8px; }
.agent-editor .skill-assignment-entry { margin-bottom: 10px; }
.agent-editor .assign-row { flex-wrap: wrap; }
.agent-editor .assign-row select { flex: 1 1 180px; }
@media (max-width: 760px), (max-height: 540px) {
  .agent-editor-overlay { padding: 0; align-items: stretch; }
  .agent-editor { width: 100%; height: var(--app-viewport-height); max-height: 100%; border: 0; border-radius: 0; }
  .agent-editor-head { padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left)); gap: 10px; }
  .agent-editor-with-section-title > .agent-editor-head { grid-template-columns: minmax(0, 1fr) auto; }
  .agent-editor-heading { gap: 10px; }
  .agent-editor-heading h2 { font-size: 18px; }
  .agent-editor-head-actions { gap: 6px; }
  .agent-editor-head .x { padding-left: 6px; }
  .agent-editor-head .agent-editor-switch { padding: 8px 4px; gap: 6px; font-size: 12px; }
  .agent-editor-portrait .agent-portrait-lg { --agent-portrait-size: 42px; }
  .agent-editor-portrait .agent-face-lg { font-size: 14px; }
  .agent-editor-layout { display: flex; flex-direction: column; }
  .agent-editor-nav { flex-direction: row; flex-shrink: 0; padding: 8px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); gap: 5px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .agent-editor-nav button { white-space: nowrap; padding: 10px 12px; min-height: 44px; gap: 7px; font-size: 13px; }
  .agent-editor-content { padding: 20px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); flex: 1 1 auto; min-height: 0; }
  .agent-editor-panel-heading { margin-bottom: 20px; }
  .agent-editor-panel-heading h2 { font-size: 24px; }
  .agent-editor-grid, .agent-editor .grid2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .agent-editor input:not([type="checkbox"]):not([type="file"]), .agent-editor textarea, .agent-editor select { font-size: 16px; }
  .agent-editor-foot { padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .agent-editor-foot-note { display: none; }
  .agent-editor-foot .btn { min-width: 0; flex: 1; }
  .agent-photo-picker { align-items: flex-start; flex-wrap: wrap; gap: 16px; padding: 16px; }
}
@media (max-width: 480px) {
  .agent-capability-grid { grid-template-columns: minmax(0, 1fr); padding: 4px 10px; }
  .agent-capability-grid .agent-editor-switch + .agent-editor-switch { border-left: 0; border-top: 1px solid var(--border); }
  .agent-editor-heading h2 { font-size: 16px; }
  .agent-editor-head-actions .agent-editor-switch > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .agent-editor-disclosure > summary, .agent-editor-jump, .agent-editor-channel-toggle { padding: 14px; gap: 10px; }
}
@media (max-height: 540px) {
  .agent-editor-head { padding-block: max(7px, env(safe-area-inset-top)) 7px; }
  .agent-editor-heading p { display: none; }
  .agent-editor-nav { padding-block: 4px; }
  .agent-editor-foot { padding-top: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .agent-editor-content { padding-top: 14px; }
}

.agent-editor-foot { flex-wrap: wrap; }
.agent-editor-save-error:not(:empty) { flex: 0 0 100%; color: var(--err); margin: 0; order: -1; overflow-wrap: anywhere; }

/* Current availability is attached to the portrait, independently of runtime activity. */
.agent-portrait { --agent-portrait-size: 38px; position: relative; display: inline-flex; flex: none; width: var(--agent-portrait-size); height: var(--agent-portrait-size); min-width: var(--agent-portrait-size); min-height: var(--agent-portrait-size); aspect-ratio: 1; vertical-align: middle; }
.agent-portrait-lg { --agent-portrait-size: 56px; }
.agent-portrait-xl { --agent-portrait-size: 112px; }
.agent-presence-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; box-sizing: content-box; border: 2px solid var(--surface); border-radius: 50%; }
.agent-presence-dot.available { background: #378449; }
.agent-presence-dot.unavailable { background: #c34235; }
.agent-portrait-lg .agent-presence-dot { width: 13px; height: 13px; }
.agent-portrait-xl .agent-presence-dot { width: 19px; height: 19px; border-width: 3px; right: 3px; bottom: 3px; }
.agent-row-clickable { cursor: pointer; }
.agent-row-clickable:hover > td { background: var(--surface-2); }
.agent-row-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.agent-working-hours { margin-bottom: 24px; }
.agent-working-hours h3 { margin-bottom: 16px; }
.agent-working-hours .hint:last-child { margin-bottom: 0; }
.agent-working-fields[hidden] { display: none; }


/* Working hours stay compact on desktop and wrap for touch screens. */
.agent-working-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.agent-working-row > .field { flex: 0 1 185px; }
.agent-working-fields { display: contents; }
.agent-working-fields > .field { flex: 0 1 108px; }
.agent-working-fields > .field:last-child { flex-basis: 170px; }
.agent-working-row .field { margin-bottom: 0; }
.agent-working-zone { margin-top: 12px; color: var(--text-dim); font-size: 12px; }
.agent-working-zone > summary { cursor: pointer; min-height: 28px; display: list-item; width: fit-content; }
.agent-working-zone .field { max-width: 260px; margin-top: 8px; }
.agent-working-hours .hint { margin-top: 8px; }
.agent-working-zone[hidden], .agent-working-hours .hint[hidden] { display: none; }
@media (max-width: 760px), (max-height: 540px) {
  .agent-working-row > .field { flex: 1 1 100%; }
  .agent-working-fields > .field { flex: 1 1 100px; }
  .agent-working-fields > .field:last-child { flex: 1 1 100%; }
  .agent-working-zone > summary { min-height: 44px; line-height: 44px; }
}

/* Equal touch targets keep the agent sections visible on phones. */
@media (max-width: 760px), (max-height: 540px) {
  .agent-editor-nav { display: grid; grid-template-columns: repeat(var(--agent-editor-tab-count, 7), minmax(44px, 1fr)); gap: 0; padding-inline: max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-right)); overflow-x: auto; }
  .agent-editor-nav button { justify-content: center; min-width: 0; min-height: 44px; padding: 10px 0; gap: 0; }
  .agent-editor-tab-icon { width: 26px; font-size: 24px; }
  .agent-editor-tab-label { display: none; }
  .agent-editor-with-section-title:not(.agent-setup) .agent-editor-nav { grid-template-columns: repeat(var(--agent-editor-tab-count, 8), minmax(0, 1fr)); }
  .agent-editor-panel-tasks .agent-editor-panel-heading { display: grid; grid-template-columns: minmax(0, 1fr); }
  .agent-editor-panel-tasks .agent-task-settings { display: grid; gap: 14px; }
  .agent-editor-panel-tasks .agent-editor-panel-heading > .work-task-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin: 0; }
  .agent-editor-panel-tasks .work-task-toolbar .btn { min-height: 44px; white-space: normal; }
  .agent-editor-panel-tasks .work-task-filters { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
  .agent-editor-panel-tasks .work-task-filters > select { grid-column: 1 / -1; width: 100%; }
  .agent-editor-panel-tasks .work-task-filters > :is(input, select) { min-width: 0; min-height: 44px; height: auto; font-size: 16px; }
  .agent-editor-panel-tasks .work-task-filters > .hint { grid-column: 1 / -1; }
  .agent-editor-panel-tasks .work-task-table tbody td { padding: 6px 0; }
  .agent-editor-panel-tasks .work-task-table td:last-child { text-align: left; }
}

.agent-editor-panel .agent-editor-disclosure + .field { margin-top: 18px; }
.agent-editor .agent-editor-disclosure-body > div { min-width: 0; }

/* Account photos stay circular in the sidebar, settings and user list. */
#userMenu .avatar, .user-avatar { border-radius: 50%; overflow: hidden; flex-shrink: 0; }
#userMenu .avatar {
  flex: 0 0 30px;
  width: 30px; min-width: 30px; max-width: 30px;
  height: 30px; min-height: 30px; max-height: 30px;
  aspect-ratio: 1;
}
#userMenu .user-meta { flex: 1; min-width: 0; }
#userMenu .user-meta b, #userMenu .user-meta small {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-photo-editor { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.profile-photo-editor .field { min-width: 0; flex: 1 1 180px; }
.profile-photo-editor input[type="file"] { max-width: 100%; }

/* Consistent communication symbols in navigation, headings and channel choices. */
.agent-channel-icon { width: 22px; height: 22px; display: inline-block; flex: 0 0 22px; vertical-align: middle; }
.agent-channel-heading, .agent-channel-name { display: flex; align-items: center; gap: 10px; }
.agent-channel-heading .agent-channel-icon { color: var(--accent); }
.agent-editor-tab-icon:has(.agent-channel-icon) { display: inline-flex; align-items: center; justify-content: center; }
.agent-editor-tab-icon .agent-channel-icon { width: 24px; height: 24px; flex-basis: 24px; }

.agent-profile-top { width: fit-content; max-width: 100%; box-sizing: border-box; margin-bottom: 24px; padding: 0; border: 0; gap: 16px; }
.agent-profile-top .agent-portrait-xl { --agent-portrait-size: 84px; }
.agent-profile-top .agent-portrait-xl .agent-presence-dot { width: 14px; height: 14px; border-width: 2px; right: 1px; bottom: 1px; }
.agent-profile-top .agent-photo-actions .form-actions { flex-wrap: wrap; }

.agent-voice-technical { margin: 0 0 16px; padding: 12px; background: var(--surface-2); border-radius: 7px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }

/* Profile image and personal details share the available desktop space. */
.agent-profile-layout { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 6px; }
.agent-profile-layout > .agent-profile-top { flex-direction: column; align-items: flex-start; margin-bottom: 18px; width: 100%; }
.agent-profile-layout .agent-photo-actions .form-actions { flex-direction: column; align-items: flex-start; gap: 6px; }
.agent-profile-fields { min-width: 0; }
.agent-profile-details-layout { row-gap: 0; }
.agent-profile-details-layout > .agent-profile-top { grid-row: span 2; margin-bottom: 0; }
.agent-profile-details-layout > .agent-editor-grid { min-width: 0; }
.profile-identity-layout { display: grid; grid-template-columns: minmax(140px, 190px) minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-identity-layout .profile-photo-editor { flex-direction: column; align-items: flex-start; }
.profile-identity-layout .profile-photo-editor .field { flex: none; width: 100%; }
@media (max-width: 760px) {
  .agent-profile-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .agent-profile-layout > .agent-profile-top { width: fit-content; flex-direction: row; align-items: center; }
  .agent-profile-details-layout > .agent-profile-top { grid-row: auto; }
  .agent-profile-layout .agent-photo-actions .form-actions { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .profile-identity-layout { grid-template-columns: minmax(0, 1fr); }
}

.agent-profile-id { display: grid; gap: 6px; min-width: 0; padding-top: 2px; color: var(--text-dim); font-size: 13px; }
.agent-profile-id code { display: block; padding-top: 10px; color: var(--text); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; user-select: text; }
.agent-profile-alias-row { align-items: start; }
.agent-profile-bottom { align-items: start; }
.agent-profile-bottom .agent-working-hours { margin-top: 0; }

/* Observed access failures remain separate from working hours and activity. */
.agent-attention-badge { color: var(--err); border: 1px solid var(--err); background: var(--surface); cursor: pointer; font: inherit; font-size: 12px; white-space: normal; text-align: left; min-height: 32px; }
.agent-attention-badge:focus-visible { outline: 2px solid var(--err); outline-offset: 3px; }
.agent-needs-attention > td:first-child { box-shadow: inset 3px 0 var(--err); }
.agent-presence-dot.attention { display: grid; place-items: center; color: var(--surface); background: var(--err); font-size: 10px; font-weight: 800; line-height: 1; }
.agent-editor-attention:empty { display: none; }
.agent-editor-identity-meta { display: flex; align-items: center; gap: 8px; height: 20px; margin-top: 5px; min-width: 0; }
.agent-editor-identity-meta > .hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-editor-attention { min-width: 0; max-width: 100%; flex: 0 1 auto; }
.agent-editor-attention .agent-attention-badge { display: block; min-height: 0; max-width: 100%; height: 20px; padding: 0 6px; font-size: 11px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-height: 540px) {
  .agent-editor-identity-meta:not(:has(.agent-attention-badge)) { display: none; }
}
.agent-attention-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(var(--app-viewport-height) - 24px); }
.agent-attention-dialog .modal-body { overflow-y: auto; }
.agent-attention-issue + .agent-attention-issue { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.agent-attention-issue strong { color: var(--err); font-size: 14px; font-weight: 600; }
.agent-attention-issue p { overflow-wrap: anywhere; margin: 7px 0; }

.work-status-missed, .work-status-skipped { color: var(--warn); background: var(--surface-2); }

.llm-provider-form [hidden], .llm-provider-shell [hidden] { display: none !important; }
.llm-model-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.field .llm-model-heading label { margin: 0; }
.llm-model-picker { position: relative; min-width: 0; }
.llm-model-picker > input { width: 100%; min-width: 0; }
.llm-model-options { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.llm-model-option { padding: 10px 12px; cursor: pointer; overflow-wrap: anywhere; }
.llm-model-option:hover, .llm-model-option[aria-selected="true"] { background: var(--surface-2); color: var(--accent); }
.llm-model-empty { padding: 10px 12px; }


/* Own unread messages in both sidebar and mobile navigation. */
.inbox-unread-badge { margin-left: auto; flex-shrink: 0; min-width: 19px; height: 19px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-family: inherit; font-size: 11px; font-weight: 700; line-height: 19px; font-style: normal; text-align: center; }
.inbox-unread-badge:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; }
.nav-item:has(.inbox-unread-badge), .app-tab:has(.inbox-unread-badge) { position: relative; }
.app-tab .inbox-unread-badge { position: absolute; top: 2px; right: max(4px, calc(50% - 27px)); margin: 0; }
@media (min-width: 721px) {
  .sidebar.collapsed .inbox-unread-badge { position: absolute; right: 1px; top: 1px; margin: 0; }
}

/* Creation uses the same editor with six numbered, draft-preserving steps. */
.agent-setup [hidden] { display: none !important; }
.agent-setup-progress { font-size: 12px; }
.agent-setup .agent-editor-tab-icon { border: 1px solid var(--border-strong); border-radius: 50%; font-size: 12px; font-weight: 600; }
.agent-setup .agent-editor-nav button[aria-selected="true"] .agent-editor-tab-icon { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.agent-setup .agent-editor-nav button:disabled { opacity: .5; cursor: default; }
.agent-setup .agent-setup-visited .agent-editor-tab-icon { border-color: var(--accent); color: var(--accent); }
.agent-setup-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
.agent-setup-choice { display: flex; align-items: start; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; min-width: 0; }
.agent-setup-choice:has(:checked) { border-color: var(--accent); background: var(--accent-soft); }
.agent-setup-choice input { width: 20px; height: 20px; flex: 0 0 20px; margin: 0; accent-color: var(--accent); }
.agent-setup-choice span { min-width: 0; overflow-wrap: anywhere; }
.agent-setup-choice small { display: block; margin-top: 5px; }
.agent-setup-summary { margin: 0 0 24px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.agent-setup-summary-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr); gap: 16px; padding: 14px 18px; }
.agent-setup-summary-row + .agent-setup-summary-row { border-top: 1px solid var(--border); }
.agent-setup-summary dt { color: var(--text-dim); }
.agent-setup-summary dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow-y: auto; }
.agent-setup-activation .agent-editor-switch { min-height: 44px; }
@media (max-width: 760px), (max-height: 540px) {
  .agent-setup .agent-editor-nav { display: flex; flex-direction: row; gap: 6px; }
  .agent-setup .agent-editor-nav button { padding: 8px 10px; gap: 8px; }
  .agent-setup .agent-editor-tab-label { display: inline; }
  .agent-setup .agent-editor-tab-icon { width: 24px; height: 24px; }
  .agent-setup .agent-editor-foot { gap: 8px; }
  .agent-setup .agent-editor-foot .btn { flex: 1 1 0; padding-inline: 10px; }
  .agent-setup .agent-editor-foot .btn.primary { flex-grow: 1.4; }
  .agent-setup-choices { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 440px) {
  .agent-setup-summary-row { grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 12px 14px; }
  .agent-setup .agent-editor-foot { padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right)); }
  .agent-setup .agent-editor-foot .btn { font-size: 13px; }
  .agent-setup .agent-editor-nav button { font-size: 12px; }
}

.badge.role-manager { background: var(--accent-soft); color: var(--accent); }

/* Human account editor shares the Agent editor shell and responsive navigation. */
.user-editor { width: min(1040px, 100%); }
.user-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.user-editor input[readonly] { background: var(--surface-2); color: var(--text-dim); }
.user-editor :is(input, select):disabled { opacity: .65; cursor: not-allowed; }
.user-editor :is(input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) { .user-editor-grid { grid-template-columns: minmax(0, 1fr); } }

.user-editor select option { background: var(--surface); color: var(--text); }
:root[data-theme="light"] .user-editor { color-scheme: light; }
:root[data-theme="dark"] .user-editor { color-scheme: dark; }

/* Personal settings use the same editor navigation and photo controls as agents. */
.profile-settings-editor .settings-section { padding: 0; border: 0; }
.personal-ai-settings [hidden] { display: none !important; }
.profile-settings-editor .profile-account-data { margin: 24px 0 0; }
.profile-settings-editor .profile-account-data > div { background: var(--surface-2); }
.user-editor .profile-photo-button .user-avatar { width: 112px; height: 112px; font-size: 32px; }
.user-editor .profile-photo-editor { gap: 14px; }
.user-editor .profile-photo-editor .hint { margin: 0; }
.profile-language-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-language-choice { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.profile-language-choice:hover { border-color: var(--accent); }
.profile-language-choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); background: var(--surface-2); }
.profile-language-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-language-flag { font-size: 16px; line-height: 1; }
.profile-language-flag { font-size: 36px; line-height: 1.2; }
.profile-theme-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.profile-theme-choice { display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 10px; padding: 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
.profile-theme-choice:hover { border-color: var(--accent); }
.profile-theme-choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); background: var(--surface-2); }
.profile-theme-choice strong { font-size: 15px; }
.profile-theme-swatch { height: 120px; display: grid; grid-template-columns: 26% 1fr; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: #f7f1ea; }
.profile-theme-swatch-sidebar { background: #2b1d13; }
.profile-theme-swatch-main { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.profile-theme-swatch-main i { display: block; height: 16px; border-radius: 4px; background: #fff; }
.profile-theme-swatch-main i:first-child { width: 55%; background: #7b4a24; }
.profile-theme-swatch[data-preview-theme="dark"] { background: #33241b; }
.profile-theme-swatch[data-preview-theme="dark"] .profile-theme-swatch-sidebar { background: #241811; }
.profile-theme-swatch[data-preview-theme="dark"] i { background: #614630; }
.profile-theme-swatch[data-preview-theme="dark"] i:first-child { background: #dda06c; }
@media (max-width: 600px) {
  .profile-theme-choices { grid-template-columns: minmax(0, 1fr); }
  .profile-settings-editor .profile-account-data { grid-template-columns: minmax(0, 1fr); }
  .user-editor .profile-photo-editor { align-items: center; }
}

/* Account menu opens above the sidebar footer and remains usable on small screens. */
.user-menu-popover {
  width: min(320px, calc(var(--app-viewport-width) - 32px));
  max-height: min(520px, calc(var(--app-viewport-height) - 110px));
  padding: 0; overflow: auto; overscroll-behavior: contain;
  border-radius: 14px; box-shadow: 0 12px 40px rgba(40, 25, 12, .2);
}
.user-menu-popover[hidden] { display: none; }
.account-menu-header { display: flex; align-items: center; gap: 14px; padding: 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.account-menu-header > div:last-child { min-width: 0; }
.account-menu-header b, .account-menu-header small { display: block; overflow-wrap: anywhere; }
.account-menu-header b { color: var(--text); font-size: 16px; }
.account-menu-header small { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.account-menu-header .avatar { flex-shrink: 0; }
.account-menu-links { padding: 8px; }
.user-menu-popover button { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 11px 12px; font: 500 14px var(--font); }
.user-menu-popover [data-account-icon] { display: inline-flex; flex: 0 0 23px; width: 23px; height: 23px; align-items: center; justify-content: center; color: var(--accent); }
.user-menu-popover button > span:nth-child(2) { flex: 1; }
.user-menu-popover button:focus-visible, .user-card:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.account-menu-logout { margin: 0; padding: 8px; border-top: 1px solid var(--border); }
.account-menu-chevron { margin-left: auto; color: var(--sidebar-text-dim); font-size: 18px; transition: transform .15s; }
.user-card[aria-expanded="true"] .account-menu-chevron { transform: rotate(180deg); }
.sidebar.collapsed .account-menu-chevron { display: none; }
.account-theme-track { position: relative; display: inline-block; width: 40px; height: 24px; flex: 0 0 40px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); }
.account-theme-track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
#accountThemeSwitch[aria-checked="true"] .account-theme-track { background: var(--accent-soft); border-color: var(--accent); }
#accountThemeSwitch[aria-checked="true"] .account-theme-track::after { transform: translateX(16px); background: var(--accent); }
#accountThemeSwitch:disabled { opacity: .6; cursor: wait; }
.login-activity-toolbar { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.login-activity-toolbar .hint { margin: 0; }
.login-activity-toolbar .btn { flex-shrink: 0; }
.login-activity-list { display: grid; gap: 10px; }
.login-activity-card { display: flex; align-items: start; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.login-activity-icon { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.login-activity-icon.failed { color: var(--err); background: color-mix(in srgb, var(--err) 12%, var(--surface)); }
.login-activity-main { flex: 1; min-width: 0; display: grid; gap: 5px; overflow-wrap: anywhere; }
.login-activity-main strong { font-size: 14px; }
.login-activity-main span { font-size: 13px; color: var(--text-dim); }
.login-activity-main small, .login-activity-card time { color: var(--text-dim); font-size: 12px; }
.login-activity-card time { white-space: nowrap; }
@media (max-width: 600px) {
  .user-menu-popover { width: min(320px, calc(var(--app-viewport-width) - 32px)); }
  .account-menu-header { padding: 16px; }
  .login-activity-card { flex-wrap: wrap; }
  .login-activity-main { flex-basis: calc(100% - 48px); }
  .login-activity-card time { margin-left: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .account-theme-track::after, .account-menu-chevron { transition: none; }
}
.user-menu-popover { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--surface); }
.user-menu-popover::-webkit-scrollbar { width: 6px; }
.user-menu-popover::-webkit-scrollbar-track { background: var(--surface); }
.user-menu-popover::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
.login-activity-toolbar .btn { min-height: 44px; }

.user-editor .profile-photo-button:disabled { cursor: default; }
.user-editor .profile-photo-button:disabled::after { display: none; }

/* Contact accounts share the communication shell with three primary routes. */
.contact-profile { max-width: 620px; display: grid; gap: 18px; padding: 24px; }
.contact-profile-option { display: flex; align-items: center; gap: 10px; }
body.contact-account .app-tabbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Teams: shared organization canvas and management panel. */
.organization-page { min-width: 0; }
.org-heading, .org-toolbar, .org-actions, .org-view-tools, .org-tabs { display: flex; align-items: center; gap: 10px; }
.org-heading { justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.org-heading p { margin: 0; font-size: 15px; }
.org-actions { flex-wrap: wrap; }
.org-toolbar { justify-content: space-between; flex-wrap: wrap; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); }
.org-tabs { padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.org-tabs .btn { border-color: transparent; }
.org-view-tools { flex-wrap: wrap; }
.org-view-tools select { max-width: 240px; min-width: 150px; }
.org-zoom { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.org-workspace { display: flex; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.org-main { flex: 1; min-width: 0; }
.org-viewport { height: min(72vh, 850px); min-height: 420px; overflow: auto; position: relative; cursor: grab; touch-action: none; background: var(--surface-2); }
.org-viewport.panning { cursor: grabbing; user-select: none; }
.org-spacer { position: relative; margin: 0 auto; }
.org-canvas { position: absolute; top: 0; left: 0; transform-origin: top left; }
.org-team-frame { position: absolute; border: 1px solid var(--border-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 20%, transparent); }
.org-team-title { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.org-team-name { font: inherit; font-weight: 700; font-size: 16px; color: var(--text); border: 0; padding: 4px 0; background: transparent; text-align: left; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-team-title .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-plus { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); width: 28px; height: 28px; border-radius: 50%; font-size: 19px; font-weight: 600; box-shadow: var(--shadow); display: grid; place-items: center; padding: 0; flex-shrink: 0; }
.org-plus:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.org-plus:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.org-team-title > .org-plus { margin-left: auto; }
.org-team-empty { position: absolute; top: 64px; left: 24px; right: 24px; height: 58px; display: grid; place-items: center; }
.org-team-empty .btn { border-style: dashed; width: 100%; }
.org-member { position: absolute; z-index: 2; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); display: flex; align-items: center; gap: 10px; padding: 12px; box-shadow: var(--shadow); }
.org-member.selected, .org-member:focus-within { outline: 2px solid var(--accent); outline-offset: 0; }
.org-member[draggable="true"] { cursor: move; }
.org-member-open { position: absolute; inset: 0; z-index: 1; background: transparent; border: 0; border-radius: inherit; font-size: 0; color: transparent; cursor: inherit; }
.org-member-open:focus-visible { outline: 2px solid var(--accent); }
.org-avatar { display: grid; place-items: center; flex-shrink: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent); width: 40px; height: 40px; font-weight: 600; font-size: 16px; }
.org-member-info { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 5px; pointer-events: none; }
.org-member-info strong, .org-member-info small { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.org-member-info small { color: var(--text-dim); font-size: 11px; }
.org-kind { font-size: 10px; border-radius: 10px; padding: 4px 6px; color: var(--accent); background: var(--accent-soft); flex-shrink: 0; }
.org-report-plus { position: absolute; z-index: 3; bottom: -16px; left: calc(50% - 14px); }
.org-lines { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; overflow: visible; }
.org-lines path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.org-editor { flex: 0 0 340px; width: 340px; max-height: 850px; overflow-y: auto; border-left: 1px solid var(--border); background: var(--surface); padding: 20px; }
.org-editor[hidden], .org-viewport[hidden], .org-overview[hidden] { display: none; }
.org-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; }
.org-editor-head h3 { margin: 0; font-size: 18px; }
.org-editor > .btn { width: 100%; margin: 7px 0; }
.org-editor .field { margin-bottom: 18px; }
.org-editor :is(select,input) { width: 100%; min-width: 0; }
.org-person-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.org-person-heading strong { flex: 1; }
.org-move-summary { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); margin: 12px 0; overflow-wrap: anywhere; }
.org-move-summary small { color: var(--text-dim); line-height: 1.5; }
.org-move-summary[hidden] { display: none; }
.org-move-summary label { display: flex; align-items: flex-start; gap: 8px; }
.org-editor .org-move-summary input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; flex: 0 0 18px; margin: 2px 0 0; accent-color: var(--accent); }
.org-error:empty { display: none; }
.org-error { border: 1px solid var(--err); padding: 14px; border-radius: var(--radius-sm); color: var(--err); background: var(--surface); margin-bottom: 12px; }
.org-legend { display: flex; flex-wrap: wrap; gap: 18px; padding: 14px 4px; }
.org-empty { padding: 50px 24px; text-align: center; }
.org-overview { padding: 18px; min-height: 420px; max-height: 850px; overflow: auto; }
.org-team-list { margin-bottom: 18px; padding: 18px; }
.org-team-list header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.org-team-list h3 { margin: 0; }
.org-table-scroll { overflow-x: auto; }
.org-team-list table { width: 100%; border-collapse: collapse; }
.org-team-list :is(th,td) { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); }
.org-text-button { background: transparent; border: 0; padding: 4px 0; color: var(--accent); font: inherit; text-align: left; }
.org-dependencies { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.org-dependencies:empty { display: none; }
.org-editor hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.org-editor .btn:disabled { opacity: .5; cursor: default; }
@media (max-width: 1100px) { .org-editor { flex-basis: 290px; width: 290px; padding: 16px; } }
@media (max-width: 760px) {
  .org-workspace { flex-direction: column; }
  .org-editor { border-left: 0; border-top: 1px solid var(--border); width: 100%; flex-basis: auto; max-height: none; }
  .org-viewport { min-height: 360px; height: 55vh; }
  .org-toolbar { align-items: stretch; }
  .org-view-tools { gap: 6px; }
  .org-view-tools select { max-width: 100%; flex: 1; }
  .org-heading .org-actions { width: 100%; }
  .org-heading .org-actions .btn { flex: 1; }
  .org-overview { padding: 8px; }
  .org-team-list { padding: 12px; }
}
.nav-team-row { display: flex; align-items: center; }
.nav-team-row > .nav-item { flex: 1; min-width: 0; }
.nav-team-caret { flex-shrink: 0; width: 32px; height: 40px; border: 0; background: transparent; color: var(--sidebar-text); font: inherit; font-size: 20px; }
.nav-team-row.group-active > .nav-item { color: var(--sidebar-active-text); }
.org-view-tools select { font: inherit; padding: 9px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-height: 38px; }

.org-avatar { position: relative; overflow: visible; }
.org-avatar-face { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.org-presence-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border: 2px solid var(--surface); border-radius: 50%; background: var(--text-dim); box-sizing: content-box; }
.org-presence-dot.is-online { background: var(--success, #23834a); }
.org-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.org-member-label { display: flex; align-items: center; gap: 10px; }

/* Separate, collapsible team tree above each team's reporting chart. */
.org-team-group, .org-member-group, .org-subteams-group { display: contents; }
.org-member-group[hidden], .org-subteams-group[hidden], .org-table-scroll[hidden] { display: none; }
.org-team-card { position: absolute; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.org-team-card-head { display: flex; align-items: center; gap: 14px; padding: 15px; min-height: 94px; flex: 1; }
.org-team-avatar { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.org-team-avatar svg { width: 25px; height: 25px; }
.org-team-card-info { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.org-team-card-info .org-team-name { padding: 0; max-width: 100%; font-size: 16px; }
.org-team-card-info > .hint { font-size: 12px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.org-team-card-info > small.hint { font-size: 11px; }
.org-team-edit { align-self: flex-start; background: transparent; border: 1px solid var(--border); border-radius: 50%; color: var(--accent); width: 28px; height: 28px; font-size: 20px; line-height: 1; padding: 0; }
.org-team-toggles { display: flex; align-items: stretch; border-top: 1px solid var(--border); flex-shrink: 0; }
.org-team-toggle { font: inherit; font-size: 12px; border: 0; border-radius: 0; background: transparent; color: var(--accent); flex: 1; padding: 10px 6px; min-height: 36px; }
.org-team-toggle + .org-team-toggle { border-left: 1px solid var(--border); }
.org-team-toggle:hover, .org-team-edit:hover { background: var(--accent-soft); }
.org-team-card :is(button):focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.org-team-summary { position: relative; z-index: 2; display: flex; flex-direction: column; height: var(--org-summary-height, 172px); flex: 0 0 var(--org-summary-height, 172px); background: var(--surface); border-bottom: 1px solid var(--border); }
.org-lines .org-report-link { stroke: var(--muted); stroke-width: 1.5; }
.org-lines .org-team-link { stroke: var(--accent); stroke-width: 2; }
.org-team-line-key::before, .org-report-line-key::before { content: ""; display: inline-block; width: 28px; border-top: 2px solid var(--accent); margin-right: 8px; vertical-align: middle; }
.org-report-line-key::before { border-color: var(--muted); }

.org-team-card-head { position: relative; }
.org-team-open { position: absolute; inset: 0; z-index: 1; border: 0; padding: 0; background: transparent; font-size: 0; color: transparent; cursor: pointer; }
.org-team-open:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.org-team-card-head > :is(.org-team-avatar,.org-team-card-info,.org-kind) { pointer-events: none; }
.org-team-edit { position: relative; z-index: 2; }

.org-team-add { position: absolute; z-index: 3; }
@media (hover: hover) and (pointer: fine) {
  .org-canvas .org-plus { opacity: 0; transition: opacity .12s ease; }
  .org-member:is(:hover, :focus-within) > .org-report-plus,
  .org-team-summary:is(:hover, :focus-within) .org-team-first-member,
  .org-team-group:has(> .org-team-card:is(:hover, :focus-within)) > .org-team-add,
  .org-canvas .org-plus:is(:hover, :focus-visible) { opacity: 1; }
}

.org-team-head-actions { position: relative; z-index: 2; display: flex; align-items: center; align-self: flex-start; flex-shrink: 0; gap: 6px; }

.org-team-footer { position: absolute; bottom: 0; left: 0; width: 100%; height: 36px; z-index: 2; background: var(--surface); }

/* Searchable team directory with focused member dialogs. */
.org-legend[hidden], .org-view-tools [hidden] { display: none; }
.org-directory-tools, .org-members-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.org-directory-tools :is(input,select), .org-members-filters :is(input,select) { min-width: 0; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 11px 12px; min-height: 44px; }
.org-directory-search { flex: 1 1 280px; }
.org-directory-tools select { flex: 0 1 220px; }
.org-directory-tools + .hint { display: block; margin-bottom: 14px; }
.org-team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.org-directory-card { position: relative; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.org-directory-card:hover { border-color: var(--accent); }
.org-directory-open { display: grid; grid-template-columns: 50px minmax(0,1fr) 16px; gap: 14px; width: 100%; height: 100%; padding: 22px 18px; border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; }
.org-directory-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.org-directory-info { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding-right: 12px; }
.org-directory-info strong { font-size: 17px; overflow-wrap: anywhere; }
.org-directory-info .hint { line-height: 1.5; overflow-wrap: anywhere; }
.org-directory-arrow { align-self: center; color: var(--accent); font-size: 24px; margin-top: 28px; }
.org-directory-count { grid-column: 1 / -1; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 14px; font-size: 12px; }
.org-directory-edit { position: absolute; top: 12px; right: 12px; }
.org-directory-empty { grid-column: 1 / -1; text-align: center; padding: 32px 16px; }
.org-directory-empty h3 { margin: 0 0 10px; }
dialog.org-members-dialog { width: min(1040px, calc(100vw - 32px)) !important; max-width: calc(100vw - 24px); max-height: min(850px, calc(var(--app-viewport-height) - 32px)); background: var(--surface); }
.org-members-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.org-members-head h2 { margin: 0; font-size: 24px; overflow-wrap: anywhere; }
.org-members-head p { margin: 8px 0 0; }
.org-members-content { overflow-y: auto; min-height: 0; padding: 20px 24px; }
.org-members-filters input { flex: 1 1 280px; }
.org-members-filters select { flex: 1 1 180px; }
.org-member-table-wrap { overflow-x: auto; }
.org-member-table { border-collapse: collapse; width: 100%; min-width: 620px; }
.org-member-table :is(th,td) { border-bottom: 1px solid var(--border); padding: 14px 12px; text-align: left; }
.org-member-table th { font-size: 12px; color: var(--text-dim); font-weight: 600; white-space: nowrap; }
.org-member-table td { font-size: 13px; }
.org-member-table .org-text-button { overflow-wrap: anywhere; }
.org-popup-leader { display: block; color: var(--text-dim); font-size: 11px; }
.org-members-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; background: var(--surface-2); }
.org-members-foot > .hint { flex: 1 1 220px; }
.org-popup-subteams { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; border-top: 1px solid var(--border); padding-top: 18px; }
.org-popup-subteams strong { margin-right: 8px; }
@media (max-width: 600px) {
  .org-directory-tools :is(input,select) { flex: 1 1 100%; }
  dialog.org-members-dialog { width: calc(100vw - 16px) !important; max-width: calc(100vw - 16px); max-height: calc(var(--app-viewport-height) - 16px); border-radius: var(--radius); }
  .org-members-head, .org-members-content, .org-members-foot { padding: 16px; }
  .org-members-filters :is(input,select) { flex-basis: 100%; }
  .org-members-foot > .hint { flex-basis: 100%; }
  .org-members-foot .btn { flex: 1 1 auto; }
}

.org-directory-tools :is(input,select):focus-visible, .org-members-filters :is(input,select):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.org-assignment-warnings:empty { display: none; }
.org-assignment-warnings { padding: 12px 16px; border: 1px solid var(--warn); background: var(--surface); border-radius: var(--radius-sm); margin-bottom: 14px; line-height: 1.6; }
.org-assignment-warnings .org-text-button { margin-right: 12px; text-decoration: underline; }
.org-report-warning { display: block; color: var(--err) !important; }
.org-member.invalid-report { border-color: var(--err); }

.org-members-content[hidden], .org-members-foot[hidden], .org-popup-subteams[hidden] { display: none; }
.org-editor.org-popup-editor { width: 100%; flex: 1 1 auto; min-height: 0; max-height: none; padding: 20px 24px; border: 0; background: var(--surface); }
.org-popup-editor .org-editor-head { margin-bottom: 24px; }
.org-popup-editor .field { max-width: 640px; }
.org-popup-editor .org-move-summary { max-width: 640px; }
.org-popup-editor > .btn { width: auto; margin-right: 10px; }
.org-popup-save-error:not(:empty) { margin: 12px 24px 0; flex-shrink: 0; }
@media (max-width: 600px) { .org-editor.org-popup-editor { padding: 16px; } .org-popup-editor > .btn { width: 100%; margin-right: 0; } }

.org-popup-tabs { display: flex; gap: 6px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; }
.org-popup-tabs .btn { border-color: transparent; }
.org-popup-tabs .btn:not(.primary) { background: transparent; }
.org-popup-panels { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
@media (max-width: 600px) { .org-popup-tabs { padding: 10px 16px; } .org-popup-tabs .btn { flex: 1; } }

.org-team-avatar { overflow: hidden; }
.org-team-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.org-members-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }

.org-team-icon-gallery[hidden] { display: none; }
.org-team-icon-gallery { flex-basis: 100%; width: 100%; margin-top: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.org-team-icon-gallery > strong { display: block; margin-bottom: 14px; }
.org-team-image-picker .profile-photo-button .user-avatar { width: 112px; height: 112px; font-size: 32px; }
.org-team-image-picker .user-avatar svg { width: 60%; height: 60%; color: var(--accent); }
.org-department-symbol { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.org-department-symbol svg { width: 34px; height: 34px; }

/* Calls directory: sidebar on desktop, tabs and icon actions on mobile. */
.calls-home { position: relative; max-width: 1240px; margin: 20px auto 60px; color: var(--text); }
.calls-toolbar { margin-bottom: 28px; }
.calls-heading h1 { margin: 0; font-size: clamp(28px, 3vw, 38px); letter-spacing: -.8px; line-height: 1.2; }
.calls-heading p { margin: 6px 0 0; color: var(--text-dim); font-size: 16px; }
.calls-workspace { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.calls-sidebar { display: flex; flex-direction: column; min-height: 560px; }
.calls-sidebar-label { margin: 12px 12px 10px; color: var(--text-dim); font-size: 11px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; }
.calls-directory-panel { min-width: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); padding: 18px 22px 0; }
.calls-searchbar { display: flex; min-width: 140px; flex: 1; max-width: 320px; }
.calls-contact-filters { min-width: 0; max-width: 150px; min-height: 36px; border: 1px solid var(--border); border-radius: 9px; padding: 6px 8px; color: var(--text-dim); background: var(--surface); font: inherit; font-size: 12px; }
.calls-contact-filters[hidden] { display: none; }
.calls-directory-count { margin: 12px 0 0; padding: 18px 6px; border-top: 1px solid var(--border); color: var(--text-dim); font-size: 13px; }
.calls-contact-filters:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.calls-search { display: flex; align-items: center; gap: 14px; min-width: 0; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); padding: 0 20px; flex: 1; box-shadow: 0 3px 14px #39251404; }
.calls-icon { display: inline-flex; width: 22px; height: 22px; flex: 0 0 22px; }
.calls-icon svg { width: 100%; height: 100%; }
.calls-search input { border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; width: 100%; min-height: 44px; font: inherit; font-size: 16px; box-shadow: none; padding: 0; }
.calls-search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.calls-mic { flex: 0 0 auto; }
.calls-mic .comm-orch { height: 44px; min-height: 44px; width: auto; padding: 0 12px; margin: 0; gap: 8px; justify-content: center; border-radius: 11px; box-shadow: none; color: var(--accent); background: var(--surface); }
.calls-mic .comm-orch-ic { background: transparent; width: 24px; height: 32px; }
.calls-mic .comm-orch-ic svg { width: 22px; height: 22px; }
.calls-mic .comm-orch-tx { white-space: nowrap; font-size: 13px; }
.calls-mic .comm-orch-go { display: none; }
.calls-mic .comm-orch:hover { background: var(--accent-soft); border-color: var(--accent); }
.calls-mic .comm-orch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.comm-voice-dialog { width: min(380px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); box-sizing: border-box; margin: auto; padding: 22px; overflow-y: auto; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.comm-voice-dialog::backdrop { background: #20130b66; backdrop-filter: blur(3px); }
.comm-voice-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.comm-voice-head h2 { margin: 0; font-size: 21px; letter-spacing: -.4px; }
.comm-voice-close { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--text-dim); font-size: 28px; cursor: pointer; }
.comm-voice-close:hover { background: var(--accent-soft); }
.comm-voice-example { margin: 10px 0 18px; color: var(--text-dim); font-size: 14px; line-height: 1.5; }
.comm-voice-status { min-height: 72px; padding: 14px; margin: 0 0 18px; border-radius: 12px; background: var(--accent-soft); white-space: pre-line; overflow-wrap: anywhere; font-size: 15px; line-height: 1.5; }
.comm-voice-status.err { color: var(--err); }
.comm-voice-control { width: 100%; min-height: 48px; display: flex; justify-content: center; align-items: center; gap: 10px; }
.comm-voice-control svg { width: 24px; height: 24px; }
.comm-voice-control.is-recording { box-shadow: 0 0 0 4px var(--accent-soft); }
.calls-actions { display: flex; flex-direction: column; gap: 4px; margin: 0 0 24px; }
.calls-directory-nav { display: flex; flex-direction: column; gap: 4px; margin-bottom: 28px; }
.calls-actions > .calls-button, .calls-directory-nav .calls-button { justify-content: flex-start; width: 100%; min-height: 48px; padding: 10px 12px; gap: 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 14px; font-weight: 400; }
.calls-directory-nav .calls-button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; box-shadow: inset 3px 0 var(--accent); }
.calls-directory-nav .calls-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.calls-actions .calls-icon, .calls-directory-nav .calls-icon { width: 22px; height: 22px; flex-basis: 22px; color: var(--accent); }
.calls-sidebar .calls-mic .comm-orch { width: 100%; border: 0; background: transparent; padding: 10px 12px; justify-content: flex-start; gap: 12px; min-height: 48px; }
.calls-sidebar .calls-mic .comm-orch-tx { font-size: 14px; color: var(--text); }
.calls-sidebar .calls-mic .comm-orch-tx b { font-weight: 400; }
.calls-mic { order: 1; }
.calls-actions > .calls-button:nth-child(2) { order: 2; }
.calls-button { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 48px; padding: 12px 20px; border: 1px solid var(--border); border-radius: 13px; color: var(--accent); background: var(--surface); font: inherit; font-weight: 600; cursor: pointer; }
.calls-button:hover:not(:disabled) { background: var(--surface-2); }
.calls-button.primary { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.calls-button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.calls-button:disabled { opacity: .5; cursor: default; }
.calls-section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.calls-section-head h2 { font-size: 22px; margin: 0 auto 0 6px; }
.calls-invite-contact { display: flex; align-items: center; gap: 12px; min-height: 48px; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 20px 12px 8px; margin-top: auto; color: var(--accent); background: transparent; font: inherit; font-size: 14px; cursor: pointer; }
.calls-targets { display: flex; flex-direction: column; gap: 0; }
.calls-targets > .calls-target { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; padding: 18px 6px; }
.calls-targets > .calls-target:hover { background: var(--surface-2); }
.calls-target { display: flex; align-items: center; gap: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 14px; }
.calls-avatar { display: inline-grid; place-items: center; position: relative; width: 52px; height: 52px; border-radius: 50%; flex: 0 0 52px; background: var(--accent-soft); font-size: 25px; }
.calls-avatar img { position: absolute; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.calls-online, .calls-offline { position: absolute; right: -1px; bottom: 0; width: 13px; height: 13px; border: 2px solid var(--surface); border-radius: 50%; background: #26ae68; }
.calls-offline { background: var(--text-dim); }
.calls-target-text > .calls-presence.is-online { color: var(--success, #23834a); }
.calls-target-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.calls-target-text b { color: var(--text); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calls-target-text > span { color: var(--text-dim); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calls-call { flex: 0 0 48px; width: 48px; min-height: 48px; padding: 11px; gap: 0; justify-content: center; border: 0; background: transparent; border-radius: 10px; }
.calls-call > span:not(.calls-icon) { display: none; }
.calls-call .calls-icon { width: 26px; height: 26px; flex-basis: 26px; }
.calls-row-menu { position: relative; flex: 0 0 auto; }
.calls-row-menu summary { display: grid; place-items: center; width: 34px; height: 44px; cursor: pointer; list-style: none; font-size: 23px; color: var(--accent); }
.calls-row-menu summary::-webkit-details-marker { display: none; }
.calls-row-commands { position: absolute; right: 0; top: 100%; min-width: 230px; z-index: 5; padding: 6px; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); background: var(--surface); }
.calls-row-commands button { width: 100%; padding: 12px; min-height: 44px; border: 0; background: transparent; text-align: left; color: var(--text); font: inherit; border-radius: 7px; cursor: pointer; }
.calls-row-commands button:hover { background: var(--surface-2); }
.calls-row-commands .calls-danger { color: var(--danger, #ae3930); }
.calls-more-title { margin: 18px 0 0; font-size: 16px; color: var(--text-dim); }
.calls-empty, .calls-status { color: var(--text-dim); font-size: 14px; }
.calls-status:empty { display: none; }
.calls-picker, .calls-share { position: fixed; inset: 0; margin: auto; width: min(580px, calc(100vw - 40px)); max-width: none; max-height: calc(100dvh - 48px); height: min(740px, calc(100dvh - 48px)); border: 1px solid var(--border); border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); box-shadow: -8px 6px 36px #3925140d; }
.calls-picker[open], .calls-share[open] { display: flex; flex-direction: column; }
.calls-picker::backdrop, .calls-share::backdrop { background: #20130b55; backdrop-filter: blur(3px); }
.calls-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 25px 26px 9px; flex: 0 0 auto; }
.calls-dialog-head h2 { font-size: 25px; margin: 0; letter-spacing: -.5px; }
.calls-close { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; color: var(--text-dim); background: transparent; cursor: pointer; flex: 0 0 44px; }
.calls-close:hover { background: var(--surface-2); }
.calls-picker-copy { margin: 0; padding: 0 26px 15px; color: var(--text-dim); font-size: 15px; }
.calls-picker-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 26px 20px; flex: 1; min-height: 0; }
.calls-picker-search { border-radius: 11px; padding: 0 14px; }
.calls-picker-search input { min-height: 46px; font-size: 14px; }
.calls-picker-body h3 { font-size: 17px; margin: 19px 0 12px; }
.calls-selected { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.calls-selected:empty { display: none; }
.calls-selected-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); padding: 5px 9px 5px 5px; font: inherit; font-size: 13px; cursor: pointer; min-height: 44px; }
.calls-selected-chip .calls-avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 18px; }
.calls-choice { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 9px 14px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); cursor: pointer; }
.calls-choice input { accent-color: var(--accent); width: 20px; height: 20px; margin: 0; flex: 0 0 20px; }
.calls-choice:has(input:disabled) { opacity: .5; cursor: default; }
.calls-choice .calls-avatar { width: 44px; height: 44px; flex-basis: 44px; font-size: 23px; }
.calls-name { display: flex; flex-direction: column; gap: 7px; color: var(--text-dim); font-size: 14px; margin-top: 22px; }
.calls-name input { min-height: 46px; padding: 10px 13px; font: inherit; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface); }
.calls-error { color: var(--danger, #ae3930); font-size: 14px; }
.calls-error:empty { display: none; }
.calls-picker-footer { padding: 14px 26px 24px; border-top: 1px solid var(--border); background: var(--surface); flex: 0 0 auto; }
.calls-picker-note { color: var(--text-dim); font-size: 13px; margin: 0 0 13px; line-height: 1.5; }
.calls-selection-count { font-size: 14px; margin: 0 0 12px; }
.calls-picker-footer > button { width: 100%; }
.calls-share .call-invite-card { margin: 10px 26px 26px; overflow-y: auto; }
@media (max-width: 900px) {
  .calls-workspace { grid-template-columns: 160px minmax(0, 1fr); gap: 16px; }
  .calls-directory-panel { padding: 14px 16px 0; }
  .calls-section-head .calls-searchbar { max-width: none; flex-basis: 100%; }
}
@media (max-width: 600px) {
  .calls-home { display: flex; flex-direction: column; margin: 8px auto 24px; }
  .calls-toolbar { order: 0; margin-bottom: 16px; padding-right: 65px; }
  .calls-heading h1 { font-size: 28px; }
  .calls-heading p { display: block; font-size: 13px; line-height: 1.4; max-width: 260px; }
  .calls-workspace, .calls-sidebar, .calls-directory-panel, .calls-section-head { display: contents; }
  .calls-sidebar-label, .calls-section-head h2 { display: none; }
  .calls-searchbar { order: 1; max-width: none; width: 100%; margin: 0 0 10px; }
  .calls-search { padding: 0 12px; gap: 9px; border-radius: 13px; }
  .calls-search input { min-height: 44px; font-size: 16px; }
  .calls-directory-nav { order: 2; flex-direction: row; gap: 4px; margin-bottom: 8px; }
  .calls-directory-nav .calls-button { flex: 1; width: auto; justify-content: center; min-width: 0; min-height: 44px; padding: 8px; font-size: 14px; }
  .calls-directory-nav .calls-icon { display: none; }
  .calls-directory-nav .calls-button[aria-pressed="true"] { box-shadow: none; }
  .calls-actions { order: 3; flex-direction: row; justify-content: space-around; gap: 4px; margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .calls-actions > .calls-button, .calls-sidebar .calls-mic .comm-orch { flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 60px; padding: 4px; font-size: 12px; }
  .calls-actions > .calls-button, .calls-mic { flex: 1; width: 0; min-width: 0; }
  .calls-actions > .calls-button:first-child span:last-child { font-size: 0; }
  .calls-actions > .calls-button:first-child span:last-child::after { content: "Gruppe"; font-size: 12px; }
  .calls-actions .calls-icon, .calls-mic .comm-orch-ic, .calls-mic .comm-orch-ic svg { width: 25px; height: 25px; flex-basis: 25px; }
  .calls-sidebar .calls-mic .comm-orch { width: 100%; height: auto; }
  .calls-sidebar .calls-mic .comm-orch-tx { display: block; font-size: 12px; }
  #commOrchLaunch .comm-orch-tx b { font-size: 0; }
  #commOrchLaunch .comm-orch-tx b::after { content: "Sprachwahl"; font-size: 12px; }
  .calls-invite-contact { position: absolute; top: 0; right: 0; margin: 0; padding: 4px; border: 0; flex-direction: column; gap: 3px; font-size: 0; min-width: 52px; }
  .calls-invite-contact::after { content: "Einladen"; font-size: 12px; }
  .calls-invite-contact .calls-icon { width: 25px; height: 25px; }
  .calls-contact-filters { order: 4; align-self: flex-end; margin-bottom: 8px; min-height: 32px; padding: 4px 8px; font-size: 12px; }
  .calls-missed { order: 5; }
  .calls-targets { order: 6; background: var(--surface); border-radius: 16px; }
  .calls-targets > .calls-target { gap: 10px; padding: 12px; }
  .calls-targets > .calls-target:first-child { border-top: 0; border-radius: 16px 16px 0 0; }
  .calls-targets > .calls-target:last-child { border-radius: 0 0 16px 16px; }
  .calls-avatar { width: 44px; height: 44px; flex-basis: 44px; font-size: 22px; }
  .calls-target-text b { font-size: 14px; }
  .calls-target-text > span { font-size: 12px; }
  .calls-row-menu summary { width: 24px; }
  .calls-directory-count { order: 8; text-align: center; border: 0; margin: 0; padding: 14px; }
  .calls-status { order: 7; }
  .calls-picker, .calls-share { inset: auto 0 0; margin: 0; width: 100%; height: min(780px, 94dvh); max-height: 94dvh; border-radius: 22px 22px 0 0; border: 0; }
  .calls-dialog-head { padding: max(14px, env(safe-area-inset-top)) 18px 8px; }
  .calls-dialog-head h2 { font-size: 23px; }
  .calls-picker-copy { padding: 0 18px 14px; font-size: 14px; }
  .calls-picker-body { padding: 4px 18px 16px; }
  .calls-picker-footer { padding: 13px 18px max(18px, env(safe-area-inset-bottom)); }
  .calls-share .call-invite-card { margin: 10px 18px; }
}
:root[data-theme="light"] .calls-choice input { color-scheme: light; }
:root[data-theme="dark"] .calls-choice input { color-scheme: dark; }
.calls-links { margin: 28px 0; }
.calls-links[hidden] { display: none; }
.calls-links h2 { margin: 0 0 14px; font-size: 20px; }
.calls-saved-link { display: flex; align-items: center; gap: 18px; margin: 10px 0; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); }
.calls-saved-link .calls-target-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.calls-link-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.calls-link-tabs { display: flex; flex-shrink: 0; gap: 8px; padding: 0 26px 18px; border-bottom: 1px solid var(--border); }
.calls-link-tabs[hidden] { display: none; }
.calls-link-tabs .calls-button { flex: 1; }
.calls-link-tabs [aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.calls-link-tabs .calls-button[aria-selected="true"]:hover:not(:disabled) { background: var(--accent-hover); color: var(--accent-text); border-color: var(--accent-hover); }
.calls-link-tabs .calls-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.calls-link-body { min-height: 0; overflow-y: auto; padding: 18px 26px 26px; }
.calls-link-body [role="tabpanel"][hidden] { display: none; }
.calls-share .calls-links { margin: 0; }
.calls-share .calls-saved-link { flex-direction: column; align-items: stretch; }
.calls-share .calls-link-actions .calls-button { flex: 1; padding: 10px; }
.calls-share .calls-link-body .call-invite-card { margin: 0; }
@media (max-width: 700px) {
  .calls-link-tabs { padding: 0 18px 14px; }
  .calls-link-body { padding: 16px 18px; }
  .calls-saved-link { align-items: stretch; flex-direction: column; gap: 14px; }
  .calls-link-actions .calls-button { flex: 1; padding: 10px; }
}

.calls-invite-overlay { backdrop-filter: blur(3px); }
.calls-invite-dialog { border: 1px solid var(--border); background: var(--surface); border-radius: 20px; }
.calls-invite-dialog .comm-name-input { min-height: 48px; font-size: 16px; }
.calls-invite-dialog .comm-invite-link { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .calls-invite-overlay { align-items: flex-end; }
  .calls-invite-dialog { width: 100%; max-width: 100%; max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .calls-invite-dialog .modal-foot { padding-bottom: max(18px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .calls-invite-dialog .modal-foot .btn { min-height: 44px; }
}

/* Chat: ruhige Flächen und kompakte Werkzeuge; Designfarben bleiben variabel. */
.ms-shell .ms-chat-head {
  margin: 0; padding: 14px 20px; border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; background: var(--surface); box-shadow: none; backdrop-filter: none;
}
.ms-shell .ms-chat-head .ms-avatar { box-shadow: none; }
.ms-shell .ms-chat-head .ms-chat-ident b { font-size: 17px; }
.ms-shell .ms-chat-head .ms-chat-ident small { font-size: 12px; }
.ms-shell .ms-chat-head .ms-round { background: transparent; border-color: transparent; color: var(--accent); }
.ms-shell .ms-chat-head .ms-round:hover:not(:disabled) { background: var(--accent-soft); }
.ms-shell .ms-messages { padding: 24px clamp(16px, 3vw, 48px); }
.ms-shell .ms-message-row { align-items: flex-start; gap: 12px; margin: 0; padding: 7px 0 14px; }
.ms-shell .ms-message-avatar { width: 36px; height: 36px; flex: 0 0 36px; margin-top: 2px; font-size: 12px; }
.ms-shell.ms-theme .ms-bubble.mine,
.ms-shell.ms-theme .ms-bubble.theirs { padding: 13px 16px 9px; border-radius: 16px; box-shadow: none; backdrop-filter: none; }
.ms-shell.ms-theme .ms-bubble .ms-text,
.ms-shell.ms-theme .ms-bubble .ms-markdown { font-size: 15px; line-height: 1.6; }
.ms-shell.ms-theme .ms-bubble .ms-sender { margin-bottom: 7px; color: inherit; opacity: .8; font-size: 12px; font-weight: 600; }
.ms-shell .ms-ai-label { background: transparent; color: inherit; border: 1px solid currentColor; font-size: 8px; opacity: .7; }
.ms-shell.ms-theme .ms-bubble .ms-message-meta { margin-top: 7px; font-size: 10.5px; opacity: .7; }
.ms-shell.ms-theme .ms-bubble.mine .ms-message-meta .read { color: #6ec1ff; opacity: 1; text-shadow: none; }
.ms-shell .ms-day { margin: 12px auto 22px; padding: 5px 18px; background: transparent; border-color: var(--border); backdrop-filter: none; }
.ms-contact-section { border-top: 1px solid var(--border); }
.ms-contact-section > summary { display: flex; align-items: center; gap: 12px; padding: 18px; color: var(--text); font-size: 13px; font-weight: 650; list-style: none; cursor: pointer; }
.ms-contact-section > summary::-webkit-details-marker { display: none; }
.ms-contact-section > summary::before { content: "›"; font-size: 22px; line-height: 1; color: var(--accent); transition: transform .15s; }
.ms-contact-section[open] > summary::before { transform: rotate(90deg); }
.ms-contact-section > summary:hover { background: var(--surface-2); }
.ms-contact-section > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.ms-shell .ms-composer { margin: 4px 16px calc(14px + var(--app-chat-bottom-inset, env(safe-area-inset-bottom))); }
.ms-shell .ms-input-pill { padding: 8px 10px; border-radius: 20px; background: var(--surface); border-color: var(--border); box-shadow: 0 2px 8px #39271905; backdrop-filter: none; }
.ms-shell .ms-input-pill:focus-within { border-color: var(--accent); }
.ms-shell .ms-send { width: 42px; height: 42px; background: var(--accent); color: var(--accent-text); box-shadow: none; }
.ms-shell .ms-send:hover:not(:disabled) { background: var(--accent-hover); }
.ms-shell .ms-input-pill textarea, .ms-shell .ms-input-pill textarea:focus { padding: 10px 8px; }
@media (min-width: 721px) {
  .ms-shell .ms-input-pill:not(.dictating) { display: grid; grid-template-columns: 40px minmax(0, 1fr) repeat(3, 38px) 42px; align-items: end; gap: 4px; }
  .ms-shell .ms-input-pill:not(.dictating) .ms-input-tools,
  .ms-shell .ms-input-pill:not(.dictating) .ms-tools-right { display: contents; }
  .ms-shell .ms-input-pill:not(.dictating) textarea { grid-column: 2; grid-row: 1; }
  .ms-shell .ms-input-pill:not(.dictating) .ms-attach { grid-column: 1; grid-row: 1; }
  .ms-shell .ms-input-pill:not(.dictating) .ms-pill-btn,
  .ms-shell .ms-input-pill:not(.dictating) .ms-send { grid-row: 1; }
}
@media (max-width: 720px) {
  .ms-shell .ms-chat-head { margin: 0; padding: 10px 12px; border-radius: 0; }
  .ms-shell .ms-messages { padding: 12px 10px; }
  .ms-shell .ms-message-row { gap: 7px; }
  .ms-shell .ms-message-avatar { width: 27px; height: 27px; flex-basis: 27px; font-size: 10px; }
  .ms-shell .ms-message-row.theirs .ms-swipe-track { max-width: calc(100% - 34px); }
  .ms-shell.ms-theme .ms-bubble.mine, .ms-shell.ms-theme .ms-bubble.theirs { padding: 10px 12px 7px; }
  .ms-shell .ms-composer { margin: 2px 8px calc(8px + var(--app-chat-bottom-inset, env(safe-area-inset-bottom))); }
}

/* Teams overview: member information and direct communication, without editing. */
.org-member-info-card { align-items: flex-start; }
.org-member-info-card .org-kind { position: absolute; left: 62px; bottom: 14px; }
.org-quick-actions { position: absolute; right: 9px; bottom: 9px; z-index: 3; display: flex; gap: 5px; }
.org-quick-actions .btn { display: grid; place-items: center; width: 30px; height: 30px; min-height: 30px; padding: 0; color: var(--accent); background: var(--surface); border-color: var(--border); border-radius: 8px; }
.org-quick-actions .btn:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.org-quick-actions .agent-channel-icon { width: 17px; height: 17px; }
.org-info-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 22px; }
.org-info-actions .btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; flex: 1; color: var(--accent); }
.org-info-actions .agent-channel-icon { width: 19px; height: 19px; }
.org-info-details { display: grid; gap: 20px; margin: 18px 0 0; }
.org-info-details > div { display: grid; gap: 7px; }
.org-info-details dt { color: var(--text-dim); font-size: 12px; font-weight: 600; }
.org-info-details dd { margin: 0; color: var(--text); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }

.app-tab > span { display: grid; place-items: center; width: 36px; height: 25px; }
.app-tab > span .agent-channel-icon { width: 22px; height: 22px; }
.app-tab .inbox-unread-badge { background: var(--accent); color: var(--accent-text); }
.calls-missed { margin: 28px 0; }
.calls-missed[hidden] { display: none; }
.calls-missed h2 { margin: 0 0 14px; font-size: 20px; }
.calls-missed .calls-target { margin-bottom: 10px; }
.calls-missed-new { border-color: var(--accent); }
.calls-dir { display: inline-block; font-weight: 700; font-size: 1.1em; line-height: 1; color: var(--accent); }
.calls-dir-bad { color: #d64545; }
.calls-name-bad { color: #d64545; }
.calls-meta { display: flex; align-items: center; gap: 6px; color: var(--muted, #8a8178); font-size: 15px; }
.calls-time { flex: 0 0 auto; color: var(--muted, #8a8178); font-size: 15px; font-variant-numeric: tabular-nums; margin-left: auto; padding-right: 4px; }
.calls-missed .calls-call { border-radius: 50%; color: var(--accent); background: var(--accent-soft); }
.calls-missed .calls-target { align-items: center; }
@media (max-width: 480px) {
  .calls-missed .calls-target { flex-wrap: wrap; }
  .calls-missed .calls-call { margin-left: auto; }
}

/* Existing status, above avatar tiles and directly below the product name. */
.cc-brand-status { display: none; }
body.call-status-in-header .cc-head { display: flex !important; }
body.call-status-in-header .cc-brand-status {
  display: block; margin-top: 3px; color: #32d574; font-size: 13px;
  font-weight: 600; line-height: 1.35; white-space: normal;
}
body.call-status-in-header .cc-brand-status:not([data-state="ok"]) { color: var(--text-dim); }
body.call-status-in-header #statusText { display: none !important; }
/* Name/Status stehen in der Kopfzeile unter „Agent Studio“; die Mitte gehört den Kacheln. */
body.call-status-in-header #peerName, body.call-conference #peerName { display: none !important; }
/* Solange die Agent-Kacheln den Bereich füllen, darf der Warte-Hinweis („● Verbunden“)
   und der Name der Bühne nicht dahinter durchscheinen — der Status steht in der Kopfzeile. */
body:has(#agentCanvasHost:not([hidden])) #peerName,
body:has(#agentCanvasHost:not([hidden])) #remoteTile.call-tile-waiting { display: none !important; }
body.call-conference .call-agent-canvas-host { top: calc(80px + var(--call-safe-top)); }
.call-pending-invites {
  position: fixed; z-index: 25; top: calc(90px + env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px)); width: min(38vw, 240px);
  max-height: 45vh; display: grid; grid-auto-rows: 125px; gap: 8px; overflow-y: auto;
}
.call-pending-invites .call-tile { position: relative; inset: auto; width: 100%; height: 125px; border-radius: 14px; }

/* Eigener Container je Route (app.js route()): Layout bleibt wie direkte Kinder von #content. */
.route-view { display: contents; }

/* Model names retain the panel width when their controls need a second row. */
.ai-providers-page .ai-assignment-panel { container-type: inline-size; }
@container (max-width: 480px) {
  .ai-providers-page .llm-tree-row.is-model { flex-wrap: wrap; gap: 8px; }
  .ai-providers-page .llm-tree-row.is-model > .llm-tree-label { order: -1; flex: 0 0 100%; box-sizing: border-box; }
  .ai-providers-page .llm-tree-row.is-model > .llm-tree-count { margin-left: auto; }
  .ai-providers-page .llm-tree-children { padding-left: 8px; }
  .ai-providers-page .ai-assignment-heading { flex-wrap: wrap; }
}

/* Knowledge assignment workspace, matching Skills and AI Providers. */
.knowledge-page .ai-assignment-panel { container-type: inline-size; }
@container (max-width: 480px) {
  .knowledge-page .kb-row { flex-wrap: wrap; gap: 8px; }
  .knowledge-page .kb-row > .llm-tree-label { order: -1; flex: 0 0 100%; box-sizing: border-box; }
  .knowledge-page .kb-row > .llm-tree-label > span { overflow-wrap: break-word; }
  .knowledge-page .kb-row > .llm-tree-count { margin-left: auto; }
  .knowledge-page .ai-assignment-heading { flex-wrap: wrap; }
  .knowledge-page .ai-assignment-heading h2 { flex-basis: 100%; }
}

.knowledge-page .knowledge-tiles, .knowledge-page .knowledge-agent-drops { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.knowledge-upload-zone { display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 12px; border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--text-dim); font-size: 14px; }
.knowledge-upload-zone > svg { width: 26px; height: 26px; flex: none; color: var(--accent); }
.knowledge-upload-zone small { display: block; margin-top: 5px; font-size: 12px; }
.knowledge-upload-zone.drop-hover { border-color: var(--accent); background: var(--accent-soft); }
.knowledge-page .knowledge-tile { border: 1px solid var(--border); padding: 14px; border-radius: 10px; background: var(--surface); }
.knowledge-page .knowledge-tile:hover { box-shadow: none; transform: none; background: color-mix(in srgb, var(--surface), black 5%); }
.knowledge-row-head { display: flex; align-items: flex-start; gap: 12px; }
.knowledge-row-copy { flex: 1; min-width: 0; }
.knowledge-row-copy > b { font-size: 15px; overflow-wrap: anywhere; }
.knowledge-page .knowledge-definition { min-height: 0; margin: 6px 0; font-size: 12px; overflow-wrap: anywhere; }
.knowledge-row-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 7px; color: var(--text-dim); font-size: 11px; }
.knowledge-row-head > .badge { flex: none; }
.knowledge-page .knowledge-status-line { justify-content: space-between; flex-wrap: wrap; margin: 14px 0 0; font-size: 12px; }
.knowledge-state { display: inline-flex; align-items: center; gap: 7px; color: var(--text-dim); }
.knowledge-state i { width: 8px; height: 8px; flex: none; background: currentColor; border-radius: 50%; }
.knowledge-state.status-success { color: var(--ok); }
.knowledge-state.status-failed { color: var(--err); }
.knowledge-state.status-running, .knowledge-state.status-queued { color: var(--accent); }
.knowledge-page .knowledge-agent-drop { display: flex; flex-direction: row; align-items: flex-start; min-height: 0; min-width: 0; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.knowledge-page .knowledge-agent-drop.drop-hover { border-color: var(--accent); background: var(--accent-soft); }
.knowledge-agent-content { flex: 1; min-width: 0; }
.knowledge-page .agent-drop-head b { color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.knowledge-page .knowledge-assignment-list { min-height: 0; margin: 12px 0; }
.knowledge-page .knowledge-assignment { padding: 5px 6px 5px 10px; font-size: 12px; box-sizing: border-box; }
.knowledge-page .agent-drop-hint { display: flex; align-items: center; gap: 8px; padding: 10px; margin-top: 12px; border: 1px dashed var(--border-strong); border-radius: 8px; font-size: 12px; color: var(--text-dim); }
.knowledge-page .agent-drop-hint svg { width: 18px; height: 18px; flex: none; }
@media (max-width: 560px) {
  .knowledge-row-head { flex-wrap: wrap; gap: 8px; }
  .knowledge-row-copy { flex-basis: calc(100% - 80px); }
  .knowledge-row-head > .badge { margin-left: 24px; }
  .knowledge-page .knowledge-agent-drop { padding: 10px; gap: 9px; }
}

.knowledge-page .kb-progress { width: 100%; margin-top: 10px; height: 12px; line-height: 12px; font-size: 9px; background: var(--accent-soft); color: var(--text); }
.knowledge-page .kb-progress-fill { background: color-mix(in srgb, var(--accent) 60%, var(--accent-soft)); }

/* Laufender Anruf: Kapsel oben in der App (app.js renderActiveCallBar) — Stil der iOS-Anrufanzeige */
.active-call-bar { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 6px); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: min(92vw, 420px); min-height: 38px; padding: 6px 16px 6px 12px; border: 0; border-radius: 999px; background: #000; color: #fff; font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.45); }
.active-call-phone { flex: none; display: inline-flex; }
.active-call-time { flex: none; color: #34c759; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.active-call-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d9d9de; font-weight: 550; }
.active-call-wave { flex: none; display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.active-call-wave i { display: block; width: 2.5px; height: 4px; border-radius: 2px; background: #34c759; animation: active-call-wave 1s ease-in-out infinite; }
@keyframes active-call-wave { 0%, 100% { height: 4px; } 50% { height: 13px; } }
@media (max-width: 820px) {
  body:has(.active-call-bar) .app, body:has(.active-call-bar) #app { padding-top: calc(52px + env(safe-area-inset-top, 0px)); }
}
.skill-details-tabs { display: flex; gap: 12px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.skill-details-tabs > button { padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--text-dim); font: inherit; cursor: pointer; }
.skill-details-tabs > button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.skill-details-tabs > button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.skill-details [role="tabpanel"][hidden] { display: none; }
.skill-details [role="tabpanel"] > h4 { margin: 22px 0 10px; }
.skill-details .skill-instructions { margin-top: 0; }
.skill-version-import { align-items: center; text-align: center; }
.skill-version-import > svg { width: 30px; height: 30px; color: var(--accent); }
.skill-version-import .form-actions { flex-wrap: wrap; justify-content: center; }

.modal:has(.skill-details) .modal-foot > .danger { margin-right: auto; }

.skills-page .skill-tile-delete { flex: none; width: 27px; height: 27px; padding: 5px; }
.skill-tile-delete svg { width: 17px; height: 17px; }
.skill-tile-update { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; padding: 7px 9px; border: 1px dashed var(--border-strong); border-radius: 6px; background: transparent; color: var(--text-dim); font: inherit; font-size: 11px; cursor: pointer; }
.skill-tile-update svg { width: 16px; height: 16px; flex: none; }
.skill-tile-update:hover, .skill-tile-update.drop-hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.knowledge-page .knowledge-tile { cursor: pointer; }
.knowledge-page .knowledge-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.knowledge-page .knowledge-tile-delete { flex: none; width: 27px; height: 27px; padding: 5px; }
.knowledge-tile-delete svg { width: 17px; height: 17px; }
@media (max-width: 560px) { .knowledge-page .knowledge-tile-delete { margin-left: auto; } }

.knowledge-header-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.knowledge-header-actions .btn { white-space: nowrap; }
.knowledge-embedding-summary { margin: 10px 0 0 30px; font-size: 11px; color: var(--text-dim); overflow-wrap: anywhere; }
.knowledge-embedding-change { margin: 8px 0 0; font-size: 12px; color: var(--accent); }
.embedding-connection-info { overflow-wrap: anywhere; }
.modal:has(.embedding-setup) { width: 720px; }

/* Keep management controls visible while the desktop agent rows scroll. */
@media (min-width: 901px) and (min-height: 600px) {
  #app:has(.agent-management-page) { height: var(--app-viewport-height); }
  .main:has(.agent-management-page) { min-height: 0; }
  .content:has(.agent-management-page) { flex: 1; min-height: 0; overflow: hidden; padding-bottom: 24px; }
  .route-view.agent-management-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
  .agent-management-page > .cards, .agent-management-page > .toolbar { flex: none; }
  .agent-management-page > .agents-panel { flex: 1; min-height: 0; overflow: auto; }
  .agent-management-page > .agents-graph-panel { flex: 1; min-height: 0; overflow: auto; }
  .agent-management-page .agents-table { border-collapse: separate; border-spacing: 0; }
  .agent-management-page .agents-table th { position: sticky; top: 0; z-index: 3; background: var(--surface); box-shadow: inset 0 -1px var(--border); }
}
@media (max-width: 720px) {
  .agent-management-page .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .agent-management-page .stat { padding: 10px; gap: 8px; }
  .agent-management-page .stat .icon { width: 24px; height: 24px; flex-basis: 24px; border-radius: 7px; font-size: 14px; }
  .agent-management-page .stat .label { font-size: 11px; }
  .agent-management-page .stat .value { font-size: 20px; }
  .agent-management-page .stat .sub { display: none; }
}

/* Calendar month, participation and moving appointments. */
.calendar-month { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); min-width:620px; }
.calendar-month-heading { position:sticky; top:0; z-index:2; padding:10px; text-align:center; font-weight:600; background:var(--surface); border-bottom:1px solid var(--border); }
.calendar-month-day { min-height:125px; padding:5px; border-right:1px solid var(--border); border-bottom:1px solid var(--border); min-width:0; }
.calendar-month-day.outside { background:var(--bg); color:var(--muted); }
.calendar-month-day.today { box-shadow:inset 0 3px var(--accent); }
.calendar-month-date { border:0; background:transparent; color:inherit; font:inherit; font-weight:600; padding:3px 6px; cursor:pointer; }
.calendar-month-event { display:flex; align-items:center; gap:2px; margin:4px 0; border-radius:5px; background:var(--bg); border-left:3px solid var(--accent); }
.calendar-month-event.cancelled { opacity:.65; text-decoration:line-through; }
.calendar-month-open { flex:1; min-width:0; padding:5px; border:0; background:transparent; color:inherit; text-align:left; font:inherit; font-size:11px; overflow-wrap:anywhere; cursor:pointer; }
.calendar-move-handle { flex-shrink:0; border:0; border-radius:4px; background:var(--surface); color:var(--muted); padding:3px 7px; cursor:grab; touch-action:none; font-size:16px; }
.calendar-entry > .calendar-move-handle { position:absolute; right:2px; bottom:2px; z-index:2; }
.calendar-drag-label { position:fixed; z-index:10000; pointer-events:none; padding:8px 12px; max-width:220px; background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:7px; box-shadow:var(--shadow); }
.calendar-event-extras { display:flex; flex-wrap:wrap; gap:8px; margin:14px 0; }
.calendar-overlap-remove { align-self: center; flex: 0 0 auto; margin-right: 4px; }
.calendar-event-extras > p,.calendar-responses { width:100%; margin:0; }
.calendar-responses { padding:0; list-style:none; font-size:12px; line-height:1.8; }
.calendar-responses li { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:baseline; gap:10px; padding:4px 0; }
.calendar-response-name { overflow-wrap:anywhere; }
.calendar-my-response { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.calendar-response { display:inline-block; flex-shrink:0; padding:2px 8px; border-radius:999px; font-size:12px; font-weight:600; line-height:1.5; color:var(--muted); background:color-mix(in srgb,var(--muted) 10%,var(--surface)); }
.calendar-response.response-accepted { color:#216b36; background:#e5f4e9; }
.calendar-response.response-declined { color:#ac302a; background:#fcebe9; }
.calendar-response.response-tentative { color:#805c09; background:#fff4ce; }
:root[data-theme="dark"] .calendar-response.response-accepted { color:#99dfab; background:#203c29; }
:root[data-theme="dark"] .calendar-response.response-declined { color:#ffb1a9; background:#492725; }
:root[data-theme="dark"] .calendar-response.response-tentative { color:#f4d679; background:#40351e; }
.calendar-frequent-hint { margin:6px 0 12px; }
@media (max-width:600px) {
  .calendar-month { min-width:510px; }
  .calendar-month-day { min-height:105px; padding:3px; }
}
.calendar-entry.cancelled,.calendar-agenda-item.cancelled { opacity:.65; }

.calendar-entry.cancelled strong,.calendar-agenda-item.cancelled strong { text-decoration:line-through; }
.calendar-page [hidden],.calendar-event-dialog [hidden] { display:none !important; }
.calendar-month { min-height:100%; }
@media (min-width:900px) {
  .calendar-month-day { min-height:72px; }
}

/* Shared calendar categories, including month cards and source buttons. */
:is(.calendar-page,.calendar-info-dialog,.calendar-overlap-dialog) { --calendar-appointment-tone:#246fb8; --calendar-task-tone:#8051b5; }
:root[data-theme="dark"] :is(.calendar-page,.calendar-info-dialog,.calendar-overlap-dialog) { --calendar-appointment-tone:#79b9f7; --calendar-task-tone:#c4a0f0; }
.calendar-month-event { --calendar-month-tone:var(--calendar-appointment-tone); border-left:4px solid var(--calendar-month-tone); background:color-mix(in srgb,var(--calendar-month-tone) 15%,var(--surface)); color:var(--text); }
.calendar-month-event.task { --calendar-month-tone:var(--calendar-task-tone); }
.calendar-month-event:hover { background:color-mix(in srgb,var(--calendar-month-tone) 23%,var(--surface)); }
.calendar-month-open { display:flex; align-items:flex-start; gap:5px; }
.calendar-month-open > span:last-child { min-width:0; }
.calendar-month-open .calendar-entry-glyph { flex:0 0 14px; width:14px; height:14px; margin-top:1px; color:var(--calendar-month-tone); }
.calendar-month-open .calendar-entry-glyph svg { width:14px; height:14px; }
.calendar-source-events { --calendar-source-tone:var(--calendar-appointment-tone); }
.calendar-source-tasks { --calendar-source-tone:var(--calendar-task-tone); }
.calendar-source:is(.calendar-source-events,.calendar-source-tasks) { background:color-mix(in srgb,var(--calendar-source-tone) 10%,var(--surface)); color:var(--calendar-source-tone); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--calendar-source-tone) 45%,transparent); }
.calendar-source:is(.calendar-source-events,.calendar-source-tasks).active { background:var(--calendar-source-tone); color:var(--surface); box-shadow:none; }
.calendar-source:is(.calendar-source-events,.calendar-source-tasks):hover { background:color-mix(in srgb,var(--calendar-source-tone) 20%,var(--surface)); }
.calendar-source:is(.calendar-source-events,.calendar-source-tasks).active:hover { background:color-mix(in srgb,var(--calendar-source-tone) 90%,var(--text)); }

.calendar-entry-glyph.calendar-task-state { color:var(--calendar-task-tone); }
.calendar-entry-glyph.calendar-task-state.status-completed { color:var(--calendar-success); }
.calendar-entry-glyph.calendar-task-state:is(.status-failed,.status-missed) { color:var(--calendar-error); }
.calendar-entry-glyph.calendar-task-state.status-running { color:var(--calendar-running); }
.calendar-entry-glyph.calendar-task-state:is(.status-paused,.status-cancelled) { color:var(--calendar-inactive); }
.calendar-kind.event { color:var(--calendar-appointment-tone); background:color-mix(in srgb,var(--calendar-appointment-tone) 15%,var(--surface)); }
.calendar-kind.task { color:var(--calendar-task-tone); background:color-mix(in srgb,var(--calendar-task-tone) 15%,var(--surface)); }
/* A declined RSVP stays visible with a distinct personal cancellation state. */
:is(.calendar-page,.calendar-info-dialog,.calendar-overlap-dialog) { --calendar-declined-tone:#ac302a; }
:root[data-theme="dark"] :is(.calendar-page,.calendar-info-dialog,.calendar-overlap-dialog) { --calendar-declined-tone:#ffb1a9; }
.calendar-entry.declined,.calendar-agenda-item.declined { --calendar-tone:var(--calendar-declined-tone); color:var(--calendar-tone); border-color:var(--calendar-tone); border-style:dashed; background:color-mix(in srgb,var(--calendar-tone) 10%,var(--surface)); }
.calendar-month-event.declined { --calendar-month-tone:var(--calendar-declined-tone); color:var(--calendar-month-tone); border-left-style:dashed; }
.calendar-kind.event.declined { color:var(--calendar-declined-tone); background:color-mix(in srgb,var(--calendar-declined-tone) 12%,var(--surface)); }
.calendar-entry-response { display:block; font-size:11px; font-weight:700; line-height:1.3; white-space:nowrap; margin-bottom:2px; }
.calendar-entry.declined strong { text-decoration:line-through; }
.calendar-entry.declined:focus-within { outline-color:var(--calendar-tone); }
.calendar-kind.task::before { content:"Task · "; white-space:pre; }
.calendar-kind.task.status-completed { color:var(--calendar-success); background:color-mix(in srgb,var(--calendar-success) 13%,var(--surface)); }
.calendar-kind.task:is(.status-failed,.status-missed) { color:var(--calendar-error); background:color-mix(in srgb,var(--calendar-error) 13%,var(--surface)); }
.calendar-kind.task.status-running { color:var(--calendar-running); background:color-mix(in srgb,var(--calendar-running) 13%,var(--surface)); }
.calendar-kind.task:is(.status-paused,.status-cancelled) { color:var(--calendar-inactive); background:color-mix(in srgb,var(--calendar-inactive) 13%,var(--surface)); }

/* Anrufliste: pro Person gebündelt, Historie aufklappbar */
.calls-recent-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.calls-filter-chip { padding: 6px 14px; border-radius: 999px; font-size: 14px; }
.calls-filter-chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.calls-group { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.calls-group .calls-group-head { border: 0; margin: 0; background: transparent; }
.calls-group-status, .calls-group-prev { display: block; font-size: 14px; }
.calls-group-prev { color: var(--muted, #8a8178); font-size: 13px; }
.calls-group-toggle { flex: 0 0 auto; background: transparent; border-color: transparent; }
.calls-group-history { border-top: 1px solid var(--border); padding: 10px 14px 12px; }
.calls-group-history-title { margin: 0 0 6px; color: var(--muted, #8a8178); font-size: 14px; }
.calls-history-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.calls-history-kind { font-weight: 500; }
.calls-kind-icon { display: inline-flex; flex: 0 0 auto; width: 20px; height: 20px; }
.calls-kind-icon svg { width: 100%; height: 100%; }
.calls-kind-missed { color: #d64545; }
.calls-kind-in { color: #2fa866; }
.calls-kind-out { color: var(--accent); }
.calls-group-statusline { display: flex; align-items: center; gap: 6px; }
.calls-group-prev .calls-kind-icon { width: 16px; height: 16px; }
.calls-prev-ok { color: #2fa866; }

/* A–Z-Streifen für Kontakte und Agenten */
.calls-letter { padding: 14px 6px 4px; color: var(--muted, #8a8178); font-size: 14px; font-weight: 600; scroll-margin-top: 12px; }
.calls-targets:has(.calls-letter) { padding-right: 34px; }
.calls-index { position: fixed; right: 8px; bottom: 14px; z-index: 20; display: flex; flex-direction: column; align-items: center; padding: 6px 3px; border-radius: 14px; background: color-mix(in srgb, var(--surface, #fff) 92%, transparent); box-shadow: 0 0 0 1px var(--border); touch-action: none; user-select: none; }
.calls-index[hidden] { display: none; }
.calls-index-letter { border: 0; background: transparent; padding: 0; width: 26px; line-height: 1; font-size: 14px; height: min(24px, calc((100vh - 140px) / 27)); color: var(--muted, #8a8178); opacity: .5; cursor: default; }
.calls-index-letter.has-entries { color: var(--accent); opacity: 1; font-weight: 700; cursor: pointer; }

/* Anrufkarte nach Vorlage: Name+Zähler | Status-Zeilen | Rückruf | Aufklappen */
.calls-filter-chip { display: inline-flex; align-items: center; gap: 8px; }
.calls-filter-chip .calls-kind-icon { width: 22px; height: 22px; }
.calls-filter-count { min-width: 24px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft, #efe5d9); font-size: 13px; text-align: center; }
.calls-filter-chip[aria-pressed="true"] .calls-filter-count { background: rgba(255,255,255,.25); }
.calls-kind-out { color: #2f6fd0; }
.calls-group-nameline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.calls-group-count { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft, #efe5d9); font-size: 13px; font-weight: 500; }
.calls-group-sub { display: block; color: var(--muted, #8a8178); font-size: 14px; }
.calls-group-lines { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding-left: 18px; border-left: 1px solid var(--border); }
.calls-group-line { display: flex; align-items: center; gap: 10px; }
.calls-group-line .calls-kind-icon { width: 24px; height: 24px; }
.calls-group-label { flex: 1 1 auto; min-width: 0; }
.calls-group-line .calls-time { margin-left: 0; padding: 0; font-size: 14px; white-space: nowrap; }
.calls-group-head .calls-call { border-radius: 50%; background: var(--accent-soft, #efe5d9); width: 52px; height: 52px; padding: 0; justify-content: center; }
.calls-group-toggle { padding-left: 14px; border-left: 1px solid var(--border); border-radius: 0; }
.calls-group:has(.calls-group-nameline .calls-name-bad) { background: color-mix(in srgb, #d64545 6%, var(--surface, #fff)); }
@media (max-width: 760px) { .calls-group-head { flex-wrap: wrap; } .calls-group-lines { order: 5; flex-basis: 100%; border-left: 0; padding-left: 0; } }

.calls-recent-filters { align-items: center; }
.calls-cleanup { margin-left: auto; position: relative; }
.calls-cleanup .calls-row-commands { right: 0; left: auto; min-width: 260px; z-index: 30; }
.calls-history-delete { margin-left: 4px; padding: 4px 8px; background: transparent; border-color: transparent; }
.calls-history-row .calls-time { margin-left: auto; }
.calls-cleanup summary { width: auto; height: 40px; padding: 0 14px; font-size: 14px; font-weight: 600; border: 1px solid var(--border); border-radius: 999px; }

/* Voice Diagnostics: Phasen-Balken wie im Entwurf */
.voice-diag-metrics { text-align: center; }
.voice-diag-metric { align-items: center; }
.voice-diag-metric b { font-size: 26px; }
.voice-diag-metric span { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.voice-diag-heading { color: var(--muted); margin: 4px 0 10px; font-size: 14px; }
.voice-diag-timeline { --diag-label: 162px; position: relative; padding: 18px 0 34px; gap: 14px; }
.voice-diag-row { grid-template-columns: var(--diag-label) minmax(0, 1fr); }
.voice-diag-label { font-size: 17px; font-weight: 500; }
.voice-diag-track { height: 30px; border-radius: 10px; }
.voice-diag-bar { position: absolute; top: 0; bottom: 0; border-radius: 10px; opacity: .9; }
.voice-diag-bar.audio, .voice-diag-dot.audio { background: #3f9487; }
.voice-diag-bar.stt, .voice-diag-dot.stt { background: #4c7ff0; }
.voice-diag-bar.llm, .voice-diag-dot.llm { background: #8b5cf6; }
.voice-diag-dot.cut { background: #d64545; }
.voice-diag-bargein { position: absolute; top: 0; bottom: 20px; width: 0; border-left: 3px dashed #d64545; z-index: 2; }
.voice-diag-bargein span { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); color: #d64545; font-weight: 600; white-space: nowrap; }
.voice-diag-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); }
.voice-diag-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.voice-diag-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
@media(max-width:720px) { .voice-diag-timeline { --diag-label: 88px; } .voice-diag-label { font-size: 14px; } }
.voice-diag-row { gap: 0; } .voice-diag-label { padding-right: 12px; box-sizing: border-box; }

/* Voice Diagnostics: Gesprächsprotokoll */
.voice-protocol { padding: 20px; margin: 12px 0; }
.voice-protocol-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.voice-protocol-head h3 { margin: 0; font-size: 20px; }
.voice-protocol-badge { padding: 4px 12px; border-radius: 999px; background: var(--surface-2, rgba(127,127,127,.15)); font-size: 13px; }
.voice-protocol-sub { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; padding: 8px 0 14px; border-bottom: 1px solid var(--border, rgba(127,127,127,.2)); font-variant-numeric: tabular-nums; }
.voice-protocol-entry { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; align-items: start; }
.voice-protocol-entry time { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.voice-protocol-icon { font-size: 18px; text-align: center; }
.voice-protocol-entry.user .voice-protocol-icon { color: #4c7ff0; }
.voice-protocol-entry.mic .voice-protocol-icon { color: var(--muted); }
.voice-protocol-entry.abort .voice-protocol-icon { color: #e8833a; }
.voice-protocol-body b { font-size: 17px; }
.voice-protocol-body p { margin: 4px 0 0; }
.voice-protocol-text { font-size: 17px; }
.voice-protocol-detail { color: var(--muted); font-size: 14px; }
.voice-protocol-resolution { color: #2fa866; }
.voice-protocol-resolution i { font-style: normal; font-weight: 700; }
@media(max-width:720px) { .voice-protocol-entry { grid-template-columns: 24px minmax(0, 1fr); } .voice-protocol-entry time { grid-column: 2; } }

/* Voice Diagnostics: Ansichtswahl + Tabelle */
.voice-diag-views { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2, rgba(127,127,127,.15)); }
.voice-diag-view { border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; font: inherit; color: var(--muted); cursor: pointer; }
.voice-diag-view.is-active { background: var(--accent, #7a4b2a); color: #fff; }
@media(max-width:720px) { .voice-diag-views { align-self: flex-start; } }
.voice-diag-views { margin: 4px 0 8px; }

/* Balken-Ansicht als eine Karte wie im Entwurf */
.voice-diag-card { padding: 22px; margin: 12px 0; }
.voice-diag-card .voice-protocol-head h3 { font-size: 22px; }
.voice-diag-status { padding: 4px 12px; border-radius: 999px; background: var(--surface-2, rgba(127,127,127,.15)); font-size: 13px; }
.voice-diag-status.live { color: #2fa866; }
.voice-diag-turn-select { margin: 12px 0 6px; max-width: 100%; }
.voice-diag-card .voice-diag-metrics { margin-top: 18px; }
.voice-diag-card .voice-diag-bargein span { font-size: 20px; bottom: -30px; }
.voice-diag-card .voice-diag-timeline { padding-bottom: 44px; }
.voice-diag-card .voice-diag-label { font-size: 22px; }

/* Zeitachse unter den Balken */
.voice-diag-axis { position: relative; height: 22px; border-top: 1px solid var(--border, rgba(127,127,127,.3)); }
.voice-diag-tick { position: absolute; top: 4px; transform: translateX(-50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.voice-diag-tick:first-child { transform: none; }
.voice-diag-tick:last-child { transform: translateX(-100%); }
.voice-diag-tick::before { content: ""; position: absolute; top: -5px; left: 50%; height: 4px; border-left: 1px solid var(--border, rgba(127,127,127,.5)); }
.voice-diag-tick:first-child::before { left: 0; } .voice-diag-tick:last-child::before { left: 100%; }


/* Compact calendar: content first, optional controls in one disclosure. */
.calendar-mobile-actions:empty,.calendar-desktop-views:empty,.calendar-view-options:empty { display:none; }
.calendar-more { min-width:0; }
.calendar-more > summary { cursor:pointer; list-style:none; white-space:nowrap; }
.calendar-more > summary::-webkit-details-marker { display:none; }
.calendar-more[open] > summary { background:var(--accent-soft); }
.calendar-more-body { display:grid; gap:12px; padding:12px 0 0; }
.calendar-compact .calendar-toolbar { display:flex; flex-direction:column; gap:8px; margin-bottom:10px; }
.calendar-compact .calendar-toolbar-main { display:block; }
.calendar-compact .calendar-navigation { display:grid; grid-template-columns:36px 36px auto minmax(0,1fr); gap:5px; width:100%; }
.calendar-compact .calendar-navigation .btn { min-width:0; min-height:36px; padding:7px; }
.calendar-compact .calendar-range-label { min-width:0; padding:6px 2px; font-size:12px; white-space:nowrap; text-align:right; }
.calendar-compact .calendar-mobile-actions { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:8px; }
.calendar-compact .calendar-mobile-actions > .calendar-new { min-width:0; width:auto; margin:0; min-height:36px; padding:8px 10px; }
.calendar-compact .calendar-more > summary { min-height:36px; padding:8px 10px; font-size:12px; }


.calendar-compact .calendar-more-body .calendar-sources { display:flex; width:100%; flex-wrap:nowrap; }
.calendar-compact .calendar-more-body .calendar-sources > .btn { flex:1; min-width:0; padding:7px; font-size:12px; }
.calendar-compact .calendar-more-body .calendar-filters { width:100%; padding:0; border:0; grid-template-columns:repeat(2,minmax(0,1fr)); }
.calendar-compact .calendar-more-body .calendar-filters :is(select,input) { min-width:0; width:100%; font-size:13px; }
.calendar-compact .calendar-more-body .calendar-export { justify-self:start; }
.calendar-compact .calendar-desktop-views:empty,.calendar-compact .calendar-view-options:empty { display:none; }
.calendar-compact .calendar-layout { display:block; }
.calendar-compact .calendar-detail { display:none; }
.calendar-compact .calendar-grid-wrap { max-height:none; overflow:visible; border:0; min-height:130px; }
.calendar-compact .calendar-grid-wrap:has(.calendar-week),.calendar-compact .calendar-grid-wrap:has(.calendar-month) { overflow:auto; max-height:65dvh; }
.calendar-compact .calendar-agenda { padding:6px 8px 10px; }
.calendar-compact .calendar-agenda-day > h3 { position:static; padding:8px 3px; font-size:13px; }
.calendar-compact .calendar-agenda-open { grid-template-columns:22px minmax(0,1fr); gap:3px 8px; padding:11px 9px; }
.calendar-compact .calendar-agenda-open > .calendar-agenda-time { grid-column:2; grid-row:1; font-size:11px; }
.calendar-compact .calendar-agenda-open > .calendar-entry-glyph { grid-column:1; grid-row:1 / 3; align-self:center; }
.calendar-compact .calendar-agenda-open > .calendar-agenda-copy { grid-column:2; grid-row:2; gap:3px; }
.calendar-compact .calendar-agenda-item.has-leading-join { grid-template-columns:minmax(0,1fr) 42px; gap:0; }
.calendar-compact .calendar-agenda-item.has-leading-join > .calendar-agenda-open { grid-column:1; grid-template-columns:minmax(0,1fr); }
.calendar-compact .calendar-agenda-item.has-leading-join > .calendar-agenda-open > :is(.calendar-agenda-time,.calendar-agenda-copy) { grid-column:1; }
.calendar-compact .calendar-agenda-item.has-leading-join > .calendar-leading-join { grid-column:2; grid-row:1; }
.calendar-compact .calendar-agenda-copy strong { font-size:13px; }
.calendar-compact .calendar-agenda-empty-day { padding:12px 3px; }
:is(.calendar-info-dialog,.calendar-overlap-dialog).calendar-mobile-sheet { position:fixed; inset:auto 0 0; margin:0 auto; width:100%; max-width:640px; max-height:85dvh; border-radius:18px 18px 0 0; }
:is(.calendar-info-dialog,.calendar-overlap-dialog).calendar-mobile-sheet .modal-body { min-height:0; overflow-y:auto; }
@media (max-width:1100px) and (max-height:520px) {
  .calendar-compact .calendar-toolbar { gap:5px; margin-bottom:6px; }
  .calendar-compact .calendar-toolbar-main { width:100%; }
  .calendar-compact .calendar-agenda-day > h3 { padding-block:5px; }
  :is(.calendar-info-dialog,.calendar-overlap-dialog).calendar-mobile-sheet { max-height:94dvh; max-width:760px; }
}
.calendar-compact .calendar-mobile-actions > .calendar-new { grid-column:auto; }
@media (min-width:761px) and (max-width:1100px) and (max-height:520px) {
  #app:has(.calendar-compact) > .sidebar { width:68px; flex:0 0 68px; padding-inline:8px; }
  #app:has(.calendar-compact) > .sidebar :is(.brand-text,.user-meta,.sidebar-action-label,.build-version) { display:none; }
  #app:has(.calendar-compact) > .sidebar .nav-item > span:not(.ic) { display:none; }
  #app:has(.calendar-compact) > .sidebar .nav-item { justify-content:center; padding-inline:8px; }
  #app:has(.calendar-compact) > .sidebar .brand { justify-content:center; padding-inline:0; }
  #app:has(.calendar-compact) > .sidebar .user-card { justify-content:center; padding-inline:0; }
  #app:has(.calendar-compact) > .sidebar .sidebar-notifications .notification-bell { justify-content:center; padding-inline:0; }
  #app:has(.calendar-compact) .content-heading { padding:8px 12px 0; }
  #app:has(.calendar-compact) #pageSub { display:none; }
  #app:has(.calendar-compact) .content { padding:8px 12px 12px; }
  .calendar-compact .calendar-toolbar { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:8px; }
  .calendar-compact .calendar-mobile-actions { grid-template-columns:auto auto; }

  .calendar-compact .calendar-toolbar-main .calendar-range-label { font-size:12px; }
}

@media (max-height:520px) {
  .calendar-event-dialog { max-height:96dvh; }
  .calendar-event-dialog .modal-body { min-height:0; overflow-y:auto; }
}

.calendar-compact .calendar-toolbar { position:relative; }
.calendar-compact .calendar-more-body { position:absolute; z-index:30; top:calc(100% + 6px); left:0; right:0; max-height:min(var(--calendar-menu-height,60dvh),calc(100dvh - 245px)); overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; padding:12px; border:1px solid var(--border-strong); border-radius:12px; background:var(--surface); box-shadow:0 8px 28px rgb(0 0 0 / 18%); }
.calendar-compact .calendar-more-body .calendar-sources { min-width:0; box-sizing:border-box; }
.calendar-compact .calendar-more-body .calendar-filters { min-width:0; }
.calendar-mobile-sheet .calendar-facts dd,.calendar-mobile-sheet .calendar-description { overflow-wrap:anywhere; min-width:0; }

@media (max-width:1100px) and (max-height:520px) {
  .calendar-compact .calendar-more-body { max-height:min(var(--calendar-menu-height,60dvh),calc(100dvh - 100px)); }
}

.ms-message-link { color:var(--accent); text-decoration:underline; text-underline-offset:2px; overflow-wrap:anywhere; }
.ms-message-link:hover { text-decoration-thickness:2px; }
.ms-message-link:focus-visible { outline:2px solid currentColor; outline-offset:3px; border-radius:2px; }
/* Protokoll: aufklappbare Details je Eintrag */
.voice-protocol-details { margin-top: 8px; }
.voice-protocol-details summary { cursor: pointer; color: var(--accent, #7a4b2a); font-size: 14px; font-weight: 600; }
.voice-protocol-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 24px; padding: 10px 0 4px; }
.voice-protocol-block h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.voice-protocol-block dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.voice-protocol-block dt { color: var(--muted); } .voice-protocol-block dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* Emoji-Reaktionen */
.ms-reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ms-reaction { border: 1px solid var(--border, rgba(127,127,127,.3)); background: rgba(127,127,127,.12); color: inherit; border-radius: 999px; padding: 2px 9px; font: inherit; font-size: 15px; cursor: pointer; line-height: 1.5; }
.ms-reaction.mine { border-color: var(--accent, #c8956b); background: color-mix(in srgb, var(--accent, #c8956b) 22%, transparent); }
.ms-bubble-react { position: absolute; top: 6px; right: 34px; border: 0; background: transparent; color: inherit; opacity: 0; font-size: 18px; cursor: pointer; padding: 0 4px; }
.ms-bubble:hover .ms-bubble-react, .ms-bubble-react:focus-visible { opacity: .65; }
@media (hover: none) { .ms-bubble-react { opacity: .45; } }
.ms-menu-emojis { display: flex; gap: 2px; padding: 6px; flex-wrap: wrap; max-width: 260px; border-bottom: 1px solid var(--border, rgba(127,127,127,.25)); }
.ms-menu-emoji { border: 0; background: transparent; font-size: 24px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.ms-menu-emoji:hover, .ms-menu-emoji.mine { background: rgba(127,127,127,.2); }

.voice-diag-hoststrip { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 4px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2, rgba(127,127,127,.12)); font-size: 13px; }
.voice-diag-hoststrip span { display: grid; gap: 1px; }
.voice-diag-hoststrip small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

/* Session-Zeitleiste (Voice Diagnostics) */
.vdt-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 8px; }
.vdt-info { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.vdt-tools { display: inline-flex; gap: 6px; }
.vdt-btn { border: 1px solid var(--border, rgba(127,127,127,.3)); background: transparent; color: inherit; border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.vdt-btn.is-active { background: var(--accent, #7a4b2a); border-color: transparent; color: #fff; }
.vdt-body { display: flex; border-radius: 14px; background: var(--surface-2, rgba(127,127,127,.1)); overflow: hidden; }
.vdt-labels { flex: 0 0 auto; border-right: 1px solid var(--border, rgba(127,127,127,.25)); background: inherit; }
.vdt-label-axis { height: 34px; }
.vdt-label { display: flex; align-items: center; padding: 0 12px; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vdt-scroll { flex: 1 1 auto; min-width: 0; overflow-x: auto; cursor: grab; touch-action: pan-x; user-select: none; }
.vdt-scroll.dragging { cursor: grabbing; user-select: none; }
.vdt-canvas { position: relative; }
.vdt-axis { position: absolute; left: 0; right: 0; top: 0; height: 34px; border-bottom: 1px solid var(--border, rgba(127,127,127,.3)); }
.vdt-tick { position: absolute; top: 9px; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vdt-tick:first-of-type { transform: none; }
.vdt-tick::before { content: ""; position: absolute; top: -9px; left: 50%; height: 6px; border-left: 1px solid var(--border, rgba(127,127,127,.5)); }
.vdt-gap { position: absolute; top: 0; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(127,127,127,.18) 5px 6px); overflow: hidden; white-space: nowrap; }
.vdt-row { position: absolute; left: 0; right: 0; border-bottom: 1px solid var(--border, rgba(127,127,127,.12)); }
.vdt-seg { position: absolute; top: 7px; bottom: 7px; border-radius: 8px; opacity: .92; overflow: hidden; display: flex; align-items: center; }
.vdt-seg-text { padding: 0 8px; font-size: 12px; font-style: normal; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.vdt-label.human, .vdt-label.tts { font-weight: 700; }
.vdt-seg:hover { opacity: 1; outline: 2px solid rgba(255,255,255,.55); }
.vdt-seg.user { background: #3f9487; } .vdt-seg.stt { background: #4c7ff0; } .vdt-seg.llm { background: #8b5cf6; } .vdt-seg.tts { background: #d98a3a; }
.voice-diag-dot.tts { background: #d98a3a; }
.vdt-marker { position: absolute; top: 0; width: 0; border-left: 3px dashed #d64545; z-index: 2; cursor: help; }
.vdt-marker::after { content: ""; position: absolute; top: 0; bottom: 0; left: -8px; width: 14px; }
.vdt-marker.ignored { border-left-color: var(--muted); border-left-width: 2px; }
.vdt-marker span { position: absolute; top: 36px; left: 6px; font-size: 11px; font-weight: 600; color: #d64545; white-space: nowrap; background: var(--surface, transparent); padding: 0 3px; border-radius: 4px; }
.vdt-marker.ignored span { color: var(--muted); }
.vdt-tip { position: fixed; z-index: 1000; display: none; max-width: 340px; padding: 10px 12px; border-radius: 10px; background: #1d1713; color: #f3ece3; font-size: 13px; line-height: 1.4; box-shadow: 0 6px 24px rgba(0,0,0,.35); pointer-events: none; }
.vdt-tip b { display: block; margin-bottom: 2px; font-size: 14px; }
.voice-callid { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0 12px; }
.voice-callid code { font-size: 13px; user-select: all; overflow-wrap: anywhere; }


/* Shared selection checkboxes. Setting toggles use agentEditorSwitch().
   Exclude its hidden semantic input so the established switch stays intact. */
:root input[type="checkbox"]:not(.agent-editor-switch-input) {
  appearance: none; -webkit-appearance: none;
  display: inline-grid; place-content: center; box-sizing: border-box;
  width: 20px; height: 20px; min-width: 20px; min-height: 20px;
  flex: 0 0 20px; padding: 0; margin: 0; vertical-align: middle;
  border: 1.5px solid var(--border-strong); border-radius: 5px;
  background: var(--surface); color: var(--accent-text); cursor: pointer;
}
:root input[type="checkbox"]:not(.agent-editor-switch-input)::before {
  content: ""; width: 12px; height: 12px; background: currentColor;
  clip-path: polygon(12% 44%, 0 59%, 38% 94%, 100% 20%, 84% 6%, 36% 65%);
  opacity: 0;
}
:root input[type="checkbox"]:not(.agent-editor-switch-input):is(:checked, :indeterminate) {
  border-color: var(--accent); background: var(--accent);
}
:root input[type="checkbox"]:not(.agent-editor-switch-input):is(:checked, :indeterminate)::before { opacity: 1; }
:root input[type="checkbox"]:not(.agent-editor-switch-input):indeterminate::before { clip-path: inset(42% 0); }
:root input[type="checkbox"]:not(.agent-editor-switch-input):hover:not(:disabled) { border-color: var(--accent); }
:root input[type="checkbox"]:not(.agent-editor-switch-input):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:root input[type="checkbox"]:not(.agent-editor-switch-input):disabled { opacity: .55; cursor: not-allowed; }
.agent-editor-switch { max-width: 100%; }
.agent-editor-switch > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.agent-editor-switch:has(input:disabled) { cursor: not-allowed; }
@media (forced-colors: active) {
  :root input[type="checkbox"]:not(.agent-editor-switch-input) { appearance: auto; -webkit-appearance: auto; }
  :root input[type="checkbox"]:not(.agent-editor-switch-input)::before { content: none; }
}

/* Generic form input/label rules must not enlarge the hidden switch control. */
:root input[type="checkbox"].agent-editor-switch-input {
  position: absolute; width: 1px; height: 1px; min-width: 0; min-height: 0;
  padding: 0; margin: 0; border: 0; opacity: 0;
}
.field label.agent-editor-switch { display: inline-flex; margin-bottom: 0; }

/* Voice Diagnostics auf dem Handy (Hoch- und Querformat): nichts überlappt, nichts abgeschnitten */
@media (max-width: 720px), (max-height: 500px) {
  .voice-diagnostics-panel { padding: 12px; }
  .voice-diag-card { padding: 14px; }
  .voice-diag-card .voice-protocol-head { flex-wrap: wrap; }
  .voice-diag-card .voice-protocol-head h3 { font-size: 18px; }
  .vdt-toolbar { gap: 8px; }
  .vdt-info { font-size: 12px; flex: 1 1 100%; overflow-wrap: anywhere; }
  .vdt-tools { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
  .vdt-btn { padding: 6px 12px; font-size: 13px; white-space: nowrap; flex: 0 0 auto; }
  .vdt-label { padding: 0 8px; font-size: 12px; }
  .vdt-seg-text { font-size: 11px; padding: 0 5px; }
  .vdt-tick { font-size: 10px; }
  .voice-diag-legend { gap: 6px 12px; font-size: 12px; }
  .voice-diag-person dl { grid-template-columns: 1fr; gap: 0; }
  .voice-diag-person dt { margin-top: 8px; font-size: 12px; }
  .voice-diag-metrics { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
  .voice-diag-hoststrip { gap: 6px 14px; padding: 8px 10px; }
}

/* Lange IDs/Tokens in Key-Value-Zeilen dürfen nie die Seite aufweiten */
.kv-v { overflow-wrap: anywhere; word-break: break-word; }

/* Agent-Editor auf dem Handy: ruhiger, zentrierter Kopfbereich */
@media (max-width: 720px) {
  .agent-profile-layout > .agent-profile-top { width: 100%; flex-direction: column; align-items: center; gap: 8px; margin: 6px 0 22px; padding: 18px 12px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2, rgba(127,127,127,.06)); box-sizing: border-box; }
  .agent-profile-top .agent-portrait-xl { --agent-portrait-size: 96px; }
  .agent-photo-edit::after { left: auto; right: -2px; bottom: 2px; }
  .agent-photo-actions { text-align: center; }
  .agent-photo-actions p { margin: 0; }
  .agent-photo-actions p strong { font-size: 13px; font-weight: 600; color: var(--muted); }
  .agent-photo-actions p strong::after { content: " · tippen zum Ändern"; font-weight: 400; }
  .agent-editor .field { margin-bottom: 14px; }
  .agent-editor .field > label, .agent-editor .field > .label { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
}

/* Flüssigere Übergänge zwischen den Rubriken: sanftes Einblenden statt hartem Umschalten */
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.route-view > * { animation: view-in .22s cubic-bezier(.2, .7, .2, 1) backwards; }
.bottom-nav a, .bottom-nav button, .nav-item, .calls-button, .calls-target, .ms-avatar { transition: background-color .18s ease, color .18s ease, border-color .18s ease, opacity .18s ease; }
@media (prefers-reduced-motion: reduce) { .route-view > * { animation: none; } }

/* Bilder: Porträts in Listen bleiben handlich und zeigen das Gesicht */
.agent-face img, .calls-avatar img, .ms-avatar img { object-fit: cover; object-position: center 22%; }
.agent-profile-top .agent-portrait-xl { --agent-portrait-size: 84px; }


/* Agenten-Karte: Drei-Punkte-Menü oben rechts */
.agent-choice-card { position: relative; }
.agent-choice-menu { position: absolute; top: 14px; right: 14px; z-index: 5; }
.agent-choice-menu > summary { list-style: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; letter-spacing: 1px; user-select: none; transition: background-color .18s ease; }
.agent-choice-menu > summary::-webkit-details-marker { display: none; }
.agent-choice-menu > summary:hover, .agent-choice-menu[open] > summary { background: var(--surface-2, rgba(127,127,127,.15)); color: var(--text); }
.agent-choice-menu-list { position: absolute; right: 0; top: 44px; min-width: 190px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: view-in .14s ease both; }
.agent-choice-menu-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: inherit; font: inherit; padding: 11px 12px; border-radius: 9px; cursor: pointer; }
.agent-choice-menu-item:hover:not(:disabled) { background: var(--surface-2, rgba(127,127,127,.12)); }
.agent-choice-menu-item:disabled { opacity: .45; cursor: default; }
.agent-choice-heading { padding-right: 44px; }



/* Anrufe-Liste (Handy) wie bei WhatsApp: Avatar · Name + Art/Zeit · Anruf-Symbol. Nur die Liste, der Rest bleibt wie er war. */
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-recent-filters { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 10px; }
  .calls-recent-filters::-webkit-scrollbar { display: none; }
  .calls-recent-filters .calls-filter-chip { flex: 0 0 auto; white-space: nowrap; }
  .calls-missed .calls-target, .calls-missed > .calls-group .calls-target { background: transparent; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 12px 2px; }
  .calls-group-head { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "av text call" "av lines call"; column-gap: 12px; row-gap: 1px; align-items: center; }
  .calls-group-head > .calls-avatar { grid-area: av; width: 52px; height: 52px; }
  .calls-group-head > .calls-target-text { grid-area: text; align-self: end; gap: 0; }
  .calls-group-head .calls-group-sub, .calls-group-head .calls-group-count { display: none; }
  .calls-group-head > .calls-group-lines { grid-area: lines; align-self: start; min-width: 0; gap: 0; }
  .calls-group-head .calls-group-line { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-dim); }
  .calls-group-head .calls-group-lines .calls-group-line:not(:first-child), .calls-group-head .calls-group-label { display: none; }
  .calls-group-head .calls-group-line .calls-icon { width: 16px; height: 16px; flex: 0 0 16px; }
  .calls-group-head .calls-time { font-size: 13px; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); }
  .calls-group-head > .calls-call { grid-area: call; background: transparent !important; width: 44px; min-height: 44px; color: var(--accent); }
  .calls-group-head > .calls-group-toggle { display: none; }
  .calls-group-head .calls-target-text b.calls-name-bad { color: #d64545; }
}
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-missed .calls-group { background: transparent; border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; }
  .calls-missed .calls-group:first-child { border-top: 0; }
}
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-recent-filters { flex-wrap: wrap; overflow: visible; gap: 6px; padding: 2px 0 10px; }
  .calls-recent-filters .calls-filter-chip { flex: 0 1 auto; min-height: 34px; padding: 4px 11px; gap: 6px; font-size: 13px; }
  .calls-recent-filters .calls-filter-chip .calls-icon { width: 17px; height: 17px; flex-basis: 17px; }
}

/* Anrufliste (Handy): „Aufräumen“ wird zum ⋯ oben, Löschen per Wischen nach links */
.calls-swipe-delete { display: none; }
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-missed { position: relative; }
  .calls-recent-filters .calls-cleanup { position: absolute; top: -6px; right: 0; margin: 0; }
  .calls-cleanup summary { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; font-size: 0; }
  .calls-cleanup summary::after { content: "⋯"; font-size: 26px; line-height: 1; color: var(--accent); }
  .calls-cleanup[open] summary { background: var(--surface-2, rgba(127,127,127,.15)); }
  .calls-swipe-card { position: relative; overflow: hidden; }
  .calls-swipe-card > .calls-group-head { position: relative; z-index: 1; background: var(--bg, var(--surface)) !important; touch-action: pan-y; will-change: transform; }
  .calls-swipe-card.calls-missed-new > .calls-group-head { background: color-mix(in srgb, #d64545 8%, var(--bg, var(--surface))) !important; }
  .calls-swipe-delete { display: grid; place-items: center; position: absolute; top: 0; right: 0; bottom: 0; width: 84px; border: 0; background: #d64545; color: #fff; font-size: 22px; cursor: pointer; }
}

/* Anrufe (Handy, Hochformat): Zuletzt / Kontakte / Agenten unten, gut mit dem Daumen erreichbar */
@media (max-width: 720px) and (orientation: portrait) {
  .calls-directory-nav { position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 40; padding: 4px; margin: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 6px 22px rgba(0,0,0,.16); flex-direction: row; gap: 0; }
  .calls-directory-nav .calls-button { flex: 1 1 0; width: auto; min-height: 42px; padding: 6px 8px; justify-content: center; border: 0; border-radius: 12px; font-size: 14px; box-shadow: none; }
  .calls-directory-nav .calls-button[aria-pressed="true"] { box-shadow: none; }
  .calls-home { padding-bottom: 72px; }
}

/* „Einladen“ liegt im Handy in der Anrufliste unter ⋯ (nur in der Rubrik „Zuletzt“) */
.calls-row-commands .calls-menu-invite { display: none; }
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-row-commands .calls-menu-invite { display: block; }
  .calls-home[data-mode="recent"] .calls-invite-contact { display: none; }
}

/* Anrufe (Handy, Hochformat): Suche unten über den Tabs */
@media (max-width: 720px) and (orientation: portrait) {
  .calls-home .calls-searchbar { position: fixed; left: 12px; right: 12px; bottom: calc(126px + env(safe-area-inset-bottom)); z-index: 40; max-width: none; min-width: 0; width: auto; flex: none; margin: 0; box-shadow: 0 6px 22px rgba(0,0,0,.16); border-radius: 17px; }
  .calls-home .calls-search { min-height: 48px; padding-block: 0; }
  .calls-home { padding-bottom: 132px; }
}

@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home[data-mode="recent"] .calls-actions { display: none; }
  .calls-row-commands .calls-menu-invite:disabled { opacity: .45; }
}

/* Anrufe (Handy): Überschrift + Untertitel entfallen, die Liste beginnt direkt */
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-heading { display: none; }
  .calls-toolbar { margin: 0; }
}
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-missed > h2 { display: none; }
  .calls-missed { padding-top: 40px; }
}
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-missed { padding-top: 0; }
  .calls-recent-filters .calls-cleanup { top: -2px; }
  .calls-home { margin-top: 0; }
  .calls-directory-panel { padding-top: 0; }
  .calls-workspace { gap: 0; }
}

/* Anrufliste (Handy): Anzahl hinter dem Namen, Antippen klappt die Liste auf */
.calls-group-count-short { display: none; }
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-group-count-short { display: inline; margin-left: 6px; color: var(--text-dim); font-weight: 500; }
  .calls-group-head { cursor: pointer; }
  .calls-group-history { padding: 4px 4px 10px 64px; background: transparent; }
  .calls-group-history-title { display: none; }
  .calls-history-row { padding: 9px 0; font-size: 13px; border-top: 1px solid var(--border); }
  .calls-history-row:first-of-type { border-top: 0; }
}
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-swipe-card:has(.calls-group-history) > .calls-swipe-delete { display: none; }
  .calls-swipe-card:has(.calls-group-history) > .calls-group-head { transform: none !important; }
}

/* Handy: Löschen nur per Wischen nach links, keine Mülleimer-Buttons */
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-history-delete, .calls-history-row .calls-history-delete { display: none; }
  .calls-swipe-delete { font-size: 15px; font-weight: 600; }
  .calls-history-swipe { background: var(--bg, var(--surface)); }
  .calls-history-swipe > .calls-history-row { position: relative; z-index: 1; background: var(--bg, var(--surface)); touch-action: pan-y; }
  .calls-swipe-card:has(.calls-group-history) > .calls-swipe-delete { display: none; }
}

/* Anrufe (Handy): Reihenfolge Filter → Suche → Zuletzt/Kontakte/Agenten → Aktionen → Liste (alles im normalen Fluss, nichts mehr fest unten) */
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-workspace { display: flex; flex-direction: column; gap: 10px; }
  .calls-home .calls-sidebar, .calls-home .calls-directory-panel, .calls-home .calls-section-head, .calls-home .calls-missed:not([hidden]) { display: contents; }
  .calls-home .calls-missed[hidden] { display: none; }
  .calls-home .calls-workspace :is(.calls-targets, .calls-status, .calls-directory-count, .calls-index, .calls-invite-contact, .calls-contact-filters:not([hidden]), .calls-missed > .calls-button, .calls-missed > .calls-empty, .calls-sidebar-label) { order: 6; }
  .calls-home .calls-recent-filters { order: 1; position: relative; }
  .calls-home .calls-searchbar { order: 2; position: static; width: 100%; max-width: none; min-width: 0; flex: none; margin: 0; box-shadow: none; }
  .calls-home .calls-directory-nav { order: 3; position: static; left: auto; right: auto; bottom: auto; width: 100%; box-shadow: none; border: 0; background: var(--surface-2, rgba(127,127,127,.12)); z-index: auto; }
  .calls-home .calls-actions { order: 4; }
  .calls-home .calls-group { order: 5; }
  .calls-home { padding-bottom: 12px; }
}
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-group, .calls-home .calls-recent-filters, .calls-home .calls-targets { width: 100%; box-sizing: border-box; }
}
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-invite-contact { position: static; order: 4; width: 100%; min-width: 0; margin: 0; padding: 10px 14px; flex-direction: row; justify-content: center; gap: 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 14px; }
  .calls-home .calls-invite-contact::after { content: none; }
  .calls-home .calls-invite-contact .calls-icon { width: 20px; height: 20px; }
}
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-workspace { align-items: stretch; }
  .calls-home .calls-actions { width: 100%; box-sizing: border-box; }
}
/* Reihenfolge fest: Suche → Zuletzt/Kontakte/Agenten → Filter → Liste (in allen Tabs gleich) */
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-searchbar { order: 1; }
  .calls-home .calls-directory-nav { order: 2; }
  .calls-home .calls-recent-filters { order: 3; padding-top: 4px; }
  .calls-home .calls-actions, .calls-home .calls-invite-contact { order: 4; }
}

/* A–Z-Streifen: Buchstaben füllen genau die Höhe der Kontaktliste */
.calls-index { box-sizing: border-box; justify-content: space-between; padding-block: 4px; }
.calls-index-letter { flex: 1 1 0; height: auto; min-height: 0; line-height: 1; font-size: clamp(9px, 2.1vh, 14px); }

/* Handy: Aktionszeile/Sprachwahl/Einladen entfallen, alles Weitere im ⋯ */
.calls-more-menu { display: none; }
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-actions, .calls-home .calls-mic, .calls-home .calls-invite-contact { display: none; }
  .calls-home:not([data-mode="recent"]) .calls-more-menu { display: block; order: 3; align-self: flex-end; position: relative; margin: -4px 0 0; }
  .calls-home .calls-more-menu .calls-row-commands { right: 0; }
}

/* ⋯ immer oben rechts, auf Höhe der Suche (alle Tabs) */
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home { position: relative; }
  .calls-home .calls-recent-filters { position: static; }
  .calls-home .calls-recent-filters .calls-cleanup, .calls-home:not([data-mode="recent"]) .calls-more-menu { position: absolute; top: 4px; right: 0; margin: 0; order: 0; align-self: auto; z-index: 30; }
  .calls-home .calls-searchbar { margin-right: 48px; width: calc(100% - 48px); }
  .calls-home .calls-recent-filters { padding-top: 0; }
}

/* Handy: brauner Rahmen um die App; Hintergrund wird von links unten nach rechts oben dunkler */
@media (max-width: 720px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  html { background: linear-gradient(to top right, color-mix(in srgb, var(--accent) 8%, var(--bg)) 0%, color-mix(in srgb, var(--accent) 28%, var(--bg)) 50%, color-mix(in srgb, var(--accent) 56%, var(--bg)) 100%) fixed; }
  body { background: transparent; }
  body::after { content: ""; position: fixed; inset: 0; z-index: 2147483000; border: 3px solid var(--accent); border-radius: 22px; box-shadow: 0 0 0 60px #000; pointer-events: none; box-sizing: border-box; }
}

/* Einzelne Anrufe in der Auflistung: nach links wischen/ziehen → „Löschen“ (alle Breiten, Finger und Maus) */
.calls-history-delete { display: none !important; }
.calls-history-swipe { position: relative; overflow: hidden; background: var(--bg, var(--surface)); }
.calls-history-swipe > .calls-history-row { position: relative; z-index: 1; background: var(--bg, var(--surface)); touch-action: pan-y; user-select: none; will-change: transform; }
.calls-history-swipe > .calls-swipe-delete { display: grid; place-items: center; position: absolute; top: 0; right: 0; bottom: 0; width: 84px; border: 0; background: #d64545; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
/* A–Z-Streifen ohne eigene Fläche: kein heller Rand um die Buchstaben */
.calls-index { background: transparent; box-shadow: none; border-radius: 0; }

/* Handy: überall rundere Ecken */
@media (max-width: 720px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  :root { --radius: 22px; --radius-sm: 16px; }
  .panel, .mailcard, .agent-choice-card, .calls-directory-panel, .calls-target, .agent-photo-picker { border-radius: 22px; }
  .btn, button.btn, .calls-button, .calls-filter-chip { border-radius: 16px; }
  .calls-filter-chip, .vdt-btn { border-radius: 999px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea { border-radius: 16px; }
  .calls-search, .calls-searchbar { border-radius: 20px; }
  .calls-directory-nav { border-radius: 20px; }
  .calls-directory-nav .calls-button { border-radius: 16px; }
  .agent-choice-menu-list, .calls-row-commands { border-radius: 18px; }
  .vdt-body { border-radius: 20px; }
}
/* Anruf-Zeilen als runde Karten */
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-missed .calls-group, .calls-home .calls-group { border: 0 !important; border-radius: 22px; overflow: hidden; margin-bottom: 4px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
  .calls-home .calls-group > .calls-group-head, .calls-home .calls-swipe-card > .calls-group-head { border: 0 !important; border-radius: 22px; padding-left: 10px; padding-right: 6px; }
  .calls-home .calls-group-history { border-radius: 0 0 22px 22px; }
  .calls-history-swipe:last-of-type > .calls-history-row { border-radius: 0 0 14px 14px; }
}

/* Handy (Hoch- und Querformat): Zuletzt/Kontakte/Agenten als eine Reihe */
@media (max-width: 1000px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-directory-nav { flex-direction: row; gap: 0; padding: 4px; }
  .calls-home .calls-directory-nav .calls-button { flex: 1 1 0; width: auto; min-height: 40px; padding: 6px 8px; justify-content: center; border: 0; border-radius: 16px; font-size: 14px; box-shadow: none; }
  .calls-home .calls-directory-nav .calls-button .calls-icon { display: none; }
  .calls-home .calls-directory-nav .calls-button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
  .calls-home .calls-sidebar-label, .calls-home .calls-heading { display: none; }
  .calls-home .calls-section-head h2 { display: none; }
}

/* Handy quer (wenig Höhe): Suche + Tabs nebeneinander, Filter in einer Zeile, schlanke Anruf-Karten */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-workspace { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .calls-home .calls-searchbar { order: 1; flex: 1 1 40%; width: auto; margin: 0; min-width: 200px; }
  .calls-home .calls-search { min-height: 40px; }
  .calls-home .calls-directory-nav { order: 2; flex: 1 1 45%; width: auto; padding: 3px; }
  .calls-home .calls-directory-nav .calls-button { min-height: 34px; }
  .calls-home .calls-recent-filters { order: 3; flex: 1 1 100%; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding: 0 0 4px; gap: 6px; }
  .calls-home .calls-recent-filters .calls-filter-chip { min-height: 30px; padding: 2px 10px; font-size: 12px; }
  .calls-home .calls-recent-filters .calls-cleanup { top: -52px; right: 0; }
  .calls-home .calls-group, .calls-home .calls-targets, .calls-home .calls-actions { flex: 1 1 100%; width: 100%; }
  .calls-home .calls-group-head { padding-block: 4px; }
  .calls-home .calls-group-head > .calls-avatar { width: 40px; height: 40px; }
  .calls-home .calls-more-menu { order: 2; position: static !important; margin: 0 !important; }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calls-home .calls-recent-filters .calls-cleanup, .calls-home:not([data-mode="recent"]) .calls-more-menu { position: absolute !important; top: 10px; right: 6px; }
  .calls-home .calls-directory-nav { margin-right: 44px; }
  .calls-home .calls-recent-filters { overflow: visible; flex-wrap: wrap; }
  .calls-home .calls-target-text b { font-size: 15px; }
}

/* Querformat: auch im geöffneten Chat bleibt die Rubrik-Leiste links sichtbar (sonst kommt man nicht zu anderen Rubriken) */
@media (orientation: landscape) and (max-width: 1024px) and (pointer: coarse) {
  body.messenger-chat-open .app-tabbar { display: flex; }
  body.messenger-chat-open .main { padding-left: calc(62px + env(safe-area-inset-left)); }
}

/* Handy quer: Menü-Schublade kompakt (schmal, kleine Einträge) */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .sidebar, .sidebar.collapsed { width: min(46vw, 250px); max-width: 250px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); padding-inline: 10px; overflow-y: auto; }
  .sidebar .brand { padding: 2px 4px 8px; gap: 8px; }
  .sidebar .brand-text { font-size: 14px; }
  .sidebar .nav-item { min-height: 34px; padding: 6px 10px; gap: 10px; font-size: 13px; border-radius: 12px; }
  .sidebar .nav-item .ic { width: 18px; height: 18px; flex-basis: 18px; }
  .sidebar .nav-item .ic svg { width: 18px; height: 18px; }
  .sidebar .nav-section-title, .sidebar .nav-label { margin: 6px 8px 2px; font-size: 10px; }
  .sidebar-foot, .sidebar .version, .sidebar-footer { font-size: 10px; }
  .sidebar .user-card, .sidebar .nav-user { padding: 6px 8px; }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .sidebar .build-version { display: none; }
  .sidebar .brand-logo { width: 30px; height: 30px; }
  .sidebar .nav-item { min-height: 30px; padding-block: 4px; }
  .sidebar .sidebar-notifications { min-height: 0; }
  .sidebar .notification-bell, .sidebar .user-card { padding-block: 4px; min-height: 0; }
  .sidebar .nav { min-height: 0; overflow-y: auto; flex: 1 1 auto; }
}

/* ≡-Knopf: nur Handy quer */
.rail-toggle { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rail-toggle { display: grid; place-items: center; position: fixed; z-index: 60; top: 6px; left: calc(62px + env(safe-area-inset-left) + 6px); width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.14); }
  body.rail-hidden .rail-toggle { left: calc(env(safe-area-inset-left) + 8px); }
  body.rail-hidden .app-tabbar, body.rail-hidden.messenger-chat-open .app-tabbar { display: none; }
  body.rail-hidden .main, body.rail-hidden.messenger-chat-open .main { padding-left: env(safe-area-inset-left); }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rail-toggle { top: 50%; transform: translateY(-50%); left: calc(62px + env(safe-area-inset-left) - 14px); width: 28px; height: 52px; border-radius: 14px; font-size: 18px; }
  body.rail-hidden .rail-toggle { left: env(safe-area-inset-left); width: 24px; border-radius: 0 14px 14px 0; border-left: 0; }
}
/* ≡ sitzt oben IN der vertikalen Leiste; ausgeblendet bleibt ein kleiner Griff am linken Rand */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body:not(.rail-hidden) .rail-toggle { top: max(4px, env(safe-area-inset-top)); transform: none; left: calc((62px + env(safe-area-inset-left) - 40px) / 2 + env(safe-area-inset-left) / 2); width: 40px; height: 28px; border: 0; border-radius: 10px; background: transparent; box-shadow: none; color: var(--muted); font-size: 22px; z-index: 80; }
  body:not(.rail-hidden) .app-tabbar { padding-top: 34px; }
}
/* Ausgeblendet: ≡ bleibt oben links, um die Leiste wieder einzublenden */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body.rail-hidden .rail-toggle { top: max(6px, env(safe-area-inset-top)); transform: none; left: calc(env(safe-area-inset-left) + 6px); width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: 0 2px 8px rgba(0,0,0,.14); color: var(--text); }
  body.rail-hidden .main, body.rail-hidden.messenger-chat-open .main { padding-left: calc(env(safe-area-inset-left) + 44px); }
}
/* ≡: in beiden Zuständen gleiche Größe und gleiche Position (oben links) */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rail-toggle, body.rail-hidden .rail-toggle, body:not(.rail-hidden) .rail-toggle { top: max(4px, env(safe-area-inset-top)); left: calc(env(safe-area-inset-left) + 11px); transform: none; width: 40px; height: 28px; border: 0; border-radius: 10px; background: transparent; box-shadow: none; color: var(--muted); font-size: 22px; z-index: 80; }
  body.rail-hidden .rail-toggle { color: var(--text); background: color-mix(in srgb, var(--surface) 70%, transparent); }
  body.rail-hidden .main, body.rail-hidden.messenger-chat-open .main { padding-left: calc(env(safe-area-inset-left) + 56px); }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body.rail-hidden .rail-toggle { background: transparent; color: var(--muted); box-shadow: none; }
}

/* Handy quer: Menü als Kachel-Raster über den ganzen Bildschirm */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .sidebar, .sidebar.collapsed { inset: 0; width: auto; max-width: none; height: var(--app-viewport-height, 100vh); padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 6px; overflow-y: auto; box-shadow: none; }
  .sidebar .nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; align-content: start; overflow: visible; flex: 0 0 auto; }
  .sidebar .nav-group, .sidebar .nav-team-row { display: contents; }
  .sidebar .nav-item, .sidebar .nav-group-toggle, .sidebar .nav-team-row > .nav-item { position: relative; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; min-height: 64px; height: 64px; padding: 6px 4px; border-radius: 16px; background: rgba(255,255,255,.07); font-size: 12px; line-height: 1.15; }
  .sidebar .nav-item.active { background: var(--sidebar-active); }
  .sidebar .nav-item .ic, .sidebar .nav-item .ic svg { width: 24px; height: 24px; flex: none; }
  .sidebar .nav-item .nav-label { white-space: normal; }
  .sidebar .nav-group-caret { display: none; }
  .sidebar .nav-item .inbox-unread-badge { position: absolute; top: 6px; right: 8px; margin: 0; }
  .sidebar .nav-group-children, .sidebar .nav-group-children.expanded { grid-column: 1 / -1; display: none; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
  .sidebar .nav-group-children.expanded { display: grid; }
  .sidebar .nav-group-children .nav-item { height: 56px; min-height: 56px; background: rgba(255,255,255,.04); }
  .sidebar .sidebar-notifications, .sidebar .user-menu { flex: 0 0 auto; }
}

/* Benachrichtigungen: dezentes, kompaktes Fenster links unten */
.sidebar-notifications .notification-popover { width: min(300px, calc(var(--app-viewport-width) - 32px)); max-height: min(300px, 45vh); padding: 4px; border-radius: 14px; box-shadow: 0 8px 26px rgba(0,0,0,.18); }
.sidebar.collapsed .sidebar-notifications .notification-popover { bottom: 0; left: calc(100% + 10px); }
.sidebar-notifications .notification-popover-head { padding: 6px 8px 8px; font-size: 12px; }
.sidebar-notifications .ms-notification-item { padding: 8px 9px; gap: 1px 8px; }
.sidebar-notifications .ms-notification-item b { font-size: 12px; }
.sidebar-notifications .ms-notification-item span { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sidebar-notifications .ms-notification-item small { font-size: 10px; }

/* Kalender (Handy): die ganze Woche passt ohne Seitwärts-Scrollen auf den Bildschirm */
@media (max-width: 760px), (max-width: 1100px) and (max-height: 520px) {
  .calendar-compact .calendar-week { grid-template-columns: 40px repeat(var(--calendar-days, 7), minmax(0, 1fr)); min-width: 0; }
  .calendar-compact .calendar-week > * { min-width: 0; }
  .calendar-compact .calendar-day-head, .calendar-compact .calendar-week [class*="day-head"] { padding-inline: 1px; font-size: 10px; line-height: 1.15; overflow: hidden; text-overflow: clip; }
  .calendar-compact .calendar-week [class*="hour"], .calendar-compact .calendar-week [class*="time-label"] { font-size: 9px; }
  .calendar-compact .calendar-event, .calendar-compact .calendar-week [class*="event"] { font-size: 9px; padding: 1px 2px; }
}

/* Kalender Handy hochkant: Monatsraster wie beim iPhone (ganze Woche sichtbar, Zahlen mittig, heute als Kreis, Termine als Punkte) */
@media (max-width: 760px) and (orientation: portrait) {
  .calendar-compact .calendar-month { min-width: 0; width: 100%; }
  .calendar-compact .calendar-month-heading { padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--muted); }
  .calendar-compact .calendar-month-day { min-height: 56px; padding: 4px 1px; display: flex; flex-direction: column; align-items: center; gap: 3px; border-right: 0; }
  .calendar-compact .calendar-month-day.today { box-shadow: none; }
  .calendar-compact .calendar-month-date { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 50%; font-size: 16px; font-weight: 500; }
  .calendar-compact .calendar-month-day.today .calendar-month-date { background: var(--accent); color: var(--accent-text, #fff); font-weight: 700; }
  .calendar-compact .calendar-month-event { width: 7px; height: 7px; margin: 0 1px; padding: 0; border: 0; border-radius: 50%; background: var(--calendar-month-tone, var(--accent)); overflow: hidden; }
  .calendar-compact .calendar-month-event .calendar-month-open { display: none; }
  .calendar-compact .calendar-month-day { flex-wrap: wrap; flex-direction: row; justify-content: center; align-content: flex-start; }
  .calendar-compact .calendar-month-day .calendar-month-date { flex: 0 0 100%; margin: 0 auto; width: 30px; }
}

/* Kalender: alle Wochentage immer sichtbar (Mo–So), Spalten schrumpfen statt seitwärts zu scrollen */
.calendar-week { grid-template-columns: 46px repeat(var(--calendar-days, 7), minmax(0, 1fr)); min-width: 0; }
.calendar-week > * { min-width: 0; }
@media (max-width: 1100px) {
  .calendar-week [class*="day-head"], .calendar-week .calendar-day-head { padding-inline: 2px; font-size: 12px; overflow: hidden; }
}

/* Kalender Handy quer: wenig Höhe → Kopfbereich in einer Zeile, mehr Platz fürs Raster */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calendar-compact .calendar-toolbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; margin-bottom: 6px; }
  .calendar-compact .calendar-toolbar-main { flex: 1 1 auto; flex-wrap: nowrap; gap: 8px; }
  .calendar-compact .calendar-mobile-actions { flex: 0 0 auto; flex-wrap: nowrap; gap: 8px; }
  .calendar-compact .calendar-toolbar .btn { min-height: 36px; padding-block: 4px; }
  .topbar-sub, .page-sub, .calendar-page > .hint:first-child { display: none; }
}
/* Kalender Handy: Untertitel weg, Raster füllt den Rest der Höhe (00–24 Uhr ohne Scrollen) */
@media (max-width: 760px), (max-width: 1100px) and (max-height: 520px) {
  .calendar-compact ~ * , #pageSub { }
  .calendar-compact .calendar-grid-wrap { overflow-y: hidden; }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #pageSub { display: none !important; }
  .calendar-compact .calendar-toolbar { display: flex !important; flex-wrap: nowrap !important; align-items: center; gap: 8px; margin: 0 0 4px; }
  .calendar-compact .calendar-toolbar > * { flex: 0 1 auto; }
  .calendar-compact .calendar-toolbar-main { flex: 1 1 auto; }
  .calendar-compact .calendar-mobile-actions { justify-content: flex-end; }
  .calendar-compact .calendar-toolbar .btn { min-height: 32px; padding: 2px 10px; font-size: 13px; }
  .calendar-compact .calendar-range-label { font-size: 12px; }
  .calendar-compact .calendar-week > .calendar-corner, .calendar-compact .calendar-week > .calendar-day-head { }
  .calendar-compact .calendar-week { grid-template-rows: 36px var(--calendar-hours-height, 288px); }
}
/* Kalender Handy quer: Überschrift weg, alle Bedienelemente in einer Zeile → maximale Fläche für das Raster */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .main:has(.calendar-compact) #contentHeading { display: none; }
  .calendar-compact .calendar-mobile-actions { display: flex !important; gap: 8px; flex: 0 0 auto; }
  .calendar-compact .calendar-toolbar-main { display: flex; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; gap: 8px; }
  .calendar-compact .calendar-toolbar { padding-top: 4px; }
  .calendar-compact .calendar-toolbar .calendar-new { margin-left: 0; }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calendar-compact .calendar-toolbar > * { width: auto !important; max-width: none !important; margin: 0 !important; }
  .calendar-compact .calendar-toolbar-main { justify-content: flex-start; }
  .calendar-compact .calendar-toolbar-main .calendar-range-label { margin-left: auto; white-space: nowrap; }
}
/* Aktuelle Stunde markieren */
.calendar-hour-now { position: absolute; left: 0; right: 0; z-index: 0; background: color-mix(in srgb, var(--accent) 14%, transparent); border-block: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); pointer-events: none; }
.calendar-hours span.now-hour { color: var(--accent); font-weight: 800; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calendar-compact .calendar-week { grid-template-rows: 36px var(--calendar-hours-height, 288px); }
}

/* Kalender kompakt (alle Handy-/Schmalfenster-Größen): Navigation + Aktionen in EINER Zeile */
@media (max-width: 760px), (max-width: 1100px) and (max-height: 520px) {
  .main:has(.calendar-compact) #contentHeading { display: none; }
  .calendar-compact .calendar-toolbar { display: flex !important; flex-wrap: nowrap !important; align-items: center; gap: 6px; margin: 0 0 6px; }
  .calendar-compact .calendar-toolbar > * { width: auto !important; max-width: none !important; margin: 0 !important; min-width: 0; }
  .calendar-compact .calendar-toolbar-main { display: flex !important; flex: 1 1 auto; flex-wrap: nowrap !important; gap: 6px; justify-content: flex-start; }
  .calendar-compact .calendar-mobile-actions { display: flex !important; flex: 0 0 auto; flex-wrap: nowrap; gap: 6px; }
  .calendar-compact .calendar-toolbar .btn { min-height: 34px; padding: 2px 10px; font-size: 13px; white-space: nowrap; }
  .calendar-compact .calendar-toolbar-main .calendar-range-label { margin-left: auto; white-space: nowrap; font-size: 12px; min-width: 0; padding: 0; }
}
@media (max-width: 520px) {
  .calendar-compact .calendar-mobile-actions .btn { font-size: 0; padding: 0 9px; min-width: 38px; }
  .calendar-compact .calendar-mobile-actions .btn svg { width: 20px; height: 20px; }
  .calendar-compact .calendar-toolbar-main .calendar-range-label svg { display: none; }
}
@media (max-width: 760px), (max-width: 1100px) and (max-height: 520px) {
  .calendar-compact .calendar-toolbar { flex-direction: row !important; justify-content: space-between; }
  .calendar-compact .calendar-view-options { display: none !important; }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .calendar-compact .calendar-grid-wrap { height: calc(100dvh - 58px); max-height: calc(100dvh - 58px); overflow-y: auto; }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .content:has(.calendar-compact) { padding: 4px 12px 6px; }
  .calendar-compact .calendar-grid-wrap { height: calc(var(--app-viewport-height, 100vh) - 54px); max-height: calc(var(--app-viewport-height, 100vh) - 54px); }
}
/* Reiter „Agenten“: nur ein ⋯ (das „Mehr“-Menü), nicht zusätzlich das Aufräumen-Menü der Anrufliste */
@media (max-width: 1000px) {
  .calls-home:not([data-mode="recent"]) .calls-recent-filters .calls-cleanup { display: none; }
}

/* Handy: der Tab „Profil“ öffnet nur das Konto-Fenster (Mein Profil, Darstellung, Kontoeinstellungen, Abmelden) */
@media (max-width: 720px), (orientation: landscape) and (max-width: 1024px) and (pointer: coarse) {
  .sidebar .nav, .sidebar .notification-center, .sidebar .build-version, .sidebar .user-card { display: none !important; }
  .sidebar .user-menu { flex: 0 0 auto; }
  .sidebar .user-menu-popover, .sidebar .user-menu-popover[hidden] { display: block !important; position: static; width: 100%; max-height: none; margin: 8px 0 0; box-shadow: none; border-radius: 16px; }
}

/* Dunkelmodus: gleicher Braunverlauf von links unten nach rechts oben */
@media (max-width: 720px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  html[data-theme="dark"] { background: linear-gradient(to top right, color-mix(in srgb, var(--accent) 12%, var(--bg)) 0%, color-mix(in srgb, var(--accent) 30%, var(--bg)) 50%, color-mix(in srgb, var(--accent) 58%, var(--bg)) 100%) fixed; }
}
/* Anrufliste ohne Filterzeile: mehr Platz, nur das ⋯ bleibt */
.calls-recent-filters { min-height: 0; padding: 0; margin: 0; }
@media (max-width: 1000px) { .calls-home .calls-recent-filters { padding: 0; height: 0; } }

/* ===== Performance (Handy): flüssigere Seitenwechsel =====
   Kein fixer Vollflächen-Verlauf auf <html> und kein riesiger box-shadow mehr: Verlauf liegt als eigene Ebene,
   die schwarzen Ecken sind vier kleine Verlaufs-Kacheln, Blur der unteren Leiste und will-change pro Zeile entfallen. */
@media (max-width: 720px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  html, html[data-theme="dark"] { background: #000; }
  body { background: transparent; }
  html::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; transform: translateZ(0);
    background: linear-gradient(to top right, color-mix(in srgb, var(--accent) 8%, var(--bg)) 0%, color-mix(in srgb, var(--accent) 28%, var(--bg)) 50%, color-mix(in srgb, var(--accent) 56%, var(--bg)) 100%); }
  html[data-theme="dark"]::before { background: linear-gradient(to top right, color-mix(in srgb, var(--accent) 12%, var(--bg)) 0%, color-mix(in srgb, var(--accent) 30%, var(--bg)) 50%, color-mix(in srgb, var(--accent) 58%, var(--bg)) 100%); }
  body::before { content: ""; position: fixed; inset: 0; z-index: 2147482999; pointer-events: none;
    background:
      radial-gradient(circle at 100% 100%, transparent 21px, #000 22px) top left / 22px 22px no-repeat,
      radial-gradient(circle at 0 100%, transparent 21px, #000 22px) top right / 22px 22px no-repeat,
      radial-gradient(circle at 100% 0, transparent 21px, #000 22px) bottom left / 22px 22px no-repeat,
      radial-gradient(circle at 0 0, transparent 21px, #000 22px) bottom right / 22px 22px no-repeat; }
  body::after { box-shadow: none; }
  .app-tabbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
  .calls-swipe-card > .calls-group-head, .calls-history-swipe > .calls-history-row { will-change: auto; }
}
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }
.route-view > * { animation: view-in .16s ease-out backwards; }

/* Profil-Seite in der App (Handy-Tab „Profil“) */
.account-page { display: grid; gap: 14px; max-width: 560px; margin: 0 auto; padding: 8px 2px 24px; }
.account-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; }
.account-head { display: flex; align-items: center; gap: 14px; padding: 18px; }
.account-head b { display: block; font-size: 18px; }
.account-head small { color: var(--muted); }
.account-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 12px 18px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); font: 500 16px var(--font); text-align: left; cursor: pointer; }
.account-row:first-child { border-top: 0; }
.account-row:active { background: var(--accent-soft); }
.account-row-icon { display: inline-flex; width: 24px; height: 24px; color: var(--accent); }
.account-row-icon svg { width: 100%; height: 100%; }
.account-row-label { flex: 1; }
.account-version-row { cursor: default; }
.account-version-row:active { background: transparent; }
.account-version-row .account-row-icon { flex-shrink: 0; }
.account-version-row .account-row-label { flex: 0 0 auto; }
.account-version-value { display: grid; gap: 3px; min-width: 0; margin-left: auto; text-align: right; font-size: 14px; overflow-wrap: anywhere; }
.account-version-value small { color: var(--muted); font-size: 12px; font-weight: 400; }
.performance-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.performance-controls .switch { margin-right: auto; }
.account-row[role="switch"] .account-theme-track { margin-left: auto; position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--border); transition: background-color .18s ease; }
.account-row[role="switch"] .account-theme-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.account-row[role="switch"][aria-checked="true"] .account-theme-track { background: var(--accent); }
.account-row[role="switch"][aria-checked="true"] .account-theme-track::after { transform: translateX(18px); }

/* ======================================================================
   Handy-Kalender im Stil des iPhone-Kalenders (calendar-ios.js)
   ====================================================================== */
.content.content-flush .ios-cal-page { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.ios-cal, .ios-sheet {
  --ios-red: #ff453a; --ios-event: #2f8f86; --ios-event-bg: rgba(47,143,134,.20); --ios-conference: #3b82f6; --ios-conference-bg: rgba(59,130,246,.20);
  --ios-task: var(--accent); --ios-task-bg: color-mix(in srgb, var(--accent) 22%, transparent); --ios-failed: #e5484d; --ios-failed-bg: rgba(229,72,77,.20);
  --ios-done: #3f9d5a; --ios-done-bg: rgba(63,157,90,.20); --ios-declined: var(--muted); --ios-declined-bg: rgba(128,128,128,.16);
  color: var(--text); font-family: var(--font);
}
.ios-cal { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; position: relative; }
:root[data-theme="dark"] :is(.ios-cal, .ios-sheet) { --ios-event: #5fd3c6; --ios-conference: #7ab0ff; --ios-failed: #ff7a7f; --ios-done: #6fd08a; }
:where(.ios-cal, .ios-sheet) :is(button, a) { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.ios-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 2px 4px; flex: 0 0 auto; }
.ios-chip { display: inline-flex; align-items: center; gap: 2px; min-height: 42px; padding: 0 16px 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 18px; font-weight: 600; cursor: pointer; text-transform: capitalize; }
.ios-pill { display: inline-flex; align-items: center; gap: 2px; padding: 0 4px; min-height: 44px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.ios-icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.ios-icon-btn.small { width: 34px; height: 34px; background: var(--surface-2); }
.ios-icon-btn:active { background: var(--accent-soft); }
.ios-badge { position: absolute; top: 3px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ios-red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.ios-cal-title { display: flex; align-items: baseline; gap: 10px; padding: 2px 6px 6px; flex: 0 0 auto; }
.ios-cal-title h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; text-transform: capitalize; }
.ios-cal-sub { color: var(--text-dim); font-size: 15px; font-weight: 600; text-transform: capitalize; }
.ios-cal-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.ios-cal-bottom { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px 4px; flex: 0 0 auto; }
.ios-today-btn { min-height: 44px; padding: 0 22px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 17px; font-weight: 700; cursor: pointer; }
/* Monat */
.ios-month { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.ios-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700; text-align: center; }
.ios-weekdays span:nth-child(n+6) { color: var(--muted); }
.ios-weeks { flex: 1 1 auto; min-height: 0; display: grid; grid-template-rows: repeat(6, minmax(0, 1fr)); }
.ios-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 0; border-top: 1px solid var(--border); }
.ios-week:first-child { border-top: 0; }
@keyframes ios-month-enter-up { from { opacity: .72; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ios-month-enter-down { from { opacity: .72; transform: translateY(-28px); } to { opacity: 1; transform: translateY(0); } }
.ios-period-swipe-up > :is(.ios-month, .ios-year) { animation: ios-month-enter-up .22s cubic-bezier(.2,.75,.25,1) both; }
.ios-period-swipe-down > :is(.ios-month, .ios-year) { animation: ios-month-enter-down .22s cubic-bezier(.2,.75,.25,1) both; }
.ios-day { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; min-height: 0; padding: 4px 1px 2px; border: 0; background: transparent; text-align: center; cursor: pointer; overflow: hidden; }
.ios-day .ios-num { align-self: center; display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 50%; font-size: 17px; font-weight: 700; }
.ios-day.weekend .ios-num, .ios-day.outside .ios-num { color: var(--muted); }
.ios-day.outside { opacity: .55; }
.ios-day.today .ios-num { background: var(--ios-red); color: #fff; }
.ios-day.selected:not(.today) .ios-num { background: var(--accent-soft); }
.ios-chipitem { display: block; padding: 1px 4px; border-radius: 4px; font-size: 10.5px; font-weight: 600; line-height: 1.35; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-more { font-size: 10px; color: var(--text-dim); text-align: left; padding-left: 4px; }
.ios-chipitem.event { background: var(--ios-event-bg); color: var(--ios-event); }
.ios-chipitem.conference { background: var(--ios-conference-bg); color: var(--ios-conference); }
.ios-chipitem.task { background: var(--ios-task-bg); color: var(--ios-task); }
.ios-chipitem.failed { background: var(--ios-failed-bg); color: var(--ios-failed); }
.ios-chipitem.done { background: var(--ios-done-bg); color: var(--ios-done); }
.ios-chipitem.declined { background: var(--ios-declined-bg); color: var(--ios-declined); text-decoration: line-through; }
/* Jahr */
.ios-year { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; padding: 6px 4px 10px; overflow-y: auto; align-content: start; }
.ios-mini { padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.ios-mini b { display: block; margin-bottom: 4px; font-size: 16px; font-weight: 700; text-transform: capitalize; }
.ios-mini.current b { color: var(--ios-red); }
.ios-mini-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px 0; font-size: 8.5px; font-weight: 600; text-align: center; }
.ios-mini-days span, .ios-mini-days i { display: block; min-height: 12px; line-height: 12px; }
.ios-mini-days span.today { background: var(--ios-red); color: #fff; border-radius: 50%; }
.ios-mini-days span.has:not(.today) { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
/* Woche / Tag */
.ios-dayview { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.ios-strip { display: grid; grid-template-columns: repeat(7, 1fr); padding: 2px 0 6px; border-bottom: 1px solid var(--border); }
.ios-strip-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0; border: 0; background: none; cursor: pointer; }
.ios-strip-day small, .ios-time-day small { color: var(--text-dim); font-size: 12px; font-weight: 700; text-transform: capitalize; }
.ios-strip-day b, .ios-time-day b { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-size: 19px; font-weight: 700; }
.ios-strip-day.today b, .ios-time-day.today b { color: var(--ios-red); }
.ios-strip-day.selected b, .ios-time-day.selected b { background: var(--text); color: var(--bg); }
.ios-strip-day.selected.today b, .ios-time-day.selected.today b { background: var(--ios-red); color: #fff; }
.ios-time { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.ios-time-head { display: flex; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.ios-time.single .ios-time-head { display: none; }
.ios-time-gutter { flex: 0 0 40px; }
.ios-time-day { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; padding: 2px 0 4px; border: 0; background: none; cursor: pointer; }
.ios-time-scroll { position: relative; display: flex; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ios-hours { position: relative; flex: 0 0 40px; height: 1248px; }
.ios-hours span { position: absolute; right: 6px; transform: translateY(-50%); color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ios-columns { position: relative; display: flex; flex: 1 1 auto; min-width: 0; }
.ios-column { position: relative; flex: 1 1 0; min-width: 0; border-left: 1px solid var(--border); }
.ios-hline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); pointer-events: none; }
.ios-block { position: absolute; display: flex; flex-direction: column; gap: 1px; padding: 2px 4px; border: 0; border-left: 3px solid currentColor; border-radius: 6px; font-size: 11px; line-height: 1.25; text-align: left; overflow: hidden; cursor: pointer; }
.ios-block b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-block span { font-size: 10.5px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-time.single .ios-block { font-size: 13px; padding: 4px 8px; }
.ios-block.event { background: var(--ios-event-bg); color: var(--ios-event); }
.ios-block.conference { background: var(--ios-conference-bg); color: var(--ios-conference); }
.ios-block.task { background: var(--ios-task-bg); color: var(--ios-task); }
.ios-block.failed { background: var(--ios-failed-bg); color: var(--ios-failed); }
.ios-block.done { background: var(--ios-done-bg); color: var(--ios-done); }
.ios-block.declined { background: var(--ios-declined-bg); color: var(--ios-declined); }
.ios-now { position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px; background: var(--ios-red); pointer-events: none; z-index: 2; }
.ios-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ios-red); }
.ios-now span { position: absolute; left: -44px; top: -9px; padding: 0 3px; border-radius: 4px; background: var(--bg); color: var(--ios-red); font-size: 11px; font-weight: 700; }
.ios-time:not(.single) .ios-now span { display: none; }
/* Sheets */
.ios-sheet-backdrop { position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.45); animation: ios-fade .18s ease; }
.ios-sheet { position: fixed; z-index: 9001; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 640px; max-height: 88dvh; display: flex; flex-direction: column; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 -8px 30px rgba(0,0,0,.35); animation: ios-up .22s ease; padding-bottom: env(safe-area-inset-bottom); }
.ios-sheet.wide { height: 82dvh; }
.ios-sheet-grip { width: 38px; height: 5px; margin: 8px auto 2px; border-radius: 3px; background: var(--border-strong); flex: 0 0 auto; }
.ios-sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 4px 12px 8px; flex: 0 0 auto; }
.ios-sheet-head > :last-child { justify-self: end; }
.ios-sheet-head strong { font-size: 17px; text-transform: capitalize; text-align: center; }
.ios-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 14px 22px; overscroll-behavior: contain; }
@keyframes ios-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes ios-fade { from { opacity: 0; } to { opacity: 1; } }
.ios-list { display: flex; flex-direction: column; gap: 2px; }
.ios-row { display: grid; grid-template-columns: 68px 4px minmax(0, 1fr); align-items: stretch; gap: 10px; padding: 8px 4px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.ios-row:active { background: var(--accent-soft); }
.ios-row-time { display: flex; flex-direction: column; text-align: right; font-variant-numeric: tabular-nums; }
.ios-row-time b { font-size: 14px; white-space: nowrap; }
.ios-row-time small, .ios-row-text small { color: var(--text-dim); font-size: 12px; }
.ios-row-bar { border-radius: 2px; background: currentColor; }
.ios-row.event .ios-row-bar { color: var(--ios-event); } .ios-row.conference .ios-row-bar { color: var(--ios-conference); } .ios-row.task .ios-row-bar { color: var(--ios-task); }
.ios-row.failed .ios-row-bar { color: var(--ios-failed); } .ios-row.done .ios-row-bar { color: var(--ios-done); } .ios-row.declined .ios-row-bar { color: var(--ios-declined); }
.ios-row-text { display: flex; flex-direction: column; min-width: 0; }
.ios-row-text b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-empty { margin: 18px 0; color: var(--text-dim); text-align: center; }
.ios-actions { display: flex; gap: 10px; margin-top: 14px; }
.ios-primary, .ios-secondary, .ios-danger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 1 0; min-height: 46px; padding: 0 14px; border: 0; border-radius: 13px; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; }
.ios-primary { background: var(--accent); color: var(--accent-text); }
.ios-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.ios-danger { background: var(--surface-2); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 38%, var(--border)); }
.ios-detail-head { padding-left: 12px; border-left: 5px solid currentColor; margin-bottom: 14px; }
.ios-detail-head.event { color: var(--ios-event); } .ios-detail-head.conference { color: var(--ios-conference); } .ios-detail-head.task { color: var(--ios-task); }
.ios-detail-head.failed { color: var(--ios-failed); } .ios-detail-head.done { color: var(--ios-done); } .ios-detail-head.declined { color: var(--ios-declined); }
.ios-detail-head h2 { margin: 2px 0 0; color: var(--text); font-size: 24px; line-height: 1.2; }
.ios-detail-kind { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.ios-facts { margin: 0 0 12px; display: flex; flex-direction: column; gap: 12px; }
.ios-facts > div { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; }
.ios-facts dt { color: var(--text-dim); padding-top: 1px; } .ios-facts dd { margin: 0; display: flex; flex-direction: column; }
.ios-facts dd small { color: var(--text-dim); }
.ios-description { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); white-space: pre-wrap; }
.ios-detail .calendar-event-extras { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.ios-menu { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.ios-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 8px 16px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; font-size: 17px; text-decoration: none; color: var(--text); cursor: pointer; }
.ios-menu-row:first-child { border-top: 0; } .ios-menu-row.active { color: var(--accent); font-weight: 700; }
.ios-menu-row span { display: flex; flex-direction: column; } .ios-menu-row small { color: var(--text-dim); font-size: 12px; font-weight: 400; }
.ios-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
.ios-summary > div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); }
.ios-summary b { font-size: 26px; } .ios-summary small { color: var(--text-dim); font-size: 12px; }
.ios-group h3 { margin: 18px 0 6px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.ios-search { width: 100%; min-height: 44px; margin-bottom: 8px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 17px; }
@media (max-height: 520px) and (orientation: landscape) {
  .ios-cal-title h1 { font-size: 22px; } .ios-chip, .ios-today-btn { min-height: 36px; } .ios-pill, .ios-icon-btn { min-height: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .ios-period-swipe-up > :is(.ios-month, .ios-year),
  .ios-period-swipe-down > :is(.ios-month, .ios-year) { animation: none; }
}
/* Die Handy-Kalenderseite füllt exakt den Bereich über der Tab-Leiste (wie der Messenger):
   #app bekommt die feste Viewport-Höhe, sodass Raster und Zeitleiste intern scrollen. */
#app:has(.ios-cal-page) { height: var(--app-viewport-height); }
#app:has(.ios-cal-page) .main { min-height: 0; }
.content.content-flush:has(.ios-cal-page) { padding: 6px 8px 0; }

/* Desktop popup windows: keep layout and touch presentation unchanged until used. */
.popup-window-grip { display: none; }
.desktop-popup-controls .popup-window-enabled:not(dialog) { position: relative; }
.desktop-popup-controls .popup-window-enabled > :is(.modal-head, .drawer-head, .agent-editor-head) { cursor: grab; touch-action: none; }
.desktop-popup-controls :is(.modal, .drawer, .agent-editor).popup-window-positioned {
  position: fixed !important; inset: auto !important;
  left: var(--popup-left) !important; top: var(--popup-top) !important;
  width: var(--popup-width) !important; height: var(--popup-height) !important;
  min-width: 0 !important; min-height: 0 !important;
  max-width: calc(100vw - 16px) !important; max-height: calc(100vh - 16px) !important;
  margin: 0 !important; box-sizing: border-box; transform: none !important;
}
.desktop-popup-controls .popup-window-grip { display: block; position: absolute; z-index: 30; touch-action: none; }
.desktop-popup-controls .popup-window-grip-n { top: 0; left: 10px; right: 10px; height: 5px; cursor: ns-resize; }
.desktop-popup-controls .popup-window-grip-s { bottom: 0; left: 10px; right: 10px; height: 5px; cursor: ns-resize; }
.desktop-popup-controls .popup-window-grip-e { right: 0; top: 10px; bottom: 10px; width: 5px; cursor: ew-resize; }
.desktop-popup-controls .popup-window-grip-w { left: 0; top: 10px; bottom: 10px; width: 5px; cursor: ew-resize; }
.desktop-popup-controls :is(.popup-window-grip-ne, .popup-window-grip-nw, .popup-window-grip-se, .popup-window-grip-sw) { width: 12px; height: 12px; }
.desktop-popup-controls .popup-window-grip-ne { top: 0; right: 0; cursor: nesw-resize; }
.desktop-popup-controls .popup-window-grip-nw { top: 0; left: 0; cursor: nwse-resize; }
.desktop-popup-controls .popup-window-grip-se { bottom: 0; right: 0; cursor: nwse-resize; }
.desktop-popup-controls .popup-window-grip-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.desktop-popup-controls .popup-window-grip-se::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 6px; height: 6px; border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim); opacity: .6; }
.popup-window-interacting, .popup-window-interacting * { user-select: none !important; }
.popup-window-interacting .popup-window-enabled > :is(.modal-head, .drawer-head, .agent-editor-head) { cursor: grabbing; }

/* Lange Chatverläufe: Offscreen-Zeilen überspringt der Browser beim Rendern (keine Änderung der Scroll-Logik). */
.ms-long .ms-message-row { content-visibility: auto; contain-intrinsic-size: auto 72px; }

/* iPhone-Kalender eingebettet (Agenten-Editor, Task-Seite): feste Höhe statt Vollfläche. */
.ios-cal-embed { display: flex; flex-direction: column; height: min(calc(var(--app-viewport-height, 100vh) - 150px), 720px); min-height: 420px; margin-top: 8px; }
.ios-cal-embed .ios-cal { flex: 1 1 auto; min-height: 0; }

/* ======================================================================
   Erscheinungsbild „Cave“ (Profil → Darstellung): dunkle Höhle als Hintergrund,
   Kalender, Chatliste, Chats und Agenten-Chats liegen als Glasflächen darüber.
   data-theme bleibt „dark“ (alle Dunkel-Regeln gelten), data-skin="cave" legt das Bild darüber.
   Bild: web/static/web/cave.webp (querformatig, wird mit cover zugeschnitten).
   ====================================================================== */
:root[data-skin="cave"] {
  --cave-glass: rgba(38, 18, 8, .56);
  --cave-glass-strong: rgba(34, 16, 7, .72);
  --cave-edge: rgba(255, 158, 72, .34);
  --cave-edge-soft: rgba(255, 190, 120, .16);
  --cave-glow: #ff9a42;
  --bg: #1a0d06;
  --accent: #f3a561;
  --accent-soft: rgba(243, 165, 97, .22);
  --text-dim: #f0d3b8;
  --muted: #cfae90;
  --border: rgba(255, 190, 120, .20);
  --border-strong: rgba(255, 170, 90, .36);
}
:root[data-skin="cave"], :root[data-skin="cave"] body { background: #1a0d06; }
:root[data-skin="cave"] body { background: transparent; }
/* Eigenes festes Element statt ::before auf <html>: iOS/WKWebView zeichnete den Pseudo-Hintergrund auf dem Wurzelelement nicht zuverlässig. */
.cave-backdrop { display: none; }
:root[data-skin="cave"] .cave-backdrop {
  display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(16, 7, 3, .30), rgba(16, 7, 3, .52)),
    url("cave.4cf58c199b37.webp") center / cover no-repeat;
  -webkit-transform: translateZ(0); transform: translateZ(0);
}
/* Flächen, die sonst deckend sind, werden durchsichtig; Dialoge/Sheets bleiben deckend. */
:root[data-skin="cave"] :is(#app, .main, .content, .topbar, .content-heading) { background: transparent; }
:root[data-skin="cave"] .sidebar {
  background: var(--cave-glass); border-right: 1px solid var(--cave-edge-soft);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
}
:root[data-skin="cave"] .app-tabbar {
  background: var(--cave-glass-strong); border-color: var(--cave-edge-soft); box-shadow: 0 -8px 28px rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(18px) saturate(1.25); backdrop-filter: blur(18px) saturate(1.25);
}
:root[data-skin="cave"] .app-tab.active, :root[data-skin="cave"] .app-tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

/* Chat: Liste, Chat-Fläche, Blasen, Kopf und Eingabe (gilt für alle Chats inkl. Agenten-Chats). */
:root[data-skin="cave"] .ms-theme { --ms-wall: transparent; --ms-wave: transparent;
  --ms-glass: var(--cave-glass); --ms-glass-border: var(--cave-edge);
  --ms-theirs-bg: rgba(38, 18, 8, .66); --ms-theirs-fg: #fbeee0; --ms-theirs-border: var(--cave-edge);
  --ms-mine-bg: rgba(120, 62, 24, .72); --ms-mine-fg: #fff3e4; }
:root[data-skin="cave"] :is(.ms-shell, .ms-list-panel, .ms-list-head, .ms-chat-panel, .ms-shell .ms-chat-panel) { background: transparent; }
:root[data-skin="cave"] .ms-list-panel { border-right-color: var(--cave-edge-soft); }
:root[data-skin="cave"] .ms-chips { border-bottom: 0; }
:root[data-skin="cave"] .ms-chip { background: transparent; border-color: var(--cave-edge); color: var(--text); }
:root[data-skin="cave"] .ms-chip.active { background: linear-gradient(180deg, rgba(255, 160, 80, .42), rgba(190, 100, 40, .42)); color: var(--cave-glow); border-color: var(--cave-edge); }
:root[data-skin="cave"] .ms-search input { background: var(--cave-glass); border-color: var(--cave-edge-soft); color: var(--text);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
:root[data-skin="cave"] .ms-round { background: var(--cave-glass); color: var(--text); border: 1px solid var(--cave-edge-soft); }
:root[data-skin="cave"] .ms-round.ms-new { background: linear-gradient(180deg, #f6a65c, #e48a3e); color: #2b1608; border-color: transparent; }
:root[data-skin="cave"] .ms-thread-list { padding: 4px 10px 12px; }
:root[data-skin="cave"] .ms-thread {
  width: 100%; margin: 0 0 8px; border: 1px solid var(--cave-edge); border-radius: 16px; background: var(--cave-glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}
:root[data-skin="cave"] .ms-thread:hover { background: rgba(58, 28, 12, .66); }
:root[data-skin="cave"] .ms-thread.active { background: rgba(120, 62, 24, .56); border-color: var(--cave-glow); }
:root[data-skin="cave"] .ms-section { color: var(--cave-glow); }
:root[data-skin="cave"] .ms-shell .ms-input-pill {
  background: var(--cave-glass-strong); border-color: var(--cave-edge); box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
:root[data-skin="cave"] .ms-shell .ms-send { background: linear-gradient(180deg, #f6a65c, #e48a3e); color: #2b1608; }
:root[data-skin="cave"] .ms-shell .ms-chat-head { box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
:root[data-skin="cave"] .ms-shell .ms-day { background: var(--cave-glass); border-color: var(--cave-edge-soft); }
:root[data-skin="cave"] .ms-chat-empty { color: var(--text-dim); }

/* Kalender (iPhone-Stil): Raster auf dem Bild, Kapseln als Glas. */
:root[data-skin="cave"] .ios-cal-page, :root[data-skin="cave"] .ios-cal, :root[data-skin="cave"] .ios-cal-body { background: transparent; }
:root[data-skin="cave"] .ios-cal { text-shadow: 0 1px 6px rgba(0, 0, 0, .55); }
:root[data-skin="cave"] :is(.ios-chip, .ios-pill, .ios-today-btn) {
  background: var(--cave-glass-strong); border-color: var(--cave-edge-soft); color: #fff3e4; text-shadow: none;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
:root[data-skin="cave"] .ios-icon-btn.small { background: var(--cave-glass); }
:root[data-skin="cave"] .ios-weekdays, :root[data-skin="cave"] .ios-week { border-color: rgba(255, 255, 255, .22); }
:root[data-skin="cave"] .ios-day { color: #fff7ee; }
:root[data-skin="cave"] .ios-day.weekend .ios-num, :root[data-skin="cave"] .ios-day.outside .ios-num { color: rgba(255, 244, 230, .62); }
:root[data-skin="cave"] .ios-day.selected:not(.today) .ios-num { background: rgba(255, 255, 255, .24); }

/* Vorschau in „Profil → Darstellung“. */
.profile-theme-swatch[data-preview-theme="cave"] { background: linear-gradient(135deg, #3a1a08 0%, #b8651f 48%, #14305c 100%); }
.profile-theme-swatch[data-preview-theme="cave"] .profile-theme-swatch-sidebar { background: rgba(26, 12, 5, .78); }
.profile-theme-swatch[data-preview-theme="cave"] i { background: rgba(255, 240, 220, .30); border: 1px solid rgba(255, 170, 90, .5); }
.profile-theme-swatch[data-preview-theme="cave"] i:first-child { background: #f3a561; }

/* Task-Liste: Platz für die Statuszeile bleibt reserviert, damit die Tabelle beim Laden nicht nach unten springt. */
.work-management > p.hint[role="status"] { min-height: 1.5em; margin: 8px 0; }

/* Fehlermeldung der Anrufansicht (z. B. „Gespräch beendet“): als eigenes Banner UNTER der Kopfzeile, nie über Titel oder Pfeil. */
#liveError:not([hidden]) {
  position: fixed; z-index: 45; left: 14px; right: 14px; margin: 0;
  top: calc(var(--call-safe-top, env(safe-area-inset-top, 0px)) + 64px);
  padding: 10px 14px; border-radius: 12px; text-align: center; font-size: 13.5px; line-height: 1.35;
  background: rgba(46, 14, 12, .94); color: #ffc2b8; border: 1px solid rgba(229, 72, 77, .55);
}

/* Kalender-Einstellungen: Agenten-Zugriff, Erinnerungen, Ruhezeiten */
.calendar-setting-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; }
.calendar-setting-row input { margin-top: 4px; flex: 0 0 auto; }
.calendar-setting-row span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calendar-setting-quiet { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calendar-setting-lead { display: grid; grid-template-columns: 1fr 110px auto; align-items: center; gap: 8px; padding: 3px 0; }
.calendar-setting-lead input { width: 100%; }
.calendar-access-panel { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.calendar-phone-sync { margin-top: 12px; }
.calendar-phone-row { display: grid; grid-template-columns: auto 1fr minmax(120px, 190px); align-items: center; gap: 8px; padding: 4px 0; }
.calendar-phone-row span { display: flex; flex-direction: column; min-width: 0; }
.calendar-phone-row select { min-width: 0; }

/* Teilnehmerauswahl wie bei Microsoft Teams: Vorschlagsliste unter dem Feld, Chips mit Avatar */
.calendar-participant-search { position: relative; display: block; }
.calendar-participant-search input { width: 100%; }
.calendar-participant-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 260px; box-shadow: 0 12px 32px rgba(0, 0, 0, .35); }
.calendar-person-result { display: flex; align-items: center; gap: 10px; text-align: left; }
.calendar-person-result.active { background: var(--accent-soft); }
.calendar-person-text { display: grid; gap: 1px; min-width: 0; }
.calendar-person-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-person-avatar { display: inline-grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.calendar-person-avatar.agent { background: rgba(120, 160, 255, .22); color: #9db9ff; }
.calendar-person-avatar.external { background: rgba(255, 255, 255, .12); color: var(--text-dim); }
.calendar-participant-chip.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.calendar-participant-chip.pill .calendar-person-avatar { flex-basis: 24px; width: 24px; height: 24px; font-size: 10px; }
.calendar-chip-label { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-chip-remove { border: 0; background: transparent; color: var(--text-dim); font: inherit; line-height: 1; padding: 2px 8px 2px 2px; cursor: pointer; }
.calendar-chip-remove:hover { color: var(--text); }
.calendar-person-empty { margin: 0; padding: 10px 12px; }
.calendar-participant-search input[type="search"]::-webkit-search-cancel-button, .calendar-participant-search input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.calendar-chip-label { display: inline-flex; align-items: baseline; gap: 6px; }
.calendar-chip-email { color: var(--text-dim); font-size: 11px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.calendar-conference-auto { margin: 6px 0 0; }

.agent-assignment-dialog { width: min(760px, calc(100vw - 24px)); }
.agent-assignment-dialog .skill-binding-body { min-width: 0; }
@media (max-width: 480px) {
  .agent-skill-card-shell { flex-wrap: wrap; gap: 0; padding: 0; }
  .agent-skill-card-shell > .agent-skill-static { flex-basis: 100%; }
  .agent-skill-actions { display:grid;grid-template-columns:minmax(0,1fr) auto;flex:1 1 100%;min-width:0;width:100%;margin:0;padding:0 12px 12px;box-sizing:border-box; }
  .agent-skill-actions .assignment-switches {grid-column:1 / -1;min-width:0;gap:4px;}
  .agent-skill-actions .agent-editor-switch {padding:8px 4px;gap:8px;font-size:12px;}
  .agent-skill-actions .agent-channel-edit {justify-self:start;}
  .agent-skill-actions .agent-skill-remove {justify-self:end;}
}

.agent-assignment-sections > [hidden] { display: none !important; }
.agent-assignment-tabs { flex-wrap: wrap; }
.agent-assignment-tabs .btn { flex: 0 0 auto; min-width: 0; }

.assignment-switches { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.assignment-access-editor { margin-block: 12px; }
.assignment-access-editor select[multiple] { min-height: 110px; }

.account-menu-language { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 7px 12px; font: 500 14px var(--font); }
.account-language-label { flex: 1; }
.account-language-choices { display: flex; flex-shrink: 0; gap: 4px; }
:is(.user-menu-popover, .account-page) .account-language-choices button { width: 32px; min-height: 32px; padding: 4px; justify-content: center; border: 1px solid transparent; font-size: 18px; line-height: 1; }
:is(.user-menu-popover, .account-page) .account-language-choices button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
:is(.user-menu-popover, .account-page) .account-language-choices button:disabled { opacity: .6; cursor: wait; }

.account-language-row { cursor: default; }
.account-language-row .account-row-icon { flex-shrink: 0; }
.account-language-row .account-language-choices button { border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; }
.account-language-row .account-language-choices button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Samsung Smart TV */
.tv-page { display: grid; gap: 14px; max-width: 560px; }
.tv-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tv-chip { border: 1px solid var(--line, #3a3f4b); background: transparent; color: inherit; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.tv-chip.active { background: var(--accent, #3b82f6); border-color: transparent; color: #fff; }
.tv-add summary { cursor: pointer; font-weight: 600; }
.tv-row, .tv-found { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.tv-row input, .tv-row select { flex: 1 1 140px; min-width: 0; }
.tv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tv-head h3 { margin: 0; }
.tv-badge { font-size: 12px; border-radius: 999px; padding: 2px 10px; border: 1px solid var(--line, #3a3f4b); }
.tv-badge.sim { background: #8b5cf6; border-color: transparent; color: #fff; }
.tv-badge.ok { background: #16a34a; border-color: transparent; color: #fff; }
.tv-badge.warn { background: #b45309; border-color: transparent; color: #fff; }
.tv-result { padding: 8px 12px; border-radius: 8px; margin-top: 10px; background: rgba(127,127,127,.15); }
.tv-result.ok { border-left: 4px solid #16a34a; } .tv-result.sent { border-left: 4px solid #d97706; } .tv-result.error { border-left: 4px solid #dc2626; }
.tv-demo { margin: 8px 0 0; padding-left: 20px; } .tv-demo .error { color: #dc2626; }
.tv-state { display: grid; gap: 4px; margin-top: 10px; padding: 10px; border: 1px dashed #8b5cf6; border-radius: 10px; }
.tv-screen { height: 84px; display: grid; place-items: center; border-radius: 8px; font-weight: 700; letter-spacing: .08em; }
.tv-screen.on { background: linear-gradient(135deg, #1e3a8a, #6d28d9); color: #fff; } .tv-screen.off { background: #111; color: #555; }
.tv-state-row { display: flex; justify-content: space-between; }
.tv-remote { display: grid; gap: 14px; margin-top: 12px; justify-items: center; }
.tv-remote > * { width: 100%; max-width: 280px; }
.tv-body { display: grid; gap: 22px; padding: 22px 26px 28px; border-radius: 34px 34px 44px 44px; background: linear-gradient(180deg, #2b2b2e, #141416); box-shadow: inset 0 1px 2px rgba(255,255,255,.18), 0 10px 28px rgba(0,0,0,.35); color: #e8e8ea; }
.tv-key { min-height: 44px; border-radius: 14px; border: 1px solid var(--line, #3a3f4b); background: var(--panel, rgba(255,255,255,.06)); color: inherit; font-size: 17px; cursor: pointer; touch-action: manipulation; }
.tv-key {transition:background-color .1s,box-shadow .1s,filter .1s,transform .1s; -webkit-tap-highlight-color:transparent;}
.tv-key:active,.tv-key.is-pressed { transform: scale(.97); filter: brightness(1.18); }
.tv-body .tv-key:active,.tv-body .tv-key.is-pressed {background-color:#38383d;box-shadow:inset 0 2px 6px #0009,0 1px 1px #ffffff12;}
.tv-body .tv-dpad-ring .tv-key:active,.tv-body .tv-dpad-ring .tv-key.is-pressed {background:rgba(255,255,255,.12);box-shadow:inset 0 2px 5px #0006;}
.tv-body .tv-bar .tv-key:active,.tv-body .tv-bar .tv-key.is-pressed {background:rgba(255,255,255,.1);}
.tv-body .tv-key.power.mute.tone-on:active,.tv-body .tv-key.power.mute.tone-on.is-pressed {background-color:#22c55e;}
.tv-body .tv-key.power.mute.active:active,.tv-body .tv-key.power.mute.active.is-pressed {background-color:#ef4444;}
.tv-key > .agent-channel-icon {width:24px;height:24px;display:inline-block;vertical-align:middle;flex-shrink:0;pointer-events:none;}
.tv-panel-head {display:none;}
.tv-control .tv-panel-head {display:flex;position:sticky;top:0;z-index:3;justify-content:flex-start;padding-bottom:8px;background:inherit;}
.tv-control .tv-panel-head .tv-key {display:inline-flex;align-items:center;gap:8px;min-height:44px;}
.tv-body .tv-key { border: 0; background: #1d1d20; color: #e8e8ea; box-shadow: inset 0 1px 1px rgba(255,255,255,.12), 0 2px 4px rgba(0,0,0,.5); }
.tv-power-row { display: flex; gap: 14px; }
.tv-key.power { width: 54px; height: 54px; min-height: 0; border-radius: 50%; font-size: 22px; }
.tv-power-row .mute { margin-left: auto; }
.tv-body .tv-key.power.off { color: #ff6b6b; } .tv-body .tv-key.power.on { color: #4ade80; }
.tv-pill-row { display: flex; justify-content: space-between; }
.tv-pill { width: 62px; height: 62px; min-height: 0; border-radius: 50% !important; font-size: 13px; font-weight: 700; }
.tv-dpad-ring { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 100%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #3a3a3e 0%, #232326 62%, #1a1a1c 100%); box-shadow: inset 0 3px 8px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.1); padding: 6px; }
.tv-body .tv-dpad-ring .tv-key { background: transparent; box-shadow: none; border-radius: 50%; font-size: 20px; min-height: 0; color: #cfcfd3; }
.tv-dpad-ring .up { grid-area: 1 / 2; } .tv-dpad-ring .left { grid-area: 2 / 1; } .tv-dpad-ring .right { grid-area: 2 / 3; } .tv-dpad-ring .down { grid-area: 3 / 2; }
.tv-body .tv-dpad-ring .ok { grid-area: 2 / 2; background: radial-gradient(circle at 40% 35%, #2c2c30, #0e0e10); box-shadow: inset 0 2px 6px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.12); }
.tv-nav { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 2px; }
.tv-nav .tv-key { width: 56px; height: 56px; min-height: 0; border-radius: 50% !important; font-size: 20px; }
.tv-nav .home { margin-bottom: -22px; width: 62px; height: 62px; }
.tv-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-radius: 12px; background: #1d1d20; box-shadow: inset 0 1px 1px rgba(255,255,255,.12), 0 2px 4px rgba(0,0,0,.5); margin-top: 8px; }
.tv-body .tv-bar .tv-key { background: transparent; box-shadow: none; min-height: 58px; font-size: 24px; border-radius: 12px; }
.tv-bar-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; opacity: .75; padding: 0 8px; }
.tv-panel { padding: 14px; border-radius: 18px; background: rgba(127,127,127,.14); display: grid; gap: 12px; }
.tv-panel[hidden] { display: none; }
.tv-media { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tv-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tv-key.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; font-size: 14px; }
.tv-digits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tv-agents { display: grid; gap: 6px; margin-top: 8px; }
.tv-channel-box summary { cursor: pointer; font-weight: 600; }
.tv-channel-row input[type="number"] { flex: 0 0 90px; }

/* Samsung Smart TV: ruhigere, kartenartige Darstellung */
.tv-page { gap: 16px; }
.tv-detail { display: grid; gap: 14px; }
.tv-head { padding: 14px 16px 0; }
.tv-head h3 { font-size: 20px; }
.tv-place {display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:0 16px;color:var(--text-dim)}
.tv-options {margin:0 16px}
.tv-options > summary {cursor:pointer;font-weight:600}
.tv-options[open] > * + * {margin-top:12px}
.tv-detail > .hint { padding: 0 16px; margin-top: -8px; }
.tv-detail > .tv-row { padding: 0 16px; }
.tv-detail .tv-row .btn { min-height: 40px; }
.tv-result { margin: 0 16px; }
.tv-add { display: grid; gap: 18px; border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.tv-add-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tv-add-heading .btn { display: inline-flex; align-items: center; gap: 8px; }
.tv-add-heading svg { width: 16px; height: 16px; }
.tv-add-fields { min-width: 0; }
.tv-add-fields .field { min-width: 0; margin: 0; }
.tv-add-fields input { width: 100%; min-width: 0; }
.tv-add-actions { display: flex; justify-content: flex-end; gap: 10px; }
.tv-add .tv-found { margin: 0; }
.tv-add .tv-found:empty { display: none; }
.modal .tv-page:not(.tv-page-control) { width: 100%; max-width: none; }
.modal .tv-add { padding: 0; border: 0; border-radius: 0; }
.modal.agent-assignment-dialog.tv-setup-dialog { width: 640px; }
.tv-channel-box, .tv-detail > details { border: 1px solid var(--line, rgba(127,127,127,.35)); border-radius: 14px; padding: 12px 16px; }
.tv-locked { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 16px; border-radius: 18px; background: rgba(127,127,127,.12); }
.tv-locked p { margin: 0; }
.tv-ghost { width: 100%; opacity: .35; pointer-events: none; filter: grayscale(.6); transform: scale(.94); }

.tv-badge.bad { background: #dc2626; border-color: transparent; color: #fff; }
.tv-body .tv-key.power.mute.active { background: #dc2626; color: #fff; }
.tv-body .tv-key.power.mute.tone-on { background: #16a34a; color: #fff; }
.tv-remote-status {justify-self:center;align-self:center;font-size:10.5px;font-weight:600;letter-spacing:.07em;color:#9b9b9f;text-shadow:0 -1px 0 #0008,0 1px 0 #ffffff0a;background:none;border:0;padding:0;line-height:1.3;}
.tv-remote-status.bad {color:#d6aaa5;}

.tv-offline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 16px; padding: 10px 14px; border-radius: 10px; background: rgba(220,38,38,.14); border-left: 4px solid #dc2626; }
.tv-offline[hidden] { display: none; }

/* Shared remote fills the available phone viewport, including native safe areas. */
.device-control-page { display: flex; flex-direction: column; gap: 10px; min-height: 650px; max-width: 480px; margin: auto; }
.device-control-header { display: flex; gap: 10px; align-items: center; flex: 0 0 auto; }
.device-control-header select {flex:1;min-width:0;max-width:100%;min-height:44px;padding:8px 12px;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--text);font:inherit;text-overflow:ellipsis;}
.device-control-back {display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;padding:0;}
.device-control-back .agent-channel-icon {width:24px;height:24px;}
body.device-control-active .app-tabbar,body.device-control-active .rail-toggle,body.device-control-active .sidebar {display:none !important;}
body.device-control-active .main {padding:0 !important;}
body.device-control-active .content {padding:0;overflow:visible;}
body.device-control-active .device-control-page {z-index:10000;}
.device-control-content, .device-control-host, .tv-page-control, .tv-control { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.tv-page-control { max-width: none; }
.tv-control { gap: 8px; }
.tv-control > .tv-badge { align-self: center; }
.tv-control .tv-result { flex: 0 0 auto; margin: 0; }
.tv-control .tv-result[hidden] { display: none; }
.tv-control .tv-remote { position: relative; flex: 1; min-height: 0; margin: 0; width: calc(100% - 20px); align-self: center; }
.tv-control .tv-body { max-width: none; width: 100%; min-height: 0; height: 100%; gap: clamp(8px, 1.6dvh, 18px); padding: 12px 22px; align-content: space-between; }
.tv-control .tv-key.power, .tv-control .tv-pill, .tv-control .tv-nav .tv-key { width: clamp(44px, 6.3dvh, 58px); height: clamp(44px, 6.3dvh, 58px); }
.tv-control .tv-nav .home { margin-bottom: 0; }
.tv-control .tv-bar { margin-top: 0; }
.tv-control .tv-bar .tv-key { min-height: clamp(44px, 6.3dvh, 58px); }
.tv-control .tv-dpad-ring { width: min(100%, 31dvh); min-width: 150px; justify-self: center; }
.tv-control .tv-panel:not([hidden]) { position: absolute; inset: 0; overflow: auto; z-index: 2; background: #252528; color: #e8e8ea; align-content: start; }
.tv-remote-dialog .modal { display: flex; flex-direction: column; width: min(480px, 100vw); height: var(--app-viewport-height); max-height: var(--app-viewport-height); }
.tv-remote-dialog .modal-body { display: flex; flex: 1; min-height: 0; overflow: auto; }
.tv-remote-dialog .modal-foot { display: none; }
@media (max-width: 760px) {
  .device-control-page { position: fixed; inset: 0; z-index: 1000; max-width: none; min-height: 0; height: var(--app-viewport-height); background: var(--bg); padding: calc(env(safe-area-inset-top) + 8px) 12px calc(env(safe-area-inset-bottom) + 8px); overflow: auto; }
  .tv-remote-dialog { padding: 0 !important; }
  .tv-remote-dialog .modal { width: 100%; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}
@media (orientation:landscape) and (max-height:600px) {
  .device-control-page {position:fixed;inset:0;max-width:none;min-height:0;height:var(--app-viewport-height);overflow:auto;background:var(--bg);gap:4px;padding:calc(env(safe-area-inset-top) + 6px) max(12px,env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 6px) max(12px,env(safe-area-inset-left));}
  .device-control-header select {font-size:14px;}
  .tv-control {gap:4px;}
  .tv-control > .hint {margin:0;font-size:11px;}
  .tv-control .tv-body {display:grid;grid-template-columns:minmax(140px,1fr) minmax(130px,1.2fr) minmax(130px,1fr);grid-template-areas:"power pad volume" "pills pad channel" "nav pad status";grid-template-rows:repeat(3,minmax(44px,1fr));gap:6px 16px;padding:10px 18px;align-items:center;align-content:center;border-radius:26px;}
  .tv-control .tv-remote-status {grid-area:status;}
  .tv-control .tv-power-row {grid-area:power;gap:8px;}
  .tv-control .tv-pill-row {grid-area:pills;}
  .tv-control .tv-dpad-ring {grid-area:pad;min-width:0;width:min(100%,calc(100dvh - 140px));}
  .tv-control .tv-nav {grid-area:nav;}
  .tv-control .tv-bar:nth-last-child(2) {grid-area:volume;}
  .tv-control .tv-bar:last-child {grid-area:channel;}
  .tv-control .tv-key.power,.tv-control .tv-pill,.tv-control .tv-nav .tv-key {width:44px;height:44px;}
}

.personal-knowledge-list { display: grid; gap: 12px; margin-top: 16px; }
.personal-knowledge-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.personal-knowledge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.personal-knowledge-recipients { display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.personal-knowledge-dialog > form { display: flex; flex-direction: column; min-height: 0; max-height: 85vh; }
.profile-settings-editor button[hidden], .profile-settings-editor .agent-editor-foot-note[hidden], .personal-knowledge-recipients[hidden] { display: none !important; }
.personal-knowledge-actions .btn[aria-pressed="true"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--text-dim); }
.personal-knowledge-dropzone { border: 2px dashed var(--border); border-radius: 10px; padding: 16px; transition: border-color .15s, background .15s; }
.personal-knowledge-dropzone.drag-over { border-color: var(--text); background: var(--surface); }
.personal-knowledge-dropzone > .hint { margin-top: 0; }
.personal-knowledge-files { display: grid; gap: 6px; max-height: 180px; overflow-y: auto; }
.personal-knowledge-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.personal-knowledge-file > span { overflow-wrap: anywhere; min-width: 0; }

@media (max-width: 760px) {
  .personal-knowledge-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .personal-knowledge-actions .btn { justify-content: center; min-height: 40px; }
  .personal-knowledge-card { padding: 12px; }
  .personal-knowledge-card .personal-knowledge-actions { display: grid; grid-template-columns: 1fr; }
  .personal-knowledge-card .personal-knowledge-actions label { justify-self: start; }
  .personal-knowledge-dialog > form { max-height: 92vh; }
  .personal-knowledge-dialog .modal-body { padding: 12px; gap: 12px; }
  .personal-knowledge-dropzone { padding: 12px; }
  .personal-knowledge-files { max-height: 120px; }
}

.security-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.security-tab[aria-pressed="true"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--text-dim); }
.security-panel[hidden] { display: none !important; }
.profile-language-group { margin-top: 12px; }
.profile-language-group h5 { margin: 0 0 8px; font-weight: 600; }
.personal-knowledge-actions .btn.icon { display: inline-flex; align-items: center; justify-content: center; padding: 8px; min-width: 36px; min-height: 36px; }
.personal-knowledge-actions .btn.icon svg { width: 18px; height: 18px; }
.personal-knowledge-actions .btn.primary { font-size: 18px; line-height: 1; padding: 6px 14px; }

.knowledge-upload-zone { cursor: pointer; min-height: 44px; }
.knowledge-upload-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.personal-knowledge-errors { margin-top: 12px; }
.personal-knowledge-errors > summary { cursor: pointer; }
.personal-knowledge-error-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }

/* Multiple independent histories with one person share a collapsible entry. */
.ms-thread-group-summary { display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius); }
.ms-thread-group-summary > .ms-thread-main { flex: 1; }
.ms-thread-group-summary.active { border-color: var(--accent); background: var(--accent-soft); }
.ms-thread-group-summary::after, .overview-conversation-group > summary::after { content: "›"; flex: 0 0 auto; color: var(--text-dim); }
.ms-thread-group[open] > summary::after, .overview-conversation-group[open] > summary::after { transform: rotate(90deg); }
.ms-thread-group > summary, .overview-conversation-group > summary { list-style: none; cursor: pointer; }
.ms-thread-group > summary::-webkit-details-marker, .overview-conversation-group > summary::-webkit-details-marker { display: none; }
.ms-thread-group { margin-bottom: 8px; }
.ms-thread-group-items, .overview-conversation-group-items { padding-left: 12px; border-left: 2px solid var(--border); margin: 8px 0 8px 12px; }
.ms-chat-count { display: inline-grid; place-items: center; min-width: 26px; padding: 3px 7px; border-radius: 20px; background: var(--accent-soft); color: var(--text); font-size: 13px; font-weight: 600; }

/* Skill catalog grouping reuses the existing assignment controls and theme. */
.skill-catalog-toolbar { display: grid; grid-template-columns: minmax(140px, 1fr) auto minmax(0, auto) auto; }
.skill-catalog-toolbar .ai-assignment-select { width: 100%; max-width: none; }
@container ai-panel (max-width: 640px) {
  .skill-catalog-toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .skill-catalog-toolbar .ai-assignment-search { grid-column: 1 / -1; }
}
.skill-group-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.skill-group-toolbar .ai-assignment-search { grid-column: 1 / -1; }
.skill-group-toolbar .ai-assignment-select { width: 100%; max-width: none; }
.skill-group-assignments { width: 100%; table-layout: fixed; border-collapse: collapse; }
.skill-group-assignments th { text-align: left; color: var(--text-dim); font-weight: 600; }
.skill-group-assignments td, .skill-group-assignments th { padding: 10px 0; overflow-wrap: anywhere; }
.skill-group-assignments td:first-child { padding-right: 14px; }
.skill-group-assignments .ai-assignment-select { width: 100%; max-width: none; min-height: 42px; }

/* Jenkins: Build-Dashboard + Servereinstellungen */
.mcp-status.pending { color: var(--warn, #b7791f); background: color-mix(in srgb, var(--warn, #b7791f) 14%, transparent); }
.mcp-status.running { color: var(--accent, #3b82f6); background: color-mix(in srgb, var(--accent, #3b82f6) 14%, transparent); }
.mcp-status.muted { color: var(--muted, #6b7280); background: color-mix(in srgb, var(--muted, #6b7280) 12%, transparent); }
.jenkins-row { cursor: pointer; }
.jenkins-row.selected td { background: color-mix(in srgb, var(--accent, #3b82f6) 9%, transparent); }
.jenkins-log { max-height: 420px; overflow: auto; margin: 0; padding: 10px 12px; border-radius: 8px; background: #0f172a; color: #e2e8f0; font-size: 12px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.jenkins-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.jenkins-params { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.jenkins-errors { margin: 0 0 12px; padding-left: 18px; }
.jenkins-errors li { margin-bottom: 8px; }
.jenkins-error-line { display: block; margin-top: 3px; white-space: pre-wrap; word-break: break-word; font-size: 12px; }
.jenkins-error-text { color: var(--err); }
.jenkins-agent-list { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 160px; overflow: auto; }
.jenkins-agent { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.jenkins-server .mcp-card-head { gap: 10px; flex-wrap: wrap; }
.mcp-layout.jenkins-layout { display: flex; flex-direction: column; gap: 16px; }
.jenkins-detail:empty, .jenkins-servers:empty { display: none; }

.agent-workflow { min-width: 0; }
.agent-workflow textarea { width: 100%; max-width: 100%; box-sizing: border-box; font-family: monospace; }
.agent-workflow pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 24rem; overflow: auto; }
.workflow-drawing { width: 100%; overflow: auto; }
.workflow-drawing svg { display: block; min-width: 580px; width: 100%; max-width: 780px; color: var(--text); }
.workflow-drawing [role="button"] { cursor: pointer; }
.workflow-drawing [role="button"]:focus { stroke: var(--accent); stroke-width: 3; outline: none; }
.workflow-step-editor { display: grid; gap: .7rem; }

/* Keep native hidden semantics when shared button/layout display rules apply. */
.agent-editor-foot > [hidden], .agent-workflow [hidden] { display: none !important; }
.agent-workflow .form-actions { flex-wrap: wrap; gap: 8px; }
.workflow-empty { padding: 64px 24px; text-align: center; border: 1px dashed var(--border); border-radius: 14px; margin: 20px 0; }
.workflow-empty h3 { margin: 0 0 8px; }
.workflow-graph-view { position: relative; margin: 16px 0; }
.workflow-canvas-tools { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }
.workflow-drawing { height: 420px; border: 1px solid var(--border); border-radius: 14px; background-color: var(--bg); background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 20px 20px; overscroll-behavior: contain; }
.workflow-drawing svg { width: auto; max-width: none; min-width: 0; touch-action: none; }
.workflow-node-card { fill: var(--card, var(--bg)); stroke: var(--border); stroke-width: 1.5; }
.workflow-node:hover .workflow-node-card, .workflow-node:focus-within .workflow-node-card { stroke: var(--accent); }
.workflow-node-hit { cursor: grab; touch-action: none; }
.workflow-node-hit:active { cursor: grabbing; }
.workflow-port { fill: var(--card, var(--bg)); stroke: var(--accent); stroke-width: 2; }
.workflow-port-output { cursor: crosshair; touch-action: none; }
.workflow-port-output:hover { fill: var(--accent); }
.workflow-step-editor:empty { display: none; }
.workflow-step-editor:not(:empty) { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-top: 12px; }
.workflow-bindings { margin: 16px 0; }
.workflow-canvas-tools { flex-wrap: wrap; align-items: center; }
.workflow-canvas-tools select { width: auto; min-width: 120px; margin-right: auto; }
.workflow-canvas-hint { margin: 8px 0; font-size: 12px; }
.workflow-file-over .workflow-empty, .workflow-file-over .workflow-drawing { outline: 2px dashed var(--accent); outline-offset: 3px; }
.agent-workflow button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.workflow-drawing { overflow: hidden; cursor: grab; touch-action: none; user-select: none; }
.workflow-drawing svg { display: block; width: 100%; height: 100%; }
.workflow-drawing.workflow-panning, .workflow-drawing.workflow-panning * { cursor: grabbing !important; }
.workflow-drawing.workflow-space-pan *, .workflow-drawing.workflow-space-pan { cursor: grab; }
.workflow-zoom-value { min-width: 48px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }

.kb-index-details { padding: 14px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; }
.kb-index-details .hint { margin: 8px 0; }
.kb-index-details .kb-progress { width: 100%; }

.rag-runs-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.rag-runs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rag-runs-table th, .rag-runs-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.rag-runs-table th { white-space: nowrap; }
.rag-runs-table td { min-width: 90px; max-width: 260px; overflow-wrap: anywhere; }
.rag-run-primary { font-weight: 600; line-height: 1.4; }
.rag-run-secondary { display: block; margin-top: 4px; color: var(--text-dim); font-size: 12px; line-height: 1.45; }
.rag-runs-table details p { min-width: 170px; margin: 6px 0; }

.rag-runs-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; align-items: center; }
.rag-runs-toolbar input[type="search"], .rag-runs-toolbar select { min-width: 160px; flex: 1; box-sizing: border-box; min-height: 42px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.rag-runs-toolbar input[type="search"] { flex: 2; min-width: min(260px, 100%); }
.rag-runs-more[hidden] { display: none !important; }

.workflow-catalog-scroll { max-width: 100%; overflow-x: auto; }
.workflow-catalog .data-table td:last-child { width: 1%; white-space: nowrap; }

.workflow-basics { display: grid; gap: 12px; margin-bottom: 16px; }
.workflow-basics textarea { min-height: 88px; font: inherit; }
.workflow-advanced { margin-top: 16px; }
.workflow-advanced > summary { cursor: pointer; margin-bottom: 10px; }
.workflow-dropzone { display: flex; width: 100%; min-height: 100px; align-items: center; justify-content: center; gap: 12px; padding: 20px; margin: 12px 0 20px; border: 2px dashed var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text-muted); font: inherit; cursor: pointer; text-align: center; }
.workflow-dropzone svg { width: 26px; height: 26px; flex-shrink: 0; }
.workflow-dropzone:hover, .workflow-dropzone:focus-visible, .workflow-file-over .workflow-dropzone { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.workflow-dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.workflow-resource-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; }
.workflow-resource-row > strong { overflow-wrap: anywhere; }
.workflow-resources { display: flex; flex-direction: column; max-width: 850px; border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px; }
.workflow-resources > .workflow-resource-row,
.workflow-resources > .field { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 8px 16px; align-items: start; margin: 0; padding: 12px 0; }
.workflow-resources > * + * { border-top: 1px solid var(--border); }
.workflow-resources > .field > label { margin: 0; color: var(--muted); font-size: inherit; font-weight: 400; }
.workflow-knowledge-choices { display: flex; flex-direction: column; gap: 10px; }
.workflow-resources .field label.workflow-knowledge-choice { display: flex; align-items: flex-start; gap: 10px; margin: 0; font-size: inherit; font-weight: 400; cursor: pointer; }
.workflow-knowledge-choice input[type="checkbox"] { flex: 0 0 auto; margin: 2px 0 0; }
.workflow-knowledge-choice span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .workflow-resources > .workflow-resource-row,
  .workflow-resources > .field { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

.monitor-section + .monitor-section { margin-top: 18px; }
.monitor-section-body { min-width: 0; }
.monitor-runs-table .model-route { white-space: nowrap; }
.model-route-tools { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.model-route-tools code { padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11px; overflow-wrap: anywhere; }
.model-route-tools code.is-failed { background: transparent; color: var(--err); border: 1px solid var(--err); }
.model-route-cell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.model-route-cell .hint { font-size: 11px; overflow-wrap: anywhere; }

/* Finanz- und Flug-Rich-Results (web-recherchierte Daten) */
.fin-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 8px 0; background: var(--panel, rgba(127,127,127,0.04)); }
.fin-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.fin-head b { font-size: 15px; }
.fin-badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.fin-badge.sm { font-size: 10px; }
.fin-quotes { display: flex; flex-wrap: wrap; gap: 10px; }
.fin-quote { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; min-width: 120px; }
.fin-amount { font-size: 20px; font-weight: 600; }
.fin-asof { font-size: 11px; color: var(--muted); }
.fin-empty, .fin-note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.fin-note { padding: 6px 8px; border-left: 2px solid var(--border); }
.fin-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fin-tabs { display: inline-flex; gap: 2px; background: rgba(127,127,127,0.12); border-radius: 8px; padding: 2px; }
.fin-tab { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 3px 10px; border-radius: 6px; cursor: pointer; }
.fin-tab.active { background: var(--bg, #fff); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.fin-toggle { border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 12px; padding: 3px 10px; border-radius: 8px; cursor: pointer; }
.fin-toggle.active { color: var(--fg); border-color: var(--accent, #4a86ff); }
.fin-chart { position: relative; }
.fin-chart-svg { width: 100%; height: auto; display: block; }
.fin-chart-axis { font-size: 10px; fill: var(--muted); }
.fin-chart-dot { cursor: pointer; }
.fin-chart-tip { position: absolute; transform: translate(-50%, -140%); background: var(--fg); color: var(--bg); font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.fin-chart-tip[hidden] { display: none; }
.fin-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fin-legend-item { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 2px 9px; font-size: 12px; cursor: pointer; color: var(--fg); }
.fin-legend-item.off { opacity: 0.4; text-decoration: line-through; }
.fin-legend-item.partial { border-style: dashed; }
.fin-swatch { width: 10px; height: 10px; border-radius: 50%; }
.fin-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.fin-sources-label { font-weight: 600; }
.fin-source { color: var(--accent, #4a86ff); text-decoration: none; }
.fin-source:hover { text-decoration: underline; }
body {
  --music-dock-width: clamp(236px, 25vw, 320px);
  --music-dock-inset: max(12px, env(safe-area-inset-right));
  --music-dock-space: calc(var(--music-dock-width) + var(--music-dock-inset) + 12px);
}
.music-dock { position: fixed; inset: auto var(--music-dock-inset) max(16px, env(safe-area-inset-bottom)) auto;
  z-index: 30; width: var(--music-dock-width); padding: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; }
@media (min-width: 761px) {
  body:has(.music-dock:not(.music-dock-chat)) .ms-shell.chat-open > .ms-chat-panel { margin-right: var(--music-dock-space); }
  body:has(.music-dock:not(.music-dock-chat)) .content.content-conversation-detail { padding-right: var(--music-dock-space); }
}
@media (max-width: 760px) {
  .music-dock { bottom: calc(70px + env(safe-area-inset-bottom)); width: min(360px, calc(100vw - 24px)); }
  body.messenger-chat-open:has(.music-dock:not(.music-dock-chat)) .ms-shell .ms-messages { padding-bottom: 260px; }
}
/* Player inside the open chat: below the header, full chat width, never above the messages. */
.ms-chat-panel > .music-dock.music-dock-chat { position: relative; inset: auto; z-index: 1; flex: none;
  width: auto; max-width: 560px; margin: 4px 8px 0; padding: 4px; }
.ms-chat-panel > .music-dock.music-dock-chat { margin-top: 10px; }
.music-dock-chat > .row-actions { position: absolute; top: -10px; right: -8px; z-index: 1; margin: 0; }
.music-dock-chat > .row-actions .btn { min-width: 28px; min-height: 28px; padding: 0 8px; border-radius: 50%; }
/* Player inside a chat message: the slot keeps its place, the stable layer carries the iframe. */
.music-slot { height: 208px; margin-top: 8px; }
.music-chat-layer { position: absolute; left: 0; right: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.music-chat-layer > .music-dock.music-dock-inline { position: absolute; inset: auto; margin: 0; padding: 4px;
  max-width: none; pointer-events: auto; }
.music-dock-inline > .row-actions { top: -2px; right: -2px; }
/* YouTube requires at least 200 × 200 px; in the chat the player keeps exactly that height. */
.music-dock-chat iframe { height: 200px !important; min-height: 200px !important; aspect-ratio: auto !important; }
.music-card-paged { inline-size: min(22rem, 64vw); max-inline-size: 100%; }
.music-list { display: flex; flex-direction: column; gap: 6px; }
.music-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px 0; }
.music-row + .music-row { border-top: 1px solid var(--border); }
.music-list-paged { display: grid; grid-template-rows: repeat(3, minmax(61px, 1fr)); }
.music-list-paged > .music-row:first-child { border-top: 1px solid transparent; }
.music-play.btn { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; margin-left: auto; padding: 0; border-radius: 50%; }
.music-play svg { width: 20px; height: 20px; }
.music-thumb { width: 44px; height: 44px; flex: none; border-radius: 6px; object-fit: cover; background: rgba(127,127,127,0.15); }
.music-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.music-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.music-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-flights { display: flex; flex-direction: column; gap: 8px; }
.fin-flight { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.fin-flight-head { display: flex; align-items: baseline; gap: 8px; }
.fin-flight-trip { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-top: 4px; flex-wrap: wrap; }
.fin-flight-meta { color: var(--muted); }
.fin-excerpt { margin-top: 6px; font-size: 12px; }
.fin-excerpt-body { color: var(--muted); white-space: pre-wrap; max-height: 160px; overflow: auto; margin-top: 4px; }

/* Finanz-Chart: aktueller Kurs, Fadenkreuz-Tooltip, Legendenwerte */
.fin-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.fin-price-now { font-size: 26px; font-weight: 700; letter-spacing: -0.2px; }
.fin-price-chg { font-size: 13px; font-weight: 600; }
.fin-price-chg.up { color: #3f9e57; }
.fin-price-chg.down { color: #d2524a; }
.fin-chart-tip { min-width: 120px; display: flex; flex-direction: column; gap: 3px; white-space: nowrap; text-align: left; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 5px 8px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); z-index: 3; }
.fin-tip-date { font-weight: 600; opacity: 0.85; margin-bottom: 1px; }
.fin-tip-row { display: flex; align-items: center; gap: 6px; }
.fin-tip-name { flex: 1; opacity: 0.9; }
.fin-tip-val { font-weight: 600; }
.fin-legend-name { }
.fin-legend-val { font-weight: 600; margin-left: 4px; }
.fin-legend-val.fin-muted, .fin-muted { color: var(--muted); font-weight: 400; }
.fin-loading { opacity: 0.55; transition: opacity 0.15s; }
.fin-tab:disabled { opacity: 0.5; cursor: default; }

/* Finanz-Chart: Messbereich (Ziehen) */
.fin-measure { position: absolute; top: 6%; right: 2%; min-width: 150px; display: flex; flex-direction: column; gap: 3px; background: var(--fg); color: var(--bg); font-size: 11px; padding: 6px 9px; border-radius: 8px; text-align: left; white-space: nowrap; pointer-events: none; }
.fin-measure[hidden] { display: none; }
.fin-tip-val.up { color: #7be3a0; }
.fin-tip-val.down { color: #ff9b94; }
.fin-chart-hint { font-size: 10px; color: var(--muted); text-align: right; margin-top: 2px; opacity: 0.7; }

/* Finanz-Chart: Fadenkreuz-/Mess-Tooltip gut lesbar (helles Gelb auf dunkel) */
.fin-chart-tip, .fin-measure {
  background: rgba(22,16,10,0.95) !important;
  color: #ffe6a3 !important;
  border: 1px solid rgba(255,214,128,0.40);
  box-shadow: 0 6px 18px rgba(0,0,0,0.55);
}
.fin-chart-tip .fin-tip-date, .fin-measure .fin-tip-date { color: #ffe6a3; font-weight: 700; }
.fin-chart-tip .fin-tip-name, .fin-measure .fin-tip-name { color: #f0e6d2; }
.fin-chart-tip .fin-tip-val { color: #ffe6a3; font-weight: 700; }
.fin-measure .fin-tip-val.up { color: #8ff0ad; }
.fin-measure .fin-tip-val.down { color: #ff9d8a; }

/* Finanz-Chart: selbst gerechnete Delta-Chips (1W/2W/1M) */
.fin-deltas { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 8px; }
.fin-delta { display: inline-flex; align-items: baseline; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 3px 10px; font-size: 12px; }
.fin-delta-lbl { color: var(--muted); }
.fin-delta-val { font-weight: 700; }
.fin-delta.up .fin-delta-val { color: #3f9e57; }
.fin-delta.down .fin-delta-val { color: #d2524a; }
.fin-quote-group { display: grid; gap: 12px; min-width: 0; }

/* Persisted request evidence: architecture stations and actual model calls. */
.run-route { padding: 18px; margin: 16px 0; }
.run-route h3 { margin: 0 0 8px; }
.run-route h4 { margin: 20px 0 10px; }
.run-route-node { min-width: 0; padding: 13px 15px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); overflow-wrap: anywhere; }
.run-route-node-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.run-route-badge { font-size: 11px; font-weight: 650; color: var(--text-dim); }
.run-route-note { display: block; margin-top: 6px; color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.run-route-node[data-state="used"] { border-color: var(--ok); box-shadow: inset 3px 0 var(--ok); }
.run-route-node[data-state="used"] .run-route-badge { color: var(--ok); }
.run-route-node[data-state="checked"] { border-color: var(--accent); }
.run-route-node[data-state="checked"] .run-route-badge { color: var(--accent); }
.run-route-node[data-state="attempted"] { border-color: var(--warn); }
.run-route-node[data-state="attempted"] .run-route-badge { color: var(--warn); }
.run-route-node[data-state="skipped"], .run-route-node[data-state="unknown"] { border-style: dashed; }
.run-route-arrow { padding: 7px 0; color: var(--muted); text-align: center; font-size: 19px; }
.run-route-arrow[data-state="used"], .run-route-branch-label[data-state="used"] { color: var(--ok); }
.run-route-branches { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
.run-route-branch { min-width: 0; }
.run-route-branch-label { padding: 10px 0; text-align: center; color: var(--text-dim); font-size: 12px; font-weight: 650; }
.run-route-models { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.run-route-calls { margin: 0; padding-left: 25px; }
.run-route-calls li { padding: 7px 0 7px 3px; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .run-route { padding: 14px; }
  .run-route-branches, .run-route-models { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

/* Kopier-Symbol unten rechts in der Sprechblase (wie WhatsApp): nur beim Drüberfahren. */
.ms-bubble-copy { border: 0; background: transparent; color: inherit; font-size: 13px; line-height: 1; padding: 1px 4px; border-radius: 5px; cursor: pointer; opacity: 0; transition: opacity .12s; }
@media (hover: hover) and (pointer: fine) {
  .ms-bubble:hover .ms-bubble-copy, .ms-bubble-copy:focus-visible { opacity: .6; }
  .ms-bubble-copy:hover { opacity: 1 !important; background: rgba(127,127,127,.2); }
}
@media not all and (hover: hover) and (pointer: fine) { .ms-bubble-copy { opacity: .45; } }

.ms-reply-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.ms-reply-bar[hidden] { display: none; }
.ms-reply-bar .ms-reply-quote { flex: 1; min-width: 0; }
.ms-reply-quote { display: flex; flex-direction: column; gap: 1px; padding: 5px 9px; border-left: 3px solid var(--accent, #c27a3c); border-radius: 6px; background: rgba(127,127,127,.16); font-size: 12.5px; line-height: 1.3; overflow: hidden; }
.ms-reply-quote b { font-size: 12px; color: var(--accent, #c27a3c); }
.ms-reply-quote span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ms-reply-quote.in-bubble { margin-bottom: 5px; }
.ms-forward-list { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; margin: 8px 0; }
