:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-raised: rgba(255, 255, 255, 0.94);
  --surface-soft: #eef5f1;
  --surface-muted: #f8faf9;
  --border: #dce5e2;
  --border-strong: #c5d3ce;
  --text: #17211f;
  --muted: #65736f;
  --muted-2: #899692;
  --green: #1fa855;
  --green-dark: #0c7c3c;
  --green-soft: #dff5e8;
  --amber: #f4a62a;
  --blue: #2563eb;
  --red: #d74646;
  --red-soft: #fcdedb;
  --amber-soft: #fff1d3;
  --nav-active: #17211f;
  --topbar-bg: rgba(255, 255, 255, 0.91);
  --whatsapp-bg: #ffffff;
  --memory-bg: #fffdf6;
  --memory-border: #eadfbc;
  --source-bg: #f7f9ff;
  --source-border: #d7e1ff;
  --body-gradient: radial-gradient(circle at top left, rgba(31, 168, 85, 0.14), transparent 34rem),
    linear-gradient(180deg, #fbfcfc 0%, var(--bg) 42%);
  --shadow: 0 18px 55px rgba(24, 39, 35, 0.09);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101614;
  --surface: #17201d;
  --surface-raised: rgba(23, 32, 29, 0.96);
  --surface-soft: #20322b;
  --surface-muted: #1c2824;
  --border: #2d4039;
  --border-strong: #456056;
  --text: #edf6f2;
  --muted: #a5b8b1;
  --muted-2: #7f948d;
  --green: #35c56f;
  --green-dark: #8de7b2;
  --green-soft: #123924;
  --amber: #f7bd54;
  --blue: #8fb4ff;
  --red: #ff8d82;
  --red-soft: #43201f;
  --amber-soft: #3b2d16;
  --nav-active: #e8f5ee;
  --topbar-bg: rgba(16, 22, 20, 0.92);
  --whatsapp-bg: #202e29;
  --memory-bg: #282415;
  --memory-border: #5a4d24;
  --source-bg: #172238;
  --source-border: #2f497a;
  --body-gradient: radial-gradient(circle at top left, rgba(53, 197, 111, 0.14), transparent 32rem),
    linear-gradient(180deg, #111b18 0%, var(--bg) 44%);
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--body-gradient);
  color: var(--text);
  font-family: var(--font);
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: 2px;
  border-radius: 8px;
}

.request-card:focus-visible {
  outline-offset: -2px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 28px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand,
.topbar-actions,
.user-chip {
  display: flex;
  align-items: center;
}

.brand {
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  background: linear-gradient(135deg, var(--green), #0b6b45);
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 10px 30px rgba(31, 168, 85, 0.27);
}

.brand-title {
  font-size: 17px;
  font-weight: 760;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.demo-badge {
  margin-left: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(31, 168, 85, 0.35);
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.topbar-actions {
  gap: 14px;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
}

.role-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.role-control select {
  height: 38px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 8px;
  padding: 0 34px 0 12px;
  color: var(--text);
}

.user-chip {
  gap: 9px;
  min-height: 38px;
  padding: 5px 11px 5px 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--nav-active);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.main-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px 28px 36px;
}

.side-nav {
  align-self: start;
  position: sticky;
  top: 92px;
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 750;
  text-align: left;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--green-dark);
}

.nav-ico {
  width: 30px; height: 30px; flex: none;
  padding: 5px; border-radius: 8px;
  background: var(--surface-soft);
  color: var(--green-dark);
}

.nav-item.active {
  background: var(--nav-active);
  color: var(--surface);
}

.nav-item.active span,
.nav-item.active .nav-ico {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.content {
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head.compact {
  align-items: center;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(27px, 3vw, 39px);
  line-height: 1.06;
  letter-spacing: 0;
}

.status-tabs {
  display: flex;
  gap: 7px;
  padding: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}

.status-tab {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(20, 33, 30, 0.08);
}

.queue-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(450px, 1.35fr);
  gap: 18px;
  align-items: start;
}

.queue-list-panel,
.detail-panel,
.table-card,
.add-client-form,
.manager-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.panel-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.panel-toolbar strong {
  color: var(--text);
}

.search-row {
  padding: 10px 12px 0;
}

.search-input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
}

.search-input::placeholder {
  color: var(--muted-2);
}

.request-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  max-height: calc(100vh - 285px);
  min-height: 480px;
  overflow: auto;
}

.request-list:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.request-card,
.customer-card {
  width: 100%;
  border: 1px solid transparent;
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 13px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.request-card:hover,
.customer-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.request-card.selected,
.customer-card.selected {
  background: var(--green-soft);
  border-color: rgba(31, 168, 85, 0.42);
}

.customer-card {
  display: grid;
  gap: 10px;
  padding: 0;
  overflow: hidden;
}

.customer-main {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 13px 13px 0;
  text-align: left;
}

.micro-link {
  justify-self: start;
  margin: 0 13px 13px;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--green-dark);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.request-topline,
.request-meta,
.detail-title-row,
.draft-meta,
.row-actions,
.manager-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.request-name {
  font-weight: 840;
  color: var(--text);
}

.masked-number,
.timestamp,
.request-preview,
.detail-muted {
  color: var(--muted);
}

.masked-number,
.timestamp {
  font-size: 12px;
}

.request-preview {
  margin: 10px 0 12px;
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.draft-state {
  color: var(--green-dark);
  font-weight: 750;
}

.draft-state.is-failed {
  color: var(--red);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status-new {
  color: var(--green-dark);
  background: var(--green-soft);
}

.status-in_progress {
  color: #995d05;
  background: var(--amber-soft);
}

.status-done {
  color: var(--muted);
  background: var(--surface-soft);
}

.status-failed {
  color: var(--red);
  background: var(--red-soft);
}

.confidence-high {
  color: var(--green-dark);
  background: var(--green-soft);
}

.confidence-mid {
  color: #8a5a06;
  background: var(--amber-soft);
}

.confidence-low {
  color: var(--red);
  background: var(--red-soft);
}

.paused-status {
  color: #8a5a06;
  background: var(--amber-soft);
}

[data-theme="dark"] .status-in_progress,
[data-theme="dark"] .confidence-mid,
[data-theme="dark"] .paused-status {
  color: var(--amber);
}

.detail-panel {
  min-height: 650px;
  padding: 22px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  color: var(--muted);
  text-align: center;
}

.detail-title-row {
  align-items: start;
  margin-bottom: 18px;
}

.detail-title-row h2 {
  margin: 0 0 5px;
  font-size: 25px;
}

.timeline-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.timeline-header h2 {
  margin: 0 0 5px;
  font-size: 27px;
}

.timeline-memory {
  margin-bottom: 18px;
}

.timeline {
  position: relative;
  display: grid;
  gap: 12px;
  padding-left: 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 5px;
  width: 2px;
  background: var(--border);
}

.date-separator {
  position: relative;
  justify-self: center;
  z-index: 1;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.timeline-entry {
  position: relative;
  display: flex;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 18px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--border);
}

.timeline-entry.agent {
  justify-content: flex-end;
}

.timeline-entry.agent::before {
  background: var(--blue);
}

.timeline-entry.error-entry::before {
  background: var(--red);
}

.timeline-bubble {
  width: min(88%, 640px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface-muted);
}

.timeline-entry.agent .timeline-bubble {
  background: var(--whatsapp-bg);
  border-color: rgba(31, 168, 85, 0.28);
  border-radius: 12px 12px 4px 12px;
}

.timeline-entry.customer .timeline-bubble {
  border-radius: 12px 12px 12px 4px;
}

.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-meta strong {
  color: var(--text);
}

.timeline-bubble p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.timeline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 0 6px;
}

.compact-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12.5px;
}

.back-link {
  margin-bottom: 15px;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  padding: 0;
  font-weight: 850;
}

.conversation-box,
.memory-box,
.draft-box,
.source-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 14px;
  padding: 16px;
}

.conversation-box {
  background: var(--surface-muted);
}

.memory-box {
  background: var(--memory-bg);
  border-color: var(--memory-border);
}

.draft-box {
  background: var(--green-soft);
  border-color: rgba(31, 168, 85, 0.28);
}

.source-box {
  background: var(--source-bg);
  border-color: var(--source-border);
}

.error-box {
  border: 1px solid var(--red);
  border-radius: 10px;
  margin-top: 14px;
  padding: 16px;
  background: var(--red-soft);
}

.error-box .box-label {
  color: var(--red);
}

.draft-hint {
  display: flex;
  gap: 7px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(31, 168, 85, 0.3);
  color: var(--green-dark);
  font-size: 12.5px;
  font-weight: 700;
}

.draft-hint::before {
  content: "↳";
  font-weight: 900;
}

.manager-alert {
  margin-top: 14px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12.5px;
  font-weight: 750;
  line-height: 1.35;
}

.box-label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.message-text,
.draft-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.draft-text {
  font-size: 15px;
  margin-top: 10px;
  padding: 13px 15px;
  background: var(--whatsapp-bg);
  border: 1px solid rgba(31, 168, 85, 0.22);
  border-radius: 12px 12px 12px 4px;
  box-shadow: 0 3px 10px rgba(20, 33, 30, 0.05);
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.demo-rag-panel {
  padding: 20px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.rag-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.rag-flow span:not([aria-hidden="true"]) {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
}

.demo-query-form {
  display: grid;
  gap: 8px;
}

.demo-query-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.demo-input-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
}

.demo-input-row input {
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
}

.demo-results {
  margin-top: 18px;
}

.demo-empty {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-muted);
}

.demo-empty strong {
  color: var(--text);
}

.demo-answer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.demo-draft {
  margin: 0;
}

.best-match,
.alternative-matches {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: var(--source-bg);
}

.best-match h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.timestamp-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin: 12px 0 3px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--nav-active);
  color: var(--surface);
  font-size: 18px;
  font-weight: 900;
}

.alternative-matches {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.alt-match {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.alt-match small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.alt-match b {
  color: var(--green-dark);
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 10, 8, 0.54);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  position: relative;
  width: min(620px, 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-panel h2 {
  margin: 0 0 6px;
  font-size: 27px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.briefing-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding-left: 20px;
  line-height: 1.5;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary-btn,
.secondary-btn,
.done-btn,
.add-client-form button,
.toggle-btn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 850;
}

.primary-btn {
  color: #ffffff;
  background: var(--green);
  box-shadow: 0 12px 25px rgba(31, 168, 85, 0.23);
}

[data-theme="dark"] .primary-btn,
[data-theme="dark"] .add-client-form button {
  color: #07100c;
}

.primary-btn.is-copied {
  background: var(--green-dark);
}

.secondary-btn:disabled,
.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-btn,
.toggle-btn {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}

.done-btn {
  color: var(--surface);
  background: var(--nav-active);
}

.done-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.add-client-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(190px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  margin-bottom: 18px;
}

.add-client-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.add-client-form input {
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
}

.add-client-form button {
  color: #ffffff;
  background: var(--green);
}

.table-card {
  overflow: hidden;
}

.table-head,
.whitelist-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr .9fr 120px 260px;
  gap: 12px;
  align-items: center;
}

.table-head {
  padding: 14px 16px;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.whitelist-row {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}

.whitelist-row:last-child {
  border-bottom: 0;
}

.client-cell strong,
.manager-card strong {
  display: block;
}

.client-cell span,
.manager-card small {
  color: var(--muted);
}

.blocked {
  color: var(--red);
  background: var(--red-soft);
}

.active-status {
  color: var(--green-dark);
  background: var(--green-soft);
}

.manager-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.manager-card {
  padding: 18px;
}

.manager-card-head {
  align-items: start;
  margin-bottom: 18px;
}

.manager-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--nav-active);
  color: var(--surface);
  font-weight: 850;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  margin-top: 5px;
  font-size: 25px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  color: white;
  background: var(--nav-active);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-weight: 800;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 40;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .queue-layout {
    grid-template-columns: 1fr;
  }

  .request-list {
    max-height: none;
    min-height: 0;
  }

  .manager-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-answer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .brand {
    flex-wrap: wrap;
  }

  .demo-badge {
    margin-left: 0;
  }

  .topbar-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .theme-toggle {
    order: 3;
  }

  .main-grid {
    padding: 16px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .status-tabs {
    width: 100%;
  }

  .detail-panel {
    min-height: 0;
    padding: 16px;
  }

  .add-client-form,
  .table-head,
  .whitelist-row {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .whitelist-row {
    gap: 8px;
  }

  .manager-cards,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .timeline-header,
  .detail-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .timeline-bubble {
    width: 100%;
  }

  .timeline-actions {
    justify-content: flex-start;
  }

  .demo-input-row {
    grid-template-columns: 1fr;
  }

  .alt-match {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── Login-Overlay + Feedback (Produktiv-UI) ───────────────────────── */
.login-backdrop {
  position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; background: var(--bg, #f5f6fa); z-index: 50;
}
.login-card {
  width: min(360px, 92vw); padding: 28px; border-radius: 14px;
  background: var(--panel, #fff); box-shadow: 0 12px 40px rgba(20, 24, 40, .14);
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { font-size: 1.25rem; margin: 0; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.login-card input {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border, #d8dbe4);
  background: transparent; color: inherit; font: inherit;
}
.login-error { color: #c0392b; font-size: .85rem; min-height: 1.2em; margin: 0; }
.feedback-form { display: flex; flex-direction: column; gap: 12px; }
.feedback-form textarea {
  min-height: 110px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border, #d8dbe4); background: transparent;
  color: inherit; font: inherit; resize: vertical;
}
.feedback-form select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border, #d8dbe4);
  background: transparent; color: inherit; font: inherit;
}
.memory-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.memory-note {
  padding: 10px 12px; border-radius: 8px; background: var(--panel-soft, #f2f3f8);
  font-size: .88rem;
}
.memory-note small { opacity: .65; display: block; margin-top: 4px; }
.hidden { display: none !important; }

/* Karten nicht auf Listenhöhe strecken (min-height 480px + grid stretch) */
.request-list { align-content: start; }
.customer-card { align-content: start; }

/* Konfidenz-Badges (aus Rerank-Score) */
.confidence-high { background: rgba(31,168,85,.15); color: var(--green-dark, #157a3d); }
.confidence-mid  { background: rgba(230,160,30,.18); color: #8a5d00; }
.confidence-low  { background: rgba(200,60,50,.15); color: #a3271f; }

/* Whitelist-Zeilen: Aktionsspalte trägt jetzt 3 Buttons (Sperren/Auskunft/Löschen) */
.whitelist-row { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.whitelist-row .secondary-btn { padding: 0 10px; min-height: 30px; font-size: 12px; }

/* Login-Branding */
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-brand .brand-mark {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--green, #1fa855); color: #fff; font-weight: 850; font-size: 15px;
}
.login-brand .brand-title { font-size: 1.15rem; font-weight: 800; line-height: 1.1; }
.login-brand .brand-subtitle { font-size: .82rem; color: var(--muted, #777); }

/* ── Kunden-Thread-Posteingang ─────────────────────────────────────── */
.health-dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:7px; vertical-align:middle; }
.sla-chip { font-size:11px; font-weight:800; padding:3px 8px; border-radius:999px; white-space:nowrap; }
.sla-red    { background:rgba(192,57,50,.14);  color:#a3271f; }
.sla-orange { background:rgba(224,140,20,.16); color:#8a4b00; }
.sla-yellow { background:rgba(224,180,20,.18); color:#7a5c00; }
.sla-green  { background:rgba(31,168,85,.14);  color:#157a3d; }
.sla-grey   { background:var(--surface-soft);  color:var(--muted); }
.mini-tag { font-size:10.5px; font-weight:800; padding:1px 6px; border-radius:6px; margin-right:5px; }
.tag-dringend { background:rgba(192,57,50,.14); color:#a3271f; }
.tag-aktuell  { background:rgba(224,180,20,.18); color:#7a5c00; }
.tag-prio { background:var(--surface-soft); color:var(--green-dark); }
.tag-todo { background:rgba(55,48,163,.12); color:#3730a3; }

/* Status-Leiste im Thread */
.status-bar { background:var(--surface-soft); border-radius:10px; padding:12px 14px; margin:12px 0; display:flex; flex-direction:column; gap:10px; }
.ball-row { display:flex; gap:8px; flex-wrap:wrap; }
.ball-btn { border:1px solid var(--border); background:var(--surface); color:var(--muted); border-radius:8px; padding:6px 12px; font-weight:800; font-size:13px; min-height:34px; }
.ball-btn.active { background:var(--nav-active); color:#fff; border-color:transparent; }
.ctrl-row { display:flex; gap:16px; flex-wrap:wrap; }
.ctrl-row label { font-size:12px; font-weight:700; color:var(--muted); display:flex; align-items:center; gap:6px; }
.ctrl-row select { border:1px solid var(--border); border-radius:7px; padding:4px 8px; background:var(--surface); color:inherit; font:inherit; }
.todo-row { display:flex; gap:8px; }
.todo-row input { flex:1; border:1px solid var(--border); border-radius:8px; padding:7px 10px; background:var(--surface); color:inherit; font:inherit; }

/* Steckbrief */
.steckbrief { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:10px 14px; margin-bottom:12px; }
.steckbrief > summary { font-weight:800; cursor:pointer; color:var(--green-dark); }
.steckbrief-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:12px 0; }
.steckbrief-grid label { font-size:12px; font-weight:700; color:var(--muted); display:flex; flex-direction:column; gap:4px; }
.steckbrief-grid input { border:1px solid var(--border); border-radius:7px; padding:6px 9px; background:transparent; color:inherit; font:inherit; }

/* Konversation + Nachrichten-Blöcke */
.conversation { display:flex; flex-direction:column; gap:18px; }
.msg-block { border-top:1px solid var(--border); padding-top:14px; }
.msg-block:first-child { border-top:0; padding-top:0; }

/* Video-Zeilen mit Rating + Copy */
.vid-row { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding:9px 0; border-bottom:1px dashed var(--border); }
.vid-row:last-child { border-bottom:0; }
.vid-title { font-weight:800; font-size:13px; }
.vid-info { font-size:12px; color:var(--muted); margin-top:2px; }
.vid-actions { display:flex; gap:8px; align-items:center; flex:none; }
.vid-actions .secondary-btn { min-height:30px; padding:0 10px; font-size:12px; }
.rating-pill { font-size:10.5px; font-weight:800; padding:1px 7px; border-radius:999px; margin-left:6px; }
.rating-high { background:rgba(31,168,85,.15); color:#157a3d; }
.rating-mid  { background:rgba(224,180,20,.18); color:#7a5c00; }
.rating-low  { background:var(--surface-soft); color:var(--muted); }
.session-ignore { color:var(--muted); }
.session-ignore:hover { color:#b23b2e; border-color:#b23b2e; }

/* ── Einstellungen: Sub-Tabs, Formulare, Snippets (theme-var-basiert) ───────── */
.set-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.set-tab { background: var(--surface); border: 1px solid var(--border); color: var(--muted);
           border-radius: var(--radius); padding: 9px 16px; font-weight: 600; font-size: 14px; cursor: pointer; }
.set-tab:hover { color: var(--text); border-color: var(--border-strong); }
.set-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.set-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
                 padding: 14px 18px; border-bottom: 1px solid var(--border); }
.set-form { display: grid; gap: 14px; margin: 16px 0; }
.set-form label { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.set-form input { width: 100%; box-sizing: border-box; margin-top: 5px; }
.set-check { display: flex; align-items: center; gap: 9px; }
.set-check input { margin: 0; width: auto; }
.set-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.set-btn { background: var(--blue); border: 0; color: #fff; border-radius: var(--radius);
           padding: 9px 16px; font-weight: 600; font-size: 14px; cursor: pointer; }
.warn-box { background: var(--amber-soft); border: 1px solid var(--amber); border-radius: var(--radius);
            padding: 12px 14px; color: var(--text); font-size: 13px; }
.snip { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
        margin-top: 12px; background: var(--surface-muted); }
.snip-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.snip-head strong { color: var(--text); }
.snip-note { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.snip-text { white-space: pre-wrap; font-size: 13px; color: var(--text); margin-top: 10px;
             background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
             padding: 12px; max-height: 240px; overflow: auto; }

/* ── Dark-Mode-/Kontrast-Fixes (Codex-Review 23.07.) ───────────────────────── */
/* 1+2: undefinierte Fallback-Flaechen (--panel/--panel-soft) -> semantische Vars */
.login-card { background: var(--surface); color: var(--text); }
.memory-note { background: var(--surface-soft); color: var(--text); }
/* 3: native Selects + Optionen konsequent thematisieren (sonst helle Schrift auf weiss) */
select { color: var(--text); background-color: var(--surface); }
select option, select optgroup { color: var(--text); background-color: var(--surface); }
/* 4-7: weisser Inhalt auf hellem Dark-Mode-Highlight -> Surface-Farbe (in beiden Themes korrekt) */
.avatar, .toast, .ball-btn.active { color: var(--surface); }
[data-theme="dark"] .nav-item.active span,
[data-theme="dark"] .nav-item.active .nav-ico { color: var(--surface); }
/* 9: Chips im Dark Mode kraeftige Theme-Farben statt kontrastarmer Fixfarben */
[data-theme="dark"] .sla-red, [data-theme="dark"] .tag-dringend { color: var(--red); }
[data-theme="dark"] .sla-orange, [data-theme="dark"] .sla-yellow,
[data-theme="dark"] .tag-aktuell, [data-theme="dark"] .rating-mid { color: var(--amber); }
[data-theme="dark"] .sla-green, [data-theme="dark"] .rating-high { color: var(--green); }
[data-theme="dark"] .tag-todo { color: #a9a4ff; }

/* ── Professionelle Politur: Dropdowns + Kunden-Threads (24.07.) ────────────── */
/* Dropdowns: eigener Chevron (appearance:none), konsistente Groesse, klarer Focus */
select, .ctrl-row select, .set-form select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  min-height: 38px; padding: 0 34px 0 12px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background-color: var(--surface); color: var(--text); font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%238a94a0'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='6%209%2012%2015%2018%209'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:hover, .ctrl-row select:hover { border-color: var(--muted-2); }
select:focus, .ctrl-row select:focus {
  outline: none; border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(31,168,85,.16);
}
select option, select optgroup { color: var(--text); background-color: var(--surface); font-weight: 500; }
.ctrl-row select { min-height: 34px; }

/* Kunden-Karten: professionellere Auswahl (Grün-Akzentkante) + ruhigerer Hover */
.customer-card { border-radius: 11px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.customer-card:hover { border-color: var(--border-strong); background: var(--surface);
  transform: none; box-shadow: 0 4px 14px rgba(20,33,30,.06); }
.customer-card.selected { background: var(--surface); border-color: rgba(31,168,85,.5);
  box-shadow: inset 3px 0 0 var(--green-dark), 0 6px 18px rgba(20,33,30,.08); }
[data-theme="dark"] .customer-card.selected { background: var(--surface-soft); }
.customer-main { padding: 14px 15px 0; }
.request-name { font-weight: 700; letter-spacing: -.01em; }
.request-preview { margin: 9px 0 11px; }
.draft-state { font-weight: 650; }

/* Filter-Tabs, Toolbar, Detail-Leiste, Chips: dezentere Gewichte */
.status-tab { font-weight: 650; }
.status-tab.active { font-weight: 700; }
.panel-toolbar { padding: 16px; }
.panel-toolbar strong { font-weight: 700; }
.search-input { height: 40px; border-radius: 9px; }
.search-input:focus { outline: none; border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(31,168,85,.14); }
.status-bar { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.ctrl-row { gap: 18px; }
.ctrl-row label { font-weight: 600; gap: 8px; }
.ball-btn { font-weight: 650; border-radius: 9px; }
.sla-chip { font-weight: 700; letter-spacing: .01em; }
.mini-tag { font-weight: 700; font-size: 11px; padding: 2px 7px; border-radius: 7px; }

/* ══ 4-Ecken-IA: Nav-Gruppen · Mobile Bottom-Tab · Lernpfad · Curriculum (24.07.) ══ */

/* Desktop-Sidebar: Gruppen */
.nav-group { display: grid; gap: 2px; }
.nav-group + .nav-group { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-group-label { display: flex; align-items: center; gap: 8px; padding: 2px 12px 5px;
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); }
.nav-group-ico { width: 15px; height: 15px; flex: none; color: var(--muted-2); }

/* Bottom-Tab + Sub-Nav + Detail-Back: Desktop aus */
.bottom-nav { display: none; }
.group-subnav { display: none; }
.detail-back { display: none; }

.bottom-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750;
  padding: 4px 2px; min-height: 50px; border-radius: 10px; }
.bottom-ico { width: 24px; height: 24px; }
.bottom-tab.active { color: var(--green-dark); }

.subnav-item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; min-height: 40px; text-decoration: none; }
.subnav-item.active { background: var(--nav-active); color: #fff; border-color: transparent; }
.subnav-item .nav-ico { width: 18px; height: 18px; padding: 0; background: transparent; color: inherit; }
.subnav-item.active .nav-ico { color: #fff; }

.detail-back { align-items: center; gap: 6px; border: 0; background: transparent;
  color: var(--green-dark); font-weight: 750; font-size: 14px; padding: 2px 0 12px; }

/* Master-Detail als Push-Nav, sobald einspaltig (≤1120) */
@media (max-width: 1120px) {
  .side-nav { position: sticky; top: 80px; display: grid; gap: 8px; overflow: visible; }
  .queue-layout { grid-template-columns: 1fr; }
  #queueView .detail-panel { display: none; }
  #queueView.show-detail .queue-list-panel { display: none; }
  #queueView.show-detail .detail-panel { display: block; }
  .detail-back { display: inline-flex; }
}
@media (min-width: 900.02px) and (max-width: 1120px) {
  .main-grid { grid-template-columns: 200px minmax(0, 1fr); }
}

/* ≤900: Bottom-Tab-Modus (iPhone/Tablet) */
@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); }
  .side-nav { display: none; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface-raised); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(20, 33, 30, .10); }
  .group-subnav { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .group-subnav::-webkit-scrollbar { display: none; }
  .topbar { position: sticky; padding: 12px 16px; }
  .curr-search { max-width: 100%; }
}

/* Lernpfad-Kachel im Kunden-Dashboard */
.lernpfad-tile { margin: 12px 0; }
.lernpfad { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); overflow: hidden; }
.lernpfad > summary { list-style: none; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; padding: 12px 14px; font-weight: 800; }
.lernpfad > summary::-webkit-details-marker { display: none; }
.lp-title { color: var(--text); }
.lp-sum { color: var(--muted); font-size: 13px; font-weight: 700; }
.lp-mods { padding: 4px 14px 12px; display: grid; gap: 9px; }
.mod-row { display: grid; grid-template-columns: auto minmax(84px, 150px) 1fr auto; gap: 10px; align-items: center; }
.mod-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.mod-name { font-size: 12.5px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-bar { position: relative; height: 8px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.mod-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.mod-fill.assigned { background: var(--amber); opacity: .45; }
.mod-fill.seen { background: var(--green); }
.mod-count { font-size: 11.5px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.lp-sugg { margin: 0 14px 8px; border: 1px dashed var(--amber); border-radius: 10px;
  padding: 8px 10px; background: rgba(224, 160, 32, .09); }
.lp-sugg-head { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.lp-sugg-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; flex-wrap: wrap; }
.lp-sugg-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.lp-sugg-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.lp-link { color: var(--blue); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.lp-sugg-act { display: flex; gap: 6px; align-items: center; }
.lp-approve { border: 1px solid var(--green-dark); background: var(--green); color: #fff;
  border-radius: 8px; padding: 5px 10px; font-weight: 750; font-size: 12px; min-height: 34px; }
.lp-approve.alt { background: transparent; color: var(--green-dark); }
.lp-reject { border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted);
  border-radius: 8px; width: 34px; height: 34px; font-size: 16px; line-height: 1; }
.lp-actions { display: flex; gap: 8px; padding: 0 14px 12px; flex-wrap: wrap; }

/* Lektions-Manager (Modal) */
.lm-list { max-height: 60vh; overflow: auto; margin-top: 10px; }
.lm-mod { border-bottom: 1px solid var(--border); }
.lm-mod > summary { cursor: pointer; padding: 11px 4px; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.lm-mn { flex: 1; }
.lm-c { color: var(--muted); font-size: 12px; font-weight: 700; }
.lm-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 4px 4px; font-weight: 800; }
.lm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.lm-lt { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lm-row.status-gesehen { opacity: .55; }
.lm-row.status-vorgeschlagen .lm-lt::before { content: "● "; color: var(--amber); }
.lm-sel { min-height: 34px; }

/* Curriculum-Browser (SZM-Daten) */
.curr-search { max-width: 300px; }
.curriculum-body { display: grid; gap: 10px; margin-top: 4px; }
.curr-mod { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raised); box-shadow: var(--shadow); overflow: hidden; }
.curr-mod > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 800; }
.curr-mod > summary::-webkit-details-marker { display: none; }
.curr-mod-name { flex: 1; color: var(--text); }
.curr-mod-c { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.curr-sec { padding: 0 16px 8px; }
.curr-sec-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; padding: 10px 0 4px; }
.curr-lesson { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.curr-lt { font-size: 14px; color: var(--text); }
.curr-dur { font-size: 12px; color: var(--muted); white-space: nowrap; }
.curr-nolink { color: var(--muted-2); }
.empty-state.small { padding: 14px; font-size: 13px; }

/* Review-Fixes 24.07.: Nav-Link-Unterstrich weg, Detail-Leerzustand zentriert */
.nav-item, .subnav-item { text-decoration: none; }
.detail-panel .empty-state { display: flex; align-items: center; justify-content: center;
  min-height: 220px; text-align: center; padding: 24px; color: var(--muted); }

/* ══ Horizontaler-Overflow-Schutz (Desktop-Übergang + Mobil „halbe Seite") 24.07. ══ */
/* Backstop: nichts läuft je aus dem Viewport (clip statt hidden → kein
   Scroll-Container-Nebeneffekt, position:sticky von Topbar/Sidebar bleibt heil) */
.app-shell { overflow-x: clip; }
/* min-width:0 hebt den Grid/Flex-min-content-Zwang auf → Spalten schrumpfen, Inhalt bricht um */
.content, .view, .queue-layout, .queue-list-panel, .detail-panel,
.customer-card, .customer-main, .request-topline, .request-meta, .conversation,
.status-bar, .ctrl-row, .lernpfad-tile, .lernpfad, .detail-title-row,
.demo-rag-panel, .table-card, .manager-card { min-width: 0; }
/* 2-Spalten-Queue: Spalten dürfen schrumpfen (kein harter 330/450-Boden mehr) */
@media (min-width: 1120.02px) {
  .queue-layout { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.35fr); }
}
/* Karten-Inhalt sauber kürzen statt Spalte aufzublähen */
.request-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-preview, .empty-state, .lp-sugg-t, .curr-lt, .mod-name { overflow-wrap: anywhere; }
.detail-panel .empty-state { max-width: 100%; }

/* ══ Mobile-Politur (CSS-seitig) 24.07. ══ */
@media (max-width: 760px) {
  /* Kompaktere Topbar (weniger vertikale Wucht) */
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-title { font-size: 15px; }
  .brand-subtitle { font-size: 11px; }
  .demo-badge { margin-left: 8px; padding: 4px 9px; font-size: 11px; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .secondary-btn { min-height: 34px; padding: 0 12px; font-size: 13px; }
  .user-chip { min-height: 34px; padding: 4px 10px 4px 5px; font-size: 13px; }
  .theme-toggle { width: 34px; height: 34px; font-size: 16px; }
  /* Straffere vertikale Rhythmik vor der Liste */
  .main-grid { padding-top: 10px; }
  .group-subnav { padding: 2px 2px 10px; }
  .section-head { margin-bottom: 12px; }
  .section-head h1 { font-size: 22px; line-height: 1.15; }
  .eyebrow { font-size: 11px; margin-bottom: 4px; }
  /* Etwas mehr Luft in den Karten für Touch */
  .customer-main { padding: 15px 15px 0; }
}
/* Bottom-Tab: klarerer Aktiv-Zustand (dezente grüne Pille statt nur Textfarbe) */
.bottom-tab { transition: background .15s ease, color .15s ease; }
.bottom-tab.active { background: rgba(31, 168, 85, 0.12); }
/* Status-Tabs: dezenter Scroll-Hinweis am rechten Rand (nur wenn scrollbar) */
@media (max-width: 900px) {
  .status-tabs { padding-right: 18px; }
}

/* ══ Lernpfad standardmäßig eingeklappt + klarer Klapp-Chevron 24.07. ══ */
.lernpfad > summary { justify-content: flex-start; gap: 8px; }
.lernpfad .lp-title { flex: 1; }
.lernpfad > summary::after, .curr-mod > summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin-left: 6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s ease;
}
.lernpfad[open] > summary::after, .curr-mod[open] > summary::after { transform: rotate(-135deg); }
/* Eingeklappt: etwas prominenter als antippbare Leiste */
.lernpfad:not([open]) > summary { color: var(--text); }
.lp-sugg-more { font-size: 12px; color: var(--muted); padding: 6px 2px 2px; font-weight: 650; }

/* Mobile Topbar-Buttons sauber gruppieren, rechtsbündig (Login/User gehört nach rechts oben) 24.07. */
@media (max-width: 760px) {
  .topbar-actions { justify-content: flex-end; align-items: center; }
  .topbar-actions .secondary-btn,
  .topbar-actions .user-chip,
  .topbar-actions .theme-toggle { flex: 0 0 auto; }
}

/* Kontrast: aktive Pillen liegen auf hellem --nav-active (Dark-Mode) → Schrift = --surface
   (dunkel im Dark-Mode, hell im Light-Mode) statt hartem #fff */
.nav-item.active, .nav-item.active span, .nav-item.active .nav-ico,
.subnav-item.active, .subnav-item.active .nav-ico,
.ball-btn.active, .avatar { color: var(--surface); }

/* ══ Kundenliste-Optimierung: Dringlichkeits-Akzent links (Scanbarkeit) 24.07. ══ */
.customer-card { border-left-width: 3px; }
.customer-card.urg-warn, .customer-card.urg-high { border-left-color: var(--amber); }
.customer-card.urg-breach { border-left-color: var(--red); }
/* Prioritäts-Tag neutral statt irreführend „grün/positiv" */
.tag-prio { background: var(--surface-muted); color: var(--muted); }
[data-theme="dark"] .tag-prio { color: var(--muted); }

/* ══ Nav-Label-Fix: Legacy-Icon-Box am Label entfernen (kein „Blob") 24.07. ══ */
.nav-item span {
  display: inline; width: auto; height: auto;
  background: transparent; border-radius: 0; place-items: initial;
  color: inherit;
}
.nav-item.active span { background: transparent; }

/* Session-Auto-Zuordnung: Vorschlagszeile (Kundenwunsch #4) */
.sess-suggest { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; margin-top: 10px; padding: 8px 10px; border-radius: 9px;
  border: 1px dashed var(--amber); background: rgba(224,160,32,.09); font-size: 13px; }
/* Antwort-Fokus: Kachel für Nachrichten ohne Auto-Entwurf */
.draft-ondemand { border: 1px dashed var(--border-strong); background: var(--surface-soft); }
.draft-ondemand .secondary-btn { margin-top: 8px; }

/* ══ Kunden-Übersicht vereinfacht (Kundenwunsch 04.08.) ══════════════════ */
/* Status-Steuerung eingeklappt: erst Überblick, Bearbeiten auf Wunsch. */
.status-fold { border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface-soft); margin: 12px 0; overflow: hidden; }
.status-fold > summary { list-style: none; cursor: pointer; display: flex;
  align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; }
.status-fold > summary::-webkit-details-marker { display: none; }
.status-fold > summary::after { content: ""; flex: none; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s ease; }
.status-fold[open] > summary::after { transform: rotate(-135deg); }
.sf-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-width: 0; }
.sf-hint { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.status-fold .status-bar { margin: 0; border: 0; border-top: 1px solid var(--border);
  border-radius: 0; background: transparent; }
.tag-ball { background: var(--surface-muted); color: var(--muted); }
/* Konversation klar als Hauptinhalt kennzeichnen */
.conv-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin: 16px 0 8px; font-weight: 800; font-size: 13px; color: var(--text);
  padding-top: 12px; border-top: 1px solid var(--border); }
.conv-hint { font-size: 11.5px; font-weight: 650; color: var(--muted-2); }

/* Todo-Zeile auf schmalen Screens stapeln (lief sonst aus dem Bild) */
@media (max-width: 760px) {
  .todo-row { flex-direction: column; align-items: stretch; }
  .todo-row input { width: 100%; min-width: 0; }
  .todo-row .secondary-btn { min-height: 44px; }
}

/* Verlaufsnachrichten schlank: nur die Nachricht, keine Entwurfs-Kachel/Aktionen.
   Trennlinie + großzügiges Padding entfallen, damit der Verlauf kompakt liest. */
.msg-block.history { border-top: 0; padding-top: 0; margin: 0; }
.conversation { gap: 18px; }
.conversation .msg-block.history + .msg-block.history { margin-top: -12px; }
.conversation-box.slim { padding: 8px 12px; background: var(--surface-muted);
  border-left: 2px solid var(--border-strong); border-radius: 8px; }
.conversation-box.slim .box-label { font-size: 10.5px; margin-bottom: 2px; opacity: .75; }
.conversation-box.slim .message-text { font-size: 13.5px; line-height: 1.45; margin: 0; }

/* Nicht-aktive Nachrichten: schlank UND anklickbar (holt Entwurf/Werkzeuge her) */
button.msg-block.history { display: block; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 0; cursor: pointer; }
button.msg-block.history:hover .conversation-box.slim { border-left-color: var(--green);
  background: var(--surface-soft); }
.slim-flag { margin-left: 8px; font-size: 10px; font-weight: 800; padding: 1px 6px;
  border-radius: 999px; background: var(--green-soft); color: var(--green-dark); }
.slim-flag.open { background: var(--amber-soft); color: var(--amber); }
/* Aktive Nachricht klar abgesetzt */
.msg-block:not(.history) { border-left: 3px solid var(--green); padding-left: 12px;
  border-top: 0; padding-top: 0; }

/* ── Todo-Liste je Kunde (Ticket #14) ─────────────────────────────────
   Löst das eine Freitextfeld ab: mehrere Einträge mit Verantwortlichkeit. */
.todo-panel { border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); margin: 12px 0; overflow: hidden; }
.todo-head { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px; }
.todo-title { font-weight: 800; font-size: 13px; }
.todo-list { list-style: none; margin: 0; padding: 0 14px;
  border-top: 1px solid var(--border); }
.todo-item { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.todo-item:last-child { border-bottom: 0; }
.todo-item > label { display: flex; align-items: flex-start; gap: 9px;
  cursor: pointer; min-width: 0; flex: 1; }
.todo-item input[type="checkbox"] { flex: none; width: 17px; height: 17px;
  margin-top: 1px; accent-color: var(--green-dark); cursor: pointer; }
.todo-text { font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted-2); }
.todo-side { display: flex; align-items: center; gap: 4px; flex: none; }
.todo-empty { padding: 10px 0; font-size: 13px; }
.icon-x { border: 0; background: transparent; color: var(--muted-2); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.icon-x:hover { background: var(--red-soft); color: var(--red); }
.todo-add { display: flex; gap: 8px; padding: 10px 14px; flex-wrap: wrap;
  border-top: 1px solid var(--border); background: var(--surface-muted); }
.todo-add input { flex: 1 1 180px; min-width: 0; border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; background: var(--surface);
  color: inherit; font: inherit; }
.todo-add select { border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 8px; background: var(--surface); color: inherit; font: inherit; }
.owner-szm { background: var(--green-soft); color: var(--green-dark); }
.owner-kunde { background: var(--amber-soft); color: #8a5a00; }
.tag-ki { background: #e6ecfd; color: var(--blue); }
.suggest-box { margin: 10px 14px 12px; border: 1px dashed var(--border-strong);
  border-radius: 10px; padding: 10px 12px; background: var(--surface-muted); }
.suggest-row { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 0; font-size: 13.5px; }
.suggest-row + .suggest-row { border-top: 1px solid var(--border); }

/* ── Konversations-Werkzeuge: Sammel-Erledigt + Mehrfachauswahl ────────── */
.conv-head { flex-wrap: wrap; }
.conv-tools { display: flex; gap: 8px; flex: none; }
.conv-tools .secondary-btn.active { background: var(--nav-active); color: #fff;
  border-color: var(--nav-active); }
.conv-head .conv-hint { flex-basis: 100%; }
.pick-bar { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 12px; margin-bottom: 10px; border-radius: 10px;
  background: var(--green-soft); color: var(--green-dark); font-weight: 700;
  font-size: 13px; position: sticky; top: 0; z-index: 3; }
.msg-block.pickable { display: flex; gap: 10px; align-items: flex-start; }
.msg-block.pickable > *:not(.pick-box) { flex: 1; min-width: 0; }
.pick-box { flex: none; width: 18px; height: 18px; margin-top: 10px;
  accent-color: var(--green-dark); cursor: pointer; }

/* ── Allowlist: Suche + unbekannte Absender (Tickets #9/#10) ──────────── */
.allow-toolbar { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px;
  flex-wrap: wrap; }
.allow-toolbar input { flex: 1 1 260px; min-width: 0; border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 12px; background: var(--surface);
  color: inherit; font: inherit; }
.pending-card { border: 1px solid var(--amber); border-radius: 12px;
  background: var(--amber-soft); padding: 12px 14px; margin-bottom: 14px; }
.pending-note { font-size: 12px; margin: 2px 0 10px; }
.pending-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px solid rgba(0,0,0,.08); }
.pending-name { font-weight: 750; font-size: 13.5px; flex: 1 1 160px; min-width: 0; }
.pending-actions { display: flex; gap: 6px; flex: none; }

@media (max-width: 760px) {
  .conv-tools { width: 100%; }
  .conv-tools .secondary-btn { flex: 1; min-height: 40px; }
  .todo-add { flex-direction: column; align-items: stretch; }
  .todo-add .secondary-btn { min-height: 42px; }
  .pending-row { align-items: flex-start; }
  .pending-actions { width: 100%; }
  .pending-actions button { flex: 1; min-height: 40px; }
}

/* Dunkles Theme: die wenigen fest kodierten Flächen abdunkeln, sonst leuchten
   Hinweiskarten und Tags im Dunkeln unangenehm auf. */
[data-theme="dark"] .tag-ki { background: #1e2a4a; color: #9db8ff; }
[data-theme="dark"] .owner-kunde { background: #3a2c10; color: #f0c46a; }
[data-theme="dark"] .pending-card { background: #33280f; border-color: #7a5b1c; }
[data-theme="dark"] .pending-row { border-top-color: rgba(255,255,255,.10); }
[data-theme="dark"] .pick-bar { background: #143324; color: #7fe0a6; }

/* ── Lektions-Korrektur: „Passt besser“ (Ticket #13) ───────────────────── */
.rating-confirmed { background: var(--green-soft); color: var(--green-dark);
  margin-left: 4px; }
[data-theme="dark"] .rating-confirmed { background: #143324; color: #7fe0a6; }
.vid-fix { border-style: dashed; }
.vid-hint { font-size: 11.5px; margin: 8px 2px 0; }
@media (max-width: 760px) {
  .vid-actions { flex-wrap: wrap; }
  .vid-actions .secondary-btn { min-height: 38px; }
}

/* ── Ticket-Ansicht (Feedback mit Status und Aufwand) ─────────────────── */
.ticket-filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 14px; }
.ticket { border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: 12px; background: var(--surface); padding: 12px 14px; margin-bottom: 10px; }
.ticket.t-erledigt  { border-left-color: var(--green); }
.ticket.t-arbeit    { border-left-color: var(--blue); }
.ticket.t-geplant   { border-left-color: var(--amber); }
.ticket.t-abgelehnt { border-left-color: var(--muted-2); }
.ticket-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px; }
.ticket-id { font-weight: 800; font-size: 13px; color: var(--muted); }
.ticket-meta { color: var(--muted-2); font-size: 11.5px; margin-left: auto; }
.ticket-msg { margin: 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap;
  overflow-wrap: anywhere; }
.ticket-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px;
  background: var(--surface-soft); font-size: 13px; line-height: 1.45; }
.tag-kind   { background: var(--surface-muted); color: var(--muted); }
.tag-effort { background: #eef1fb; color: #3a4a8c; }
.status-pill.t-offen     { background: var(--surface-muted); color: var(--muted); }
.status-pill.t-geplant   { background: var(--amber-soft); color: #8a5a00; }
.status-pill.t-arbeit    { background: #e6ecfd; color: var(--blue); }
.status-pill.t-erledigt  { background: var(--green-soft); color: var(--green-dark); }
.status-pill.t-abgelehnt { background: var(--surface-muted); color: var(--muted-2); }
.ticket-edit { margin-top: 8px; }
.ticket-edit > summary { list-style: none; cursor: pointer; font-size: 12px;
  font-weight: 700; color: var(--muted); padding: 4px 0; }
.ticket-edit > summary::-webkit-details-marker { display: none; }
.ticket-edit > summary::before { content: "▸ "; }
.ticket-edit[open] > summary::before { content: "▾ "; }
.ticket-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 10px; border-radius: 10px; background: var(--surface-muted); }
.ticket-form label { display: flex; flex-direction: column; gap: 4px;
  font-size: 11.5px; font-weight: 700; color: var(--muted); }
.ticket-form select, .ticket-form input { border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; background: var(--surface);
  color: inherit; font: inherit; font-weight: 400; }
.ticket-note-field { flex: 1 1 260px; min-width: 0; }
.ticket-note-field input { width: 100%; }

[data-theme="dark"] .tag-effort { background: #232c4a; color: #a9b8ee; }
[data-theme="dark"] .status-pill.t-arbeit { background: #1e2a4a; color: #9db8ff; }
[data-theme="dark"] .status-pill.t-geplant { background: #3a2c10; color: #f0c46a; }
[data-theme="dark"] .status-pill.t-erledigt { background: #143324; color: #7fe0a6; }

@media (max-width: 760px) {
  .ticket-meta { margin-left: 0; flex-basis: 100%; }
  .ticket-form { flex-direction: column; align-items: stretch; }
  .ticket-form .secondary-btn { min-height: 42px; }
}
.ticket-hint { font-size: 12px; margin: 0 0 10px; }
.tag-intern { background: var(--green-soft); color: var(--green-dark); }
[data-theme="dark"] .tag-intern { background: #143324; color: #7fe0a6; }

/* ── Kontakt-/Gruppenauswahl in der Allowlist (Ticket #19) ────────────── */
.wa-picker { border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); margin: 12px 0; overflow: hidden; }
.wa-picker > summary { list-style: none; cursor: pointer; padding: 10px 14px;
  font-weight: 800; font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.wa-picker > summary::-webkit-details-marker { display: none; }
.wa-picker > summary::before { content: "▸ "; color: var(--muted); }
.wa-picker[open] > summary::before { content: "▾ "; }
.wa-picker-body { border-top: 1px solid var(--border); padding: 12px 14px; }
.wa-picker-body > input { width: 100%; border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 12px; background: var(--surface);
  color: inherit; font: inherit; margin-bottom: 10px; }
.wa-pick-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid var(--border); }
.wa-pick-row:last-of-type { border-bottom: 0; }
.wa-pick-name { flex: 1 1 200px; min-width: 0; font-size: 13.5px; font-weight: 650;
  overflow-wrap: anywhere; }
.wa-pick-hint { font-size: 11.5px; margin: 10px 0 0; }
.tag-gruppe { background: #e6ecfd; color: var(--blue); }
.tag-drin { background: var(--green-soft); color: var(--green-dark); }
[data-theme="dark"] .tag-gruppe { background: #1e2a4a; color: #9db8ff; }
[data-theme="dark"] .tag-drin { background: #143324; color: #7fe0a6; }

/* ── Scroll bleibt, wo der Zeiger ist (Ticket #20) ────────────────────── */
/* Ohne das lief das Rad am Ende der Kundenliste auf die Seite weiter und der
   rechte Bereich sprang mit — man wollte links scrollen, es scrollte rechts. */
.request-list, .conversation, .detail-panel, .side-nav,
.wa-picker-body, .table-body { overscroll-behavior: contain; }
/* Die Seitenleiste scrollt bei Bedarf SELBST, statt das Rad weiterzureichen. */
@media (min-width: 901px) {
  .side-nav { max-height: calc(100vh - 112px); overflow-y: auto; }
}
.tag-gesperrt { background: var(--red-soft); color: #a3271f; }
[data-theme="dark"] .tag-gesperrt { background: #3a1a18; color: #f0a09a; }
