:root {
  --color-locked: #7a5c00;
  --color-dev-number: #7a5c00;
  --bg-dev-number: #fffbe6;
}

tr.dev-local td { background-color: var(--bg-dev-number); }
tr.dev-local a { color: var(--color-dev-number) !important; }
tr.dev-other { opacity: 0.38; pointer-events: none; cursor: default; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, sans-serif;
  font-size: 14px;
  background: #f5f5f5;
  color: #222;
}

/* Header */
.site-header { background: #1a1a2e; color: #eee; }

.header-inner {
  display: flex;
  align-items: center;
}
.header-logo-wrap {
  flex-shrink: 0;
  padding: 0.3rem 0.5rem 0.3rem 1.2rem;
}
.header-logo {
  display: block;
  max-height: 60px;
  width: auto;
  filter: brightness(0.65);
}
.header-rows {
  flex: 1;
  min-width: 0;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 1.2rem;
}
.nav-brand { font-weight: 600; font-size: 1rem; flex-shrink: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.server-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: rgba(255,255,255,0.12);
  color: #ccc;
}
.header-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
[x-cloak] { display: none !important; }

.server-switcher { position: relative; }
.server-badge--btn {
  background: rgba(255,255,255,0.12);
  border: none;
  cursor: pointer;
  color: #ccc;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}
.server-badge--btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.server-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #2a2a4e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  min-width: 100%;
  z-index: 100;
  overflow: hidden;
}
.server-dropdown-item {
  display: block;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  color: #ccc;
  text-decoration: none;
  white-space: nowrap;
}
.server-dropdown-item:hover { background: rgba(255,255,255,0.1); color: #fff; }

.nav-user  { font-size: 0.85rem; color: #aaa; }
.nav-user--link { text-decoration: none; }
.nav-user--link:hover { color: #fff; }
.btn-link  { background: none; border: none; color: #aaa; cursor: pointer; font-size: 0.85rem; }
.btn-link:hover { color: #fff; }

/* Einstellungsseite */
.settings-page { max-width: 560px; margin: 2rem auto; padding: 0 1.2rem; }
.settings-page h2 { margin-bottom: 1.5rem; }
.settings-section {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.2rem;
  border-bottom: 1px solid #eee;
}
.settings-row:last-child { border-bottom: none; }
.settings-row--top { align-items: flex-start; }
.settings-label { min-width: 140px; color: #666; font-size: 0.85rem; }
.settings-value { font-weight: 600; }
.scope-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.scope-badge {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 3px;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  font-family: monospace;
}
.scope-badge--header {
  background: rgba(99,102,241,0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.35);
}
.settings-actions { display: flex; gap: 0.8rem; }
.btn { padding: 0.45rem 1rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.88rem; font-weight: 500; }
.btn--danger { background: #dc2626; color: #fff; }
.btn--danger:hover { background: #b91c1c; }

/* Phone chip — wiederverwendbares Rufnummer-Display, Klick kopiert E.164 */
.phone-chip { display: inline-flex; align-items: center; gap: 0.4em; }
.phone-chip__raw { color: #888; font-family: monospace; }
.phone-chip__display { font-family: monospace; border-radius: 3px; padding: 0.05em 0.2em; transition: background 0.15s; }
.phone-chip__display:hover { background: rgba(0,0,0,0.06); }

/* Phone history list auf der Dev-Seite */
.phone-history { list-style: none; margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.phone-history-row { font-size: 1.05rem; }

.header-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.3rem 1.0rem;
}
.nav-link  {
  color: #aaa; text-decoration: none; font-size: 0.88rem;
  padding: 0.25rem 0.7rem; border-radius: 4px;
}
.nav-link:hover  { color: #fff; background: rgba(255,255,255,0.08); }
.nav-link.active { color: #fff; background: rgba(255,255,255,0.15); }
.nav-link--lab        { color: #ccc878; }
.nav-link--lab:hover  { color: #e0dc9a; background: rgba(255,255,255,0.08); }
.nav-link--lab.active { color: #e0dc9a; background: rgba(255,255,255,0.15); }
.nav-link--lab-locked { opacity: 0.35; cursor: not-allowed; }

.nav-dropdown { position: relative; display: inline-flex; align-items: stretch; }
.nav-dropdown-btn {
  color: #aaa; font-size: 0.88rem; padding: 0.25rem 0.7rem; border-radius: 4px;
  background: none; border: none; cursor: pointer;
}
.nav-dropdown-btn:hover  { color: #fff; background: rgba(255,255,255,0.08); }
.nav-dropdown-btn.active { color: #fff; background: rgba(255,255,255,0.15); }
.nav-dropdown-btn--lab        { color: #ccc878; }
.nav-dropdown-btn--lab:hover  { color: #e0dc9a; background: rgba(255,255,255,0.08); }
.nav-dropdown-btn--lab.active { color: #e0dc9a; background: rgba(255,255,255,0.15); }
.nav-dropdown-btn--lab-locked { opacity: 0.35; cursor: not-allowed; }
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #2a2a4e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  min-width: 130px;
  z-index: 100;
  overflow: hidden;
}
.nav-dropdown-item {
  display: block;
  padding: 0.4rem 0.8rem;
  font-size: 0.88rem;
  color: #ccc;
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-dropdown-item--lab        { color: #ccc878; }
.nav-dropdown-item--lab:hover  { color: #e0dc9a; background: rgba(255,255,255,0.1); }
.nav-dropdown-divider {
  padding: 0.3rem 0.8rem 0.2rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.35);
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 0.2rem;
}

/* Main */
main { padding: 1.5rem 1.2rem; max-width: 1200px; }

/* Markdown-Seiten */
.md-page { max-width: 700px; }
.md-page ul, .md-page ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.md-page li { margin: 0.3rem 0; }
.md-page h1, .md-page h2, .md-page h3 { margin-bottom: 0.75rem; }

/* Login */
.login-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-box {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 2rem;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.login-box h1 { font-size: 1.2rem; text-align: center; }
.login-box label { font-size: 0.85rem; color: #555; }
.login-box input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  margin-top: 0.2rem;
}
.login-box button[type=submit] {
  width: 100%;
  padding: 0.55rem;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
}
.login-box button[type=submit]:hover { background: #2a2a4e; }

.error { color: #c00; font-size: 0.85rem; }

/* Allgemein */
.mono { font-family: monospace; font-size: 0.85rem; }

/* Status-Seite */
h2 { margin-bottom: 1rem; font-size: 1.1rem; }

.cluster-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.status-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1.2rem 1.5rem;
  min-width: 280px;
}
.status-card.ok    { border-left: 4px solid #2a9d2a; }
.status-card.error { border-left: 4px solid #c00; }

.status-overall { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.status-loading { color: #999; font-size: 0.88rem; margin-top: 0.5rem; }

.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.green { background: #2a9d2a; }
.dot.red   { background: #c00; }

.status-table { width: 100%; border-collapse: collapse; }
.status-table td { padding: 0.35rem 0; font-size: 0.9rem; }
.status-table td:first-child { color: #555; width: 60%; }

/* Aktive Gespräche */
.calls-block {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1rem 1.2rem;
  max-width: 900px;
}
fieldset.calls-block {
  border: 1px solid #ddd;
  padding: 0.2rem 1.2rem 0.8rem;
}
fieldset.calls-block > legend {
  font-size: 0.9rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.3em;
  font-weight: normal;
}
.calls-empty { color: #888; font-size: 0.9rem; }
.calls-error { color: #c00; font-size: 0.9rem; }

.calls-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.calls-table th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 2px solid #ddd;
  color: #555;
  font-weight: 600;
}
.calls-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #eee; }
.calls-table tr:last-child td { border-bottom: none; }
.calls-table .calls-name { color: #888; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calls-table tr.clickable-row { cursor: pointer; }
.calls-table tr.clickable-row:hover td { background: #f9f9f9; }
.calls-block--wide { max-width: none; }

.data-table { border-collapse: collapse; font-size: 0.88rem; }
.data-table th { text-align: left; padding: 0.3rem 0.75rem; background: #f5f5f5; border: 1px solid #d5d5d5; color: #444; font-weight: 600; }
.data-table td { padding: 0.3rem 0.75rem; border: 1px solid #e0e0e0; }
.data-table tbody tr:hover td { background: #fafafa; }
@media (max-width: 800px) { .hide-md { display: none; } }
@media (max-width: 480px) { .hide-sm { display: none; } }

.call-state { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
tr.state-up   .call-state { color: #2a9d2a; }
tr.state-ring .call-state { color: #d07000; }
tr.finished   { opacity: 0.4; }
tr.finished .call-state.ended { color: #888; }

.btn-hangup {
  background: #c0392b; color: #fff; border: none; border-radius: 3px;
  padding: 0.15rem 0.5rem; font-size: 0.78rem; cursor: pointer; white-space: nowrap;
}
.btn-hangup:hover { background: #a93226; }
.hangup-confirm { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; white-space: nowrap; }
.btn-hangup-yes {
  background: #c0392b; color: #fff; border: none; border-radius: 3px;
  padding: 0.15rem 0.45rem; font-size: 0.78rem; cursor: pointer;
}
.btn-hangup-yes:hover { background: #a93226; }
.btn-hangup-no {
  background: #888; color: #fff; border: none; border-radius: 3px;
  padding: 0.15rem 0.45rem; font-size: 0.78rem; cursor: pointer;
}
.btn-hangup-no:hover { background: #666; }
.hangup-ok  { color: #2a9d2a; font-size: 0.8rem; }
.hangup-err { color: #c0392b; font-size: 0.8rem; }

.hangup-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  max-width: 900px;
}
.hangup-panel-label { font-size: 0.88rem; color: #555; white-space: nowrap; }
.hangup-select {
  flex: 1;
  min-width: 220px;
  font-size: 0.85rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid #ccc;
  border-radius: 3px;
}

.step-row td {
  padding: 0.08rem 0.6rem 0.45rem 1rem;
  font-size: 0.76rem;
  color: #667;
  border-bottom: 1px solid #eee;
}
.step-name {
  font-family: monospace; font-weight: 600;
  background: #e8edf4; color: #336;
  padding: 0.05rem 0.4rem; border-radius: 3px;
  margin-right: 0.5rem;
}
.step-param { color: #445; margin-right: 0.7rem; }
.step-key { color: #99a; }
.step-since { color: #bbb; font-size: 0.72rem; float: right; padding-right: 0.4rem; }

.ac-row { cursor: pointer; }
.ac-row:hover td { background: #f0f4f8; }

.json-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.json-modal {
  background: #fff; border-radius: 6px; box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  max-width: 680px; width: 90vw; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.json-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 1rem; background: #f4f6f8; border-bottom: 1px solid #dde1e6;
  font-size: 0.88rem; font-weight: 600; color: #334;
}
.json-modal-close {
  background: none; border: none; font-size: 1rem; cursor: pointer;
  color: #778; padding: 0 0.2rem; line-height: 1;
}
.json-modal-close:hover { color: #334; }
.json-modal-body {
  padding: 1rem; overflow: auto; flex: 1;
  font-size: 0.82rem; font-family: monospace; white-space: pre; margin: 0;
  background: #fafbfc; color: #223;
}

.status-error {
  margin-top: 1rem;
  padding: 0.6rem 0.8rem;
  background: #fff0f0;
  border: 1px solid #fcc;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #900;
  font-family: monospace;
  word-break: break-all;
}

/* Routing Detail */
.detail-page { display: flex; flex-direction: column; gap: 1.2rem; }

.detail-header h2 { margin-bottom: 0.25rem; }
.detail-notes { color: #555; font-size: 0.9rem; margin: 0; }

/* Zweispalten-Layout */
.detail-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}
.detail-col-main {
  flex: 1 1 540px;
  max-width: 860px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.detail-col-side {
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.detail-block--desc { max-width: 540px; }
.detail-col-side--editing {
  flex: 1 1 420px;
}

.detail-block {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.8rem 1rem 1rem;
  background: #fff;
}
.detail-block legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 0.4rem;
}

/* Code-Block Toggle-Button in legend */
.detail-block-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  line-height: inherit;
}
.detail-block-toggle span {
  display: inline-block;
  font-size: 0.7rem;
  margin-left: 0.1rem;
  transition: transform 0.15s;
  transform-origin: center;
}
.detail-block-toggle[aria-expanded="true"] span { transform: rotate(90deg); }

/* Description-Panel */
.detail-desc-empty { color: #bbb; font-size: 0.88rem; margin: 0; font-style: italic; }
.detail-desc-edit-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.7rem;
  color: #888;
  cursor: pointer;
  padding: 0.05rem 0.45rem;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: 0;
  font-weight: normal;
  vertical-align: middle;
  margin-left: 0.35rem;
}
.detail-desc-edit-btn:hover { border-color: #888; color: #333; }
.detail-desc-editor {
  width: 100%;
  min-height: 10rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.88rem;
}
.detail-desc-btns {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  align-items: center;
}
.btn-save--sm { padding: 0.35rem 0.8rem; font-size: 0.82rem; }
.detail-desc-cancel {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: #777;
}
.detail-desc-cancel:hover { color: #333; }
.detail-desc-hint { margin-left: auto; font-size: 0.75rem; color: #aaa; align-self: center; }
.detail-desc-error { color: #c00; font-size: 0.85rem; margin: 0.4rem 0 0; }
/* Ace Editor im script-Block */
.detail-block--editor { padding: 0; }
.detail-block--editor legend { margin-left: 0.8rem; padding: 0 0.4rem; }
#script-editor { width: 100%; min-height: 16rem; font-size: 0.88rem; }
.ace-marker--blacklist       { position: absolute; border-bottom: 2px solid #dc2626; z-index: 20; }
.ace-marker--invalid-call    { position: absolute; border-bottom: 2px solid #d97706; z-index: 20; }
.ace-marker--invalid-handler { position: absolute; border-bottom: 2px dotted #7c3aed; z-index: 20; }

/* Code-Block: kompakter mit Scrolling bei langem Output */
.detail-block--code { background: #fafafa; }
.detail-block--chat { background: #fafafa; max-width: 540px; }
.detail-block--chat.detail-block--chat--open { max-width: none; }

/* Chat-UI */
.chat-messages { display: flex; flex-direction: column; gap: 0.5rem; max-height: 420px; overflow-y: auto; padding: 0.25rem 0 0.5rem; }
.chat-msg { display: flex; }
.chat-msg--user { justify-content: flex-end; padding-left: 2.5rem; }
.chat-msg--bot  { justify-content: flex-start; padding-right: 2.5rem; }
.chat-bubble { padding: 0.45rem 0.75rem; border-radius: 8px; font-size: 0.88rem; line-height: 1.5; max-width: 90%; white-space: pre-wrap; word-break: break-word; }
.chat-msg--user .chat-bubble { background: #dbeafe; color: #1e3a5f; }
.chat-msg--bot  .chat-bubble { background: #eeeeee; color: #333; }
.chat-thinking { display: flex; gap: 5px; align-items: center; padding: 0.3rem 0.2rem; }
.chat-dot { width: 7px; height: 7px; background: #aaa; border-radius: 50%; animation: chat-bounce 1.2s infinite ease-in-out; }
.chat-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes chat-bounce { 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; } 40% { transform: scale(1.2); opacity: 1; } }
.chat-input-row { display: flex; gap: 0.4rem; align-items: flex-end; margin-top: 0.5rem; }
.chat-input { flex: 1; min-width: 0; resize: vertical; padding: 0.4rem 0.5rem; font-size: 0.9rem; font-family: inherit; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
.btn-chat-send { padding: 0.42rem 0.9rem; background: #2563eb; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.88rem; white-space: nowrap; }
.btn-chat-send:hover { background: #1d4ed8; }
.btn-chat-send:disabled { background: #93c5fd; cursor: default; }
.chat-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.35rem; }
.btn-chat-reset { background: none; border: none; color: #aaa; font-size: 0.8rem; cursor: pointer; padding: 0; }
.btn-chat-reset:hover { color: #dc2626; }
.chat-costs { font-size: 0.78rem; color: #bbb; }
.detail-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #444;
  max-height: 16rem;
  overflow-y: auto;
}
.detail-description { font-size: 0.92rem; line-height: 1.6; }
.detail-description p { margin-bottom: 0.7rem; }
.detail-description p:last-child { margin-bottom: 0; }

.detail-save-row { display: flex; justify-content: flex-end; }
.btn-save {
  background: #fff;
  color: #666;
  border: 1px solid #bbb;
  border-radius: 4px;
  padding: 0.4rem 1.1rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-save:hover { background: #f4f4f4; border-color: #888; }
.btn-save--dirty {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
  font-size: 0.9rem;
  padding: 0.45rem 1.2rem;
}
.btn-save--dirty:hover { background: #2a2a4e; border-color: #2a2a4e; }
.btn-save:disabled { opacity: 0.6; cursor: default; }
.save-spinner { display: none; width: 16px; height: 16px; border: 2px solid #ccc; border-top-color: #444; border-radius: 50%; animation: save-spin 0.7s linear infinite; vertical-align: middle; }
.save-spinner--active { display: inline-block; }
@keyframes save-spin { to { transform: rotate(360deg); } }
.btn-delete {
  background: #c00;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 1.2rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-delete:hover { background: #a00; }

.btn-lock {
  background: none;
  color: #666;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.btn-lock:hover { border-color: #888; color: #333; }
.btn-lock--unlock { background: #2a6a2a; }
.btn-lock--unlock:hover { background: #1d4d1d; }

.plan-locked-badge {
  display: inline-block;
  background: var(--color-locked);
  color: #fff;
  border-radius: 4px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.plan-locked-badge--sm {
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
  margin-left: 0.3rem;
}
.plan-lock-open {
  font-size: 0.78rem;
  color: #aaa;
  font-weight: 500;
}

.detail-delete-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid #e0e0e0;
}
.detail-delete-error {
  color: #c00;
  font-size: 0.9rem;
  margin: 0;
}
.btn--lab        { background: #a8a44a; }
.btn--lab:hover  { background: #908e38; }
.btn--lab-locked { opacity: 0.35; cursor: not-allowed; }

/* History-Panel */
.detail-history-wrap {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid #e0e0e0;
}
.detail-history-wrap--inline {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
[x-cloak] { display: none !important; }
.btn-history {
  background: none;
  border: 1px solid #bbb;
  border-radius: 4px;
  padding: 0.3rem 0.85rem;
  font-size: 0.88rem;
  color: #555;
  cursor: pointer;
}
.btn-history:hover { background: #f0f0f0; border-color: #999; }
.detail-history-panel {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.detail-history-status {
  font-size: 0.88rem;
  color: #888;
  padding: 0.3rem 0;
}
.detail-history-entry {
  background: #fafafa;
  border: 1px solid #e4e4e4;
  border-radius: 4px;
  overflow: hidden;
}
.detail-history-entry-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.45rem 0.7rem;
}
.detail-history-label {
  flex: 1;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font-size: 0.84rem;
  color: #2a6ab5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.detail-history-label:hover { color: #1a4a8a; }
.detail-history-content {
  border-top: 1px solid #e4e4e4;
  padding: 0.6rem 0.7rem;
  background: #fff;
}
.detail-history-pre {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  color: #333;
  font-family: monospace;
  max-height: 300px;
  overflow-y: auto;
}
.btn-history-use {
  background: none;
  border: 1px solid #aaa;
  border-radius: 4px;
  padding: 0.2rem 0.65rem;
  font-size: 0.82rem;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}
.btn-history-use:hover { background: #e8f0e8; border-color: #5a8a5a; color: #2a5a2a; }

.detail-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  font-size: 0.88rem;
  border: 1px solid transparent;
}
.detail-feedback--ok      { background: #f0faf0; border-color: #aadcaa; color: #1a6e1a; }
.detail-feedback--warning { background: #fffbe6; border-color: #e0cc60; color: #6b5700; }
.detail-feedback--error   { background: #fff0f0; border-color: #f5aaaa; color: #900; }
.feedback-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: inherit;
  opacity: 0.6;
  padding: 0 0.2rem;
}
.feedback-close:hover { opacity: 1; }
.detail-corrections { margin-top: 0.5rem; border: 1px solid #e0cc60; border-radius: 4px; background: #fffbe6; padding: 0.6rem 0.9rem; font-size: 0.85rem; }
.detail-corrections-title { font-weight: 600; margin-bottom: 0.4rem; color: #6b5700; }
.detail-correction-item { padding: 0.15rem 0; }
.detail-diagnostics { margin-top: 0.5rem; border: 1px solid #f5aaaa; border-radius: 4px; background: #fff0f0; padding: 0.6rem 0.9rem; font-size: 0.85rem; }
.detail-diagnostic-item { padding: 0.15rem 0; }
.review-line { font-size: 0.78rem; color: #888; margin-right: 0.3rem; }
.review-note { font-size: 0.8rem; color: #666; margin-left: 0.3rem; }
.review-severity { font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.35rem; border-radius: 3px; margin-right: 0.3rem; }
.review-severity--error   { background: #fee2e2; color: #991b1b; }
.review-severity--warning { background: #fef3c7; color: #92400e; }
.review-severity--hint, .review-severity--info { background: #e0e7ff; color: #3730a3; }

/* Help Panel */
.help-panel { border: 1px solid #ddd; border-radius: 6px; background: #fff; overflow: hidden; }
.btn-help {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  color: #444;
  width: 100%;
  text-align: left;
}
.btn-help:hover { background: #f5f5f5; }
.help-body { display: none; border-top: 1px solid #eee; }
.help-body--open { display: block; }
.help-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #eee;
  overflow-x: auto;
  padding: 0 0.5rem;
}
.help-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.5rem 0.8rem;
  font-size: 0.83rem;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
}
.help-tab:hover { color: #333; }
.help-tab.is-active { color: #1a1a2e; border-bottom-color: #1a1a2e; font-weight: 600; }
.help-content { padding-top: 0.6rem; }
.help-section-body {
  padding: 0.7rem 1rem 1rem;
  font-size: 0.85rem;
  line-height: 1.55;
}
.help-section-body table { border-collapse: collapse; width: 100%; margin-bottom: 0.5rem; }
.help-section-body th { text-align: left; padding: 0.25rem 0.5rem; border-bottom: 2px solid #ddd; color: #555; font-size: 0.82rem; }
.help-section-body td { padding: 0.25rem 0.5rem; border-bottom: 1px solid #eee; vertical-align: top; }
.help-section-body tr:last-child td { border-bottom: none; }
.help-section-body code { font-family: monospace; background: #f0f0f0; padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.83rem; }
.help-section-body pre { background: #f5f5f5; border-radius: 4px; padding: 0.6rem 0.8rem; overflow-x: auto; margin: 0.5rem 0; }

/* CDR Key-Value-Tabelle (Detailseite) */
.cdr-kv-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.cdr-kv-table td { padding: 0.35rem 0.6rem; border-bottom: 1px solid #eee; vertical-align: top; }
.cdr-kv-table tr:last-child td { border-bottom: none; }
.cdr-label { color: #666; width: 12rem; white-space: nowrap; }

/* CDR outcome badges */
.cdr-outcome { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 3px; font-size: 0.8rem; font-weight: 600; background: #e5e7eb; color: #555; }
.cdr-outcome--transferred { background: #d1fae5; color: #065f46; }
.cdr-outcome--hangup      { background: #fee2e2; color: #991b1b; }
.cdr-outcome--timeout     { background: #fef3c7; color: #92400e; }
.cdr-outcome--error       { background: #fde8d8; color: #9a3412; }
.help-section-body pre code { background: none; padding: 0; }
.help-section-body h2, .help-section-body h3 { margin-top: 1.6rem; }


/* Hamburger / Mobile Nav */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: #eee;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

@media (max-width: 550px) {
  .nav-brand { display: none; }
}

@media (max-width: 500px) {
  .hamburger { display: block; }
  .header-logo-wrap { cursor: pointer; }

  .header-nav {
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    padding: 0.4rem 0 0.8rem;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .header-nav.nav--open { display: flex; }

  .header-nav .nav-link,
  .header-nav .nav-link--lab,
  .header-nav .nav-link--lab-locked {
    width: 100%;
    padding: 0.35rem 1.2rem;
    border-radius: 0;
  }

  .nav-dropdown {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  .nav-dropdown-btn {
    width: 100%;
    text-align: left;
    padding: 0.35rem 1.2rem;
    border-radius: 0;
  }
  .nav-dropdown-menu {
    position: static !important;
    box-shadow: none;
    background: transparent;
    border: none;
    border-radius: 0;
    min-width: 0;
    padding: 0;
    width: 100%;
  }
  .nav-dropdown-item {
    padding: 0.3rem 1.2rem 0.3rem 2rem;
  }
}
