:root {
  --bg: #f6f5ef;
  --surface: #fffdf8;
  --surface-muted: #efeadf;
  --soft: #f7f8f2;
  --line: #d9d2c3;
  --text: #253228;
  --muted: #6b756c;
  --green: #2f6b4f;
  --green-dark: #214d39;
  --sage: #dfe8d7;
  --leaf: #8fb47d;
  --warning: #a0692a;
  --danger: #9d3e34;
  --shadow: 0 16px 34px rgba(39, 51, 41, 0.08);
  --context-panel-width: 340px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 38px;
  padding: 0 14px;
}

button:hover {
  background: var(--green-dark);
}

button:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

.login-screen {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(47, 107, 79, 0.08), rgba(255, 253, 248, 0.72) 34%, rgba(143, 180, 125, 0.1)),
    var(--bg);
  display: grid;
  min-height: 100vh;
  overflow: hidden;
  padding: 22px;
  place-items: center;
}

.login-screen[hidden],
.app-shell[hidden],
.login-panel[hidden] {
  display: none;
}

.login-panel {
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 58px rgba(37, 50, 40, 0.14);
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 440px;
  padding: 28px;
  width: 100%;
}

.login-panel .brand-lockup {
  border-bottom: 1px solid rgba(217, 210, 195, 0.85);
  padding-bottom: 18px;
}

.login-step {
  display: grid;
  gap: 15px;
}

.login-copy {
  display: grid;
  gap: 3px;
}

.login-copy p {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.login-copy h2 {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  line-height: 1.05;
  margin: 0;
}

.login-step-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin: -4px 0 0;
}

.login-panel label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-panel input,
.login-panel select {
  background: #fff;
  border-color: #cfc7b7;
  color: var(--text);
  min-height: 50px;
  padding: 11px 13px;
}

.login-panel input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 107, 79, 0.12);
  outline: none;
}

.login-panel > button,
.login-code-step .secondary-button {
  min-height: 50px;
}

.login-code-step .secondary-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--green-dark);
}

.login-code-step .secondary-button:hover {
  background: var(--surface-muted);
}

.login-panel [hidden] {
  display: none;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.login-hint,
.login-noscript {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  margin: 0;
}

.login-noscript {
  margin: 12px auto 0;
  max-width: 390px;
  text-align: center;
}

.app-shell {
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  padding: 0;
  gap: 0;
}

.topbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(178px, 228px) minmax(220px, 1fr) minmax(0, auto);
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-height: 54px;
  padding: 7px 10px;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 9px;
  min-width: 0;
}

.brand-copy {
  min-width: 0;
}

.brand-icon {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(39, 51, 41, 0.1);
  display: block;
  flex: 0 0 auto;
  height: 36px;
  width: 36px;
}

.login-panel .brand-icon {
  height: 48px;
  width: 48px;
}

.session-bar {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  max-width: 100%;
  min-width: 0;
}

.session-bar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.session-bar button {
  background: var(--surface-muted);
  color: var(--green-dark);
  min-height: 34px;
}

.session-bar button:hover {
  background: var(--sage);
}

.session-user-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  max-width: clamp(132px, 18vw, 220px);
  min-width: 0;
  padding: 0 10px;
}

.session-user-button span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

h1 {
  font-size: 19px;
  line-height: 1.15;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 15px;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 6px;
  min-width: 0;
}

.metric {
  appearance: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  min-width: 0;
  padding: 5px 10px;
  cursor: pointer;
  font: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.metric:hover,
.metric:focus-visible,
.metric.is-active {
  border-color: var(--green);
  background: #f3f9f1;
  box-shadow: inset 2px 0 0 var(--green);
  outline: none;
}

/* Reine Infografik-Kacheln (Antwortzeit, AI-Quote): kein Filter, kein Klick-/Hover-Verhalten. */
.metric.metric-static {
  cursor: default;
}

.metric.metric-static:hover,
.metric.metric-static:focus-visible {
  background: var(--surface-muted);
  border-color: var(--line);
  box-shadow: none;
}

.metric strong {
  display: block;
  color: var(--green-dark);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.metric span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.workspace {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 230px minmax(680px, 1fr) var(--context-panel-width);
  gap: 0;
  min-height: 0;
}

.workspace.inbox-collapsed {
  grid-template-columns: minmax(720px, 1fr) var(--context-panel-width);
}

.workspace.context-collapsed {
  grid-template-columns: 230px minmax(720px, 1fr);
}

.workspace.inbox-collapsed.context-collapsed,
.workspace.focus-mode {
  grid-template-columns: minmax(780px, 1fr);
}

.workspace.inbox-collapsed .inbox-panel,
.workspace.context-collapsed .customer-panel,
.workspace.focus-mode .inbox-panel,
.workspace.focus-mode .customer-panel {
  display: none;
}

.panel {
  background: var(--surface);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
}

.inbox-panel,
.customer-panel {
  overflow: hidden;
}

.inbox-panel {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.customer-panel {
  border-left: 1px solid var(--line);
}

.panel-header,
.conversation-header,
.customer-header {
  display: grid;
  gap: 7px;
  padding: 9px;
  border-bottom: 1px solid var(--line);
}

.panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  grid-template-columns: minmax(0, 1fr) auto;
  background: var(--surface);
  gap: 6px;
}

.panel-header .inbox-search,
.panel-header .filters {
  grid-column: 1 / -1;
}

.customer-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.icon-button {
  align-items: center;
  border-radius: 7px;
  display: inline-flex;
  font-size: 16px;
  height: 32px;
  justify-content: center;
  min-height: 32px;
  padding: 0;
  width: 32px;
}

.icon-button.active {
  background: var(--green-dark);
  color: #fff;
}

.view-toolbar {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding: 0;
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
}

.view-toolbar .icon-button {
  background: var(--surface-muted);
  color: var(--green-dark);
  height: 30px;
  min-height: 30px;
  width: 30px;
}

.view-toolbar .icon-button:hover,
.view-toolbar .icon-button.active {
  background: var(--green-dark);
  color: #fff;
}

.count,
.pill {
  align-items: center;
  background: var(--surface-muted);
  border-radius: 999px;
  color: var(--green-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 26px;
  padding: 0 10px;
  white-space: nowrap;
}

.pill.compact {
  height: 22px;
  padding: 0 8px;
}

.filters {
  display: none;
  gap: 4px;
  grid-template-columns: 1fr;
  padding: 0;
}

.filters select,
.inbox-search input {
  min-height: 32px;
  padding: 6px 8px;
}

.filters select {
  font-size: 12px;
  min-width: 0;
}

.inbox-scope-toggle {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--green-dark);
  /* Sichtbar, sobald es etwas zu zeigen gibt — das Verstecken steuert ausschließlich das [hidden]-Attribut
     (JS setzt es bei Zähler 0). Früher stand hier display:none als Grundzustand → der Button war IMMER
     unsichtbar (nur per Skript klickbar), obwohl Nicht-Kunden-Tickets vorhanden waren. */
  display: block;
  font-size: 12px;
  font-weight: 800;
  grid-column: 1 / -1;
  min-height: 30px;
  padding: 0 10px;
  text-align: center;
}

.inbox-scope-toggle:hover,
.inbox-scope-toggle.is-active {
  background: var(--sage);
}

.inbox-scope-toggle[hidden] {
  display: none;
}

.ops-panel {
  border-bottom: 1px solid var(--line);
  display: none;
  gap: 6px;
  padding: 8px 10px;
}

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

.ops-alerts {
  display: grid;
  gap: 6px;
}

.ops-alert {
  background: #f7f8f2;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  display: grid;
  gap: 2px;
  min-height: auto;
  padding: 7px 9px;
  text-align: left;
  width: 100%;
}

.ops-alert strong,
.ops-alert span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-alert strong {
  font-size: 12px;
}

.ops-alert span {
  color: var(--muted);
  font-size: 12px;
}

.ops-alert:hover {
  border-color: #b8c9ad;
  color: var(--text);
}

.ops-alert.warning {
  background: #fbf4e8;
  border-color: #e2c79b;
}

.ops-alert.urgent {
  background: #fff1ec;
  border-color: #e2b7aa;
}

.ops-alert.quiet {
  background: #f7f8f2;
}

.active-alert-filter {
  align-items: center;
  background: var(--sage);
  border: 1px solid #c7d8bf;
  border-radius: 7px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 7px 9px;
}

.active-alert-filter span {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-alert-filter button {
  background: #fff;
  border: 1px solid #c7d8bf;
  color: var(--green-dark);
  min-height: 28px;
  padding: 0 9px;
}

.active-alert-filter button:hover {
  background: #edf3e8;
}

.ops-grid {
  display: grid;
  gap: 8px;
}

.ops-section {
  display: grid;
  gap: 5px;
}

.ops-section strong {
  font-size: 12px;
}

.ops-section span {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.ops-section em {
  font-style: normal;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-section b {
  color: var(--green-dark);
  font-size: 12px;
}

.connector-panel {
  border-bottom: 1px solid var(--line);
  display: none;
  gap: 5px;
  padding: 8px 10px;
}

.connector-head,
.connector-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.connector-head,
.connector-row {
  justify-content: space-between;
}

.connector-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.connector-row {
  background: #f7f8f2;
  border: 1px solid rgba(217, 210, 195, 0.72);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  min-height: 36px;
  padding: 6px 8px;
  text-align: left;
  width: 100%;
}

.connector-row.error {
  background: #fff1ec;
  border-color: #edc2b8;
}

.connector-row.open {
  background: #fbf4e8;
  border-color: #e2c79b;
}

.connector-row.online {
  background: #f3f8ed;
  border-color: #c7d8bf;
}

.connector-summary {
  align-items: center;
  background: #f3f8ed;
  border: 1px solid #c7d8bf;
  border-radius: 7px;
  color: var(--green-dark);
  display: grid;
  gap: 6px;
  grid-template-columns: auto 1fr auto;
  min-height: 34px;
  padding: 6px 8px;
}

.connector-summary strong,
.connector-summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connector-summary strong {
  font-size: 13px;
}

.connector-summary span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.connector-row:hover,
.connector-row.is-active {
  border-color: #9fb98f;
  box-shadow: inset 0 0 0 1px rgba(67, 112, 76, 0.18);
}

.connector-row.is-active {
  background: var(--sage);
}

.connector-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.connector-row strong,
.connector-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connector-row strong {
  font-size: 13px;
}

.connector-row span {
  color: var(--muted);
  font-size: 12px;
}

.connector-status {
  color: var(--green-dark);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connector-row.error .connector-status {
  color: var(--danger);
}

.dot {
  border-radius: 999px;
  display: inline-block;
  height: 8px;
  flex: 0 0 auto;
  width: 8px;
}

.dot.online,
.dot.ready {
  background: var(--green);
}

.dot.error,
.dot.blocked {
  background: var(--danger);
}

.dot.open,
.dot.planned {
  background: var(--warning);
}

.ticket-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.ticket-item {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 6px;
  min-height: 132px;
  overflow: visible;
  padding: 13px 14px 14px;
  text-align: left;
  width: 100%;
}

.ticket-item:hover,
.ticket-item.active {
  background: #edf3e8;
}

.ticket-item:focus-visible {
  background: #edf3e8;
  outline: 2px solid rgba(47, 115, 82, 0.34);
  outline-offset: -2px;
}

.ticket-item > * {
  flex: 0 0 auto;
}

.ticket-item.active {
  box-shadow: inset 3px 0 0 var(--green);
}

.ticket-item-locked:not(.active) {
  background: #faf7ef;
}

.ticket-item-secondary {
  background: #f7f8f4;
}

.ticket-item-secondary .ticket-title,
.ticket-item-secondary .ticket-preview {
  color: #5f675d;
}

.ticket-topline,
.ticket-subline,
.ticket-signals,
.ticket-meta,
.meta-row,
.row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.ticket-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  justify-content: space-between;
}

.ticket-subline,
.ticket-signals {
  min-width: 0;
  overflow: hidden;
}
.ticket-subline .muted,
.ticket-signals .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-id {
  align-items: center;
  appearance: none;
  background: #f4f0e7;
  border: 1px solid rgba(217, 210, 195, 0.86);
  border-radius: 999px;
  color: #5a675e;
  display: inline-flex;
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 11px;
  font-weight: 850;
  height: 24px;
  letter-spacing: 0;
  padding: 0 8px;
  white-space: nowrap;
  cursor: copy;
  user-select: none;
}

.message-id:hover,
.message-id:focus-visible {
  background: #e9f2e6;
  border-color: rgba(47, 115, 82, 0.34);
  color: var(--green-dark);
  outline: none;
}

.message-id.is-copied {
  background: #e7f1e8;
  border-color: rgba(74, 137, 91, 0.42);
  color: #24563b;
}

.ticket-signals .badge,
.ticket-signals .pill {
  flex: 0 0 auto;
}

.ticket-tags {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.ticket-tag {
  background: #edf3e8;
  color: #49604f;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-title {
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.28;
  min-width: 0;
  overflow: visible;
  white-space: normal;
}

.ticket-customer {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.18;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-preview,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.ticket-preview {
  display: block;
  line-height: 1.3;
  min-height: 0;
  overflow: visible;
  white-space: normal;
}

.badge {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  min-height: 22px;
  max-width: 74px;
  overflow: hidden;
  padding: 4px 6px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.high,
.badge.urgent {
  background: #f3dfd4;
  color: var(--danger);
}

.badge.normal {
  background: #e9ead9;
  color: var(--warning);
}

.badge.low {
  background: #e4eee1;
  color: var(--green);
}

.badge.reply-needed {
  background: #e5ecd8;
  color: var(--green-dark);
}

.badge.locked {
  background: #e8ded0;
  color: #6c4d2e;
}

/* Kategorie-Badges für Nicht-Kunden-Tickets (im „System/Spam anzeigen"-Reiter). Dezent, klar von den
   roten SLA-/Dringend-Badges unterscheidbar. */
.badge.triage-badge {
  background: #eef0ec;
  color: #5a6356;
  font-weight: 800;
}

.badge.triage-business_notice {
  background: #e7eef6;
  color: #2f4d6b;
}

.badge.triage-spam_review {
  background: #f3e7e7;
  color: #7a4a4a;
}

.conversation-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  position: relative;
  background: #fbfaf5;
}

.conversation-header {
  align-items: start;
  background: var(--surface);
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 54px;
  padding: 10px 116px 10px 14px;
}

.conversation-header > div:first-child {
  min-width: 0;
  overflow: hidden;
}

/* Chips/Anhänge/Notice bekommen eine EIGENE volle Zeile (Spalte 1 bis Ende), damit die
   Status-Spalte rechts ihnen keine Breite mehr wegnimmt und keine Tags abgeschnitten werden. */
.conversation-header > .source-tools,
.conversation-header > .attachment-strip,
.conversation-header > .ticket-lock-notice {
  grid-column: 1 / -1;
}

.conversation-header .eyebrow {
  display: none;
}

.source-tools {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: start;
  margin-top: 7px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
  white-space: nowrap;
  width: 100%;
}

.source-tools button {
  align-items: center;
  background: #f7f8f2;
  border: 1px solid rgba(217, 210, 195, 0.82);
  color: var(--green-dark);
  display: inline-flex;
  flex: 0 0 auto;
  gap: 5px;
  max-width: clamp(120px, 17vw, 210px);
  min-height: 28px;
  min-width: 0;
  padding: 3px 7px;
  white-space: nowrap;
}

.source-tools button:hover,
.source-tools button.is-copied {
  background: var(--sage);
  border-color: #9fb98f;
}

.source-tools span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-tools strong {
  display: inline-block;
  font-size: 12px;
  max-width: clamp(58px, 12vw, 132px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Kompakter Lock-/Präsenz-Chip in der Quelle-Zeile (.source-tools span/strong gelten mit). */
.source-lock {
  align-items: center;
  border: 1px solid rgba(217, 210, 195, 0.82);
  border-radius: 7px;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 5px;
  min-height: 28px;
  padding: 3px 8px;
  white-space: nowrap;
}

.source-lock.own {
  background: #edf3e8;
  border-color: #9fb98f;
  color: var(--green-dark);
}

.source-lock.blocked {
  background: #fbf4e8;
  border-color: #e0c089;
  color: #6c4d2e;
}

.source-lock.presence {
  background: #eef2f6;
  border-color: #c2cdd8;
  color: #3a4a5a;
}

.source-lock button {
  background: var(--surface);
  border: 1px solid #cbbda4;
  border-radius: 6px;
  color: var(--green-dark);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  min-height: 22px;
  padding: 2px 7px;
}

.source-lock button:hover {
  background: var(--sage);
  border-color: #9fb98f;
}

.ticket-lock-notice {
  color: #6c4d2e;
  font-size: 12px;
  font-weight: 800;
  margin-top: 6px;
}

.attachment-strip {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  max-width: 100%;
}

.attachment-strip > strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.attachment-strip > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.attachment-chip,
.attachment-more {
  align-items: center;
  background: #f4f7ee;
  border: 1px solid rgba(120, 153, 112, 0.26);
  border-radius: 7px;
  color: var(--green-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  max-width: min(220px, 100%);
  min-height: 27px;
  overflow: hidden;
  padding: 5px 8px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip.blocked {
  background: #fff1ec;
  border-color: #edc2b8;
  color: var(--danger);
}

.attachment-chip:hover {
  border-color: #9fb98f;
}

.attachment-more {
  background: #f7f8f2;
  color: var(--muted);
}

.order-context,
.order-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.order-context > span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workbench-panel {
  display: none;
}
.workbench-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.workbench-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workbench-field {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px 9px;
}

.workbench-field span,
.workbench-next span,
.workbench-actions {
  color: var(--muted);
  font-size: 12px;
}

.workbench-field strong,
.workbench-next strong {
  font-size: 13px;
}

.workbench-next {
  align-items: center;
  display: flex;
  gap: 8px;
}

.workbench-source-sync {
  align-items: flex-start;
}

.workbench-sla {
  border-left: 3px solid #78936b;
  padding-left: 8px;
}

.workbench-sla.overdue {
  border-left-color: var(--danger);
}

.workbench-sla.due_soon {
  border-left-color: var(--warning);
}

.workbench-source-sync span {
  line-height: 1.35;
  min-width: 0;
}

.workbench-triage {
  background: #fff7ed;
  border: 1px solid #e2c79b;
  border-radius: 7px;
  display: grid;
  gap: 3px;
  padding: 8px 9px;
}

.workbench-triage strong {
  font-size: 13px;
}

.workbench-triage span {
  color: var(--muted);
  font-size: 12px;
}

.workbench-route {
  background: #f2f8f1;
  border: 1px solid #bfd8bd;
  border-radius: 7px;
  display: grid;
  gap: 3px;
  padding: 8px 9px;
}

.workbench-route strong {
  font-size: 13px;
}

.workbench-route span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.workbench-actions {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.workbench-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.workbench-buttons button {
  min-height: 32px;
  padding: 0 10px;
}

.workbench-buttons button:nth-child(2) {
  background: var(--surface-muted);
  color: var(--green-dark);
}

.workbench-buttons button:nth-child(2):hover {
  background: var(--sage);
}

.control-actions .workbench-buttons {
  display: grid;
  gap: 6px;
}

.control-actions .workbench-buttons button {
  justify-content: center;
  min-height: 30px;
  padding: 0 8px;
  width: 100%;
}

.messages {
  min-height: 0;
  display: grid;
  align-content: start;
  /* max-content erzwingt Inhaltshöhe je Zeile: ohne dies verteilt Chrome die Auto-Zeilen im
     Scroll-Grid auf die Containerhöhe und QUETSCHT lange Nachrichten auf ~52px (live bewiesen). */
  grid-auto-rows: max-content;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding: 16px 18px 20px;
  scrollbar-color: #b8c7ad #f1eee6;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
}

.messages::-webkit-scrollbar {
  width: 12px;
}

.messages::-webkit-scrollbar-track {
  background: #f1eee6;
  border-left: 1px solid rgba(217, 210, 195, 0.72);
}

.messages::-webkit-scrollbar-thumb {
  background: #b8c7ad;
  border: 3px solid #f1eee6;
  border-radius: 999px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: #8fb47d;
}

.message {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  justify-self: stretch;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.message * {
  min-width: 0;
}

.message.html-message {
  max-width: 100%;
  width: 100%;
}

.message.inbound {
  background: #fff;
}

.message-history-loading {
  border-style: dashed;
  box-shadow: none;
}

.message-history-loading .message-body {
  color: #687268;
}

.message.outbound {
  justify-self: end;
  background: #e8f0e2;
  max-width: min(760px, 86%);
}

.message-body {
  display: block;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  padding: 18px 22px;
  white-space: pre-wrap;
  word-break: normal;
}

.email-message-body {
  display: grid;
  gap: 0;
  overflow: hidden;
  padding: 0;
  white-space: normal;
}

.plain-email {
  display: grid;
  font-size: 13.5px;
  gap: 8px;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: normal;
}

.plain-email p {
  margin: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.email-current-message {
  background: #fffdf8;
  border-bottom: 1px solid rgba(217, 210, 195, 0.58);
  display: grid;
  gap: 8px;
  margin: -2px -2px 0;
  padding: 2px 2px 8px;
}

.plain-email blockquote {
  background: #f7f8f2;
  border-left: 3px solid #c7d8bf;
  color: #536056;
  display: grid;
  font-size: 13px;
  gap: 6px;
  margin: 3px 0;
  padding: 9px 11px;
}

.email-quoted-history {
  background: #f8fbf6;
  border: 1px solid #d9d2c3;
  border-radius: 7px;
  margin: 2px 0;
  max-width: 100%;
  overflow: hidden;
}

.email-quoted-history summary {
  align-items: center;
  background: #f7fbf5;
  color: var(--green-dark);
  cursor: pointer;
  display: flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: space-between;
  padding: 8px 10px;
}

.email-quoted-history blockquote {
  border-left-color: #9fb98f;
  border-top: 1px solid #e4dccd;
  margin: 0;
}

.email-thread-history {
  margin-top: 4px;
}

.email-thread-history summary::after {
  color: #7a856f;
  content: "vollständig";
  font-size: 11px;
  font-weight: 800;
}

.email-thread-history-body {
  background: #f8f8f2;
  display: grid;
  gap: 5px;
}

.email-html {
  background: #fff;
  color: #1f2933;
  /* contain: layout hält absolut positionierte Mail-Inhalte in der Box, ohne den Inhalt zu
     beschneiden (KEIN paint-Containment, keine max-height) — die ganze Nachricht rendert voll,
     gescrollt wird nur über den .messages-Verlauf. */
  contain: layout;
  font-family: Arial, "Segoe UI", sans-serif;
  font-size: 13px;
  isolation: isolate;
  line-height: 1.5;
  max-width: 100%;
  overflow: visible;
  padding: 18px 22px;
  white-space: normal;
  word-break: normal;
}

.email-html * {
  box-sizing: border-box;
  max-width: 100% !important;
}

.email-html table {
  border-collapse: initial;
  height: auto !important;
  max-width: 100% !important;
  table-layout: auto;
}

.email-html tbody,
.email-html thead,
.email-html tfoot,
.email-html tr,
.email-html td,
.email-html th {
  height: auto !important;
  max-width: min(720px, 100%) !important;
  min-height: 0 !important;
  overflow-wrap: anywhere;
  vertical-align: top;
  word-break: normal;
}

.email-html p,
.email-html div,
.email-html section,
.email-html article,
.email-html blockquote {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.email-html pre {
  max-width: 100% !important;
  overflow: auto;
  white-space: pre-wrap;
}

.email-html [style*="position:absolute"],
.email-html [style*="position: absolute"],
.email-html [style*="position:fixed"],
.email-html [style*="position: fixed"] {
  position: static !important;
}

.email-html [style*="z-index"] {
  z-index: auto !important;
}

.email-html [style*="font-size:0"],
.email-html [style*="font-size: 0"],
.email-html [style*="line-height:0"],
.email-html [style*="line-height: 0"],
.email-html [style*="color:transparent"],
.email-html [style*="color: transparent"] {
  display: none !important;
}

.email-html br + br {
  content: "";
  display: block;
  margin-top: 7px;
}

.email-html img {
  height: auto !important;
  max-width: 100% !important;
}

.email-html a {
  color: #1d5f45;
  text-decoration: underline;
}

.amazon-notification {
  display: grid;
  gap: 12px;
}

.amazon-meta,
.amazon-action-links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.amazon-meta span,
.amazon-customer-message span {
  color: #667266;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.amazon-meta strong {
  color: var(--green-dark);
  font-size: 13px;
}

.amazon-product {
  background: #f8f6ee;
  border: 1px solid #ded7c8;
  border-radius: 7px;
  color: #2d382f;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.amazon-customer-message {
  background: #fff;
  border: 1px solid #d9d1c0;
  border-left: 4px solid var(--green);
  border-radius: 7px;
  color: #17251c;
  display: grid;
  font-size: 14px;
  gap: 8px;
  line-height: 1.55;
  padding: 14px 16px;
}

.amazon-action-links a {
  background: #f7fbf6;
  border: 1px solid #c7d8bf;
  border-radius: 7px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  padding: 7px 10px;
  text-decoration: none;
}

.amazon-original {
  border-top: 1px solid #e5ded0;
  color: #5a665c;
  padding-top: 8px;
}

.amazon-original summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.amazon-original div {
  display: grid;
  font-size: 12px;
  gap: 4px;
  line-height: 1.45;
  margin-top: 8px;
}

.email-asset-blocked {
  background: #fbf4e8;
  border: 1px solid #e2c79b;
  border-radius: 6px;
  color: var(--warning);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: auto !important;
  line-height: 1.3 !important;
  margin: 4px 0;
  max-width: 100% !important;
  min-height: 24px !important;
  padding: 4px 7px;
  vertical-align: middle;
  width: auto !important;
}

.email-html .email-asset-blocked {
  display: inline-block !important;
  font-size: 11px !important;
  height: 24px !important;
  line-height: 14px !important;
  max-width: min(260px, 100%) !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 4px 7px !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.email-text-fallback {
  background: #f8fbf6;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  padding: 12px 16px;
}

.email-text-fallback summary {
  color: var(--green-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.email-text-fallback .plain-email {
  font-size: 13.5px;
  line-height: 1.48;
  margin-top: 10px;
}

.attachments {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
}

.attachment-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-dark);
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  text-decoration: none;
}

.attachment-row span {
  font-size: 13px;
  font-weight: 800;
}

.attachment-row small {
  color: var(--muted);
  font-size: 12px;
}

.attachment-row.blocked {
  background: #fff1ec;
  border-color: #edc2b8;
  color: var(--danger);
}
.audit-head,
.audit-item {
  display: grid;
  gap: 2px;
}

.audit-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.audit-head strong,
.audit-item span {
  font-size: 12px;
}

.audit-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.audit-item {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.audit-item strong,
.audit-item small {
  color: var(--muted);
  font-size: 12px;
}

.message-head {
  align-items: center;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 800;
  gap: 10px;
  justify-content: space-between;
  margin: 0;
  padding: 10px 12px;
}

.message-head > span {
  min-width: 0;
}

.message-head > span:first-child {
  flex: 1 1 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-head > span:last-child {
  flex: 0 0 auto;
}

.message-delivery {
  align-items: center;
  background: #fffdf8;
  border: 1px solid #e2c79b;
  border-radius: 999px;
  color: #7b5d20;
  display: inline-flex;
  flex: 1 1 auto;
  font-size: 11px;
  font-weight: 900;
  gap: 6px;
  justify-content: center;
  line-height: 1.1;
  max-width: 58%;
  overflow: hidden;
  padding: 3px 5px 3px 7px;
  text-align: center;
  white-space: nowrap;
}

.message-delivery > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-delivery.sent_external {
  background: #f6f8f1;
  border-color: #c8d8bf;
  color: var(--green-dark);
}

.message-delivery.sending_external {
  background: #fff8e8;
  border-color: #d8c08a;
  color: #765a1d;
}

.message-delivery button {
  background: #fefdf8;
  border: 1px solid #d7c9ae;
  border-radius: 999px;
  color: var(--green-dark);
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  line-height: 1;
  padding: 4px 7px;
}

.message-delivery button:hover {
  border-color: var(--green);
}

.message-delivery button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.ai-box {
  border-top: 1px solid var(--line);
  background: #f7f8f2;
  color: var(--text);
  display: none;
  min-height: 74px;
  padding: 12px 16px;
}

.knowledge-refs {
  display: grid;
  gap: 6px;
}

.knowledge-ref {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 2px;
  padding: 7px 9px;
}

.knowledge-ref strong {
  font-size: 12px;
}

.knowledge-ref span {
  color: var(--muted);
  font-size: 12px;
}

.reply-box {
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  align-items: stretch;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 178px;
  padding: 10px 14px;
  position: sticky;
  bottom: 0;
  z-index: 3;
}

.reply-box textarea {
  grid-column: 1;
  grid-row: 1;
  line-height: 1.5;
  /* Nochmals ~10% niedriger (vorher 185px), damit mehr Kundennachricht sichtbar bleibt. */
  min-height: 168px;
  resize: none;
}

/* Aktionsspalte als kompaktes 2-Spalten-Raster statt hoher Einzelspalten-Stapel: dadurch ist die
   Spalte niedriger als das Textfeld und streckt es nicht mehr künstlich (kein Leerraum mehr). */
.reply-actions {
  display: grid;
  align-content: start;
  align-items: stretch;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-column: 2;
  grid-row: 1;
  justify-content: stretch;
}

/* Primäre/breite Steuerungen über die volle Breite, die kompakten Sekundär-Buttons paaren sich. */
.reply-actions > #followUpActionSelect,
.reply-actions > #aiButton,
.reply-actions > .send-control,
.reply-actions > .reply-quick-links {
  grid-column: 1 / -1;
}

.reply-actions button,
.reply-actions select {
  font-size: 11.5px;
  font-weight: 700;
  min-height: 28px;
  /* Knappe horizontale Polsterung, damit gepaarte Buttons (📎 Anhang | Signatur) in der halben Spalte passen. */
  padding: 0 4px;
  text-align: center;
  width: 100%;
  white-space: nowrap;
}

.reply-actions button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
}

.reply-actions [hidden],
#replyStatusSelect {
  display: none;
}

#replyButton {
  min-width: 0;
  padding: 0 18px;
}

.send-control {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) 40px;
  width: 100%;
}

.reply-quick-links {
  display: grid;
  gap: 5px;
  /* Volle Breite je Schnellzugriff, damit „Rechnungs-Tool" nicht abgeschnitten wird. */
  grid-template-columns: minmax(0, 1fr);
  margin-top: 1px;
}

.reply-quick-links button,
.reply-wiki-dropdown summary {
  align-items: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--green-dark);
  display: flex;
  font-size: 11.5px;
  font-weight: 700;
  justify-content: center;
  min-height: 28px;
  min-width: 0;
  padding: 0 8px;
  text-align: center;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
}

.reply-wiki-menu {
  min-width: 0;
  position: relative;
}

.reply-wiki-main {
  justify-content: center;
  padding: 0 36px;
}

.reply-wiki-dropdown {
  min-width: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: 32px;
}

.reply-wiki-dropdown summary {
  background: transparent;
  border-color: transparent;
  cursor: pointer;
  height: 28px;
  list-style: none;
  max-width: 32px;
  min-width: 32px;
  padding: 0;
  width: 32px;
  justify-content: center;
  text-align: center;
}

.reply-wiki-dropdown summary::-webkit-details-marker {
  display: none;
}

.reply-wiki-dropdown summary::after {
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid var(--green-dark);
  content: "";
  display: block;
  height: 0;
  width: 0;
}

.reply-wiki-dropdown[open] summary::after {
  border-bottom: 8px solid var(--green-dark);
  border-top: 0;
}

.reply-wiki-dropdown button {
  background: #f8fbf6;
  border-color: #c7d8bf;
  position: absolute;
  right: 0;
  top: 32px;
  justify-content: flex-start;
  text-align: left;
  width: min(178px, calc(100vw - 32px));
  z-index: 10;
}

.reply-quick-links button:hover,
.reply-quick-links button:focus-visible,
.reply-wiki-dropdown summary:hover,
.reply-wiki-dropdown summary:focus-visible {
  background: var(--sage);
  border-color: var(--leaf);
  color: var(--green-dark);
}

.send-control #replyButton {
  width: 100%;
}

#sendActionSelect {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--green-dark) 50%), linear-gradient(135deg, var(--green-dark) 50%, transparent 50%);
  background-position: calc(50% - 3px) 50%, calc(50% + 3px) 50%;
  background-repeat: no-repeat;
  background-size: 7px 8px, 7px 8px;
  border-color: var(--line);
  justify-self: end;
  max-width: 40px;
  min-width: 40px;
  min-height: 28px;
  padding: 0;
  text-align: center;
  text-indent: -999px;
  width: 40px;
}

#followUpActionSelect,
#sendActionSelect {
  background-color: var(--surface);
  color: var(--green-dark);
  font-weight: 700;
}

#followUpActionSelect {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--green-dark) 50%), linear-gradient(135deg, var(--green-dark) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 7px, 6px 7px;
  padding-left: 28px;
  padding-right: 28px;
  text-align: center;
}

.reply-review {
  align-items: center;
  background: #f7f8f2;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-dark);
  display: flex;
  font-size: 12px;
  font-weight: 900;
  gap: 7px;
  line-height: 1;
  min-height: 34px;
  min-width: 0;
  overflow: hidden;
  padding: 5px 8px;
  white-space: nowrap;
}

.reply-review input {
  flex: 0 0 auto;
  min-height: 16px;
  width: 16px;
}

.reply-review span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-review[hidden] {
  display: none;
}

.reply-review input {
  accent-color: var(--green);
  flex: 0 0 auto;
  height: 16px;
  margin: 0;
  width: 16px;
}

.reply-review span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-review.needs-review {
  background: #fff1ec;
  border-color: #e2b7aa;
  color: var(--danger);
}

.signature-preview {
  background: #f7f8f2;
  border: 1px solid rgba(217, 210, 195, 0.72);
  border-left: 3px solid var(--green);
  border-radius: 7px;
  color: var(--text);
  display: grid;
  gap: 5px;
  grid-column: 1 / -1;
  padding: 7px 9px;
}

.signature-preview[hidden] {
  display: none;
}

.signature-preview span,
.user-settings-preview span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.signature-preview pre,
.user-settings-preview pre {
  color: var(--text);
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  margin: 0;
  max-height: 150px;
  overflow: auto;
  white-space: pre-wrap;
}

.signature-preview-html {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: auto;
  padding: 10px;
}

#signatureButton,
#aiButton,
#attachButton {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--green-dark);
}

#signatureButton:hover,
#aiButton:hover,
#attachButton:hover {
  background: var(--sage);
  border-color: var(--leaf);
}

.template-curation {
  align-items: center;
  background: #f7f8f2;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding: 8px 10px;
}

.template-curation[hidden] {
  display: none;
}

.template-curation > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.template-checks {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.template-curation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.template-curation button {
  min-height: 32px;
  padding: 0 10px;
}

.template-curation button.danger {
  background: #fff;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.template-curation button.danger:hover {
  background: #fff5f3;
}

.workflow {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}

.note-box {
  display: none;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 16px 12px;
}

.customer-panel {
  overflow: auto;
}

.customer-body {
  display: grid;
  gap: 7px;
  padding: 8px;
}

.control-center-panel {
  background: var(--surface);
  color: var(--text);
  gap: 5px;
  min-height: 100%;
  padding: 6px;
}

.control-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 8px;
}

.control-card h2 {
  color: var(--green-dark);
  font-size: 14px;
  line-height: 1.15;
}
.control-brand {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
}

.status-dot {
  background: #35a164;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(53, 161, 100, 0.16);
  display: inline-block;
  height: 8px;
  width: 8px;
}

.control-icon {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-dark);
  height: 28px;
  min-height: 28px;
  padding: 0;
  width: 28px;
}

.control-field-grid {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.control-field {
  background: #f7f8f2;
  border: 1px solid rgba(217, 210, 195, 0.72);
  border-radius: 7px;
  min-width: 0;
  padding: 4px 6px;
  position: relative;
}

.control-field.is-clickable {
  cursor: pointer;
}

.control-field.is-clickable:hover {
  background: var(--sage);
}

.control-field span,
.control-section-label,
.control-details summary {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.08;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.control-value-row {
  align-items: center;
  display: flex;
  gap: 4px;
  min-width: 0;
}

.control-value-row strong {
  color: var(--text);
  display: -webkit-box;
  flex: 1 1 auto;
  font-size: 12.5px;
  font-weight: 900;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  /* Statt hart abzuschneiden (Mitarbeiter sehen sonst „COM-2414…"), brechen Werte in maximal
     zwei Zeilen um — Bestellnummern, Namen und E-Mails bleiben vollständig lesbar. */
  -webkit-line-clamp: 2;
}

.control-value-row .is-monospace {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  /* Etwas kleiner, damit Bestell-/Rechnungsnummern (17+ Zeichen) einzeilig voll lesbar sind. */
  font-size: 11.5px;
  letter-spacing: -0.01em;
}

.control-value-row button,
.control-draft-block > button,
.control-action-row button,
.control-link-row,
.control-action-box button,
.canned-list button {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  min-height: 26px;
  padding: 0 8px;
  white-space: nowrap;
}

.control-value-row button {
  font-size: 10px;
  min-height: 22px;
  padding: 0 6px;
}

.control-value-row button:hover,
.control-draft-block > button:hover,
.control-action-row button:hover,
.control-link-row:hover,
.control-action-box button:hover,
.canned-list button:hover,
.control-value-row button.is-copied,
.control-draft-block > button.is-copied {
  background: var(--sage);
}

.control-drag-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -2px 0 6px;
}

.control-drag-copy button {
  align-items: center;
  background: #fffdf8;
  border: 1px solid rgba(178, 154, 118, 0.46);
  border-radius: 7px;
  color: var(--green-dark);
  cursor: grab;
  display: inline-flex;
  gap: 6px;
  min-height: 32px;
  min-width: 0;
  padding: 5px 9px;
}

.control-drag-copy button:active {
  cursor: grabbing;
}

.control-drag-copy span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.control-drag-copy strong {
  font-size: 12px;
  font-weight: 900;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-popover {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(39, 51, 41, 0.13);
  color: var(--text);
  display: none;
  gap: 3px;
  left: 0;
  max-width: min(300px, calc(100vw - 40px));
  padding: 8px 10px;
  position: absolute;
  top: calc(100% + 6px);
  width: 220px;
  z-index: 20;
}

.control-field:nth-child(2n) .control-popover {
  left: auto;
  right: 0;
}

.control-field.has-popover:hover .control-popover {
  display: grid;
}

.control-popover strong,
.control-popover span {
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
  text-transform: none;
  white-space: normal;
}
.control-list-item,
.control-empty {
  background: #f7f8f2;
  border: 1px solid rgba(217, 210, 195, 0.72);
  border-radius: 7px;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 7px;
}
.control-list-item span,
.control-empty,
.control-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

/* Fallübersicht v2 — Karten (Hybrid B) + Fallkopf (A) */
.control-card2 {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 5px;
  overflow: hidden;
  padding: 6px 8px;
}

.control-card2.is-clickable {
  cursor: pointer;
}

.control-card2.is-clickable:hover {
  background: #fbfcf8;
  border-color: var(--green);
}

.control-card2-action {
  background: transparent;
  border: 0;
  color: var(--green);
  cursor: pointer;
  flex: 0 1 auto;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-card2-action:hover {
  /* WICHTIG: globalen button:hover { background: var(--green-dark) } zurücksetzen, sonst wird der
     Text-Link-Button voll dunkelgrün und die (ebenfalls grün-dunkle) Schrift unsichtbar. */
  background: transparent;
  color: var(--green-dark);
  text-decoration: underline;
}

.control-card2-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.control-card2-head.is-clickable {
  border-radius: 7px;
  cursor: pointer;
  margin: -4px -5px 0;
  padding: 4px 5px;
}

.control-card2-head.is-clickable:hover,
.control-card2-head.is-clickable:focus-visible {
  background: var(--sage);
  outline: none;
}

.control-card2-title {
  color: var(--green-dark);
  /* Kartentitel haben Vorrang vor der Kopf-Aktion und werden nie abgeschnitten. */
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.control-card2-meta {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.control-card2-open {
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.control-card2-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.control-badge {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 2px 8px;
  text-transform: lowercase;
  white-space: nowrap;
}

.control-badge.ok {
  background: var(--sage);
  color: var(--green-dark);
}

.control-badge.warn {
  background: #f6ead7;
  color: var(--warning);
}

.control-badge.danger {
  background: #f4e1de;
  color: var(--danger);
}

.control-badge.neutral {
  background: var(--surface-muted);
  color: var(--muted);
}

/* A-Kopf */
.control-head-card {
  border-left: 3px solid var(--green);
}

.control-head-top {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.control-head-titles {
  min-width: 0;
}

.control-eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}

.control-eyebrow.accent {
  color: var(--green);
}

.control-head-title {
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
  margin: 2px 0 0;
}

.control-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.control-chip {
  background: var(--surface-muted);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  white-space: nowrap;
}

.control-chip.topic {
  background: var(--sage);
  color: var(--green-dark);
}

.control-chip.prio-high,
.control-chip.prio-urgent {
  background: #f4e1de;
  color: var(--danger);
}

.control-sla-banner {
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 8px;
}

.control-sla-banner.danger {
  background: #f4e1de;
  color: var(--danger);
}

.control-sla-banner.warn {
  background: #f6ead7;
  color: var(--warning);
}

.control-next-step {
  background: #f1f5ec;
  border-radius: 7px;
  display: grid;
  gap: 2px;
  padding: 5px 8px;
}

.control-next-main {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}

.control-next-sub {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.control-canned-trigger {
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 10px;
  width: 100%;
}

.control-canned-trigger:hover {
  background: var(--green-dark);
}

.control-details {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 5px 7px;
}

.control-details summary {
  cursor: pointer;
  font-size: 12px;
}

.control-details[open] {
  padding-bottom: 8px;
}
.control-action-row {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
button.control-signal {
  cursor: pointer;
  width: 100%;
}
.control-action-row button {
  justify-content: center;
  min-width: 0;
}
.control-draft-block {
  position: relative;
}

.control-draft-block > button {
  position: absolute;
  right: 7px;
  top: 7px;
  z-index: 2;
}

.control-draft {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
  max-height: 150px;
  overflow: auto;
  padding: 9px;
  white-space: pre-wrap;
}
.control-note {
  background: #f7f8f2;
  border: 1px solid rgba(217, 210, 195, 0.72);
  border-radius: 7px;
  padding: 6px 7px;
}

.control-action-box {
  display: grid;
  gap: 6px;
}

.control-action-box > strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.control-action-box .workbench-buttons {
  display: grid;
  gap: 6px;
}

.control-action-box .workbench-buttons button {
  justify-content: center;
  min-height: 30px;
  width: 100%;
}

.resource-overlay {
  align-items: stretch;
  background: rgba(9, 24, 11, 0.32);
  display: flex;
  inset: 0;
  justify-content: flex-end;
  padding: 18px;
  position: fixed;
  z-index: 1000;
}

.resource-overlay.native-control-overlay {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.resource-panel {
  background: #f7f2e8;
  border: 1px solid rgba(178, 154, 118, 0.52);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(9, 24, 11, 0.26);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 36px);
  max-width: calc(100vw - 36px);
  overflow: hidden;
  position: relative;
  width: min(900px, 72vw);
}

.resource-panel.is-external-portal {
  grid-template-rows: auto minmax(0, 1fr);
  width: min(560px, calc(100vw - 36px));
}

.native-control-panel {
  align-self: center;
  max-height: min(92vh, calc(100vh - 32px));
  max-width: min(94vw, calc(100vw - 32px));
  width: min(1320px, 94vw);
}

.native-control-body {
  align-content: start;
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.final-overlay {
  display: grid;
  gap: 12px;
}

.native-invoice-pdf-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.native-invoice-pdf-download {
  background: var(--green);
  border-radius: 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 12px;
  text-decoration: none;
}

.native-invoice-pdf-download:hover {
  background: var(--green-dark);
  color: #fff;
}

.native-invoice-pdf-draghandle {
  border: 1px dashed rgba(178, 154, 118, 0.72);
  border-radius: 999px;
  color: var(--green-dark);
  cursor: grab;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  user-select: none;
}

.native-invoice-pdf-draghandle[aria-disabled="true"] {
  cursor: progress;
  opacity: 0.55;
}

.native-invoice-pdf-frame {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 480px;
  width: 100%;
}

.native-invoice-pdf-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.reply-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 2px 0;
}

.reply-attachment-chip {
  align-items: center;
  background: var(--sage);
  border: 1px solid rgba(178, 154, 118, 0.42);
  border-radius: 999px;
  color: var(--green-dark);
  display: inline-flex;
  font-size: 12px;
  gap: 6px;
  max-width: 100%;
  padding: 3px 6px 3px 10px;
}

.reply-attachment-chip strong {
  font-weight: 800;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-attachment-chip em {
  color: #51604f;
  font-size: 11px;
  font-style: normal;
}

.reply-attachment-chip button {
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  min-height: 20px;
  padding: 0 5px;
}

.reply-attachment-chip button:hover {
  background: rgba(33, 77, 57, 0.14);
  color: var(--green-dark);
}

.update-banner {
  align-items: center;
  background: var(--green-dark);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(33, 77, 57, 0.35);
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 10px;
  left: 50%;
  padding: 9px 12px 9px 16px;
  position: fixed;
  top: 12px;
  transform: translateX(-50%);
  z-index: 4000;
}

.update-banner button {
  background: #fff;
  border: 0;
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  min-height: 28px;
  padding: 0 12px;
}

.update-banner button:hover {
  background: var(--sage);
  color: var(--green-dark);
}

/* Schließen-Kreuz: dezenter Ghost-Button, klar vom weißen Aktualisieren-Pill abgesetzt. */
.update-banner .update-banner-dismiss {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 17px;
  line-height: 1;
  min-height: 26px;
  min-width: 26px;
  padding: 0;
}

.update-banner .update-banner-dismiss:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.final-split {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.final-split .final-fact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.final-stepper {
  align-items: center;
  background: rgba(255, 252, 246, 0.94);
  border: 1px solid rgba(178, 154, 118, 0.42);
  border-radius: 14px;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}

.final-step {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 5px;
  text-align: center;
}

.final-step-dot {
  align-items: center;
  border: 2px solid rgba(178, 154, 118, 0.5);
  border-radius: 50%;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.final-step-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.final-step.is-done .final-step-dot {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.final-step.is-active .final-step-dot {
  border-color: var(--green);
  color: var(--green-dark);
}

.final-step.is-active .final-step-label {
  color: var(--green-dark);
}

.final-step-bar {
  background: rgba(178, 154, 118, 0.4);
  border-radius: 999px;
  flex: 1 1 auto;
  height: 2px;
  min-width: 12px;
}

.final-step-bar.is-done {
  background: var(--green);
}

.final-hero,
.final-card,
.final-shipment {
  background: rgba(255, 252, 246, 0.94);
  border: 1px solid rgba(178, 154, 118, 0.42);
  border-radius: 14px;
  box-shadow: none;
}

.final-hero {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px 16px;
}

.final-hero div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.final-hero span,
.final-card h3,
.final-fact span,
.final-shipment header span,
.final-subcard span,
.final-timeline-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.final-hero strong {
  color: var(--green-dark);
  font-size: clamp(16px, 1.5vw, 21px);
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.final-hero em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.final-status {
  align-self: start;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 950;
  max-width: 260px;
  overflow-wrap: anywhere;
  padding: 8px 12px;
}

.final-status-good {
  background: rgba(224, 240, 226, 0.92);
  color: #1e5a3d;
}

.final-status-warn {
  background: rgba(253, 234, 224, 0.92);
  color: #9a3b32;
}

.final-status-neutral {
  background: rgba(232, 226, 214, 0.86);
  color: var(--green-dark);
}

.final-card {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.final-card h3 {
  color: var(--green-dark);
  font-size: 13px;
}

.final-fact-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.final-fact-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.final-fact-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.final-fact-grid.shipment {
  grid-template-columns: 1.25fr repeat(5, minmax(0, 1fr));
}

.final-fact,
.final-subcard,
.final-empty {
  background: rgba(244, 241, 234, 0.66);
  border: 1px solid rgba(178, 154, 118, 0.22);
  border-radius: 11px;
}

.final-fact {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
}

.final-fact strong {
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.18;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.final-fact-address strong {
  line-height: 1.35;
}

.final-item-list,
.final-shipment-list,
.final-timeline {
  display: grid;
  gap: 7px;
}

.final-item {
  align-items: start;
  background: rgba(244, 241, 234, 0.58);
  border: 1px solid rgba(178, 154, 118, 0.22);
  border-radius: 11px;
  display: grid;
  gap: 3px;
  padding: 10px 11px;
}

.final-item strong {
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.final-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

/* Artikel-Karte im Bestell-Overlay: Label oben, Artikel mittig im (auf Nachbarhöhe gestreckten)
   Kasten — kein verwaister Artikel mit großem Leerraum mehr. */
.final-split .final-items-card {
  grid-template-rows: auto minmax(0, 1fr);
}

.final-split .final-items-card .final-item-list {
  align-content: center;
}

.final-split .final-items-card .final-empty {
  align-self: center;
}

.final-shipment {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.final-shipment-header {
  align-items: center;
  border: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0;
}

.final-shipment-header div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.final-shipment-header strong {
  color: var(--green-dark);
  font-size: 18px;
  font-weight: 950;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.final-shipment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.final-shipment-header button,
.final-shipment-actions button {
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  min-height: 34px;
  padding: 0 12px;
}

.final-shipment-header button.secondary,
.final-shipment-actions button.secondary,
.resource-actions button.secondary {
  background: #fffdf8;
  border-color: rgba(178, 154, 118, 0.48);
  color: var(--green-dark);
}

.final-subcard {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
}

.final-subcard strong {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.final-timeline-row {
  background: rgba(247, 242, 232, 0.72);
  border: 1px solid rgba(178, 154, 118, 0.22);
  border-radius: 11px;
  display: grid;
  gap: 3px;
  grid-template-columns: minmax(90px, 132px) minmax(0, 1fr);
  padding: 10px 11px;
}

.final-timeline-row strong {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.final-timeline-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  grid-column: 2;
}

.final-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  padding: 9px;
}

.native-control-body .ops-context-card {
  background: rgba(255, 252, 246, 0.86);
  border: 1px solid rgba(178, 154, 118, 0.42);
  border-radius: 7px;
  box-shadow: none;
}

.native-case-strip {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.native-case-strip div,
.native-summary-hero,
.native-detail-section {
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid rgba(178, 154, 118, 0.42);
  border-radius: 8px;
  box-shadow: none;
}

.native-case-strip div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 8px;
}

.native-case-strip span,
.native-summary-main span,
.native-summary-facts span,
.native-fact span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.native-case-strip strong,
.native-summary-facts strong,
.native-fact strong {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.native-summary-hero {
  align-items: start;
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.native-summary-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.native-summary-main strong {
  color: var(--green-dark);
  font-size: 20px;
  font-weight: 950;
  line-height: 1.05;
  min-width: 0;
  overflow-wrap: anywhere;
}

.native-summary-main em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.native-summary-status {
  align-self: start;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
  max-width: 280px;
  overflow-wrap: anywhere;
  padding: 5px 8px;
  text-align: right;
}

.native-status-good {
  background: rgba(224, 240, 226, 0.92);
  color: #1e5a3d;
}

.native-status-warn {
  background: rgba(253, 234, 224, 0.92);
  color: #9a3b32;
}

.native-status-neutral {
  background: rgba(232, 226, 214, 0.86);
  color: var(--green-dark);
}

.native-summary-facts {
  display: grid;
  gap: 6px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.native-summary-facts div {
  background: rgba(244, 241, 234, 0.72);
  border-radius: 7px;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 6px 8px;
}

.native-action-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.native-action-bar button {
  background: #fffdf8;
  border: 1px solid rgba(178, 154, 118, 0.46);
  color: var(--green-dark);
  font-size: 12px;
  flex: 0 0 auto;
  font-weight: 900;
  min-height: 30px;
  padding: 0 10px;
}

.native-action-bar button:first-child {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.native-invoice-documents {
  gap: 6px;
}

.native-invoice-document {
  align-items: center;
  background: #fffdf8;
  border: 1px solid rgba(178, 154, 118, 0.34);
  border-radius: 7px;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(92px, 1fr) minmax(82px, 0.8fr) minmax(82px, 0.8fr) auto;
  padding: 7px;
}

.native-invoice-document div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.native-invoice-document span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.native-invoice-document strong {
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.native-invoice-document button {
  background: var(--sage);
  border: 1px solid rgba(46, 121, 83, 0.18);
  border-radius: 7px;
  color: var(--green-dark);
  cursor: grab;
  font-size: 11px;
  font-weight: 900;
  min-height: 28px;
  padding: 0 8px;
}

.native-detail-section {
  display: grid;
  gap: 7px;
  padding: 9px;
}

.native-section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-width: 0;
}

.native-section-heading strong {
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 950;
}

.native-fact-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.native-fact {
  background: rgba(244, 241, 234, 0.62);
  border: 1px solid rgba(178, 154, 118, 0.22);
  border-radius: 7px;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 6px 8px;
}

.native-fact strong {
  white-space: normal;
}

.native-table-card,
.native-timeline-card {
  overflow: hidden;
}

.native-table {
  border: 1px solid rgba(178, 154, 118, 0.32);
  border-radius: 7px;
  display: grid;
  margin-top: 6px;
  overflow: hidden;
}

.native-table-row {
  align-items: start;
  background: rgba(255, 252, 246, 0.72);
  border-top: 1px solid rgba(178, 154, 118, 0.22);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 140px) minmax(54px, 70px);
  padding: 6px 8px;
}

.native-table-row:first-child {
  border-top: 0;
}

.native-table-row span {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.native-table-head {
  background: rgba(232, 226, 214, 0.82);
}

.native-table-head span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.native-timeline {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.native-timeline-row {
  background: rgba(255, 252, 246, 0.76);
  border: 1px solid rgba(178, 154, 118, 0.28);
  border-radius: 7px;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
}

.native-timeline-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.native-timeline-row strong {
  color: var(--green-dark);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.native-timeline-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.native-shipments-card,
.native-shipment-card {
  display: grid;
  gap: 7px;
}

.native-shipment-list {
  display: grid;
  gap: 7px;
}

.native-shipment-entry {
  background: rgba(255, 252, 246, 0.78);
  border: 1px solid rgba(178, 154, 118, 0.28);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  padding: 9px;
}

.native-shipment-head {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.native-shipment-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.native-shipment-head span,
.native-shipment-fact span,
.native-shipment-event span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.native-shipment-head strong,
.native-shipment-fact strong,
.native-shipment-event strong {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.native-shipment-head button {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  min-height: 30px;
  padding: 0 10px;
}

.native-shipment-meta {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.native-shipment-fact {
  background: rgba(244, 241, 234, 0.64);
  border-radius: 6px;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 7px;
}

.native-shipment-events {
  display: grid;
  gap: 5px;
}

.native-shipment-items {
  background: rgba(244, 241, 234, 0.64);
  border-radius: 6px;
  display: grid;
  gap: 3px;
  padding: 6px 7px;
}

.native-shipment-items span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.native-shipment-items strong {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.native-shipment-event,
.native-shipment-empty {
  background: rgba(247, 242, 232, 0.7);
  border-radius: 6px;
  display: grid;
  gap: 2px;
  padding: 6px 7px;
}

.native-shipment-event em,
.native-shipment-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .native-control-panel {
    max-width: calc(100vw - 24px);
    width: calc(100vw - 24px);
  }

  .native-shipment-meta,
  .final-fact-grid.four,
  .final-fact-grid.shipment,
  .final-fact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .native-control-panel {
    max-height: calc(100vh - 16px);
    max-width: calc(100vw - 16px);
    width: calc(100vw - 16px);
  }

  .native-case-strip,
  .native-summary-facts,
  .native-fact-grid,
  .native-shipment-meta,
  .final-fact-grid,
  .final-fact-grid.two,
  .final-fact-grid.four,
  .final-fact-grid.shipment {
    grid-template-columns: minmax(0, 1fr);
  }

  .final-timeline-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .final-timeline-row em {
    grid-column: auto;
  }

  .native-summary-hero,
  .final-hero,
  .final-shipment-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .native-summary-status {
    max-width: none;
    text-align: left;
  }

  .native-table-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .native-shipment-head {
    grid-template-columns: minmax(0, 1fr);
  }
}

.resource-panel header {
  align-items: center;
  border-bottom: 1px solid rgba(178, 154, 118, 0.32);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
  padding: 10px 12px;
}

.resource-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.resource-title strong {
  color: var(--green-dark);
  font-size: 16px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-actions {
  align-items: center;
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.resource-panel header button {
  align-items: center;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  min-height: 30px;
  padding: 0 9px;
  white-space: nowrap;
}

.resource-panel header [data-close-resource-overlay] {
  font-size: 24px;
  padding: 0;
  width: 30px;
}

.resource-panel iframe {
  border: 0;
  height: 100%;
  width: 100%;
}

.resource-fallback {
  align-items: center;
  background: rgba(247, 242, 232, 0.96);
  border: 1px solid rgba(178, 154, 118, 0.42);
  border-radius: 7px;
  bottom: 14px;
  box-shadow: 0 14px 30px rgba(9, 24, 11, 0.16);
  color: var(--text);
  display: grid;
  gap: 6px;
  left: 14px;
  max-width: min(420px, calc(100% - 28px));
  padding: 12px;
  position: absolute;
  z-index: 2;
}

.resource-panel.is-external-portal .resource-fallback {
  align-self: center;
  justify-self: center;
  max-width: min(460px, calc(100% - 32px));
  position: static;
}

.resource-fallback[hidden],
.resource-overlay.is-loaded .resource-fallback {
  display: none;
}

.resource-fallback strong {
  color: var(--green-dark);
}

.resource-fallback span {
  color: var(--muted);
  font-size: 13px;
}

.resource-fallback button {
  justify-content: center;
  width: 100%;
}

/* #1 Anhang-Liste im Anhänge-Overlay: Name + Typ/Größe, Virenscan-Badge und die Aktionen
   Öffnen/Download. */
.attachment-row {
  align-items: center;
  border-bottom: 1px solid rgba(178, 154, 118, 0.32);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 4px;
}

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

.attachment-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-info strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.attachment-info em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.attachment-scan {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  white-space: nowrap;
}

.attachment-scan-clean {
  background: rgba(47, 107, 79, 0.14);
  color: var(--green-dark);
}

.attachment-scan-pending {
  background: rgba(178, 154, 118, 0.2);
  color: var(--text);
}

.attachment-scan-warn {
  background: rgba(193, 138, 36, 0.18);
  color: #8a5d00;
}

.attachment-scan-infected {
  background: rgba(176, 42, 42, 0.16);
  color: #9b1c1c;
}

.attachment-actions {
  display: flex;
  gap: 8px;
}

.attachment-action {
  background: var(--green-dark);
  border-radius: 8px;
  color: #fffaf0;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  text-decoration: none;
}

.attachment-action.attachment-download {
  background: rgba(47, 107, 79, 0.12);
  color: var(--green-dark);
}

.attachment-action:hover,
.attachment-action:focus-visible {
  filter: brightness(0.96);
  outline: none;
}

/* #B2 Wiedervorlagen-Button mit Zähler-Badge in der Inbox-Kopfzeile. */
.followup-button .followup-badge {
  background: var(--green-dark);
  border-radius: 999px;
  color: #fffaf0;
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  margin-left: 4px;
  min-width: 18px;
  padding: 1px 6px;
  text-align: center;
}

/* #B2 Wiedervorlagen-Liste (Overlay): jede Zeile öffnet den Fall. */
.followup-list {
  display: grid;
  gap: 6px;
}

.followup-row {
  align-items: center;
  background: rgba(247, 242, 232, 0.7);
  border: 1px solid rgba(178, 154, 118, 0.32);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 12px;
  text-align: left;
  width: 100%;
}

.followup-row:hover {
  background: rgba(47, 107, 79, 0.1);
}

.followup-row-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.followup-row-main strong {
  color: var(--text);
}

.followup-row-main span {
  color: var(--muted);
  font-size: 13px;
}

.followup-row-due {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* #B1 Weitergeleitet-Reiter in den Profileinstellungen. */
.forwarded-archive {
  display: grid;
  gap: 10px;
  padding: 6px 0 2px;
}

.forwarded-archive-list {
  display: grid;
  gap: 8px;
}

.forwarded-archive-empty {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0;
}

.forwarded-archive-row {
  align-items: center;
  border: 1px solid rgba(178, 154, 118, 0.32);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.forwarded-archive-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.forwarded-archive-info strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.forwarded-archive-info em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.forwarded-archive-preview {
  color: var(--text);
  font-size: 12px;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forwarded-archive-restore {
  background: var(--green-dark);
  border-radius: 8px;
  color: #fffaf0;
  font-weight: 700;
  padding: 8px 14px;
  white-space: nowrap;
}

.action-confirm-panel {
  /* Das Overlay ist align-items: stretch — ohne align-self würde dieses kleine Bestätigungs-Panel
     auf volle Höhe gezogen und die Buttons aufgebläht. */
  align-self: center;
  grid-template-rows: auto auto;
  height: max-content;
  width: min(460px, calc(100vw - 36px));
}

.user-settings-panel {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: auto;
  width: min(920px, calc(100vw - 36px));
}

.user-settings-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.user-settings-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-section-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.settings-section-title strong {
  color: var(--green-dark);
  font-size: 15px;
}

.settings-section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.user-settings-form label {
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 900;
}

.user-settings-preview {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 6px;
  padding: 9px;
}

.two-factor-settings {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 10px;
  padding: 10px;
}

.two-factor-settings > div:first-child {
  display: grid;
  gap: 3px;
}

.two-factor-settings strong {
  color: var(--green-dark);
  font-size: 14px;
}

.two-factor-settings span,
.two-factor-settings small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.authenticator-setup {
  background: #f7f8f2;
  border: 1px solid rgba(217, 210, 195, 0.72);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  padding: 9px;
}

.authenticator-setup code,
.authenticator-setup small {
  overflow-wrap: anywhere;
}

.authenticator-setup code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-dark);
  font: 13px/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 8px;
}

.authenticator-qr {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 10px;
}

.authenticator-qr svg {
  display: block;
  height: 168px;
  image-rendering: pixelated;
  max-width: 100%;
  width: 168px;
}

.authenticator-qr-fallback {
  background: #fff7ed;
  border: 1px solid #ead0a8;
  border-radius: 7px;
  color: #744b16;
  font-size: 12px;
  font-weight: 800;
  padding: 8px;
}

.two-factor-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.two-factor-actions input {
  flex: 1 1 140px;
  max-width: 190px;
}

.settings-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.user-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-settings-overview {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 14px;
}

.admin-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Admin-/Sekundäraktionen: kompakte „Ghost"-Buttons statt vollbreiter Grünbalken. justify-self/align-self
   verhindern das Strecken im Grid-Container (.admin-control-entry ist display:grid). */
.admin-settings-actions button,
.admin-control-entry > button {
  justify-self: start;
  align-self: start;
  width: auto;
  min-width: 0;
  height: 34px;
  min-height: 0;
  padding: 0 16px;
  background: #fff;
  color: var(--green-dark);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.admin-settings-actions button:hover,
.admin-settings-actions button:focus-visible,
.admin-control-entry > button:hover,
.admin-control-entry > button:focus-visible {
  border-color: var(--green);
  background: #f3f9f1;
  outline: none;
}

.admin-control-entry,
.admin-control-center {
  display: grid;
  gap: 10px;
}

.admin-control-entry {
  padding: 14px;
}

.admin-control-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-control-stat,
.admin-control-section {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 8px;
}

.admin-control-details {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  min-width: 0;
}

.admin-control-details summary {
  color: var(--green-900);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  list-style-position: inside;
  min-height: 36px;
  padding: 10px;
}

.admin-control-details-body {
  border-top: 1px solid rgba(178, 154, 118, 0.22);
  display: grid;
  gap: 8px;
  padding: 8px;
}

.admin-control-stat span,
.admin-control-row em {
  color: var(--muted);
  font-size: 12px;
}

.admin-control-stat strong {
  color: var(--green-900);
  font-size: 18px;
}

.admin-control-section h4 {
  color: var(--green-900);
  font-size: 13px;
  margin: 0;
}

.admin-control-row {
  align-items: center;
  border-top: 1px solid rgba(178, 154, 118, 0.22);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(76px, 94px) minmax(120px, 0.72fr) minmax(0, 1.28fr) minmax(72px, auto);
  min-height: 34px;
  min-width: 0;
  padding-top: 6px;
}

.admin-control-row strong,
.admin-control-row em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-control-row em {
  font-style: normal;
}

.admin-control-row button {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-dark);
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  min-height: 28px;
  padding: 0 9px;
  white-space: nowrap;
}

.admin-control-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-control-actions::-webkit-scrollbar {
  display: none;
}

.admin-control-actions button {
  flex: 0 0 auto;
}

.admin-e2e-inline {
  background: rgba(239, 245, 235, 0.72);
  border-top: 1px solid rgba(47, 119, 83, 0.2);
  padding-bottom: 6px;
}

.admin-e2e-fields {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(118px, 1.1fr) minmax(126px, 1fr) minmax(78px, 0.55fr) minmax(126px, 1fr) minmax(78px, 0.55fr) minmax(96px, 0.65fr);
  min-width: 0;
}

.admin-e2e-fields input,
.admin-e2e-fields select,
.admin-e2e-fields button {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-900);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  min-height: 30px;
  min-width: 0;
  padding: 0 8px;
}

.admin-e2e-fields button {
  background: var(--surface-muted);
  white-space: nowrap;
}

.admin-control-row .admin-e2e-hint {
  white-space: normal;
}

.admin-control-badge {
  background: #eee7dc;
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 900;
  padding: 5px 7px;
  text-align: center;
}

.admin-control-badge.online,
.admin-control-badge.ok,
.admin-control-badge.tracked,
.admin-control-badge.passed,
.admin-control-badge.due {
  background: #dfeee4;
  color: #1d5b3f;
}

.admin-control-badge.warning,
.admin-control-badge.open,
.admin-control-badge.undocumented,
.admin-control-badge.due_soon,
.admin-control-badge.ready,
.admin-control-badge.scheduled {
  background: #f6ecd8;
  color: #805b18;
}

.admin-control-badge.error,
.admin-control-badge.critical,
.admin-control-badge.overdue,
.admin-control-badge.rate_limited,
.admin-control-badge.blocked {
  background: #f5dcd6;
  color: #9b372b;
}

.admin-control-empty,
.admin-control-loading {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.system-status {
  margin: 8px 0 14px;
}

/* Gesamt-Verdikt (Punkt 1): klar sichtbarer grüner/roter Banner über der Status-Tabelle. */
.system-status-verdict {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.system-status-verdict.ok {
  background: rgba(34, 139, 64, 0.12);
  color: #1c7a3a;
}
.system-status-verdict.degraded {
  background: rgba(196, 64, 48, 0.12);
  color: #b23123;
}

.system-status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.system-status-table th,
.system-status-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.08));
  vertical-align: top;
}

.system-status-table th {
  font-weight: 800;
  white-space: nowrap;
  width: 44%;
}

.system-status-issues {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
}

.system-status-issues li {
  margin: 2px 0;
}

.admin-user-management {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 14px;
}

.admin-user-heading {
  display: grid;
  gap: 3px;
}

.admin-user-heading strong {
  color: var(--green-900);
  font-size: 17px;
}

.admin-user-heading span,
.admin-user-auth {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-invite-form,
.admin-user-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(110px, 1fr) minmax(150px, 1.25fr) minmax(88px, 0.62fr) minmax(92px, 0.64fr) minmax(112px, 0.9fr) minmax(96px, 0.75fr) minmax(260px, auto);
  align-items: center;
}

.admin-invite-form {
  grid-template-columns: minmax(150px, 1fr) minmax(190px, 1.35fr) auto;
}

.admin-user-grid {
  display: grid;
  gap: 8px;
}

.admin-user-row {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
}

.admin-user-row input,
.admin-user-row select,
.admin-invite-form input,
.admin-invite-form select {
  min-width: 0;
}

.admin-user-row button,
.admin-invite-form button {
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.admin-user-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
}

.admin-user-actions button {
  flex: 0 0 auto;
}

.admin-user-row .admin-danger-button {
  border-color: #ead1c8;
  background: #fff7f3;
  color: #9d3b31;
}

.admin-invite-form .settings-error {
  grid-column: 1 / -1;
}

.admin-user-row-error {
  grid-column: 1 / -1;
  margin: 0;
}

.action-confirm-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.action-confirm-body p {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
}

.action-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-confirm-actions button {
  flex: 1 1 160px;
  min-height: 42px;
}

.action-confirm-actions button.secondary {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--green-dark);
}

.action-confirm-actions button.secondary:hover {
  background: var(--sage);
}

/* #78 Weiterleiten-Dialog */
.forward-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.forward-chip {
  background: var(--sage);
  border: 1px solid var(--leaf);
  border-radius: 999px;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
}

.forward-chip:hover,
.forward-chip:focus-visible {
  background: var(--leaf);
  color: #fff;
}

.forward-field {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
}

.forward-field input {
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  min-height: 40px;
  padding: 0 12px;
  width: 100%;
}

.forward-field input:focus-visible {
  border-color: var(--leaf);
  outline: none;
}

.forward-error {
  color: #b3261e;
  font-size: 13px;
  margin: 0;
  min-height: 1em;
}

.forward-error:empty {
  display: none;
}

/* 4 Kinder (Header, Suche, Liste, Leer-Hinweis) brauchen explizite Zeilen — sonst landet die
   Suche im 1fr-Slot und die Liste in einer impliziten Zeile und überdeckt die Suche. */
.canned-panel {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(760px, calc(100vw - 36px));
}

.canned-search {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  margin: 10px 12px 0;
  padding: 9px 12px;
  position: relative;
  z-index: 1;
}

.canned-search:focus-visible {
  border-color: var(--green);
  outline: 2px solid var(--sage);
  outline-offset: 1px;
}

.canned-empty {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  padding: 2px 12px 14px;
  text-align: center;
}

.template-review-panel {
  width: min(820px, calc(100vw - 36px));
}

.canned-list,
.template-review-list {
  display: grid;
  gap: 9px;
  overflow: auto;
  padding: 12px;
}

.canned-list article,
.template-review-item {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 10px;
}

.canned-list article span,
.template-review-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.template-review-meta {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.template-review-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-review-item.is-match {
  border-left: 3px solid var(--green);
}

.template-review-match {
  align-items: center;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.template-review-match span {
  background: var(--sage);
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 900;
  padding: 2px 7px;
  white-space: nowrap;
}

.template-review-match em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canned-list article p,
.template-review-item p {
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
}

.template-review-item p {
  max-height: 118px;
  overflow: auto;
  white-space: pre-wrap;
}

.template-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-review-actions button {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--green-dark);
  min-height: 30px;
  padding: 0 10px;
}

.template-review-actions button:hover {
  background: var(--sage);
}

.template-review-actions button.danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}

.template-review-actions button.danger:hover {
  background: #fff5f3;
}

.ops-context {
  gap: 10px;
}
.ops-link-list {
  display: grid;
  gap: 7px;
}

.ops-link-list a {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid #d6dfcf;
  border-radius: 7px;
  color: var(--green-dark);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  min-height: 32px;
  padding: 0 9px;
  text-decoration: none;
}

.ops-link-list a:hover {
  border-color: var(--green);
}

.section {
  display: grid;
  gap: 8px;
}
.line-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.line-list li {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
  padding: 0 0 7px;
}

.line-list li button {
  justify-self: start;
  margin-top: 4px;
  min-height: 32px;
  padding: 0 10px;
}

.empty-state {
  color: var(--muted);
  padding: 16px;
}

@media (max-width: 1120px) {
  :root {
    --context-panel-width: 320px;
  }

  .topbar {
    grid-template-columns: minmax(172px, 210px) minmax(160px, 1fr) minmax(0, auto);
  }

  .session-bar {
    gap: 6px;
  }

  .session-user-button {
    max-width: clamp(112px, 16vw, 180px);
  }

  .metrics {
    min-width: 0;
    grid-template-columns: repeat(2, 1fr);
  }

  .workspace {
    grid-template-columns: 205px minmax(500px, 1fr) var(--context-panel-width);
  }

  .workspace.inbox-collapsed {
    grid-template-columns: minmax(540px, 1fr) var(--context-panel-width);
  }

  .workspace.context-collapsed {
    grid-template-columns: 205px minmax(540px, 1fr);
  }

  .workspace.inbox-collapsed.context-collapsed,
  .workspace.focus-mode {
    grid-template-columns: minmax(0, 1fr);
  }

  .reply-box {
    grid-template-columns: minmax(0, 1fr) 160px;
  }

  #replyButton {
    width: 100%;
  }

  .control-field-grid,
  .control-signal-strip,
  .control-quick-actions,
  .control-action-row {
    grid-template-columns: 1fr;
  }

  .admin-invite-form,
  .admin-user-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-user-auth,
  .admin-user-actions,
  .admin-invite-form .settings-error {
    grid-column: 1 / -1;
  }

  .admin-user-actions {
    justify-content: flex-start;
  }

  .admin-control-row {
    grid-template-columns: minmax(76px, 90px) minmax(100px, 0.8fr) minmax(0, 1fr);
  }

  .admin-control-row button {
    justify-self: start;
  }

  .admin-e2e-fields {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    padding: 0;
  }

  .topbar {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .session-bar {
    justify-content: flex-start;
  }

  .session-user-button {
    max-width: min(260px, 100%);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .workspace.inbox-collapsed,
  .workspace.context-collapsed,
  .workspace.inbox-collapsed.context-collapsed,
  .workspace.focus-mode {
    grid-template-columns: 1fr;
  }

  .ticket-list {
    flex: none;
    height: 360px;
  }

  .customer-panel {
    display: block;
  }

  .workflow,
  .reply-box,
  .note-box,
  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .reply-box textarea {
    grid-column: auto;
  }

  .reply-actions {
    grid-column: auto;
    grid-row: auto;
  }

  .message {
    max-width: 100%;
  }

  .source-tools button {
    max-width: min(230px, 56vw);
  }

  .source-tools strong {
    max-width: clamp(58px, 30vw, 150px);
  }

  .resource-overlay {
    padding: 8px;
  }

  .resource-panel,
  .user-settings-panel {
    max-height: calc(100vh - 16px);
    max-width: calc(100vw - 16px);
    width: calc(100vw - 16px);
  }

  .user-settings-grid,
  .admin-settings-actions,
  .admin-invite-form,
  .admin-user-row {
    grid-template-columns: 1fr;
  }

  .admin-user-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .admin-user-actions button {
    flex: 1 1 130px;
  }

  .admin-control-summary,
  .admin-control-row {
    grid-template-columns: 1fr;
  }

  .admin-control-row button {
    justify-self: start;
  }
}
