/* ============================================================
   CaboCheck Admin-Portal · Design-System
   Mobile zuerst, ab 720px zwei Spalten, ab 1180px drei Spalten
   ============================================================ */

:root {
  /* Farben */
  --bg:          #f4f6f9;
  --bg-panel:    #ffffff;
  --bg-sunken:   #eef1f6;
  --bg-hover:    #f7f9fc;
  --line:        #e2e7ef;
  --line-strong: #cbd4e1;

  --text:        #16202e;
  --text-soft:   #5a6879;
  --text-faint:  #8b97a8;

  --brand:       #0d7d8c;
  --brand-on:    #ffffff;      /* Schrift auf der Primärfarbe — wird je nach Helligkeit gesetzt */
  --akzent:      #f59e0b;
  --akzent-on:   #111820;
  --brand-dark:  #0a5f6b;
  --brand-soft:  #e5f4f6;
  --accent:      #2563eb;

  --ok:          #0f9d58;
  --ok-soft:     #e6f5ec;
  --warn:        #d97706;
  --warn-soft:   #fdf1e0;
  --danger:      #dc2626;
  --danger-soft: #fdeaea;
  --info:        #2563eb;
  --info-soft:   #e8eefd;
  --ai:          #7c3aed;
  --ai-soft:     #f1ebfe;
  --ai-on:       #ffffff;      /* Schrift auf der KI-Farbe */

  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 2px rgba(16,26,40,.06), 0 1px 3px rgba(16,26,40,.04);
  --shadow:      0 4px 12px rgba(16,26,40,.08);
  --shadow-lg:   0 12px 32px rgba(16,26,40,.16);

  --sidebar-w:   248px;
  --list-w:      380px;
  --header-h:    60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0f151d;
    --bg-panel:    #161e28;
    --bg-sunken:   #1b242f;
    --bg-hover:    #1e2833;
    --line:        #263140;
    --line-strong: #35435a;
    --text:        #e7edf5;
    --text-soft:   #a3b0c2;
    --text-faint:  #7a8798;
    --brand:       #2aa5b5;
    --brand-dark:  #1c8493;
    --brand-soft:  #10333a;
    --ok-soft:     #102c1d;
    --warn-soft:   #33240e;
    --danger-soft: #3a1616;
    --info-soft:   #16233f;
    --ai-soft:     #241a3d;
    --shadow-sm:   0 1px 2px rgba(0,0,0,.4);
    --shadow:      0 4px 14px rgba(0,0,0,.45);
    --shadow-lg:   0 14px 36px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg:#0f151d; --bg-panel:#161e28; --bg-sunken:#1b242f; --bg-hover:#1e2833;
  --line:#263140; --line-strong:#35435a; --text:#e7edf5; --text-soft:#a3b0c2; --text-faint:#7a8798;
  --brand:#2aa5b5; --brand-dark:#1c8493; --brand-soft:#10333a;
  --ok-soft:#102c1d; --warn-soft:#33240e; --danger-soft:#3a1616; --info-soft:#16233f; --ai-soft:#241a3d;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4); --shadow:0 4px 14px rgba(0,0,0,.45); --shadow-lg:0 14px 36px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
/* Muss vor den Layout-Klassen gewinnen: sonst überstimmt z. B. .app{display:grid} das hidden-Attribut */
[hidden] { display: none !important; }
html, body { height: 100%; }
/* iOS vergrößert Text in schmalen Ansichten eigenmächtig — das sprengt sonst jedes Layout */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: clip; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Anmeldung ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--brand-soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px 28px; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-logo .mark { width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: var(--brand-on);
  display: grid; place-items: center; font-weight: 800; font-size: 17px; letter-spacing: -.5px; }
.login-logo b { font-size: 19px; letter-spacing: -.02em; }
.login-logo span { display: block; font-size: 12px; color: var(--text-soft); font-weight: 500; }

/* ---------- Formularelemente ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft);
  margin-bottom: 5px; letter-spacing: .01em; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-panel); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%),
  linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
  padding-right: 32px; }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.input.fehlerhaft, .select.fehlerhaft, .textarea.fehlerhaft { border-color: var(--danger); background: var(--danger-soft); }
.input.fehlerhaft:focus, .textarea.fehlerhaft:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.feld-fehler { font-size: 12px; color: var(--danger); margin-top: 4px; font-weight: 550; }
/* kompakte Variante für Werkzeugleisten — feste Höhen schneiden Text auf Mobilgeräten ab */
.input.sm, .select.sm { padding: 6px 10px; font-size: 13.5px; }
.select.sm { padding-right: 30px; background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; }
.checkbox { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; padding: 4px 0; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }

/* ---------- Schaltflächen ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--bg-panel); color: var(--text); font-weight: 550; font-size: 14px;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ai { background: var(--ai); border-color: var(--ai); color: var(--ai-on); }
.btn-ai:hover { filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line-strong)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-sunken); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-block { width: 100%; }

/* ---------- App-Gerüst ---------- */
.app { display: grid; height: 100dvh; overflow: hidden; grid-template-columns: minmax(0,1fr); grid-template-rows: var(--header-h) 1fr; }
@media (min-width: 900px) { .app { grid-template-columns: var(--sidebar-w) minmax(0,1fr); grid-template-rows: var(--header-h) 1fr; } }

/* Kopfzeile */
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--bg-panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
  min-width: 0; }
@media (min-width: 700px) { .topbar { gap: 12px; padding: 0 14px; } }
/* Nur die Suche darf schrumpfen — Symbole und Wortmarke behalten ihren Platz */
.topbar > .icon-btn, .topbar > .brand { flex: 0 0 auto; }
/* Die Wortmarke ist zugleich der Firmenumschalter */
.topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em;
  background: none; border: 1px solid transparent; border-radius: 22px; padding: 4px 12px 4px 4px;
  color: var(--text); cursor: default; max-width: 240px; }
.topbar .brand.wechselbar { cursor: pointer; }
.topbar .brand.wechselbar:hover { background: var(--bg-sunken); border-color: var(--line); }
.topbar .brand > span:not(.mark) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-on);
  display: grid; place-items: center; font-size: 14px; font-weight: 800; flex: none; }
.topbar .brand .brand-chevron { flex: none; opacity: .55; }
@media (max-width: 560px) { .topbar .brand > span:not(.mark) { display: none; } }
.topbar .spacer { flex: 1; }
/* Die Suche steht auf jedem Gerät in der Kopfzeile */
.topbar-search { position: relative; flex: 1 1 60px; min-width: 0; max-width: 420px; }
.topbar-search .input { padding-left: 34px; background: var(--bg-sunken); border-color: transparent; }
/* Nur die Lupe im Feld liegt absolut — Icons im Trefferfenster bleiben im Fluss */
.topbar-search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }

.tenant-pop { position: fixed; z-index: 120; background: var(--bg-panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 250px; overflow: hidden; padding: 5px; }
.tenant-pop h5 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint);
  padding: 8px 11px 5px; margin: 0; font-weight: 700; }
.tenant-pop .t-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; }
.tenant-pop .t-item:hover { background: var(--bg-hover); }
.tenant-pop .t-item.aktiv { background: var(--brand-soft); color: var(--brand-dark); font-weight: 650; }
.tenant-pop .t-item .t-mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 800; flex: none; }
.tenant-pop .t-item small { display: block; font-size: 11.5px; color: var(--text-faint); font-weight: 500; }
.tenant-pop .t-foot { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 5px; }

.icon-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center;
  border: none; background: transparent; border-radius: 10px; cursor: pointer; color: var(--text-soft); }
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 9px; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg-panel); }

/* Seitenleiste */
.sidebar { background: var(--bg-panel); border-right: 1px solid var(--line); padding: 12px 10px;
  overflow-y: auto; display: none; }
@media (min-width: 900px) { .sidebar { display: block; } }
.sidebar.open { display: block; position: fixed; inset: var(--header-h) auto 0 0; width: 270px; z-index: 60;
  box-shadow: var(--shadow-lg); }
.nav-group { margin-bottom: 18px; }
.nav-group h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint);
  padding: 0 10px; margin-bottom: 6px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-soft); cursor: pointer; font-weight: 550; font-size: 14.5px; margin-bottom: 2px; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--brand); color: var(--brand-on); }
.nav-item svg { flex: none; opacity: .85; }
.nav-item .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-faint);
  background: var(--bg-sunken); padding: 1px 7px; border-radius: 8px; }
.nav-item.active .count { background: rgba(127,127,127,.3); color: var(--brand-on); }
.nav-item .count.alarm { background: var(--danger); color: #fff; }

/* Eingeklappt bleibt nur die Symbolspalte stehen. Voreingestellt ist das im engen
   Bereich zwischen Tablet und Laptop; darüber entscheidet die eigene Wahl. */
@media (min-width: 900px) {
  .app.menue-schmal { grid-template-columns: 68px minmax(0,1fr); }
  .app.menue-schmal .sidebar { padding: 12px 8px; }
  .app.menue-schmal .sidebar .nav-item { justify-content: center; padding: 11px 0; position: relative; }
  .app.menue-schmal .sidebar .nav-item > span:not(.count) { display: none; }
  .app.menue-schmal .sidebar .nav-group h4,
  .app.menue-schmal .sidebar > div:last-child { display: none; }
  .app.menue-schmal .sidebar .nav-item .count { position: absolute; top: 4px; right: 8px; margin: 0;
    font-size: 10px; padding: 0 5px; min-width: 16px; text-align: center; }
}

/* Inhaltsbereich */
.main { overflow: hidden; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { flex: 1; overflow-y: auto; padding: 18px 16px 60px; }
@media (min-width: 900px) { .view { padding: 22px 24px 60px; } }
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head h1 { font-size: 22px; }
.view-head .spacer { flex: 1; }
.view-sub { color: var(--text-soft); font-size: 13.5px; margin-top: 2px; }

/* ---------- Karten & Raster ---------- */
.card { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15px; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 14px; min-width: 0; }
/* Rasterzellen und Karten dürfen schrumpfen — sonst sprengt breiter Inhalt (Tabellen,
   lange Adressen) die Spalte und die Ansicht läuft seitlich aus dem Bild. */
.grid > * { min-width: 0; }
.card { min-width: 0; }
.table-wrap { max-width: 100%; }
/* einzeilig mit Auslassung — verhindert, dass lange Texte Tabellen breit ziehen */
.zeile-kurz { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.tickets tbody tr.inaktiv { opacity: .55; }
.grid-kpi { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.grid-2 { grid-template-columns: minmax(0,1fr); }
@media (min-width: 860px) { .grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

.kpi { padding: 15px 16px; }
.kpi .label { font-size: 12.5px; color: var(--text-soft); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 5px; line-height: 1.1; }
.kpi .delta { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.kpi.alarm .value { color: var(--danger); }
.kpi.good .value { color: var(--ok); }

/* ---------- Kennzeichen ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 7px;
  font-size: 12px; font-weight: 650; background: var(--bg-sunken); color: var(--text-soft); white-space: nowrap; }
/* In Tabellenzellen zählt Lesbarkeit mehr als eine Zeile: dort brechen Chips um */
table.data td .badge { white-space: normal; text-align: center; line-height: 1.3; }
/* Status und Dringlichkeit: volle Farbe, Schrift in Weiß oder Schwarz —
   je nachdem, was auf der jeweiligen Farbe lesbar ist. */
.badge.new    { background: var(--info);   color: #fff; }
/* Antwort der Kundschaft: liegt bei uns und soll ins Auge fallen */
.badge.customer_replied { background: #7c3aed; color: #fff; }
.badge.open   { background: var(--brand);  color: var(--brand-on); }
.badge.pending{ background: var(--warn);   color: #fff; }
.badge.waiting_customer { background: #64748b; color: #fff; }
.badge.waiting_dev     { background: var(--ai);   color: var(--ai-on); }
.badge.waiting_partner { background: #0891b2; color: #fff; }
.badge.solved { background: var(--ok);     color: #fff; }
.badge.closed { background: #475569;       color: #fff; }
.badge.urgent { background: var(--danger); color: #fff; }
.badge.high   { background: var(--warn);   color: #fff; }
.badge.low    { background: var(--bg-sunken); color: var(--text-faint); }
.badge.overdue{ background: var(--danger); color: #fff; }
.badge.due-soon { background: var(--warn); color: #fff; }
.badge.ai     { background: var(--ai); color: var(--ai-on); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 11.5px; font-weight: 700; color: #fff; letter-spacing: .02em; background: var(--text-faint); }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------- Ticket-Arbeitsbereich ----------
   Liste und Detailansicht sind eigene Seiten, beide über die volle Breite. */
.workspace { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }

/* Detailansicht: Verlauf breit, Randspalte mit Kennzahlen */
.ticket-view { display: grid; grid-template-columns: minmax(0,1fr); height: 100%; min-height: 0; overflow: hidden; }
@media (min-width: 720px)  { .ticket-view { grid-template-columns: minmax(0,1fr) 268px; } }
@media (min-width: 1180px) { .ticket-view { grid-template-columns: minmax(0,1fr) 300px; } }
@media (min-width: 1500px) { .ticket-view { grid-template-columns: minmax(0,1fr) 340px; } }
.ticket-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.ticket-side { border-left: 1px solid var(--line); overflow-y: auto; background: var(--bg-panel); }
/* Unterhalb der zweispaltigen Breite scrollt die Detailseite als Ganzes:
   Hero → Feed → Antwortbereich → Kennzahlen. Ohne das fällt der Feed auf Höhe 0 zusammen. */
@media (max-width: 719px) {
  /* Kein Grid mehr: die Abschnitte fließen untereinander, die Seite scrollt als Ganzes */
  .ticket-view { display: block; height: 100%; overflow-y: auto; }
  .ticket-main { display: block; overflow: visible; }
  .ticket-main .pane-body { overflow: visible; flex: none; }
  .ticket-main .composer { max-height: none; overflow: visible; }
  .ticket-side { border-left: none; border-top: 1px solid var(--line); overflow: visible; }
  .feed { padding: 16px 14px 18px 34px; }
  .ticket-hero { position: sticky; top: 0; }
}

/* Ticketliste als Tabelle (ab Tablet), darunter als Karten */
.tt-wrap { flex: 1; min-height: 0; overflow: auto; }
table.tickets { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tickets th { position: sticky; top: 0; z-index: 2; background: var(--bg-panel); text-align: left;
  padding: 9px 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tickets td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tickets tbody tr { cursor: pointer; border-left: 3px solid transparent; }
table.tickets tbody tr:hover { background: var(--bg-hover); }
/* Der Streifen links zeigt die Dringlichkeit; überfällig bleibt am Hintergrund erkennbar */
table.tickets tbody tr.overdue { background: color-mix(in srgb, var(--danger) 5%, transparent); }
table.tickets tbody tr.prio-urgent, .titem.prio-urgent { border-left-color: var(--danger); }
table.tickets tbody tr.prio-high,   .titem.prio-high   { border-left-color: var(--warn); }
table.tickets tbody tr.prio-normal, .titem.prio-normal { border-left-color: var(--line-strong); }
table.tickets tbody tr.prio-low,    .titem.prio-low    { border-left-color: transparent; }
table.tickets tbody tr.unread .subj { font-weight: 700; }
table.tickets .subj { font-weight: 600; display: block; max-width: 34ch; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
table.tickets .cust { font-size: 12.5px; color: var(--text-soft); display: block; }
/* Worum es geht — die KI-Zusammenfassung, sonst die erste Kundennachricht */
table.tickets .beschr { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-soft);
  margin: 1px 0 2px; max-width: 70ch; overflow: hidden; white-space: nowrap; }
table.tickets .beschr svg { flex: none; opacity: .55; }
/* Ohne Einordnung behelfsweise der Anfang der Kundennachricht */
table.tickets .beschr.blass { color: var(--text-faint); font-style: italic; }
table.tickets .beschr > :last-child, table.tickets .beschr { text-overflow: ellipsis; }
table.tickets .num { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
/* Erste Spalte: Anlagezeitpunkt oben, letzte Aktivität darunter */
/* Feste Aufteilung: Die Tabelle passt immer in den sichtbaren Bereich,
   zu lange Inhalte werden gekürzt statt die Zeile zu sprengen. */
table.ticketliste { table-layout: fixed; width: 100%; }
table.ticketliste th, table.ticketliste td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.ticketliste th:nth-child(1), table.ticketliste td:nth-child(1) { width: 11%; }   /* Erstellt */
table.ticketliste th:nth-child(2), table.ticketliste td:nth-child(2) { width: 42%; white-space: normal; }
/* Status und Kategorie tragen Chips: dort darf die Zeile umbrechen, statt zu kappen */
table.ticketliste th:nth-child(3), table.ticketliste td:nth-child(3) { width: 13%; white-space: normal; overflow: visible; }
table.ticketliste th:nth-child(4), table.ticketliste td:nth-child(4) { width: 8%;  }   /* Priorität */
table.ticketliste th:nth-child(5), table.ticketliste td:nth-child(5) { width: 11%; }   /* Zuständig */
table.ticketliste th:nth-child(6), table.ticketliste td:nth-child(6) { width: 13%; white-space: normal; overflow: visible; }
table.ticketliste th:nth-child(7), table.ticketliste td:nth-child(7) { width: 10%; }   /* Frist */
table.ticketliste th:nth-child(8), table.ticketliste td:nth-child(8) { width: 8%;  }   /* Nummer */

/* Übrige Listen: der Name bekommt den Platz, die schmalen Spalten nur das Nötige */
table.data:not(.ticketliste) th, table.data:not(.ticketliste) td { width: 1%; white-space: nowrap; }
table.data:not(.ticketliste) th:first-child, table.data:not(.ticketliste) td:first-child { width: auto; white-space: normal; }
table.tickets .zeit { white-space: nowrap; }
table.tickets .zeit .erstellt { display: block; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
table.tickets .zeit .aktivitaet { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
table.tickets .snip { font-size: 12.5px; color: var(--text-faint); display: block; max-width: 60ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
/* Spalten entfallen der Reihe nach, damit die Tabelle nie quer scrollen muss.
   Die Schwellen berücksichtigen die 248 px breite Seitenleiste. */
@media (max-width: 1600px) { table.tickets .snip     { display: none; } }
/* Erst weichen Nummer und Priorität — beides steht im Vorgang selbst.
   Kategorie und Kontakt bleiben so lange wie möglich, sie helfen beim Überfliegen. */
@media (max-width: 1300px) { table.tickets .col-num  { display: none; } }
@media (max-width: 1250px) { table.tickets .col-prio { display: none; } }
@media (max-width: 840px)  { table.tickets .col-cat  { display: none; } }

@media (max-width: 780px) { .tt-desktop { display: none; } }
@media (min-width: 781px) { .tt-mobile { display: none; } }

.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); }
.pane:last-child { border-right: none; }
.pane-head { padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-panel);
  display: flex; align-items: center; gap: 8px; flex: none; }
.pane-body { flex: 1; min-height: 0; overflow-y: auto; }

/* Ticketliste */
.filters { display: flex; gap: 7px; padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: var(--bg-panel); flex: none;
  /* Lieber zweizeilig als abgeschnitten — jeder Filter bleibt erreichbar */
  flex-wrap: wrap; row-gap: 7px;
  overscroll-behavior-x: contain; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
/* Ohne feste Breite quetschen sich die Knöpfe zusammen, statt zu scrollen */
.filters > .chip { flex: 0 0 auto; }
.chip { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line-strong); background: var(--bg-panel);
  font-size: 13px; font-weight: 550; color: var(--text-soft); cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--bg-hover); }
.chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.chip .n { opacity: .75; margin-left: 4px; font-weight: 700; }
.chip.alarm { border-color: var(--danger); color: var(--danger); }
.chip.alarm.active { background: var(--danger); border-color: var(--danger); color: #fff; }

.tlist { list-style: none; margin: 0; padding: 0; }
.titem { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer;
  border-left: 3px solid transparent; position: relative; }
.titem:hover { background: var(--bg-hover); }
.titem.active { background: var(--brand-soft); border-left-color: var(--brand); }
.titem.overdue { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.titem.overdue.active { background: var(--danger-soft); }
.titem.unread .subject { font-weight: 700; }
.titem-top { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.titem-top .num { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
.titem-top .spacer { flex: 1; }
.titem-top .time { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.titem .subject { font-size: 14.5px; font-weight: 600; margin-bottom: 3px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.titem .from { font-size: 13px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titem .snippet { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.titem-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }

/* Ticket-Detailansicht */
/* ---------- Hero über dem Vorgang ---------- */
.ticket-hero { flex: none; padding: 15px 22px 16px; background: var(--bg-panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; overflow: hidden;
  transition: padding .18s ease; }
/* Beim Scrollen im Feed schrumpft der Hero auf eine Kopfzeile zusammen */
.ticket-hero.kompakt { padding-top: 9px; padding-bottom: 9px; }
.ticket-hero.kompakt h2 { font-size: 16px; margin-bottom: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-hero.kompakt .hero-meta,
.ticket-hero.kompakt .hero-ai { display: none; }
.ticket-hero.kompakt .hero-top { margin-bottom: 5px; }
/* Zusammengeklappt bleiben die Kennzeichen in einer Zeile und scrollen bei Bedarf */
.ticket-hero.kompakt .hero-top { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ticket-hero.kompakt .hero-top::-webkit-scrollbar { display: none; }
.ticket-hero.kompakt .hero-top > * { flex: 0 0 auto; }
.ticket-hero::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.ticket-hero.is-overdue::after { background: var(--danger); }
.ticket-hero.is-done::after    { background: var(--ok); }
.ticket-hero .hero-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
.ticket-hero .hero-num { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }
.ticket-hero h2 { font-size: 21px; line-height: 1.25; letter-spacing: -.015em; margin-bottom: 9px;
  transition: font-size .18s ease, margin-bottom .18s ease; }
.ticket-hero .hero-meta { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-soft); }
/* Dauerhaft schlanke Kopfzeile im Ticket — kein Auf- und Zuklappen */
.ticket-hero.schlank { padding: 10px 22px 11px; }
.ticket-hero.schlank h2 { font-size: 17px; margin-bottom: 5px; }
/* Lange Betreffs laufen über zwei Zeilen, erst danach wird gekürzt.
   Der Stift daneben bleibt in jedem Fall sichtbar. */
.ticket-hero.schlank h2 .text { display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.ticket-hero.schlank .hero-top { margin-bottom: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ticket-hero.schlank .hero-top::-webkit-scrollbar { display: none; }
.ticket-hero.schlank .hero-top > * { flex: 0 0 auto; }
.hero-zeile { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-soft); }
.hero-zeile > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.hero-zeile b { color: var(--text); font-weight: 600; }
.feed-item.f-ai::before { border-color: var(--ai); background: var(--ai-soft); }
.feed-item.f-ai .hero-ai { margin-top: 0; }
.ticket-hero .hero-meta > span { display: inline-flex; align-items: center; gap: 6px;
  min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.ticket-hero .hero-meta b { color: var(--text); font-weight: 600; }
/* Stammdaten als Gitter im Hero */
.stamm { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 7px 20px; margin-top: 4px; }
.stamm-feld { min-width: 0; font-size: 13.5px; }
.stamm-feld .l { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 700; }
.stamm-feld .w { display: block; color: var(--text); font-weight: 550; overflow-wrap: anywhere; }
.stamm-notiz { margin-top: 10px; font-size: 13.5px; color: var(--text-soft); white-space: pre-wrap;
  padding: 9px 12px; background: var(--bg-sunken); border-radius: var(--radius-sm); }

/* Ansprechpartner als Umschalter innerhalb des Kunden */
.ap-leiste { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 13px;
  padding-top: 12px; border-top: 1px solid var(--line); }
.ap-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 6px; border-radius: 20px;
  border: 1px solid var(--line-strong); background: var(--bg-panel); cursor: pointer;
  font-size: 13px; font-weight: 550; color: var(--text-soft); }
.ap-chip:hover { background: var(--bg-hover); color: var(--text); }
.ap-chip.aktiv { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.ap-chip .n { background: var(--bg-sunken); color: var(--text-soft); border-radius: 8px; padding: 0 6px;
  font-size: 11.5px; font-weight: 700; }
.ap-chip.aktiv .n { background: rgba(127,127,127,.28); color: var(--brand-on); }
.ap-chip .ap-name { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-chip.neu { border-style: dashed; padding-left: 11px; }
/* Zusammengeklappt bleibt die Ansprechpartner-Leiste als Navigation sichtbar —
   dann aber einzeilig und seitlich schiebbar statt umgebrochen. */
.ticket-hero.kompakt .ap-leiste { margin-top: 8px; padding-top: 8px;
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ticket-hero.kompakt .ap-leiste::-webkit-scrollbar { display: none; }
.ticket-hero.kompakt .ap-chip { flex: 0 0 auto; }
.ticket-hero.kompakt .ap-chip .ap-name { max-width: 14ch; }
.ap-details { margin-top: 12px; padding: 12px 14px; background: var(--bg-sunken); border-radius: var(--radius); }
.ticket-hero.kompakt .stamm,
.ticket-hero.kompakt .stamm-notiz,
.ticket-hero.kompakt .ap-details { display: none; }

/* Der Kundenname im Hero führt zum Kontakt — und sieht auch so aus */
.hero-meta .kontakt-link, .hero-zeile .kontakt-link {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border-radius: 20px; padding: 2px 9px 2px 2px; margin-left: -2px; transition: background .12s, color .12s; }
.hero-meta .kontakt-link:hover, .hero-zeile .kontakt-link:hover { background: var(--brand-soft); color: var(--brand); }
.hero-meta .kontakt-link svg, .hero-zeile .kontakt-link svg { transform: rotate(180deg); opacity: .5; }
.hero-zeile .kontakt-link:hover svg { opacity: 1; }
.hero-zeile .kontakt-link b { border-bottom: 1px dotted var(--line-strong); }
.hero-zeile .kontakt-link:hover b { border-bottom-color: var(--brand); }

/* Die Einordnung der KI soll sofort ins Auge fallen — farbiger Balken,
   getönter Grund und eine eigene Überschrift. */
.hero-ai { margin-top: 11px; padding: 12px 14px 12px 16px; border-radius: var(--radius);
  background: var(--ai-soft); border: 1px solid color-mix(in srgb, var(--ai) 32%, transparent);
  border-left: 4px solid var(--ai); font-size: 14px; line-height: 1.5;
  display: flex; gap: 11px; align-items: flex-start; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.hero-ai svg { flex: none; color: var(--ai); margin-top: 2px; }
.hero-ai b { color: var(--ai); font-weight: 700; letter-spacing: .01em; }
.feed-item.f-ai .hero-ai { margin-top: 0; }

/* ---------- Ein Feed: Nachrichten, Notizen und Ereignisse gemischt ---------- */
.feed { padding: 18px 22px 22px 40px; position: relative; max-width: 980px; }
.feed::before { content: ''; position: absolute; left: 17px; top: 20px; bottom: 20px;
  width: 2px; background: var(--line); }
.feed-item { position: relative; margin-bottom: 16px; min-width: 0; }
.feed-item:last-child { margin-bottom: 0; }
.feed-item::before { content: ''; position: absolute; left: -29px; top: 15px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--bg-panel); border: 2px solid var(--line-strong); z-index: 1; }
.feed-item.f-in::before   { border-color: var(--info);  background: var(--info-soft); }
.feed-item.f-out::before  { border-color: var(--brand); background: var(--brand); }
.feed-item.f-note::before { border-color: var(--warn);  background: var(--warn-soft); }
.feed-item.f-event::before{ width: 8px; height: 8px; left: -26px; top: 8px; background: var(--line-strong); border: none; }
.feed-item.f-event { margin-bottom: 9px; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--bg-panel); min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 5px 9px; padding: 10px 13px; background: var(--bg-sunken);
  font-size: 13px; border-bottom: 1px solid var(--line); flex-wrap: wrap; min-width: 0; }
.msg-head .who { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head .when { margin-left: auto; }
.msg-head > * { flex: 0 1 auto; }
.msg-head .spacer { flex: 1; }
.msg-head .when { color: var(--text-faint); font-size: 12px; }
.msg-body { padding: 13px 15px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap;
  overflow-wrap: anywhere; }
.msg.out .msg-head { background: var(--brand-soft); }
.msg.failed { border-color: var(--danger); }
.msg.failed .msg-head { background: var(--danger-soft); color: var(--danger); }
.msg-atts { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 15px 12px; }
.att { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--bg-sunken);
  border-radius: 7px; font-size: 12.5px; color: var(--text-soft); }

.note { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  border-radius: var(--radius); padding: 11px 14px; }
.note-head { display: flex; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--warn);
  margin-bottom: 6px; font-weight: 600; flex-wrap: wrap; }
.note-head svg { flex: none; }
.note-body { font-size: 14px; white-space: pre-wrap; line-height: 1.55; color: var(--text); }
.note .mention { background: color-mix(in srgb, var(--warn) 22%, transparent); padding: 0 4px; border-radius: 4px; font-weight: 650; }
/* Aus einer Erwähnung entstandene Aufgaben */
.notiz-aufgaben { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ausgabe { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; max-width: 100%;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--bg-panel); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.ausgabe:hover { background: var(--warn-soft); }
.ausgabe.erledigt { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* Notiz, die in einer Aufgabe geschrieben wurde — gehört in den Verlauf, ist aber keine Ticketnotiz */
.note.aus-aufgabe { background: var(--bg-sunken); border-color: var(--line); }
.note.aus-aufgabe .note-head { color: var(--text-soft); }
.note.aus-aufgabe .mention { background: var(--bg-panel); }

.event { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-faint);
  padding: 2px 4px; }
.event::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex: none; }

/* Antwortbereich */
.composer { border-top: 1px solid var(--line); background: var(--bg-panel); flex: none;
  max-height: 62vh; overflow-y: auto; }
.composer-tabs { display: flex; align-items: center; gap: 6px; padding: 6px 12px 0; flex-wrap: wrap; }
.composer-tabs .select, .composer-tabs .btn { margin-bottom: 5px; }
.ctab { padding: 7px 14px; border: none; background: transparent; border-radius: 8px 8px 0 0; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-soft); }
.ctab.active { background: var(--bg-sunken); color: var(--text); }
.composer-body { padding: 8px 12px 10px; background: var(--bg-sunken); }
/* Der Antwortbereich startet flach, damit der Verlauf Platz behält, und geht beim Schreiben auf.
   Die Anrede steht schon drin — deshalb entscheidet nicht der Inhalt, sondern die Schreibmarke. */
.composer .textarea { background: var(--bg-panel); min-height: 76px; transition: min-height .15s ease; }
.composer .textarea:focus, .composer .textarea.gross { min-height: 170px; }
.composer .textarea:not(.gross):not(:focus) + .composer-hint { opacity: .6; }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.composer-actions .select { flex: 1 1 200px; min-width: 0; max-width: 260px; }
.composer-actions .spacer { flex: 1; }

.ai-draft { border: 1px solid color-mix(in srgb, var(--ai) 45%, transparent); background: var(--ai-soft);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
  border-top: 3px solid var(--ai); box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.ai-draft-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
  color: var(--ai); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.ai-draft-head .spacer { flex: 1; }
.ai-draft-body { font-size: 14px; line-height: 1.55; white-space: pre-wrap; max-height: 180px; overflow-y: auto;
  background: var(--bg-panel); border-radius: var(--radius-sm); padding: 10px 12px; }
.ai-draft-actions { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.confidence { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; }
.confidence .bar { width: 42px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--ai) 20%, transparent); overflow: hidden; }
.confidence .bar span { display: block; height: 100%; background: var(--ai); }

/* Seitenspalte Ticket */
.side-block { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-block:last-child { border-bottom: none; }
.side-field { margin-bottom: 9px; }
.side-field:last-child { margin-bottom: 0; }
.side-field > label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }
.side-field .select { width: 100%; }
/* Farbmarke am Feld: zeigt Status, Priorität und Kategorie auf einen Blick */
.feld-farbig { position: relative; }
.feld-farbig::before { content: ''; position: absolute; left: 1px; top: 1px; bottom: 1px; width: 4px;
  border-radius: 7px 0 0 7px; background: var(--feldfarbe); }
.feld-farbig .select { padding-left: 14px; }
.feld-mit-avatar { display: flex; align-items: center; gap: 8px; }
.feld-mit-avatar .select { flex: 1; min-width: 0; }
.side-block h4 { display: flex; align-items: center; gap: 7px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint);
  margin-bottom: 9px; font-weight: 700; }
.kv { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 4px 0; }
.kv .k { color: var(--text-soft); min-width: 92px; }
.kv .v { font-weight: 550; }
/* Zusammenführen: die beiden Vorgänge gegenüberstellen */
.mg-paar { display: grid; grid-template-columns: minmax(0,1fr) 30px minmax(0,1fr); gap: 8px; align-items: center; }
@media (max-width: 620px) { .mg-paar { grid-template-columns: minmax(0,1fr); }
  .mg-pfeil { transform: rotate(-90deg); justify-self: center; } }
.mg-karte { border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; min-width: 0; }
.mg-karte.ziel { border-color: var(--ok); background: var(--ok-soft); }
.mg-karte.quelle { border-style: dashed; opacity: .85; }
.mg-rolle { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  color: var(--text-faint); margin-bottom: 4px; }
.mg-karte.ziel .mg-rolle { color: var(--ok); }
.mg-nr { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
.mg-betreff { font-weight: 650; font-size: 14px; margin: 2px 0 5px; overflow-wrap: anywhere; }
.mg-zeilen { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--text-soft); }
.mg-pfeil { display: grid; place-items: center; color: var(--text-faint); transform: rotate(180deg); }

/* Zweiwegeschalter in Formularen */
.segment { display: inline-flex; background: var(--bg-sunken); border-radius: 9px; padding: 3px; gap: 3px; }
.segment button { border: none; background: transparent; padding: 6px 13px; border-radius: 7px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-soft); }
.segment button:hover:not(:disabled):not(.an) { background: var(--bg-hover); color: var(--text); }
.segment button.an { background: var(--brand); color: var(--brand-on); }
.segment button:disabled { opacity: .45; cursor: not-allowed; }
.input.geerbt { background: var(--bg-sunken); color: var(--text-soft); }

/* Einrichtungsassistent */
.wz-schritte { display: flex; gap: 6px; margin: -4px 0 16px; flex-wrap: wrap; }
.wz-schritt { display: flex; align-items: center; gap: 7px; padding: 6px 12px 6px 7px; border-radius: 20px;
  font-size: 13px; font-weight: 600; color: var(--text-faint); background: var(--bg-sunken); }
.wz-schritt .nr { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--line-strong); color: var(--bg-panel); font-size: 11.5px; font-weight: 800; }
.wz-schritt.aktiv { background: var(--brand-soft); color: var(--brand-dark); }
.wz-schritt.aktiv .nr { background: var(--brand); color: var(--brand-on); }
.wz-schritt.fertig { color: var(--ok); }
.wz-schritt.fertig .nr { background: var(--ok); color: #fff; }
.wz-text { font-size: 14px; color: var(--text-soft); line-height: 1.55; margin: 0 0 14px; }
.wz-titel { display: block; font-size: 13.5px; margin: 14px 0 6px; }
.wz-liste { margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; line-height: 1.7; color: var(--text); }
.wz-liste li { margin-bottom: 3px; }
.wz-liste code, .wz-rechte code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-sunken);
  padding: 1px 6px; border-radius: 5px; }
.wz-rechte { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.wz-alternativ { font-size: 12.5px; color: var(--text-soft); line-height: 1.5; margin: 5px 0 2px;
  padding: 7px 10px; background: var(--bg-sunken); border-radius: var(--radius-sm); }
.wz-zusammenfassung { display: grid; gap: 6px; padding: 12px 14px; background: var(--bg-sunken);
  border-radius: var(--radius-sm); font-size: 13.5px; }
.wz-zusammenfassung > div { display: flex; gap: 12px; }
.wz-zusammenfassung span { width: 130px; color: var(--text-soft); flex: none; }
.wz-zusammenfassung b { overflow-wrap: anywhere; }
.wz-ergebnis { margin-top: 12px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.5; }
.wz-ergebnis.gut { background: var(--ok-soft); color: var(--ok); }
.wz-ergebnis.schlecht { background: var(--danger-soft); color: var(--danger); }
.wz-ergebnis .hint { color: inherit; opacity: .85; }
.wz-fuss { display: flex; align-items: center; gap: 8px; margin: 18px -18px -18px; padding: 13px 18px;
  border-top: 1px solid var(--line); background: var(--bg-sunken); }

/* Postfächer in den Einstellungen */
.postfach { border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; margin-bottom: 10px; }
.postfach.verbunden { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.postfach .kopf { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.postfach .adresse { font-weight: 650; overflow-wrap: anywhere; }
.postfach .zeilen { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-soft); margin-top: 6px; }
.postfach .fehler { margin-top: 7px; font-size: 12.5px; color: var(--danger); line-height: 1.5;
  background: var(--danger-soft); padding: 8px 11px; border-radius: var(--radius-sm);
  display: flex; gap: 8px; align-items: flex-start; }
.postfach .fehler svg { flex: none; margin-top: 2px; }

/* Aufgaben-Dialog: Bezugsangaben, Notizen und Verlauf */
.task-info { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--text-soft);
  padding: 9px 12px; background: var(--bg-sunken); border-radius: var(--radius-sm); margin-bottom: 4px; }
.task-feed { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--bg-sunken); }
.task-notiz { margin-bottom: 9px; }
.task-notiz .kopf { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-soft); margin-bottom: 3px; }
.task-notiz .text { font-size: 13.5px; white-space: pre-wrap; padding-left: 31px; }
table.tickets .haken { width: 18px; height: 18px; border-radius: 5px; cursor: pointer;
  border: 1.5px solid var(--line-strong); background: var(--bg-panel); display: grid; place-items: center; color: #fff; }
table.tickets .haken.an { background: var(--ok); border-color: var(--ok); }

/* Aufgaben in der Randspalte eines Tickets */
.mini-task { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.mini-task .haken { width: 18px; height: 18px; flex: none; margin-top: 1px; border-radius: 5px; cursor: pointer;
  border: 1.5px solid var(--line-strong); background: var(--bg-panel); display: grid; place-items: center; color: #fff; }
.mini-task .haken:hover { border-color: var(--brand); }
.mini-task .haken.an { background: var(--ok); border-color: var(--ok); }
.mini-task .titel { font-size: 13.5px; line-height: 1.35; }
.mini-task.erledigt .titel { text-decoration: line-through; color: var(--text-faint); }
.mini-task .unten { display: flex; align-items: center; gap: 7px; margin-top: 3px;
  font-size: 11.5px; color: var(--text-faint); }
.mini-task .faellig-rot { color: var(--danger); font-weight: 650; }
.mini-task.ueberfaellig .titel { color: var(--text); }

.timer { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: var(--bg-sunken);
  border-radius: var(--radius-sm); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.timer.running .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; padding: 9px 12px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-faint); font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data td.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Diagramme ---------- */
.chart { width: 100%; height: 200px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 8px; }
.bars .bar { flex: 1; min-width: 3px; background: var(--brand); border-radius: 3px 3px 0 0; position: relative;
  transition: opacity .15s; opacity: .85; }
.bars .bar:hover { opacity: 1; }
.bars .bar.b2 { background: var(--ok); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-soft); margin-top: 10px; flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.hbar { height: 8px; background: var(--bg-sunken); border-radius: 4px; overflow: hidden; min-width: 60px; }
.hbar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

/* ---------- Dialoge ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(12,18,28,.55); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--bg-panel); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 90dvh; display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16.5px; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body > .field:first-child { margin-top: 0; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 13px 18px; border-top: 1px solid var(--line);
  background: var(--bg-sunken); }

/* ---------- Hinweise ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--text); color: var(--bg-panel); padding: 11px 15px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 13.5px; line-height: 1.45; max-width: 330px; max-height: 120px;
  overflow: hidden; cursor: pointer; animation: slidein .2s ease; }
@media (max-width: 560px) { .toasts { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; } }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok  { background: var(--ok); color: #fff; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

.empty { text-align: center; padding: 44px 20px; color: var(--text-faint); }
.empty svg { opacity: .4; margin-bottom: 12px; }
.empty p { margin: 0 0 4px; font-size: 14.5px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 40px; }

.mention-pop { position: fixed; background: var(--bg-panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 200; max-height: 220px; overflow-y: auto; min-width: 210px; }
.mention-pop div { padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.mention-pop div:hover, .mention-pop div.sel { background: var(--brand-soft); }

@media (max-width: 899px) { .mobile-only { display: inline-flex !important; } }
@media (min-width: 900px) { .mobile-only { display: none !important; } }

.scrim { position: fixed; inset: 0; background: rgba(8,12,18,.4); z-index: 55; }
@media (min-width: 900px) { .scrim { display: none; } }

/* Knopf für Handlungen ohne Rückweg */
.btn.gefahr { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn.gefahr:hover { background: var(--danger-soft); border-color: var(--danger); }

/* Laufendes Einlesen eines ganzen Postfachs */
.import-lauf { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 9px;
  padding: 9px 12px; border-radius: var(--radius); font-size: 13px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }

.composer-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.composer-hint b { color: var(--text-soft); font-family: var(--mono); }

/* Vorschläge beim Zusammenführen */
.mg-vorschlaege { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 9px; }
.mg-vorschlag { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer;
  background: var(--bg-sunken); transition: border-color .12s, background .12s; min-width: 0; }
.mg-vorschlag:hover { border-color: var(--line-strong); background: var(--bg-panel); }
.mg-vorschlag.an { border-color: var(--brand); background: var(--brand-soft); }
.mg-v-kopf { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.mg-v-betreff { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-v-zeile { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-v-grund { margin-top: 6px; font-size: 11.5px; color: var(--brand); font-weight: 600; }

/* Geplanter Versand */
.msg-plan { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 15px 12px;
  padding: 8px 11px; border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-soft);
  background: var(--bg-sunken); border: 1px dashed var(--line-strong); }
.plan-wahl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.plan-wahl .btn { flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 12px; height: auto; }
.plan-wahl .btn span { font-size: 11.5px; color: var(--text-faint); font-weight: 400; }

/* Vorlagen-Auswahl im Antwortfeld */
.mention-pop .tpl-eintrag { display: block; min-width: 0; flex: 1; }
.mention-pop .tpl-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.mention-pop .tpl-vorschau { font-size: 11.5px; color: var(--text-faint); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Verweise im Verlauf */
.feed-link { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.feed-link:hover { color: var(--brand-strong, var(--brand)); }

/* Übergreifende Suche */
.topbar-search { position: relative; }
.such-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 200; max-height: 68vh; overflow-y: auto;
  background: var(--bg-panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 5px 0; }
.such-gruppe { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-faint); padding: 9px 14px 4px; }
.such-treffer { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; }
.such-treffer svg { flex: none; color: var(--text-faint); }
.such-treffer:hover, .such-treffer.sel { background: var(--brand-soft); }
.such-kopf { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.such-zeile { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.such-treffer { align-items: flex-start; }
/* Fundstelle aus dem Feed: woher der Treffer stammt und der Satz drumherum */
.such-fund { display: flex; align-items: baseline; gap: 7px; margin-top: 3px; min-width: 0; }
.such-fund .fund-art { flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; padding: 1px 6px; border-radius: 999px;
  background: var(--chip-bg, rgba(125,125,135,.16)); color: var(--text-soft); }
.such-fund .fund-text { font-size: 12px; color: var(--text-soft); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.fund-eingang .fund-art { background: rgba(59,130,246,.16); color: #3b82f6; }
.fund-antwort .fund-art { background: rgba(16,185,129,.16); color: #10b981; }
.fund-notiz   .fund-art { background: rgba(245,158,11,.16); color: #d97706; }
.such-syn { padding: 7px 14px; font-size: 12px; color: var(--text-soft); background: var(--bg-sunken);
  border-bottom: 1px solid var(--line); }
.such-syn b { color: var(--text); font-weight: 600; }
.such-leer { padding: 16px 14px; font-size: 13.5px; color: var(--text-faint); }
.such-fuss { padding: 9px 14px; margin-top: 4px; border-top: 1px solid var(--line); cursor: pointer;
  font-size: 12.5px; color: var(--text-soft); display: flex; align-items: center; gap: 7px; }
.such-fuss:hover { background: var(--bg-sunken); }

/* Alter des Vorgangs im Hero — hebt sich vom übrigen Etikett ab */
.ticket-hero .badge .alter { color: var(--text); font-weight: 700; margin-left: 5px; }

/* Kleines Plus in der Überschrift statt eines Knopfes darunter — spart Höhe */
.side-block h4 .kopf-plus { margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg-panel);
  color: var(--text-soft); cursor: pointer; padding: 0; }
.side-block h4 .kopf-plus:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }

/* Firmenlogo im Kopfbereich und im Umschalter */
.brand .mark.mit-logo, .t-mark.mit-logo { background: #fff !important; padding: 2px; }
.brand .mark.mit-logo img, .t-mark.mit-logo img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 4px; }
.logo-vorschau { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; }
.logo-vorschau img { max-height: 56px; max-width: 240px; object-fit: contain; display: block; }

/* Ohne Zuständigen wird der Platzhalter-Avatar selbst zur Schaltfläche */
.avatar.avatar-zuweisen { background: var(--bg-sunken); color: var(--text-faint); border: 1px dashed var(--line-strong);
  cursor: pointer; display: grid; place-items: center; padding: 0; }
.avatar.avatar-zuweisen:hover { background: var(--brand); color: var(--brand-on); border-color: var(--brand); border-style: solid; }

/* Ticketliste: Betreff darf nicht alles schlucken, Zuständig und Kategorie bleiben sichtbar */
table.tickets .subj, table.tickets .beschr { max-width: 100%; }
/* Absender unter der Zusammenfassung — die Domain sticht hervor */
table.tickets .cust { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Zweizeilige Zusammenfassung in der Ticketliste */
table.tickets .beschr { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  white-space: normal; overflow: hidden; align-items: flex-start; line-height: 1.45; }
table.tickets .beschr svg { margin-top: 2px; }

/* Frühere Vorgänge als Karten in der Randspalte */
.vorgang-karte { display: block; width: 100%; text-align: left; cursor: pointer; margin-top: 7px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-sunken); }
.vorgang-karte:hover { border-color: var(--line-strong); background: var(--bg-panel); }
.vorgang-karte .kopf { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.vorgang-karte .nr { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.vorgang-karte .titel { font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
/* Worum es ging — drei Zeilen reichen für den Kern */
.vorgang-karte .fasst { font-size: 12px; color: var(--text-soft); line-height: 1.45; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vorgang-karte .zeile { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }

/* Kunde in der Randspalte: Name und Adresse führen direkt zum Kontakt */
.kunde-link { cursor: pointer; color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--line-strong); }
.kunde-link:hover { color: var(--brand); border-bottom-color: var(--brand); }

/* Kategorie in der Liste: eigene Farbe, Schrift automatisch lesbar */
table.tickets .badge.kat { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

/* Kontaktspalte: Name oben, Adresse darunter — Domain hervorgehoben */

.mail-lokal  { color: var(--text-faint); }
.mail-domain { color: var(--text); font-weight: 600; }

/* Mitarbeiterliste: passt in jeder Breite, Aktionen bleiben sichtbar */
table.data.mitarbeiter { table-layout: fixed; width: 100%; }
table.data.mitarbeiter th, table.data.mitarbeiter td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data.mitarbeiter th:nth-child(1) { width: 26%; }
table.data.mitarbeiter th:nth-child(2) { width: 15%; }   /* „Administrator" braucht Platz */
table.data.mitarbeiter th:nth-child(3) { width: 6%;  }
table.data.mitarbeiter th:nth-child(4) { width: 8%;  }
table.data.mitarbeiter th:nth-child(5) { width: 14%; }
table.data.mitarbeiter th:nth-child(6) { width: 14%; }   /* „ohne Zugang" in einer Zeile */
table.data.mitarbeiter th:nth-child(7) { width: 140px; }
table.data.mitarbeiter .col-tun { text-align: right; white-space: nowrap; overflow: visible;
  padding-left: 0; padding-right: 6px; }
table.data.mitarbeiter .col-tun .btn { padding: 5px 6px; }
/* Rolle und Status tragen Chips — die dürfen nicht beschnitten werden */
table.data.mitarbeiter td:nth-child(2), table.data.mitarbeiter td:nth-child(6) { overflow: visible; }
table.data.mitarbeiter .badge { display: inline-block; white-space: nowrap !important; max-width: none; }
@media (max-width: 1100px) { table.data.mitarbeiter .col-login { display: none; } }
@media (max-width: 860px)  { table.data.mitarbeiter .col-ueber { display: none; } }

/* Chips in Verwaltungslisten dürfen umbrechen statt abgeschnitten zu werden */
table.data:not(.ticketliste) td:first-child { white-space: normal; }
table.data:not(.ticketliste) .badge { white-space: normal; max-width: 100%; }

/* Gefüllte Chips für Kategorien und Schlagworte */
.badge.chip-farbig { font-weight: 650; }
.badge.chip-farbig button { opacity: .8; }
.badge.chip-farbig button:hover { opacity: 1; }

/* Aufgabenliste: feste Aufteilung, damit nichts überläuft */
table.aufgabenliste { table-layout: fixed; width: 100%; }
table.aufgabenliste th, table.aufgabenliste td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.data.aufgabenliste th:nth-child(1), table.data.aufgabenliste td:nth-child(1) { width: 42px; }
table.data.aufgabenliste th:nth-child(2), table.data.aufgabenliste td:nth-child(2) { width: auto; white-space: normal; }
table.aufgabenliste th:nth-child(3), table.aufgabenliste td:nth-child(3) { width: 13%; }
table.aufgabenliste th:nth-child(4), table.aufgabenliste td:nth-child(4) { width: 14%; }
table.aufgabenliste th:nth-child(5), table.aufgabenliste td:nth-child(5) { width: 15%; }
table.aufgabenliste th:nth-child(6), table.aufgabenliste td:nth-child(6) { width: 16%; }
table.aufgabenliste .subj { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.aufgabenliste .cust { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { table.aufgabenliste th:nth-child(5), table.aufgabenliste td:nth-child(5) { display: none; } }

/* Vorgangskarte im Kontakt-Feed — knapp gehalten, der Inhalt trägt sie */
.vorgang-feed { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-panel);
  padding: 9px 12px; cursor: pointer; transition: border-color .12s, background .12s; }
.vorgang-feed:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.vf-kopf { display: flex; align-items: center; gap: 7px; min-width: 0; }
.vf-kopf svg { flex: none; color: var(--text-faint); }
.vf-betreff { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vf-zeit { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.vf-text { font-size: 12.5px; color: var(--text-soft); line-height: 1.45; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vf-fuss { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 5px; font-size: 11.5px; color: var(--text-faint); }
.vf-nr { font-family: var(--mono); }

/* Hinweis auf eine Übersetzung unter der Nachricht */
.msg-uebersetzen { display: flex; align-items: center; gap: 8px; padding: 0 15px 11px;
  font-size: 12px; color: var(--text-faint); flex-wrap: wrap; }
.msg-uebersetzen svg { color: var(--ai); }

/* Vorschau vor dem Senden */
.pruef-text { white-space: pre-wrap; font-size: 14px; line-height: 1.55; padding: 11px 13px;
  background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--radius); max-height: 220px; overflow-y: auto; }
.pruef-text.final { border-color: color-mix(in srgb, var(--ai) 45%, transparent); background: var(--ai-soft); }
.pruef-liste { margin-top: 8px; font-size: 12.5px; color: var(--text-soft); display: grid; gap: 3px; }
.pruef-liste s { color: var(--text-faint); }

/* Kategorie-Filter mit Mehrfachauswahl */
.kat-filter { position: relative; }
.kat-knopf { text-align: left; cursor: pointer; max-width: 210px; overflow: hidden;
             text-overflow: ellipsis; white-space: nowrap; }
.kat-knopf.aktiv { border-color: var(--brand); color: var(--text); }
.kat-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 240px;
            max-height: 320px; overflow-y: auto; padding: 6px; border-radius: 10px;
            border: 1px solid var(--line-strong); background: var(--bg-panel);
            box-shadow: 0 14px 34px rgba(0,0,0,.35); }
.kat-zeile { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px;
             cursor: pointer; font-size: 13px; }
.kat-zeile:hover { background: var(--bg-hover); }
.kat-zeile input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }
.kat-zeile.alle { border-bottom: 1px solid var(--line); border-radius: 7px 7px 0 0; margin-bottom: 4px; }

/* Chips im Kopf einer Nachricht ("Antwort an Kunde", "gelesen", "ungelesen"):
   Auf der eingefärbten Kopffläche brauchen sie vollen Kontrast — im dunklen
   Modus also weiße Schrift, im hellen die dunkle Textfarbe. */
.msg-head .badge:not(.new):not(.open):not(.pending):not(.high):not(.urgent):not(.solved):not(.closed):not(.ai) {
  background: var(--bg-panel); color: var(--text); border: 1px solid var(--line);
}
.msg-head .badge.ok { background: var(--ok); color: #fff; border-color: transparent; }

/* Wer außer mir gerade im Vorgang ist — eigene Zeile über dem Titel */
.mitleser { display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin: 8px 0 2px; padding: 5px 10px; border-radius: 18px;
  background: var(--bg-sunken); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.mitleser > svg { color: var(--text-faint); flex: 0 0 auto; }
.mitleser-person { position: relative; display: inline-flex; }
.mitleser-person .avatar { box-shadow: 0 0 0 2px var(--bg-panel); }
.mitleser-person.tippt .avatar { box-shadow: 0 0 0 2px var(--ok); }
.mitleser-text { font-size: 12.5px; color: var(--text-soft); }
.mitleser-text b { color: var(--text); font-weight: 650; }
.mitleser .punkte { position: absolute; right: -3px; bottom: -3px; display: flex; gap: 1.5px;
  padding: 2px 3px; border-radius: 8px; background: var(--ok); }
.mitleser .punkte i { width: 3px; height: 3px; border-radius: 50%; background: #fff;
  animation: mitschreiben 1.1s infinite ease-in-out; }
.mitleser .punkte i:nth-child(2) { animation-delay: .18s; }
.mitleser .punkte i:nth-child(3) { animation-delay: .36s; }
@keyframes mitschreiben { 0%, 60%, 100% { opacity: .35 } 30% { opacity: 1 } }

/* Aufgaben in der Randspalte: gleiche Kartenform wie die früheren Vorgänge */
.aufgabe-karte { margin-top: 7px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-sunken); }
.aufgabe-karte:hover { border-color: var(--line-strong); background: var(--bg-panel); }
.aufgabe-karte.ueberfaellig { border-left: 3px solid var(--danger); }
.aufgabe-karte.erledigt { opacity: .62; }
.aufgabe-karte .kopf { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.aufgabe-karte .frist { font-size: 11.5px; color: var(--text-faint); display: inline-flex; align-items: center; gap: 3px; }
.aufgabe-karte .frist.faellig-rot { color: var(--danger); font-weight: 650; }
.aufgabe-karte .inhalt { cursor: pointer; min-width: 0; }
.aufgabe-karte .titel { font-size: 13px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aufgabe-karte.erledigt .titel { text-decoration: line-through; }
.aufgabe-karte .text { font-size: 12px; color: var(--text-soft); line-height: 1.45; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.aufgabe-karte .fuss { display: flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 11.5px; color: var(--text-soft); }
.aufgabe-karte .haken { flex: 0 0 auto; width: 17px; height: 17px; border-radius: 5px;
  border: 1.5px solid var(--line-strong); background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.aufgabe-karte .haken.an { background: var(--ok); border-color: var(--ok); }

/* Update-Banner — ganz oben im Seitenfluss, damit es nichts verdeckt
   und keine Lücke entsteht. Fährt beim Erscheinen aus. */
.update-banner { display: none; align-items: center; gap: 12px; padding: 0 16px;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  color: var(--brand-on); font-size: 14px; font-weight: 600;
  max-height: 0; overflow: hidden; transition: max-height .34s cubic-bezier(.4,.05,.2,1); }
.update-banner.on { display: flex; max-height: 80px;
  padding: calc(11px + env(safe-area-inset-top, 0px)) 16px 11px; }
.update-banner .ub-txt { flex: 1; min-width: 0; }
.update-banner .ub-btn { flex: none; cursor: pointer; font: inherit; font-weight: 700; font-size: 13px;
  padding: 7px 16px; border-radius: 9px;
  color: #fff; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.55); }
.update-banner .ub-btn:hover { background: rgba(255,255,255,.3); }
.update-banner .ub-btn:active { transform: scale(.96); }
@media (max-width: 700px) { .update-banner { font-size: 13px; } }

/* Reiter in der Wissensbasis */
.reiter { display: flex; gap: 4px; padding: 0 2px 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.reiter-knopf { padding: 8px 15px; border: 0; background: transparent; cursor: pointer; font: inherit;
  font-size: 14px; font-weight: 600; color: var(--text-soft); border-radius: 9px 9px 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -13px; }
.reiter-knopf:hover { color: var(--text); }
.reiter-knopf.aktiv { color: var(--brand); border-bottom-color: var(--brand); }

/* Eigenes Wissen: Karten, Anlagen, Textvorschau */
.kb-karte { cursor: pointer; }
.kb-karte:hover { border-color: var(--line-strong); }
.kb-antwort { color: var(--text-soft); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.kb-anlagen { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.kb-anlagen-kopf { display: flex; align-items: baseline; gap: 10px; font-weight: 650; font-size: 13px;
  margin-bottom: 9px; }
.kb-datei { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg-sunken); font-size: 13px; }
.kb-datei .name { color: var(--text); text-decoration: none; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.kb-datei .name:hover { color: var(--brand); text-decoration: underline; }
.kb-upload { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 14px;
  border: 1px dashed var(--line-strong); border-radius: 9px; cursor: pointer; font-size: 13px;
  color: var(--text-soft); }
.kb-upload:hover { border-color: var(--brand); color: var(--brand); }
.kb-textvorschau { max-height: 60vh; overflow: auto; white-space: pre-wrap; font-size: 13px;
  line-height: 1.55; color: var(--text-soft); background: var(--bg-sunken); padding: 14px;
  border-radius: 9px; border: 1px solid var(--line); }

/* ============================================================
   Telefonformat — Werkzeugleisten dürfen nicht aus dem Bild laufen
   ============================================================ */
@media (max-width: 700px) {
  /* Sortierung, Zuständige, Kategorien und Knöpfe brechen um statt zu verschwinden */
  .pane-head { flex-wrap: wrap; row-gap: 8px; }
  .pane-head > .select { flex: 1 1 calc(50% - 4px); width: auto !important; min-width: 0; }
  .pane-head > .kat-filter { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .pane-head > .kat-filter .kat-knopf { width: 100%; max-width: none; }
  .pane-head > .spacer { display: none; }
  .pane-head > .btn { flex: 1 1 100%; justify-content: center; }
  .pane-head > .hint { flex: 1 1 100%; order: 9; margin: 0; }
  .kat-menu { left: 0; right: 0; min-width: 0; }

  /* Kopfzeilen der Ansichten: Titel oben, Werkzeuge darunter */
  .view-head { flex-wrap: wrap; row-gap: 10px; }
  .view-head > .spacer { display: none; }
  .view-head .input, .view-head .select { flex: 1 1 calc(50% - 5px); width: auto !important; min-width: 0; }
  .view-head > .btn { flex: 1 1 100%; justify-content: center; }
  #kn-werkzeuge { flex: 1 1 100%; flex-wrap: wrap; }
  #kn-werkzeuge .input, #kn-werkzeuge .select { flex: 1 1 calc(50% - 5px); width: auto !important; }
  #kn-werkzeuge .btn { flex: 1 1 100%; justify-content: center; }

  /* Suchfeld in der Kopfleiste braucht Platz zum Tippen */
  .topbar-search { min-width: 0; }
}

/* Im Telefonformat entfallen Nebenspalten — die Zeile bleibt vollständig sichtbar */
@media (max-width: 700px) {
  .nur-breit { display: none !important; }
  table.data { font-size: 13px; }
  table.data th, table.data td { padding: 9px 8px; }
  table.data:not(.ticketliste) th:first-child,
  table.data:not(.ticketliste) td:first-child { white-space: normal; }
  .zeile-kurz { max-width: none !important; }
  /* Der Kopf eines Vorgangs bricht um, statt seitlich wegzulaufen */
  .hero-top { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
  /* Karten und Gitter bleiben einspaltig */
  .view .grid { grid-template-columns: minmax(0, 1fr) !important; }
}
.kb-datei.wartend { border-style: dashed; opacity: .85; }
.kb-datei.wartend .name { color: var(--text-soft); }

/* Einheitliche Werkzeugzeile: Suche, Filter, rechts das Anlegen */
.werkzeugzeile { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; flex-wrap: wrap; }
.werkzeugzeile .suchfeld { width: 260px; flex: 0 1 260px; }
.werkzeugzeile .select { width: auto; flex: 0 0 auto; }
@media (max-width: 700px) {
  .werkzeugzeile .suchfeld { flex: 1 1 100%; width: auto; }
  .werkzeugzeile .select { flex: 1 1 calc(50% - 5px); }
  .werkzeugzeile .spacer { display: none; }
  .werkzeugzeile .btn { flex: 1 1 100%; justify-content: center; }
}

/* Verwalter für die Wissens-Kategorien */
.kb-kat-zeile { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.kb-kat-zeile .input { flex: 1 1 auto; min-width: 0; }
.kb-kat-zeile .input.farbe { flex: 0 0 46px; width: 46px; padding: 3px; height: 34px; cursor: pointer; }
.field > label .kopf-plus { margin-left: 6px; vertical-align: middle; }

/* ============================================================
   KI-Chat — Seitenleiste rechts
   ============================================================ */
.such-ki { display: flex; align-items: center; gap: 10px; padding: 10px 13px; cursor: pointer;
  border-bottom: 1px solid var(--line); background: var(--brand-soft); color: var(--text); }
.such-ki:hover { background: var(--bg-hover); }
.such-ki svg { color: var(--brand); flex: 0 0 auto; }
.such-ki kbd { margin-left: auto; font-size: 11px; padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--line-strong); color: var(--text-faint); font-family: var(--mono); }

#ki-chat { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 300;
  display: flex; flex-direction: column; background: var(--bg-panel);
  border-left: 1px solid var(--line-strong); box-shadow: -18px 0 44px rgba(0,0,0,.32);
  transform: translateX(102%); transition: transform .26s cubic-bezier(.4,.05,.2,1); }
#ki-chat.offen { transform: translateX(0); }
.ki-kopf { display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  border-bottom: 1px solid var(--line); }
.ki-kopf > svg { color: var(--brand); }
.ki-kopf b { display: block; font-size: 14px; }
.ki-kopf span { font-size: 12px; color: var(--text-faint); }
.ki-verlauf { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex;
  flex-direction: column; gap: 12px; }
.ki-nachricht { max-width: 92%; padding: 10px 13px; border-radius: 13px; font-size: 14px; line-height: 1.55; }
.ki-nachricht.ich { align-self: flex-end; background: var(--brand); color: var(--brand-on);
  border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ki-nachricht.ki { align-self: flex-start; background: var(--bg-sunken); border: 1px solid var(--line);
  border-bottom-left-radius: 4px; }
.ki-nachricht.ki p { margin: 0 0 9px; } .ki-nachricht.ki p:last-child { margin-bottom: 0; }
.ki-nachricht.ki ul { margin: 0 0 9px; padding-left: 19px; }
.ki-nachricht.ki li { margin-bottom: 3px; }
.ki-nachricht.denkt { color: var(--text-faint); display: flex; align-items: center; gap: 8px; }
.ki-nachricht.fehler { border-color: var(--danger); color: var(--danger); }
.ki-vorgang { color: var(--brand); cursor: pointer; font-family: var(--mono); font-size: 13px; }
.ki-vorgang:hover { text-decoration: underline; }
.ki-quellen { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-faint); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ki-leer { margin: auto; text-align: center; color: var(--text-faint); display: flex;
  flex-direction: column; align-items: center; gap: 9px; }
.ki-leer p { margin: 0 0 4px; font-size: 13.5px; }
.ki-vorschlag { padding: 8px 13px; border-radius: 18px; border: 1px solid var(--line-strong);
  background: var(--bg-sunken); color: var(--text-soft); font: inherit; font-size: 13px;
  cursor: pointer; text-align: left; }
.ki-vorschlag:hover { border-color: var(--brand); color: var(--text); }
.ki-fuss { display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px;
  border-top: 1px solid var(--line); }
.ki-fuss textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; line-height: 1.5; }
/* Frühere Unterhaltungen — eigene Ansicht im Panel */
.ki-fruehere { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 16px; }
.ki-gruppe { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); margin: 14px 2px 7px; }
.ki-gruppe:first-child { margin-top: 2px; }
.ki-liste-zeile { display: flex; align-items: center; gap: 8px; padding: 10px 11px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px; background: var(--bg-sunken); }
.ki-liste-zeile:hover { border-color: var(--brand); background: var(--bg-hover); }
.ki-liste-zeile .inhalt { flex: 1; min-width: 0; }
.ki-liste-zeile .titel { font-weight: 600; font-size: 13.5px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ki-liste-zeile .unten { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.ki-liste-zeile .loeschen { flex: 0 0 auto; opacity: 0; color: var(--text-faint); }
.ki-liste-zeile:hover .loeschen { opacity: 1; }
.ki-liste-zeile .loeschen:hover { color: var(--danger); }
.ki-titel { min-width: 0; }
.ki-titel b, .ki-titel span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { #ki-chat { width: 100vw; } }

/* Zugang zur Assistenz in der Kopfzeile */
.topbar .ki-knopf { color: var(--brand); flex: 0 0 auto; }
.topbar .ki-knopf:hover { background: var(--brand-soft); }

/* Anhänge im Editor */
.anhang-leiste { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 15px 0; }
.anhang-leiste[hidden] { display: none; }
.anhang { display: flex; align-items: center; gap: 7px; max-width: 260px; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-sunken); font-size: 12.5px; }
.anhang.laeuft { opacity: .7; }
.anhang img { width: 26px; height: 26px; object-fit: cover; border-radius: 5px; flex: 0 0 auto; }
.anhang .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anhang .groesse { color: var(--text-faint); flex: 0 0 auto; }
.anhang .weg { border: 0; background: transparent; color: var(--text-faint); cursor: pointer;
  padding: 2px; display: inline-flex; }
.anhang .weg:hover { color: var(--danger); }
.anhang-knopf { flex: 0 0 auto; cursor: pointer; padding: 6px 9px; }
.composer.faellt { outline: 2px dashed var(--brand); outline-offset: -6px; }

/* Anhänge im Verlauf */
.att-bild { display: inline-flex; flex-direction: column; gap: 4px; text-decoration: none;
  max-width: 180px; color: var(--text-faint); font-size: 11.5px; }
.att-bild img { width: 100%; max-height: 140px; object-fit: cover; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-sunken); }
.att-bild:hover img { border-color: var(--brand); }
.att-bild span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hinweis auf neu eingegangene Vorgänge in der Liste */
.eingangsleiste { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 20;
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border: 0; cursor: pointer;
  border-radius: 20px; background: var(--brand); color: var(--brand-on); font: inherit;
  font-size: 13px; font-weight: 600; box-shadow: 0 8px 22px rgba(0,0,0,.3); }
.eingangsleiste:hover { background: var(--brand-dark); }
.workspace { position: relative; }

/* Auswahlfeld mit Suche */
.suchwahl { position: relative; }
.suchwahl select.versteckt { display: none; }
.suchwahl-knopf { width: 100%; text-align: left; cursor: pointer; background-image: none;
  padding-right: 30px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suchwahl-knopf::after { content: ''; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px;
  margin-top: -5px; border-right: 1.6px solid var(--text-soft); border-bottom: 1.6px solid var(--text-soft);
  transform: rotate(45deg); pointer-events: none; }
.suchwahl-knopf.leer { color: var(--text-faint); }
.suchwahl-knopf:disabled { opacity: .6; cursor: default; }
.suchwahl-menu { position: absolute; left: 0; right: 0; top: calc(100% + 5px); z-index: 3100;
  padding: 7px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg-panel);
  box-shadow: 0 14px 34px rgba(0,0,0,.35); }
.suchwahl-menu.nach-oben { top: auto; bottom: calc(100% + 5px); }
.suchwahl-feld { width: 100%; height: 32px; font-size: 13px; margin-bottom: 6px; }
.suchwahl-liste { max-height: 240px; overflow-y: auto; }
.suchwahl-zeile { padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suchwahl-zeile:hover, .suchwahl-zeile.markiert { background: var(--bg-hover); }
.suchwahl-zeile.gewaehlt { color: var(--brand); font-weight: 600; }
.suchwahl-leer { padding: 9px; font-size: 13px; color: var(--text-faint); }

/* Kontaktzuweisung in der Aufgabe */
.kontaktwahl { position: relative; }
.kontaktwahl .kontakt-weg { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--text-faint); cursor: pointer; padding: 4px;
  display: inline-flex; }
.kontaktwahl .kontakt-weg:hover { color: var(--danger); }
.kontakt-vorschlaege { position: absolute; left: 0; right: 0; top: calc(100% + 5px); z-index: 70;
  max-height: 260px; overflow-y: auto; padding: 6px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--bg-panel); box-shadow: 0 14px 34px rgba(0,0,0,.35); }
.kontakt-zeile { padding: 8px 9px; border-radius: 7px; cursor: pointer; }
.kontakt-zeile:hover { background: var(--bg-hover); }
.kontakt-zeile b { display: block; font-size: 13.5px; }
.kontakt-zeile span { font-size: 12px; color: var(--text-faint); }
.kontakt-leer { padding: 9px; font-size: 13px; color: var(--text-faint); }
.kontakt-zeile .art { font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-faint); margin-left: 6px; }

/* ============================================================
   Zeiterfassung
   ============================================================ */
/* Stoppuhr in der Kopfleiste: Start — oder Anzeige mit Pause und Beenden */
.zeit-leiste { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.zeit-leiste.an { gap: 4px; padding: 3px 4px 3px 3px; border-radius: 20px;
  border: 1px solid var(--line-strong); background: var(--bg-sunken); }
.zeit-leiste.an.laeuft   { border-color: var(--ok); }
.zeit-leiste.an.pausiert { border-color: var(--warn); }
.zeit-leiste .icon-btn { width: 32px; height: 32px; }
.zeit-leiste .btn { height: 34px; padding: 0 13px; gap: 7px; font-weight: 600; }

/* Startknopf: in Betriebsfarbe, mit Beschriftung am Schreibtisch */
.zeit-leiste .zeit-start { background: var(--ok); border-color: var(--ok); color: #fff; }
.zeit-leiste .zeit-start:hover { filter: brightness(1.08); }
.zeit-leiste .zeit-weiter { background: var(--ok); border-color: var(--ok); color: #fff; }
.zeit-leiste .zeit-pause  { background: var(--warn); border-color: var(--warn); color: #fff; }
.zeit-leiste .zeit-stop   { background: var(--danger); border-color: var(--danger); color: #fff; }
.zeit-leiste .zeit-mehr   { color: var(--text-faint); }
.nur-desktop { display: inline; }
@media (max-width: 980px) { .nur-desktop { display: none; }
  .zeit-leiste .btn { padding: 0 10px; } }

.zeit-anzeige-knopf { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px;
  border: 0; border-radius: 16px; background: transparent; color: var(--text); cursor: pointer; font: inherit; }
.zeit-anzeige-knopf:hover { background: var(--bg-hover); }
.zeit-anzeige-knopf .wert { font-family: var(--mono); font-size: 14.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.zeit-anzeige-knopf .punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.zeit-leiste.laeuft .zeit-anzeige-knopf .punkt { animation: zeit-puls 1.6s infinite; }
.zeit-leiste.pausiert .zeit-anzeige-knopf .punkt { background: var(--warn); }
@keyframes zeit-puls { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
@media (max-width: 700px) { .zeit-leiste .zeit-mehr { display: none; } }

#zeit-panel { position: fixed; z-index: 300; width: min(360px, calc(100vw - 20px));
  padding: 14px; border-radius: 14px; background: var(--bg-panel);
  border: 1px solid var(--line-strong); box-shadow: 0 18px 44px rgba(0,0,0,.4); }
.zeit-kopf { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.zeit-kopf > svg { color: var(--brand); }
.zeit-anzeige { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px; margin-bottom: 12px;
  border-radius: 10px; background: var(--bg-sunken); border: 1px solid var(--line); }
.zeit-anzeige span:first-child { font-family: var(--mono); font-size: 26px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ok); }
.zeit-anzeige.pausiert span:first-child { color: var(--warn); }
.zeit-anzeige .zustand { font-size: 12px; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 600; }
.zeit-knoepfe { display: flex; gap: 8px; margin-top: 14px; }
.zeit-knoepfe .btn { flex: 1; justify-content: center; }

.zeit-balken { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 13px; }
.zeit-balken .balken { flex: 1; height: 8px; border-radius: 4px; background: var(--bg-sunken); overflow: hidden; }
.zeit-balken .balken > div { height: 100%; border-radius: 4px; }
.zeit-balken .dauer { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums;
  flex: 0 0 auto; }
.zeit-balken .geld { flex: 0 0 88px; text-align: right; color: var(--text-soft);
  font-variant-numeric: tabular-nums; }
.kz-label { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em;
  font-weight: 600; margin-bottom: 6px; }
.kz-wert { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Betreff im Vorgang: Der Text darf umbrechen, der Stift bleibt daneben stehen */
.ticket-hero h2.betreff { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.ticket-hero h2.betreff .text { flex: 1 1 auto; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-hero .betreff-aendern { flex: 0 0 auto; margin-top: 2px; opacity: .45; }
.ticket-hero h2.betreff:hover .betreff-aendern, .ticket-hero .betreff-aendern:focus { opacity: 1; }
.tag-wolke { display: flex; flex-wrap: wrap; gap: 6px; }
.badge.chip-farbig button { border: 0; background: transparent; color: inherit; cursor: pointer;
  padding: 0 0 0 3px; font-size: 13px; line-height: 1; opacity: .75; }
.badge.chip-farbig button:hover { opacity: 1; }
/* Schlagwortspalte in den Kontaktlisten */
.tag-spalte { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
table.data td .tag-spalte .badge { white-space: nowrap; }

/* Kontaktarten: Farbwähler in den Einstellungen */
.art-farbe { display: flex; align-items: center; gap: 7px; }
.art-farbe input[type="color"] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); cursor: pointer; }
.badge.art-chip { border: 1px solid transparent; font-weight: 600; }

/* Der Weg zurück ist überall gleich gekennzeichnet — in der Sekundärfarbe */
.zurueck-knopf { background: var(--akzent-soft); border-color: transparent; color: var(--akzent);
  font-weight: 600; }
.zurueck-knopf:hover { background: var(--akzent); color: var(--akzent-on); border-color: transparent; }
.zurueck-knopf svg { color: currentColor; }

/* ---------- Kopfzeile auf dem Telefon ----------
   Beim Scrollen rückt der Kopf zusammen, damit mehr Inhalt sichtbar bleibt.
   Das Überscrollen bleibt im jeweiligen Bereich — sonst zieht Safari
   die ganze Seite mit und der Kopf verschwindet. */
.view, .tt-wrap, .ticket-view, .pane-body, .main, .feed, .chat-verlauf { overscroll-behavior: contain; }

@media (max-width: 899px) {
  .topbar { transition: padding .18s ease; }
  .topbar .brand .mark, .topbar .icon-btn, .topbar-search .input,
  .topbar .zeit-knopf, .topbar .zeit-leiste .btn { transition: all .18s ease; }

  body.kopf-klein { --header-h: 46px; }
  body.kopf-klein .topbar .brand .mark { width: 24px; height: 24px; border-radius: 7px; font-size: 12px; }
  body.kopf-klein .topbar .icon-btn { width: 32px; height: 32px; }
  body.kopf-klein .topbar-search .input { height: 32px; padding-top: 0; padding-bottom: 0; }
  body.kopf-klein .topbar-search > svg { width: 13px; height: 13px; }
  body.kopf-klein .topbar .zeit-leiste .btn { height: 32px; padding: 0 10px; }
}

/* Schmaler Hinweis über dem Antwortfeld, wenn der Text von der KI stammt */
.ki-hinweis { display: flex; align-items: center; gap: 6px; margin: 0 0 6px;
  font-size: 12px; font-weight: 600; color: var(--ai, #2563eb); }
.ki-hinweis .spacer { flex: 1; }
.ki-hinweis .btn { padding: 2px 6px; height: auto; min-height: 0; }
.ki-hinweis svg { flex: none; }

/* Gewählter Zeitvorschlag im Planungsdialog */
.plan-wahl .btn.an { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
/* KI-Knopf direkt neben den Reitern des Editors */
/* Der KI-Knopf steht neben den Reitern und ist etwas kleiner als die in der Kopfzeile */
.composer-tabs .ki-knopf { color: var(--akzent); flex: 0 0 auto; width: 32px; height: 32px;
  border-radius: 9px; margin-bottom: 5px; }
.composer-tabs .ki-knopf:hover { background: var(--akzent-soft); color: var(--akzent); }
.composer-tabs .ki-knopf svg { width: 19px; height: 19px; }

/* Rückmeldung beim Sichern einer Leistung */
.kat-stand { font-size: 11.5px; color: var(--ok); min-width: 58px; text-align: right; }

/* Hinweis auf eine eingeplante Antwort in der Statusspalte */
.badge.geplant { background: var(--akzent-soft); color: var(--akzent); border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; }
.badge.geplant svg { flex: none; }

.geplant-pfeil { color: var(--text-faint); font-size: 11px; margin: 0 2px; }

/* Fehlt einem Ansprechpartner der Kunde, steht der Hinweis gelb ganz oben */
.side-block.hinweis-gelb { background: var(--warn-soft, rgba(217,119,6,.12));
  border-left: 3px solid var(--warn); }
.side-block.hinweis-gelb h4 { color: var(--warn); display: flex; align-items: center; gap: 5px; }
.side-block.hinweis-gelb svg { flex: none; }

/* ============================================================
   Einführung — Scheinwerfer und Sprechblase
   Der Schatten ist ein einziges Element mit riesigem Rahmenschatten:
   innen bleibt das Bedienelement hell, außen legt sich der Rest zurück.
   ============================================================ */
/* Die Führung liegt über allem — auch über Dialogen und Trefferfenstern */
.tour { position: fixed; inset: 0; z-index: 3000; pointer-events: none; }
.tour-schatten { position: fixed; border-radius: 12px; pointer-events: auto; cursor: pointer; z-index: 1;
  box-shadow: 0 0 0 9999px rgba(6, 10, 18, .62); transition: all .22s cubic-bezier(.4,0,.2,1); }
/* Der Rahmen um das Ziel darf keinen eigenen Stapelkontext aufmachen, sonst
   läge das Bedienelement plötzlich über der Sprechblase. Deshalb outline. */
.tour-ziel { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }

.tour-blase { position: fixed; z-index: 2; pointer-events: auto; width: min(360px, calc(100vw - 24px));
  background: var(--bg-panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 13px 14px 11px; transition: top .22s ease, left .22s ease; }
.tour-kopf { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tour-titel { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--brand); }
.tour-kopf .icon-btn { width: 28px; height: 28px; }
.tour-text { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.tour-fuss { display: flex; align-items: center; gap: 7px; margin-top: 12px; }
.tour-punkte { display: flex; gap: 5px; }
.tour-punkte span { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.tour-punkte span.an { background: var(--brand); width: 16px; border-radius: 3px; }
.tour-blase .btn[disabled] { opacity: .45; }

/* Kleiner Zeiger zum Bedienelement */
.tour-blase::before { content: ''; position: absolute; width: 10px; height: 10px;
  background: var(--bg-panel); border: 1px solid var(--line-strong); transform: rotate(45deg); }
.tour-blase.pfeil-unten::before  { top: -6px; left: 22px; border-right: none; border-bottom: none; }
.tour-blase.pfeil-oben::before   { bottom: -6px; left: 22px; border-left: none; border-top: none; }
.tour-blase.pfeil-rechts::before { left: -6px; top: 20px; border-right: none; border-top: none; }
.tour-blase.pfeil-links::before  { right: -6px; top: 20px; border-left: none; border-bottom: none; }

/* Auf dem Telefon sitzt die Blase fest am unteren Rand */
.tour-blase.unten-fix { left: 50% !important; top: auto !important; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 699px) {
  .tour-blase.unten-fix { left: 12px !important; right: 12px; transform: none; width: auto; }
}
.tour-blase.unten-fix::before { display: none; }

/* Schnellknöpfe, um den Beginn einer laufenden Zeit vorzuverlegen */
.zeit-rueck { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.zeit-rueck .btn { padding: 3px 9px; font-size: 12px; }

/* Stift neben dem Kunden im Vorgangskopf */
.hero-zeile .hero-stift { padding: 2px 6px; margin-left: -4px; color: var(--text-faint); }
.hero-zeile .hero-stift:hover { color: var(--text); background: var(--bg-hover); }

/* Suche über die Vorgänge in der Kontakt-Randleiste */
.side-block .vorgang-suche { width: 100%; height: 32px; font-size: 13px; margin-bottom: 8px; }
/* Schlagworte im Stammdaten-Raster */
.stamm-feld .tag-feld { display: flex; flex-wrap: wrap; gap: 5px; }
.stamm-feld .tag-feld .badge { font-size: 11.5px; }

.stamm-feld .tag-feld .tag-plus { padding: 1px 5px; color: var(--text-faint); }
.stamm-feld .tag-feld .tag-plus:hover { color: var(--text); background: var(--bg-hover); }

/* ============================================================
   Schichtplanung
   ============================================================ */
table.data.schichtplan td { vertical-align: top; }
table.data.schichtplan tr.wochenende td { background: color-mix(in srgb, var(--bg-sunken) 60%, transparent); }
table.data.schichtplan tr.heute td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.schicht-zelle.gewaehlt { box-shadow: inset 0 0 0 2px var(--brand); border-radius: 8px; }
.schicht-koepfe { display: flex; flex-wrap: wrap; gap: 6px; }

.ma-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px;
  border-radius: 999px; background: var(--bg-sunken); border: 1px solid var(--line);
  font-size: 12.5px; max-width: 100%; }
.ma-chip .nam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-chip button { border: 0; background: transparent; color: var(--text-faint); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 2px; }
.ma-chip button:hover { color: var(--danger); }
.ma-chip.warn { border-color: var(--warn); color: var(--warn); }
.ma-chip.warn svg { color: var(--warn); }
.ma-chip.tausch { border-style: dashed; }
.ma-chip.offen { border-style: dashed; color: var(--text-faint); cursor: pointer; padding: 4px 10px; }
.ma-chip.offen:hover { border-color: var(--brand); color: var(--brand); }

.schicht-zelle .bedarf { display: flex; align-items: center; gap: 6px; margin-top: 7px;
  font-size: 12px; color: var(--text-faint); }
.schicht-zelle .bedarf button { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line);
  background: transparent; color: var(--text-soft); cursor: pointer; line-height: 1; }
.schicht-zelle .bedarf button:hover { background: var(--bg-hover); color: var(--text); }

.zuteil-leiste .kandidaten { display: flex; flex-wrap: wrap; gap: 8px; }
.kandidat { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px 6px 6px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg-panel); cursor: pointer; }
.kandidat:hover { border-color: var(--brand); }
.kandidat .lage { font-size: 11.5px; color: var(--text-faint); }
.kandidat.frei { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.kandidat.frei .lage { color: var(--ok); }
.kandidat.dop .lage { color: var(--warn); }
.kandidat.abw { opacity: .65; }
.kandidat.abw .lage { color: var(--danger); }

/* ---------- Mobil: Kopfbereich der Listen beim Scrollen einklappen ----------
   Filterchips rücken in eine wischbare Zeile, die Werkzeugzeile tritt zurück.
   Beim Hochscrollen kommt alles wieder. */
@media (max-width: 899px) {
  .workspace .filters, .view .filters,
  .pane-head, .werkzeugzeile { transition: max-height .2s ease, opacity .18s ease, padding .2s ease, margin .2s ease; }

  body.kopf-klein .workspace .filters,
  body.kopf-klein .view .filters {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-top: 6px; padding-bottom: 6px; gap: 6px;
  }
  body.kopf-klein .workspace .filters::-webkit-scrollbar,
  body.kopf-klein .view .filters::-webkit-scrollbar { display: none; }
  body.kopf-klein .workspace .filters .chip,
  body.kopf-klein .view .filters .chip { flex: none; padding: 5px 10px; font-size: 12.5px; }

  body.kopf-klein .pane-head,
  body.kopf-klein .werkzeugzeile {
    max-height: 0; opacity: 0; overflow: hidden;
    padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; border: 0;
  }
}

/* Statusfilter tragen die Farbe ihres Status */
.chip.chip-status { border-color: color-mix(in srgb, var(--chipfarbe) 45%, transparent); }
.chip.chip-status:hover { border-color: var(--chipfarbe); }
.chip.chip-status.active { background: var(--chipfarbe); border-color: var(--chipfarbe);
  color: #fff; }
.chip.chip-status.active .n { background: rgba(255,255,255,.22); color: #fff; }

/* ---------- Suche auf dem Telefon ----------
   In der Kopfzeile steht nur die Lupe; ein Tipp darauf klappt das Feld
   über die volle Breite auf. So bleibt Platz für Zeit, Glocke und Profil. */
@media (max-width: 700px) {
  .topbar-search { flex: 0 0 42px; max-width: 42px; transition: max-width .2s ease, flex-basis .2s ease; }
  .topbar-search .input { padding-left: 34px; padding-right: 0; color: transparent; cursor: pointer; }
  .topbar-search .input::placeholder { color: transparent; }

  .topbar-search.offen { position: absolute; left: 8px; right: 8px; top: 50%; transform: translateY(-50%);
    flex: 1 1 auto; max-width: none; z-index: 210; }
  .topbar-search.offen .input { color: var(--text); cursor: text; padding-right: 34px; background: var(--bg-panel);
    border-color: var(--line-strong); }
  .topbar-search.offen .input::placeholder { color: var(--text-faint); }
  .topbar-search.offen .such-pop { left: 0; right: 0; }
  .topbar-search .such-zu { position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; z-index: 2; }
}

/* Verweise in der Randspalte eines Vorgangs */
.verweise { display: flex; flex-direction: column; gap: 6px; }
.verweis { display: flex; align-items: center; gap: 6px; }
.verweis a { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1;
  font-size: 13px; color: var(--text); padding: 5px 8px; border-radius: 8px; background: var(--bg-sunken); }
.verweis a:hover { background: var(--bg-hover); color: var(--brand); }
.verweis a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verweis a svg { flex: none; color: var(--text-faint); }
.verweis > button { border: 0; background: transparent; color: var(--text-faint); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px 4px; }
.verweis > button:hover { color: var(--danger); }

/* Linear: Kommentarverlauf im Bearbeiten-Dialog */
.lin-verlauf { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-sunken); }
.lin-kommentar .kopf { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; font-weight: 600; }
.lin-kommentar .text { font-size: 13px; color: var(--text-soft); white-space: pre-wrap; margin-top: 2px; }

/* Linear: Filter und Werkzeuge bleiben beim Scrollen stehen */
/* Der Kopf klebt bündig am oberen Rand: Der Innenabstand der Ansicht wird
   ausgeglichen, sonst scrollt die Liste in der Lücke darüber vorbei. */
.lin-kopf { position: sticky; top: -18px; z-index: 30; background: var(--bg);
  padding: 18px 18px 0; margin: -18px -18px 0; box-shadow: 0 10px 14px -12px rgba(0,0,0,.55); }
.lin-kopf .werkzeugzeile { margin-bottom: 12px; }
@media (min-width: 900px) {
  .lin-kopf { top: -22px; padding: 22px 24px 0; margin: -22px -24px 0; }
}

/* Bilder aus einer Linear-Beschreibung */
.lin-bilder { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lin-bilder img { max-height: 120px; max-width: 220px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-sunken); display: block; }
.lin-bilder a:hover img { border-color: var(--brand); }

/* ---------- Verweise zwischen Vorgang und Linear ---------- */
.verweis-linear a { color: var(--brand); }

/* Trefferliste beim Verknüpfen — kurz gehalten, damit der Dialog handlich bleibt */
.liste-schmal { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  margin-top: 2px; }
.wahl-zeile { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-sunken); color: var(--text);
  font-size: 13.5px; cursor: pointer; }
.wahl-zeile:hover { background: var(--bg-hover); }
.wahl-zeile.an { border-color: var(--brand); background: var(--bg-hover); }
.wahl-zeile b { margin-right: 6px; }
.wahl-zeile .hint { display: block; margin: 2px 0 0; }

/* Bezug der laufenden Zeiterfassung — Vorgang, Stift, Kreuz in einer Zeile */
.zeit-bezug { display: flex; align-items: center; gap: 4px; }
.zeit-bezug a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-soft); font-size: 13px; text-decoration: none; }
.zeit-bezug a:hover { color: var(--brand); }
.zeit-bezug .icon-btn { flex: none; }

/* Sprünge in der Zeitleiste: zwei Pfeile in der Punktespalte, oben und unten
   im Sichtbereich klebend — sie nehmen keinen Platz im Verlauf weg. */
.feed-sprung { position: sticky; height: 0; z-index: 4; }
.feed-sprung.oben  { top: 6px; }
.feed-sprung.unten { bottom: 6px; }
.feed-sprung button { position: absolute; left: -32px; width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--bg-panel); color: var(--text-soft);
  box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.feed-sprung.unten button { bottom: 0; }
.feed-sprung button:hover:not(:disabled) { background: var(--brand); border-color: var(--brand);
  color: var(--brand-on); }
.feed-sprung button:disabled { opacity: .3; cursor: default; }
@media (max-width: 899px) { .feed-sprung button { left: -28px; } }

/* Reiterleiste im Stil der iOS-Segmentsteuerung: eine Kapsel aus mattem Glas,
   in der eine hellere Kapsel unter das gewählte Segment gleitet. */
.segmente { position: relative; display: inline-flex; max-width: 100%; overflow-x: auto;
  margin-bottom: 16px; padding: 3px; border-radius: 999px; scrollbar-width: none;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 7%, transparent);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); }
.segmente::-webkit-scrollbar { display: none; }

.segmente button { position: relative; z-index: 1; flex: none; padding: 7px 17px; border: none;
  background: none; border-radius: 999px; color: var(--text-soft); cursor: pointer;
  font-size: 14px; font-weight: 570; white-space: nowrap; letter-spacing: .005em;
  transition: color .25s ease; -webkit-tap-highlight-color: transparent; }
.segmente button:hover:not(.active) { color: var(--text); }
.segmente button.active { color: var(--text); font-weight: 640; }
/* Beim Tippen kurz nachgeben — dieselbe kleine Rückmeldung wie unter iOS */
.segmente button:active { transform: scale(.96); }

.seg-indikator { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; z-index: 0;
  border-radius: 999px; background: var(--bg-panel); pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.16), 0 0 0 .5px color-mix(in srgb, var(--text) 6%, transparent);
  transition: transform .34s cubic-bezier(.32,.72,0,1), width .34s cubic-bezier(.32,.72,0,1); }
/* Der erste Aufbau springt nicht — er steht einfach da */
.segmente.ohne-lauf .seg-indikator { transition: none; }

:root:not([data-theme="light"]) .seg-indikator { background: color-mix(in srgb, #fff 13%, var(--bg-panel)); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .seg-indikator { background: #fff; }
}

@media (prefers-reduced-motion: reduce) { .seg-indikator { transition: none; } }
@media (max-width: 899px) { .segmente { display: flex; width: 100%; } .segmente button { flex: 1; padding: 7px 10px; } }

/* Postfächer stehen nebeneinander, sobald der Platz reicht. */
.postfach-liste { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.postfach-liste .postfach { margin-bottom: 0; }
/* Karten, die für zwei Spalten zu breit sind */
.card.breit { grid-column: 1 / -1; }

/* Zeilen, die sich als Ganzes öffnen lassen */
tr.klickbar { cursor: pointer; }
tr.klickbar:hover > td { background: var(--bg-hover); }

/* In der ##-Auswahl: woher ein Eintrag stammt */
.tpl-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tpl-quelle { background: color-mix(in srgb, var(--ai) 22%, transparent); color: var(--ai);
  border-color: transparent; }

/* ---------- Öffentliche Startseite des Support-Portals ----------
   Sie gehört zur Kundschaft, nicht zum Admin-Portal: dieselben Farben und
   dieselbe helle Anmutung wie das Kundenportal, unabhängig vom Dunkelmodus. */
.start-wrap {
  --marke: #0d7d8c; --marke-auf: #fff; --akzent: #f59e0b;
  --grund: #f4f6f9; --karte: #fff; --linie: #e2e8f0; --linie-stark: #cbd5e1;
  --p-text: #1f2933; --p-weich: #52606d; --p-blass: #7b8794;
  min-height: 100dvh; background: var(--grund); color: var(--p-text);
  font: 15px/1.55 var(--font);
}

.start-kopf { display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  background: var(--marke); color: var(--marke-auf); position: sticky; top: 0; z-index: 5; }
.start-kopf .spacer { flex: 1; }
.start-marke { display: flex; align-items: center; gap: 12px; }
.start-marke img { max-height: 36px; max-width: 190px; background: #fff; border-radius: 7px; padding: 4px; }
.start-marke .mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.18); color: #fff; font-weight: 800; font-size: 16px; }
.start-marke b { display: block; font-size: 16px; line-height: 1.2; }
.start-marke span { font-size: 12.5px; opacity: .85; }

/* Knöpfe: gefüllt in der Marke, hell im Kopf, leise für Nebensächliches */
.start-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 600; background: var(--marke); color: var(--marke-auf);
  text-decoration: none; }
.start-btn:hover { filter: brightness(1.08); }
.start-btn.hell { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.5); color: #fff; }
.start-btn.leise { background: var(--karte); color: var(--p-text); border-color: var(--linie-stark); font-weight: 550; }
.start-btn.voll { width: 100%; margin-top: 4px; }
.start-btn:disabled { opacity: .6; cursor: default; }

.start-inhalt { max-width: 1000px; margin: 0 auto; padding: 38px 20px 60px; }
.start-hero h1 { font-size: 28px; margin: 0 0 10px; letter-spacing: -.01em; }
.start-hero p { color: var(--p-weich); max-width: 64ch; margin: 0; }

.start-karten { display: grid; gap: 16px; margin-top: 28px;
  grid-template-columns: minmax(280px, 360px) minmax(320px, 1fr); align-items: start; }
.start-karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 12px;
  padding: 20px 22px; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.start-karte h2 { font-size: 18px; margin: 0 0 8px; }
.start-karte > p { color: var(--p-weich); font-size: 14px; margin: 0 0 16px; }

/* Zwei Spalten für Name und Erreichbarkeit, volle Breite für Betreff und Text */
.start-zeile { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.start-feld { margin-bottom: 12px; }
.start-feld label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--p-text); }
.start-feld input, .start-feld textarea { width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--linie-stark); background: #fff; color: var(--p-text); font: inherit; }
.start-feld textarea { resize: vertical; min-height: 120px; }
.start-feld input:focus, .start-feld textarea:focus { outline: 2px solid color-mix(in srgb, var(--marke) 45%, transparent);
  outline-offset: 1px; border-color: var(--marke); }

.start-anlagen { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.start-anlage { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--p-weich);
  border: 1px solid var(--linie); border-radius: 8px; padding: 7px 10px; background: var(--grund); }
.start-anlage .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.start-anlage button { border: none; background: none; cursor: pointer; color: var(--p-blass);
  font-size: 16px; line-height: 1; padding: 0 2px; }
.start-anlage button:hover { color: #b42318; }
.start-anlage.laeuft { opacity: .6; }

.start-hint { color: var(--p-blass); font-size: 13px; margin-top: 8px; }
.start-fehler { color: #b42318; font-size: 13.5px; margin: 4px 0 10px; }
.start-falle { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.start-danke { border: 1px solid color-mix(in srgb, var(--akzent) 40%, var(--linie)); border-radius: 10px;
  padding: 16px 18px; background: color-mix(in srgb, var(--akzent) 10%, #fff); }
.start-danke p { color: var(--p-weich); font-size: 14px; margin: 6px 0 0; }
.start-fuss { margin-top: 32px; color: var(--p-blass); font-size: 13px; text-align: center; }

@media (max-width: 820px) {
  .start-karten { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 560px) {
  .start-inhalt { padding: 24px 16px 48px; }
  .start-hero h1 { font-size: 23px; }
  .start-zeile { grid-template-columns: minmax(0,1fr); }
}

/* Solange die öffentliche Startseite sichtbar ist, trägt auch der Rahmen ihre Farbe */
body.oeffentlich { background: #f4f6f9; }

/* Alter des Vorgangs, eingefärbt nach dem Stand der Frist */
.badge.sla-gruen { background: var(--ok);     color: #fff; }
.badge.sla-gelb  { background: var(--warn);   color: #fff; }
.badge.sla-rot   { background: var(--danger); color: #fff; }

/* Video und Ton laufen direkt im Verlauf */
.att-medium { display: flex; flex-direction: column; gap: 5px; max-width: 460px; margin: 4px 0; }
.att-medium video { width: 100%; max-height: 340px; border-radius: 10px; background: #000; }
.att-medium audio { width: 100%; }
.att-medium a { font-size: 12.5px; color: var(--text-faint); text-decoration: none; }
.att-medium a:hover { color: var(--brand); }
