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

/* ── Breakpoints (Referenz, nicht als CSS-Vars nutzbar in @media) ──
   --bp-sm:  640px   Mobile
   --bp-md:  900px   Tablet
   --bp-lg:  1200px  Desktop
   --bp-xl:  1400px  Large
*/

:root {
  --blue:      #008a4f;
  --blue-d:    #00673b;
  --blue-l:    #eef8f1;
  --blue-mid:  #00a862;
  --brand-rgb: 0,138,79;
  --overlay-rgb: 0,68,39;
  --login-bg:  #eff8f2;
  --text:      #1a1a1a;
  --text2:     #4a4a4a;
  --muted:     #8a8a8a;
  --light:     #9ab;
  --border:    #e8eaed;
  --border-s:  #d8dce0;
  --bg:        #FFFFFF;
  --bg2:       #f8f9fb;
  --bg3:       #f0f1f4;
  --red:       #c4244a;
  --red-l:     #fdf2f4;
  --warn:      #c27800;
  --warn-l:    #fef9ee;
  --green:     #1a8a5c;
  --green-l:   #f0faf5;
  --r:         6px;
  --rl:        8px;
  --rx:        10px;
  --rxx:       12px;
  --pill-h:    30px;
  --pill-pad:  0 12px;
  --pill-fs:   12px;
  --pill-bw:   1.25px;
  --sh:        0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.03);
  --sh-md:     0 2px 4px rgba(0,0,0,.03), 0 4px 12px rgba(0,0,0,.06);
  --sh-lg:     0 4px 8px rgba(0,0,0,.04), 0 12px 28px rgba(0,0,0,.08);
  --sh-xl:     0 8px 16px rgba(0,0,0,.06), 0 20px 48px rgba(0,0,0,.12);
  --sh-glow:   0 0 0 1px rgba(var(--brand-rgb), .08), 0 4px 16px rgba(var(--brand-rgb), .1);
  --ease:      cubic-bezier(.4, 0, .2, 1);
  --ease-out:  cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --duration:  180ms;
  --duration-md: 280ms;
  --duration-lg: 400ms;
  --font:      'DM Sans', -apple-system, system-ui, sans-serif;
  --mono:      'JetBrains Mono', monospace;
  /* Typography scale – Red Dot consolidated */
  --fs-xs:     11px;
  --fs-sm:     12px;
  --fs-base:   13px;
  --fs-md:     14px;
  --fs-lg:     16px;
  --fs-xl:     20px;
  --fs-2xl:    28px;
  --fs-label:  11px;
  --lh-tight:  1.2;
  --lh-base:   1.5;
  --lh-loose:  1.65;
  --dept-color: var(--blue);
  --radius-pill: 999px;
  --radius-card: 16px;
  --radius-input: 8px;
  /* Readable radius aliases (keep short names for backward compat) */
  --radius-sm: var(--r);
  --radius-md: var(--rl);
  --radius-lg: var(--rx);
  --radius-xl: var(--rxx);
}
body[data-theme="blue"] {
  --blue:      #005ea8;
  --blue-d:    #004780;
  --blue-l:    #f0f4f8;
  --blue-mid:  #006bbf;
  --brand-rgb: 0,94,168;
  --overlay-rgb: 0,47,80;
  --login-bg:  #f0f5f9;
}

/* ── Utility Classes ───────────────────────────────────── */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Screen-reader only – visually hidden but accessible */
.visually-hidden,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: var(--font);
  background: var(--bg2);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

/* ── Global micro-interactions ── */
button, .btn, .action-btn, .btn-icon, .header-action-btn, .l-btn, .ctl, .usz-nav-item {
  transition: all var(--duration) var(--ease);
}
button:active:not(:disabled), .btn:active:not(:disabled),
.action-btn:active:not(:disabled), .btn-icon:active:not(:disabled),
.header-action-btn:active:not(:disabled),
.l-btn:active:not(:disabled), .ctl:active:not(:disabled) {
  transform: scale(.965);
}

/* ── Global focus-visible rings ── */
:focus-visible {
  outline: 2px solid rgba(var(--brand-rgb), .4);
  outline-offset: 2px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible,
.l-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .14);
}

/* ── Row fade-in animation ── */
@keyframes rowFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.cases-table tbody tr {
  animation: rowFadeIn var(--duration) var(--ease) both;
}
.cases-table tbody tr:nth-child(1) { animation-delay: 0ms; }
.cases-table tbody tr:nth-child(2) { animation-delay: 30ms; }
.cases-table tbody tr:nth-child(3) { animation-delay: 60ms; }
.cases-table tbody tr:nth-child(4) { animation-delay: 90ms; }
.cases-table tbody tr:nth-child(5) { animation-delay: 120ms; }
.cases-table tbody tr:nth-child(n+6) { animation-delay: 150ms; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
.view-enter { animation: fadeSlideUp var(--duration-md) var(--ease-out) both; }
.view-enter-delay-1 { animation-delay: 60ms; }
.view-enter-delay-2 { animation-delay: 120ms; }
.view-enter-delay-3 { animation-delay: 180ms; }

/* ═══════════════════════════
   TOP HEADER
═══════════════════════════ */
.usz-header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.06);
  flex-shrink: 0;
}
.usz-header-inner {
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.usz-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.usz-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font);
  color: #fff;
  letter-spacing: 0;
  flex-shrink: 0;
}
.usz-logo-name {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}
.usz-logo-name strong {
  display: block;
  background: none;
  color: #111;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .8px;
  line-height: 1;
}
.usz-logo-name span {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 400;
}
.usz-logo-inline {
  display: inline-block;
  width: 90px;
  height: 13px;
  vertical-align: -2px;
  background: center / contain no-repeat var(--brand-logo);
  color: transparent;
  font-size: 0;
  line-height: 0;
}
body[data-theme="blue"] .usz-logo { gap: 12px; }
body[data-theme="blue"] .usz-logo-icon {
  width: 36px;
  height: 36px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
}
body[data-theme="blue"] .usz-logo-name strong {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.usz-header-right {
  margin-left: 0;
  display: none;
  align-items: center;
  gap: 6px;
}
.usz-header-right.show {
  display: flex;
}
/* .header-action-btn: visually matches .btn .btn-sec .btn-sm with font-weight 500 */
.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: var(--pill-bw) solid var(--border-s);
  background: #fff;
  color: var(--text2);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.header-action-btn:hover {
  border-color: rgba(var(--brand-rgb), .3);
  color: var(--blue);
  background: var(--blue-l);
  box-shadow: var(--sh);
}
.header-action-btn .label { white-space: nowrap; }

/* SSE connection indicator */
.sse-indicator {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500; cursor: default;
  background: rgba(var(--brand-rgb, 34,139,34), .10);
  color: var(--brand, #228b22);
  transition: background .3s, color .3s, opacity .3s;
}
.sse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand, #228b22);
  transition: background .3s;
}
.sse-indicator.connected .sse-dot { animation: sse-pulse 2s ease-in-out infinite; }
.sse-indicator.disconnected {
  background: rgba(220,53,69,.10); color: #dc3545;
}
.sse-indicator.disconnected .sse-dot { background: #dc3545; animation: none; }
@keyframes sse-pulse { 0%,100% { opacity:.4; } 50% { opacity:1; } }

.header-info {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: var(--pill-bw) solid var(--border-s);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════
   SUB-NAV
═══════════════════════════ */
.usz-subnav {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  overflow: visible;
}
.usz-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font);
  transition: color .15s, background .15s;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}
.usz-nav-item:hover { background: var(--blue-l); color: var(--blue); }
.usz-nav-item.active { border-bottom-color: var(--blue); color: var(--blue); font-weight: 600; }
.usz-nav-item:active { transform: scale(.97); }
.usz-nav-icon {
  width: 20px; height: 20px;
  background: var(--blue-l);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.usz-subnav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Klinik-Dropdown in Subnav */
.clinic-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  padding: 0;
  min-height: var(--pill-h);
}
.clinic-select-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1;
  font-family: var(--font);
}
.clinic-select {
  --clinic-color: var(--blue);
  --clinic-color-rgb: var(--brand-rgb);
  --clinic-bg: rgba(var(--clinic-color-rgb),.12);
  --clinic-border: rgba(var(--clinic-color-rgb),.32);
  appearance: none; -webkit-appearance: none;
  background: var(--clinic-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: var(--pill-bw) solid var(--clinic-border);
  border-radius: 999px;
  padding: var(--pill-pad);
  padding-right: 30px;
  height: var(--pill-h);
  min-height: var(--pill-h);
  font-family: var(--font);
  font-size: var(--pill-fs);
  font-weight: 600;
  line-height: 1;
  color: var(--clinic-color); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  width: auto;
  min-width: 120px;
  max-width: min(420px, 46vw);
}
.clinic-select:hover { border-color: rgba(var(--clinic-color-rgb),.55); }
.clinic-select:focus {
  border-color: rgba(var(--clinic-color-rgb),.7);
  box-shadow: 0 0 0 3px rgba(var(--clinic-color-rgb),.14);
}
.clinic-select.is-all {
  --clinic-bg: #fff;
}
.clinic-select:disabled {
  opacity: 1;
  cursor: default;
}
.clinic-dd {
  position: relative;
  display: inline-flex;
}
.clinic-dd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  background-image: none;
  padding-right: 12px;
}
.clinic-dd.open .clinic-select {
  min-width: min(420px, 62vw);
}
.clinic-dd-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--clinic-color, var(--blue));
  flex: 0 0 auto;
}
.clinic-dd-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clinic-dd-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  width: max-content;
  min-width: 100%;
  max-width: min(560px, 86vw);
  background: #fff;
  border: 1px solid var(--border-s);
  border-radius: 14px;
  box-shadow: var(--sh-lg);
  padding: 6px;
  max-height: 0;
  opacity: 0;
  transform: translateY(-5px);
  pointer-events: none;
  overflow: hidden auto;
  z-index: 70;
  transition: max-height .26s cubic-bezier(.24,.7,.2,1), opacity .18s ease, transform .22s ease;
}
.clinic-dd.open .clinic-dd-menu {
  max-height: 392px; /* exakt 10 Eintraege + Menu-Padding */
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.clinic-dd-item {
  width: 100%;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--text2);
  font-family: var(--font);
  font-size: var(--pill-fs);
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  transition: background .14s, color .14s;
}
.clinic-dd-item:hover,
.clinic-dd-item.is-active {
  background: var(--blue-l);
  color: var(--blue);
}
.clinic-dd-item.is-disabled {
  opacity: .55;
  cursor: default;
}
.clinic-dd-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}

/* User pill */
.user-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  min-height: 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: border-color .22s ease, box-shadow .22s ease, background .22s ease;
}
.user-pill.open {
  border-color: rgba(var(--brand-rgb),.3);
  box-shadow: 0 6px 16px rgba(var(--overlay-rgb),.12);
  background: #fff;
}
.user-pill-main {
  border: 0;
  background: transparent;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: inherit;
}
.user-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: .15px;
}
.user-nm {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -.01em;
}
.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  padding-left: 0;
  border-left: 1px solid transparent;
  max-width: 0;
  opacity: 0;
  transform: translateX(8px);
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  transition: max-width .32s cubic-bezier(.22,.68,.18,1), opacity .2s ease, transform .28s ease, margin-left .2s ease, padding-left .2s ease, border-color .2s ease;
}
.user-pill.open .user-menu {
  max-width: 160px;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  margin-left: 2px;
  padding-left: 8px;
  border-left-color: var(--border);
}
.user-icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: var(--pill-bw) solid var(--border-s);
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateX(8px) scale(.96);
  transition: transform .26s cubic-bezier(.2,.7,.2,1), opacity .2s ease, border-color .15s, color .15s, background .15s;
}
.user-pill.open .user-icon-btn { opacity: 1; transform: translateX(0) scale(1); }
.user-pill.open .user-icon-btn:nth-child(1) { transition-delay: .04s; }
.user-pill.open .user-icon-btn:nth-child(2) { transition-delay: .09s; }
.user-icon-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-l);
}

/* ═══════════════════════════
   LOGIN
═══════════════════════════ */
.login-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(165deg, var(--bg2) 0%, var(--blue-l) 50%, var(--bg2) 100%);
}
.login-wrap { width: min(460px, 100%); text-align: center; }
.login-kicker {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.login-kicker::before { content:''; width:14px; height:2px; background:var(--border-s); border-radius:2px; }
.login-h {
  font-size: 28px; font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.login-sub { font-size: 15px; color: var(--muted); margin-bottom: 32px; }
.login-card .lc-body { text-align: left; }
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--sh-md);
}
.lc-body { padding: 30px; }
.l-field { margin-bottom: 18px; }
.l-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text2); margin-bottom: 7px;
}
.l-input {
  width: 100%; min-height: 42px; padding: 0 14px;
  background: #fff;
  border: var(--pill-bw) solid var(--border-s);
  border-radius: 999px;
  color: var(--text); font-family: var(--font); font-size: 14px;
  transition: border-color .15s;
  outline: none;
}
.l-input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); }
.l-err {
  width: 100%;
  min-height: var(--pill-h, 42px);
  border: var(--pill-bw, 1.25px) solid rgba(174,0,96,.28);
  border-radius: 999px;
  background: rgba(174,0,96,.08);
  color: var(--red);
  font-family: var(--font);
  font-size: var(--pill-fs, 13px);
  font-weight: 600;
  line-height: 1.25;
  padding: 6px 14px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
}
.l-err::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  flex: 0 0 7px;
}
.l-err.show { display: flex; }
/* .l-btn: now composed as .btn .btn-filled .btn-lg .btn-block */
.l-btn {
  width: 100%; min-height: 44px; padding: 0 20px;
  background: var(--blue); color: #fff;
  border: none; border-radius: 999px;
  font-family: var(--font); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all var(--duration) var(--ease);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(var(--brand-rgb), .25);
}
.l-btn:hover { background: var(--blue-d); box-shadow: 0 4px 14px rgba(var(--brand-rgb), .3); }
.l-btn:disabled { opacity: .5; cursor: not-allowed; }
.lc-foot {
  padding: 12px 30px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.lc-foot::before { content: ''; width: 12px; height: 12px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239ab' stroke-width='1.6'%3E%3Crect x='3' y='7' width='10' height='8' rx='1.5'/%3E%3Cpath d='M5 7V5a3 3 0 0 1 6 0v2'/%3E%3C/svg%3E") center/contain no-repeat; display: inline-block; vertical-align: middle; flex-shrink: 0; }

.usz-footer {
  background: var(--blue-d); color: rgba(255,255,255,.55);
  padding: 12px 28px; font-size: 11.5px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 10px;
  flex-shrink: 0;
}
.usz-footer .footer-left  { justify-self: start; }
.usz-footer .footer-center{ justify-self: center; text-align: center; }
.usz-footer .footer-right { justify-self: end; }
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
}
.theme-switch-header {
  margin-left: auto;
}
.theme-btn {
  width: 18px;
  height: 18px;
  min-height: 18px;
  border: 1.5px solid var(--border-s);
  border-radius: 999px;
  padding: 0;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
}
.theme-btn-green { background: #008a4f; }
.theme-btn-blue { background: #005ea8; }
.theme-btn.active {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}
.theme-btn:hover { border-color: var(--text2); }

/* ═══════════════════════════
   APP SHELL
═══════════════════════════ */
#app-screen { display: none; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.app-body { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* SIDEBAR */
aside {
  width: 264px; min-width: 264px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sb-top {
  padding: 12px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sb-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.sb-edit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  border: var(--pill-bw) solid var(--border-s);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, color .15s;
}
.sb-edit-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-l);
}
.sb-edit-toggle .tog {
  transform: scale(.82);
  transform-origin: center;
  pointer-events: none;
}
.sb-edit-toggle-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
}
.sb-edit-toggle.unlocked {
  border-color: rgba(var(--brand-rgb),.35);
  background: var(--blue-l);
  color: var(--blue);
}
.sb-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--light); }
.sb-add-btn {
  display: flex; align-items: center; gap: 4px;
  min-height: 26px;
  padding: 0 11px; border-radius: 999px;
  background: var(--blue); color: #fff; border: none;
  font-family: var(--font); font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: filter .15s; white-space: nowrap; flex-shrink: 0;
  line-height: 1;
}
.sb-add-btn:hover { filter: brightness(1.1); }
.sb-new-wrap { position: relative; display: inline-flex; }
.sb-new-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  min-width: 132px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--sh-lg);
  padding: 4px;
  max-height: 0;
  opacity: 0;
  transform: translateY(-5px);
  pointer-events: none;
  overflow: hidden;
  transition: max-height .28s cubic-bezier(.24,.7,.2,1), opacity .18s ease, transform .24s ease;
  z-index: 15;
}
.sb-new-wrap.open .sb-new-menu {
  max-height: 120px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.sb-new-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  border-radius: 9px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.sb-new-item:hover {
  background: var(--blue-l);
  color: var(--blue);
}
.sb-add-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.sb-add-btn:disabled:hover {
  filter: none;
  background: #fff;
  color: var(--muted);
  border-color: var(--border-s);
}
.skill-list { flex: 1; overflow-y: auto; padding: 8px; }
.sb-bottom {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 9px 12px 11px;
  display: flex;
  justify-content: flex-start;
}
.sb-bottom .sb-edit-toggle {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text2);
  gap: 8px;
}
.sb-bottom .sb-edit-toggle:hover {
  border: 0;
  background: transparent;
  color: var(--text);
}
.sb-bottom .sb-edit-toggle.unlocked {
  border: 0;
  background: transparent;
  color: var(--text2);
}
.sb-bottom .sb-edit-toggle .tog {
  transform: none;
}
.sb-bottom .sb-edit-toggle-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}
.sb-folder { margin-bottom: 8px; }
.sb-folder-hdr {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  transition: background .14s, color .14s;
}
.sb-folder-hdr:hover { background: var(--bg2); color: var(--text2); }
.sb-folder-chev {
  width: 14px;
  font-size: 11px;
  line-height: 1;
  color: var(--light);
  transition: transform .16s ease;
  flex-shrink: 0;
}
.sb-folder-hdr.is-collapsed .sb-folder-chev { transform: rotate(-90deg); }
.sb-folder-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .65px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.sb-folder-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--light);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
}
.sb-folder-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sb-folder-btn {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .14s, background .14s, border-color .14s;
}
.sb-folder-btn:hover { color: var(--blue); background: var(--blue-l); border-color: rgba(var(--brand-rgb),.18); }
.sb-folder-btn.danger:hover { color: var(--red); background: var(--red-l); border-color: rgba(196,36,74,.22); }
.sb-folder-body {
  padding-top: 3px;
  max-height: 9999px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height .34s cubic-bezier(.24,.7,.2,1), opacity .2s ease, transform .24s ease, padding .22s ease;
}
.sb-folder.is-collapsed .sb-folder-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-5px);
  padding-top: 0;
  pointer-events: none;
}
.sb-folder-empty {
  margin: 2px 6px 8px;
  padding: 8px 10px;
  border: 1.5px dashed var(--border);
  border-radius: var(--r);
  color: var(--light);
  font-size: 11.5px;
  text-align: center;
}
.sb-folder.is-drop-target .sb-folder-hdr {
  background: var(--blue-l);
  color: var(--blue);
}
.sb-folder.is-drop-target .sb-folder-body {
  border-radius: var(--r);
  background: rgba(var(--brand-rgb),.04);
}

.sk-item {
  padding: 10px 12px; border-radius: var(--r);
  cursor: pointer; margin-bottom: 2px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  transition: background .1s, border-color .1s;
  position: relative;
}
.sk-item:hover { background: var(--bg2); }
.sk-item[draggable="true"] { cursor: grab; }
.sk-item.dragging { opacity: .45; }
.sk-item.drop-before::before,
.sk-item.drop-after::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 1px rgba(var(--brand-rgb),.14);
  pointer-events: none;
}
.sk-item.drop-before::before { top: -1px; }
.sk-item.drop-after::after { bottom: -1px; }
.sk-item.active {
  background: var(--blue-l);
  border-color: rgba(var(--brand-rgb),.15);
  border-left-color: var(--blue);
}
.sk-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.sk-meta { flex: 1; min-width: 0; }
.sk-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.sk-sub { font-size: 11px; color: var(--light); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nd-badge { background: var(--red-l); color: var(--red); border: 1px solid rgba(174,0,96,.2); border-radius: 4px; padding: 1px 5px; font-size: 10px; font-weight: 700; }
.dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex-shrink: 0; }

main {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 28px 32px;
  display: flex; flex-direction: column; gap: 16px;
  background: var(--bg2);
  min-width: 0; min-height: 0; /* flex child darf schrumpfen */
}
.empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: var(--light);
}
.empty-icon { font-size: 48px; opacity: .15; filter: grayscale(1); }
.empty-title { font-size: 19px; font-weight: 700; color: var(--text2); letter-spacing: -.35px; }
.empty-sub { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* ═══════════════════════════
   CARDS
═══════════════════════════ */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--rl);
  box-shadow: var(--sh);
  overflow: clip; /* clippt visuell, blockiert aber keine Kind-Scrollbars */
  min-width: 0; /* verhindert Overflow als flex-child */
  transition: box-shadow var(--duration-md, 280ms) var(--ease), transform var(--duration-md, 280ms) var(--ease);
}
.card:hover {
  box-shadow: var(--sh-md);
}
.card-hdr {
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  min-width: 0;
  cursor: pointer; user-select: none;
}
.card-title {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .65px;
  color: var(--muted);
  display: flex; align-items: center; gap: 7px;
  min-width: 0; overflow: hidden;
  flex-wrap: wrap;
}
.card-title-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0;
}
.card .card-body {
  padding: 16px;
  max-height: 9999px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height .34s cubic-bezier(.24,.7,.2,1), opacity .2s ease, transform .24s ease, padding .22s ease;
}

.field-row { display: flex; gap: 14px; flex-wrap: wrap; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
label { font-size: 11.5px; font-weight: 500; color: var(--text2); }
input[type=text], input[type=number], textarea, select {
  background: var(--bg2); border: var(--pill-bw) solid var(--border-s);
  border-radius: 999px; color: var(--text);
  padding: 7px 11px; font-family: var(--font); font-size: 12.5px; font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
  width: 100%; min-width: 0; max-width: 100%;
  resize: vertical; outline: none; -webkit-appearance: none;
}
textarea { border-radius: 12px; }
input[type=text]:focus, input[type=number]:focus, textarea:focus, select:focus {
  border-color: var(--blue); background: #fff;
}
input:disabled, textarea:disabled, select:disabled { opacity: .45; cursor: not-allowed; }

/* EDITOR STICKY TOPBAR */
.editor-topbar {
  position: sticky;
  top: -28px;
  z-index: 20;
  margin: -28px -32px 16px;
  padding: 8px 22px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.editor-topbar-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text2);
  min-width: 0; overflow: hidden;
}
.editor-topbar-cluster {
  color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Collapsible cards */
.card-hdr .card-chevron { transition: transform .2s; display: inline-flex; color: var(--muted); margin-left: auto; flex-shrink: 0; }
.card.collapsed .card-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  padding: 0 !important;
  pointer-events: none;
}
.card.collapsed .card-chevron { transform: rotate(-90deg); }
.card.collapsed { opacity: .7; }
.card.collapsed:hover { opacity: .85; }

/* RED FLAGS */
#meta-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
#rf-list   { max-height: 220px; overflow-y: auto; padding-right: 2px; padding-bottom: 4px; }
#nd-list   { max-height: 300px; overflow-y: auto; padding-right: 2px; padding-bottom: 4px; }
#phases-wrap { max-height: 420px; overflow-y: auto; padding-right: 2px; padding-bottom: 4px; }

.rf-row {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
  background: var(--red-l);
  border: 1px solid rgba(174,0,96,.15);
  border-left: 3px solid var(--red);
  border-radius: var(--r); padding: 9px 12px; margin-bottom: 6px;
}
.rf-row input { flex: 1; min-width: 120px; }
.rf-row select { flex-shrink: 0; }
.rf-row .btn { flex-shrink: 0; }

/* ═══════════════════════════
   NOTFALLDIAGNOSEN
═══════════════════════════ */
.nd-card {
  background: #fff;
  border: 1px solid rgba(174,0,96,.2);
  border-left: 3px solid var(--red);
  border-radius: var(--r);
  overflow: hidden; margin-bottom: 8px;
}
.nd-hdr {
  padding: 9px 12px; display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none; background: var(--red-l);
  transition: background .1s; flex-wrap: wrap;
}
.nd-hdr:hover { background: #f5d0e7; }
.nd-name-inp {
  background: #fff;
  border: var(--pill-bw) solid rgba(174,0,96,.2);
  border-radius: 999px;
  padding: 6px 10px;
  font-family: var(--font); font-weight: 700; font-size: 12.5px;
  color: var(--red); flex: 1; min-width: 120px; max-width: 100%;
  transition: border-color .15s, background .15s;
}
.nd-name-inp:focus { outline: none; border-color: var(--red); background: #fff; }
.nd-acts { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }
.nd-body {
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid rgba(174,0,96,.12);
  max-height: 9999px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height .34s cubic-bezier(.24,.7,.2,1), opacity .2s ease, transform .24s ease, padding .22s ease;
}
.nd-chevron { transition: transform .24s ease; }
.nd-card.is-collapsed .nd-chevron { transform: rotate(-90deg); }
.nd-card.is-collapsed .nd-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}
.nd-field { display: flex; flex-direction: column; gap: 5px; }
.nd-field label { color: var(--red); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.nd-field input[type=text], .nd-field textarea {
  border-color: rgba(174,0,96,.2); background: var(--red-l);
}
.nd-field input[type=text]:focus, .nd-field textarea:focus {
  border-color: var(--red); background: #fff;
}
.nd-field-row { display: flex; gap: 12px; flex-wrap: wrap; min-width: 0; }
.nd-field-col { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 5px; }
.nd-field-col label { color: var(--red); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.nd-field-col input[type=text], .nd-field-col textarea {
  border-color: rgba(174,0,96,.2); background: var(--red-l);
}
.nd-field-col input[type=text]:focus, .nd-field-col textarea:focus {
  border-color: var(--red); background: #fff;
}
.nd-symptom-title {
  font-size: 11px; font-weight: 700; color: var(--red);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px;
}
.nd-symptom-row {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
  background: var(--red-l); border: 1px solid rgba(174,0,96,.15);
  border-radius: var(--r); padding: 8px 12px; margin-bottom: 5px;
  min-width: 0;
}
.nd-symptom-key {
  font-family: var(--mono); font-size: 11px; padding: 7px 10px;
  width: 120px; min-width: 0; flex-shrink: 0;
  color: var(--red); background: rgba(174,0,96,.08); border-color: rgba(174,0,96,.2);
}
.nd-symptom-key:focus { border-color: var(--red); background: #fff; }
.ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600;
  background: #fff; color: var(--blue);
  border: var(--pill-bw) solid rgba(var(--brand-rgb),.25); white-space: nowrap;
}
.add-nd-btn {
  border: 1.5px dashed rgba(174,0,96,.3); background: transparent;
  color: var(--red); border-radius: 999px;
  padding: 11px; width: 100%; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: var(--font); margin-top: 4px;
}
.add-nd-btn:hover { border-color: var(--red); background: var(--red-l); }

/* PHASES */
.phase-card {
  background: #fff; border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--r); overflow: hidden; margin-bottom: 8px;
}
.phase-hdr {
  padding: 9px 12px; display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  cursor: pointer; user-select: none; background: var(--bg2);
  transition: background .1s;
}
.phase-hdr:hover { background: var(--bg3); }
.phase-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.phase-num {
  width: 24px; height: 24px; background: var(--blue); color: #fff;
  border-radius: 6px; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.phase-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.phase-name-inp {
  background: #fff;
  border: var(--pill-bw) solid var(--border-s);
  border-radius: 999px;
  padding: 6px 10px;
  font-family: var(--font); font-weight: 600; font-size: 12.5px;
  color: var(--text); width: 100%; max-width: 100%;
  transition: border-color .15s, background .15s;
}
.phase-name-inp:focus { outline: none; border-color: var(--blue); background: #fff; }
.flag-badge {
  font-family: var(--mono); font-size: 10.5px; padding: 2px 8px;
  border-radius: 5px; background: var(--warn-l); color: var(--warn);
  border: 1px solid rgba(217,119,6,.2);
}
.phase-acts { display: flex; gap: 4px; margin-left: auto; }
.phase-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 20px;
}
.phase-chevron {
  margin-left: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
  transition: transform .24s ease;
  line-height: 1;
}
.phase-card.is-collapsed .phase-chevron { transform: rotate(-90deg); }
.phase-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 9999px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height .34s cubic-bezier(.24,.7,.2,1), opacity .2s ease, transform .24s ease, padding .22s ease;
}
.phase-card.is-collapsed .phase-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

/* QUESTIONS */
.q-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 11px;
  display: flex; flex-direction: column; gap: 9px;
  min-width: 0;
}
.q-row { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; min-width: 0; }
.q-key {
  font-family: var(--mono); font-size: 10.5px; padding: 6px 9px;
  flex: 0 0 180px;
  width: 180px;
  min-width: 120px;
  max-width: 220px;
  color: var(--blue-d); background: var(--blue-l); border-color: rgba(var(--brand-rgb),.2);
}
.q-text {
  flex: 1 1 340px;
  width: auto;
  min-width: 220px;
  font-size: 13px;
}
.q-acts { display: flex; gap: 3px; flex-shrink: 0; }
.q-toggles { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.tog-wrap { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.tog {
  position: relative; width: 36px; height: 21px;
  background: var(--border-s); border-radius: 11px;
  transition: background .2s; flex-shrink: 0;
  border: 1.5px solid var(--border-s);
}
.tog::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; background: #fff; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.tog.on { background: var(--blue); border-color: var(--blue); }
.tog.on::after { transform: translateX(15px); }
.tog-lbl { font-size: 12.5px; color: var(--text2); font-weight: 500; }
.add-phase-btn {
  border: 1.5px dashed var(--border-s); background: transparent;
  color: var(--muted); border-radius: 999px;
  padding: 12px; width: 100%; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: var(--font); margin-top: 6px;
}
.add-phase-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }

/* ═══════════════════════════
   BUTTONS
═══════════════════════════ */
.btn {
  padding: 6px 14px; border: none; cursor: pointer;
  font-family: var(--font); font-weight: 600; font-size: var(--pill-fs);
  transition: all .15s; display: flex; align-items: center; gap: 6px;
  white-space: nowrap; line-height: 1; border-radius: 999px; width: fit-content;
}
.btn-primary { background: #fff; color: var(--blue); border: var(--pill-bw) solid rgba(var(--brand-rgb),.25); }
.btn-primary:hover { border-color: var(--blue); background: var(--blue-l); }
.btn-primary:active { background: rgba(var(--brand-rgb),.08); }
.btn-sec { background: #fff; color: var(--text2); border: var(--pill-bw) solid var(--border-s); }
.btn-sec:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.btn-sec:active { background: rgba(var(--brand-rgb),.08); }
/* .btn-teal removed – identical to .btn-primary */
.btn-danger { background: #fff; color: var(--red); border: var(--pill-bw) solid rgba(174,0,96,.2); }
.btn-danger:hover { border-color: var(--red); background: var(--red-l); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid transparent; padding: 5px 8px; }
.btn-ghost:hover { color: var(--red); background: var(--red-l); }
.btn-xs { padding: 3px 10px; font-size: 11px; }
.btn-sm { padding: 5px 12px; font-size: 11.5px; }
.btn-lg { padding: 0 24px; font-size: 14px; min-height: 44px; }
.btn-filled { background: var(--blue); color: #fff; border: none; box-shadow: 0 2px 8px rgba(var(--brand-rgb), .25); }
.btn-filled:hover { background: var(--blue-d); box-shadow: 0 4px 14px rgba(var(--brand-rgb), .3); }
.btn-filled:disabled { opacity: .5; }
.btn-on-dark { background: var(--blue); color: #fff; border-color: rgba(255,255,255,.5); }
.btn-on-dark:hover { opacity: .85; transform: scale(1.08); background: var(--blue); border-color: #fff; }
.btn-on-dark.is-active { opacity: .8; background: var(--blue-d); border-color: var(--blue-d); }
.btn-icon {
  width: var(--pill-h); height: var(--pill-h); padding: 0;
  justify-content: center;
}
.btn-icon .btn-label { display: none; }
.btn-icon.is-active { border-color: var(--blue); background: var(--blue-l); }
.btn-icon.danger { color: var(--red); border-color: rgba(196,36,74,.22); }
.btn-icon.danger:hover { border-color: var(--red); background: var(--red-l); }
.btn-block { width: 100%; justify-content: center; }
.btn-info-dot {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 999px;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--blue);
  border-color: rgba(var(--brand-rgb), .26);
  background: #fff;
}
.btn-info-dot:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(var(--brand-rgb), .1);
}
.btn-info-dot.is-active {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}
.btn-info-dot:focus-visible {
  outline: 2px solid rgba(var(--brand-rgb), .3);
  outline-offset: 1px;
}
.btn:disabled { opacity: .38; cursor: not-allowed; }

/* ── Form Inputs (consolidated) ── */
.form-input {
  width: 100%; min-height: 40px; padding: 8px 14px;
  border: var(--pill-bw) solid var(--border-s); border-radius: var(--radius-input);
  font-family: var(--font); font-size: 14px; color: var(--text);
  background: #fff; outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .1); }
.form-input.is-extracted { border-color: rgba(var(--brand-rgb),.25); background: rgba(var(--brand-rgb),.02); }
textarea.form-input { min-height: 80px; border-radius: var(--radius-card); resize: vertical; }
select.form-input {
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

.spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════
   PANELS
═══════════════════════════ */
.panel {
  position: fixed; inset: 0;
  background: rgba(var(--overlay-rgb),.32);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  z-index: 300; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.panel.open { opacity: 1; pointer-events: all; }
.panel-box {
  background: #fff;
  border-radius: var(--rx);
  width: min(800px, 93vw); max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-lg);
  transform: translateY(12px) scale(.98);
  transition: transform .25s cubic-bezier(.34,1.4,.64,1);
  overflow: hidden;
}
.panel.open .panel-box { transform: none; }
.panel-hdr {
  background: var(--blue);
  padding: 18px 26px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 2px 8px rgba(0,0,0,.15);
}
.panel-title { font-size: 16px; font-weight: 600; color: #fff; letter-spacing: -.2px; }
.panel-hdr-actions { display: flex; gap: 8px; align-items: center; }
.btn.panel-hdr-icon-btn {
  width: 30px;
  max-width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  border: var(--pill-bw) solid var(--border-s);
  box-shadow: none;
  filter: none;
  transition: opacity .15s, transform .15s;
}
.btn.panel-hdr-icon-btn:hover {
  border-color: var(--blue);
  background: var(--blue-l);
  filter: none;
  box-shadow: none;
}
.panel-hdr .btn.panel-hdr-icon-btn,
.historie-detail-hdr-actions .btn.panel-hdr-icon-btn,
.action-hub-header .btn.panel-hdr-icon-btn,
.btn.panel-hdr-icon-btn.btn-on-dark {
  background: var(--blue);
  color: #fff;
  border-color: rgba(255,255,255,.5);
}
.panel-hdr .btn.panel-hdr-icon-btn:hover,
.historie-detail-hdr-actions .btn.panel-hdr-icon-btn:hover,
.action-hub-header .btn.panel-hdr-icon-btn:hover,
.btn.panel-hdr-icon-btn.btn-on-dark:hover {
  opacity: .85;
  transform: scale(1.08);
  background: var(--blue);
  border-color: #fff;
}
.btn.panel-hdr-icon-btn.is-active {
  opacity: .8;
  background: var(--blue-d);
  border-color: var(--blue-d);
}
.panel-hdr-icon-btn svg {
  width: 14px;
  height: 14px;
  display: block;
  stroke: currentColor;
  fill: none;
}
.panel-body { flex: 1; overflow-y: auto; padding: 24px 26px; }
.panel-footer {
  padding: 14px 26px; border-top: 1px solid var(--border-s);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--bg2); flex-shrink: 0;
  box-shadow: 0 -1px 4px rgba(0,0,0,.03);
}

/* Admin panel: kompakter/minimalistischer */
#admin-panel .panel-box { width: min(1180px, 95vw); }
#admin-panel .panel-hdr { padding: 14px 20px; }
#admin-panel .panel-title { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
#admin-panel .panel-body { padding: 14px 18px; }
#admin-panel .admin-tabsbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
#admin-panel .tabs { margin-bottom: 0; }
#admin-panel .tab { padding: 8px 16px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
#admin-panel .tab svg { flex-shrink: 0; opacity: .6; }
#admin-panel .tab.active svg { opacity: 1; }
#admin-panel #tab-users,
#admin-panel #tab-depts,
#admin-panel #tab-llm,
#admin-panel #tab-stale {
  animation: fadeSlideUp 220ms cubic-bezier(.16, 1, .3, 1) both;
}
#admin-panel #admin-add-btn {
  flex-shrink: 0;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}
#admin-panel #admin-add-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(var(--brand-rgb),.2);
}
#admin-panel #admin-add-btn:active {
  transform: scale(.95);
}
#admin-panel .add-form { padding: 12px; margin-bottom: 12px; gap: 9px; }
#admin-panel .add-form-title { font-size: 10.5px; letter-spacing: .55px; padding-bottom: 7px; }
#admin-panel .form-row { gap: 8px; }
#admin-panel .form-field { gap: 4px; }
#admin-panel label { font-size: 11.5px; }
#admin-panel input[type=text],
#admin-panel input[type=password],
#admin-panel input[type=number],
#admin-panel select {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 12.5px;
}
#admin-panel #nu-dept-list { gap: 4px !important; margin-top: 4px !important; }
#admin-panel .dept-access-row { padding: 6px 9px; }
#admin-panel .dept-access-label { font-size: 12px; font-weight: 500; }
#admin-panel .dept-access-role label { padding: 2px 8px; font-size: 11px; }
#admin-panel .u-table { font-size: 12.5px; }
#admin-panel .u-table th { padding: 8px 10px; font-size: 10.5px; letter-spacing: .5px; }
#admin-panel .u-table td { padding: 8px 10px; }
#admin-panel .btn { min-height: 30px; padding: 5px 10px; font-size: 11.5px; }
#admin-panel .btn-xs { min-height: 24px; padding: 2px 8px; font-size: 10.5px; }
#admin-panel .btn-sm { min-height: 26px; padding: 4px 9px; font-size: 11px; }

#user-edit-panel .panel-box { width: min(860px, 95vw); max-width: none !important; }
#user-edit-panel .panel-body { padding: 14px 18px; }
#user-edit-panel .add-form {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  margin: 0;
  gap: 10px;
}
#user-edit-panel .form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
#user-edit-panel .form-field { min-width: 0; gap: 5px; }
#user-edit-panel input[type=text],
#user-edit-panel input[type=email],
#user-edit-panel input[type=password],
#user-edit-panel select {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--border-s);
  font-size: 12.5px;
  font-weight: 500;
}
#user-edit-panel #eu-dept-list { gap: 6px !important; margin-top: 6px !important; }
#user-edit-panel .dept-access-row {
  border-radius: 999px;
  min-height: 40px;
  padding: 7px 11px;
}
#user-edit-panel .dept-access-role label { border-radius: 999px; }
#user-edit-panel .eu-pass-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#user-edit-panel #eu-change-pass-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
#user-edit-panel .eu-pass-sidebar {
  margin-top: 8px;
  background: #fff;
  border: 1.5px solid var(--border-s);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0 12px;
  border-width: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: max-height .28s cubic-bezier(.16, 1, .3, 1), opacity .22s ease, padding .22s ease, transform .24s cubic-bezier(.16, 1, .3, 1), border-width .2s ease;
}
#user-edit-panel .eu-pass-sidebar.open {
  max-height: 420px;
  opacity: 1;
  padding: 10px 12px 12px;
  border-width: 1.5px;
  transform: translateX(0);
  pointer-events: auto;
}
#user-edit-panel .eu-pass-sidebar .pc-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
#user-edit-panel .eu-pass-sidebar .pc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
#user-edit-panel .eu-pass-sidebar .pc-field input[type=password] {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1.5px solid var(--border-s);
  background: #fff;
  font-size: 12.5px;
  font-weight: 500;
}
#user-edit-panel .eu-pass-sidebar .pc-hint {
  font-size: 11px;
  color: var(--muted);
}
#user-edit-panel .eu-pass-sidebar-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 2px;
}
#analytics-export-panel .panel-box { width: min(1560px, 96vw); max-width: none !important; }
#analytics-export-panel .panel-body {
  padding: 12px 14px;
}
#analytics-export-panel .exp-split-layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) minmax(520px, 1.4fr);
  gap: 12px;
  align-items: stretch;
}
#analytics-export-panel .exp-left-col,
#analytics-export-panel .exp-right-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#analytics-export-panel .exp-controls-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg2);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
#analytics-export-panel .exp-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#analytics-export-panel .exp-toggle-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  min-width: 74px;
}
#analytics-export-panel .add-form {
  margin: 0;
  padding: 11px 12px;
  gap: 9px;
}
#analytics-export-panel .add-form-title {
  font-size: 10.5px;
  letter-spacing: .55px;
  padding-bottom: 7px;
}
#analytics-export-panel .exp-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(190px, 250px));
  gap: 9px 11px;
  justify-content: start;
}
#analytics-export-panel .form-field {
  min-width: 0;
  gap: 4px;
}
#analytics-export-panel .form-field > label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text2);
}
#analytics-export-panel .exp-dd,
#analytics-export-panel .date-dd {
  width: 100%;
  min-width: 0;
}
#analytics-export-panel .exp-dd .range-dd-btn,
#analytics-export-panel .date-dd .range-dd-btn {
  width: 100%;
}
#analytics-export-panel #exp-preview-wrap {
  flex: 1;
  min-height: 0;
}
#analytics-export-panel .exp-preview-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg2);
  padding: 11px 12px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
#analytics-export-panel .exp-preview-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#analytics-export-panel .exp-preview-card-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
}
#analytics-export-panel .exp-preview-open-btn {
  min-height: 28px;
  padding: 0 11px;
  font-size: 11.5px;
}
#analytics-export-panel .exp-print-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#analytics-export-panel .exp-print-icon-btn {
  min-width: 34px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#analytics-export-panel .exp-print-doc-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
}
#analytics-export-panel .exp-action-tip {
  position: relative;
}
@media (max-width: 980px) {
  #analytics-export-panel .exp-split-layout {
    grid-template-columns: 1fr;
  }
  #analytics-export-panel .exp-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
}
@media (max-width: 760px) {
  #analytics-export-panel .exp-filter-grid { grid-template-columns: 1fr; }
  #analytics-export-panel .exp-toggle-label { min-width: auto; width: 100%; }
}
#analytics-export-panel .export-preview-box {
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--muted);
  min-height: 420px;
  height: 100%;
}
#analytics-export-panel .export-preview-box.is-ready { cursor: zoom-in; }
.exp-preview-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.exp-preview-inline-count { font-size: 12px; color: var(--text2); font-weight: 600; }
.exp-preview-inline-hint { font-size: 11px; color: var(--light); }
.exp-preview-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.exp-preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.exp-preview-table th,
.exp-preview-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
}
.exp-preview-table th {
  font-size: 10.5px;
  letter-spacing: .45px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.exp-preview-table tbody tr:last-child td { border-bottom: 0; }
.exp-preview-inline-doc-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}
.exp-preview-inline-doc {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.exp-preview-inline-doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.exp-preview-inline-doc-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.exp-preview-inline-doc-sub {
  font-size: 11.5px;
  color: var(--muted);
}
.exp-preview-inline-chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.exp-preview-inline-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .35px;
  text-transform: uppercase;
  padding: 3px 8px;
}
.exp-preview-inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
}
.exp-preview-inline-field {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg2);
  padding: 8px 9px;
}
.exp-preview-inline-field-key {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 3px;
}
.exp-preview-inline-field-val {
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}
@media (max-width: 980px) {
  .exp-preview-inline-fields {
    grid-template-columns: 1fr;
  }
}
#export-preview-panel .panel-box { width: min(1360px, 96vw); max-width: none !important; }
#export-preview-panel .panel-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#export-preview-panel .exp-preview-modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
#export-preview-panel .exp-preview-modal-content {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg2);
  padding: 10px;
}
#export-preview-panel .exp-preview-modal-table-wrap {
  max-height: min(66vh, 680px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
#export-preview-panel .exp-preview-modal-doc {
  max-height: min(66vh, 680px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
#export-preview-panel .exp-doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
#export-preview-panel .exp-doc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
#export-preview-panel .exp-doc-sub {
  font-size: 12px;
  color: var(--muted);
}
#export-preview-panel .exp-doc-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 9px;
  background: var(--bg2);
}
#export-preview-panel .exp-doc-block-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 7px;
}
#export-preview-panel .exp-doc-answers-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}
#export-preview-panel .exp-preview-nav {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
#export-preview-panel .exp-preview-page {
  min-width: 84px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}
@media (max-width: 760px) {
  #admin-panel .admin-tabsbar { align-items: stretch; flex-wrap: wrap; }
  #admin-panel .tabs { width: 100%; }
  #admin-panel #admin-add-btn { margin-left: auto; }
  #user-edit-panel .form-row { grid-template-columns: 1fr; }
}

/* TABS */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; padding-bottom: 8px; }
.tab {
  padding: 7px 16px; cursor: pointer; font-size: 12.5px; font-weight: 500;
  color: var(--muted); border: 1.25px solid transparent; background: transparent;
  font-family: var(--font); border-radius: 999px;
  transition: all 180ms cubic-bezier(.4, 0, .2, 1);
}
.tab:hover { color: var(--text); background: var(--bg2); border-color: var(--border); }
.tab.active { color: var(--blue); background: var(--blue-l); border-color: rgba(var(--brand-rgb),.2); font-weight: 600; }

/* TABLES */
.u-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.u-table th {
  text-align: left; padding: 10px 13px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--light); border-bottom: 2px solid var(--border); background: var(--bg2);
  position: sticky; top: 0; z-index: 2;
}
.u-table td { padding: 11px 13px; border-bottom: 1px solid var(--border); vertical-align: middle; transition: background 180ms ease; }
.u-table tbody tr { transition: background 180ms ease; }
.u-table tbody tr:nth-child(even) td { background: rgba(var(--brand-rgb),.015); }
.u-table tbody tr:hover td { background: rgba(var(--brand-rgb),.05); }

.role-badge { font-size: 11px; padding: 3px 10px; border-radius: var(--radius-pill); font-weight: 600; display: inline-block; }
.role-badge.admin { background: #fff; color: var(--red); border: 1.25px solid rgba(174,0,96,.25); }
.role-badge.editor { background: #fff; color: var(--blue); border: 1.25px solid rgba(var(--brand-rgb),.25); }
.role-badge.viewer { background: #fff; color: var(--muted); border: 1.25px solid var(--border-s); }
.dept-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; border: var(--pill-bw) solid;
}
.dept-chip-dot { width: 5px; height: 5px; border-radius: 50%; }

/* ADD FORMS */
.add-form {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px; margin-bottom: 20px;
  display: flex; flex-direction: column; gap: 13px;
}
.add-form-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .7px;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
}
.form-row { display: flex; gap: 11px; flex-wrap: wrap; }
.form-field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 120px; }
.form-helper {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  letter-spacing: .01em;
}
.add-form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.add-form-row > label {
  min-width: 180px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
}
.add-form-row > input,
.add-form-row > select {
  flex: 1;
  min-width: 120px;
  max-width: 280px;
}

/* DEPT */
/* Dept checkboxes in user form */
.dept-access-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r);
  border: 1.5px solid var(--border); background: #fff;
  transition: border-color .14s, background .14s;
}
.dept-access-row.checked { border-color: var(--blue); background: var(--blue-l); }
.dept-access-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }
.dept-access-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dept-access-label { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.dept-access-role { display: flex; gap: 4px; }
.dept-access-role label {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border); color: var(--muted); background: #fff; transition: all .12s;
}
.dept-access-role input[type=radio] { display: none; }
.dept-access-role input[type=radio]:checked + span { color: var(--blue-d); }
.dept-access-role label:has(input[value="editor"]:checked)  { border-color: var(--blue);  background: var(--blue-l);  color: var(--blue-d); }
.dept-access-role label:has(input[value="viewer"]:checked)  { border-color: var(--green); background: var(--green-l); color: var(--green); }
.dept-access-role label:has(input[value="zuweiser"]:checked) { border-color: var(--warn);  background: var(--warn-l);  color: var(--warn); }

/* Dept grid + edit form */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 18px; }
.dept-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}
.dept-list-help {
  margin-bottom: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.dept-empty-note {
  padding: 9px 11px;
  border: 1px dashed var(--border-s);
  border-radius: var(--r);
  background: #fff;
  color: var(--muted);
  font-size: 11.5px;
}
.dept-list-item {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #fff;
  overflow: hidden;
  transition: border-color 180ms ease, box-shadow 280ms ease;
}
.dept-list-item:hover {
  border-color: rgba(var(--brand-rgb),.18);
  box-shadow: 0 2px 8px rgba(var(--brand-rgb),.06);
}
.dept-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}
.dept-list-row:hover { background: var(--bg2); }
.dept-list-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.dept-list-text { min-width: 0; }
.dept-list-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.dept-edit-form {
  margin-top: 6px; padding: 10px 12px; background: var(--bg2);
  border: 1px solid rgba(var(--brand-rgb),.2); border-radius: var(--r);
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 0 0 1px rgba(var(--brand-rgb),.06), 0 2px 8px rgba(var(--brand-rgb),.06);
}
.dept-card {
  background: #fff; border: 1px solid var(--border);
  border-left: 3px solid var(--blue); border-radius: var(--r);
  padding: 13px 16px; display: flex; align-items: center; gap: 11px;
}
.dept-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dept-name { font-weight: 600; font-size: 13.5px; }
.dept-id { font-size: 11px; color: var(--light); font-family: var(--mono); }
.admin-users-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 10px;
}
.admin-users-filter-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.admin-users-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(var(--brand-rgb),.22);
  background: var(--blue-l);
  color: var(--blue-d);
  font-size: 11.5px;
  font-weight: 600;
}
.admin-users-search {
  margin: 0 0 10px;
}
.admin-users-search input {
  width: min(400px, 100%);
  padding-left: 32px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
}

.swatches { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 4px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2.5px solid transparent; transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.swatch:hover { transform: scale(1.1); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.swatch.sel { border-color: var(--text); box-shadow: 0 0 0 3px rgba(0,0,0,.1); transform: scale(1.05); }

.code-block {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; font-family: var(--mono); font-size: 11px; line-height: 1.7;
  color: var(--text); white-space: pre; overflow: auto; max-height: 360px;
}

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 28px;
  background: var(--text);
  border-radius: var(--r);
  padding: 12px 20px;
  font-size: 13.5px; font-weight: 500; color: #fff;
  display: flex; align-items: center; gap: 9px;
  transform: translateY(64px); opacity: 0;
  transition: all .28s cubic-bezier(.34,1.4,.64,1);
  z-index: 9999; box-shadow: var(--sh-lg);
  border-left: 4px solid var(--blue);
}
.toast.show { transform: none; opacity: 1; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--warn); }

/* Confirm dialog */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.confirm-overlay.show { opacity: 1; pointer-events: all; }
.confirm-box {
  background: #fff; border-radius: var(--rl); padding: 24px 28px;
  max-width: 400px; width: 90vw; box-shadow: var(--sh-lg);
}
.confirm-msg { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 18px; line-height: 1.5; }
.confirm-btns { display: flex; gap: 8px; justify-content: flex-end; }
.confirm-password-box { max-width: 520px; }
.confirm-password-input {
  width: 100%;
  min-height: 38px;
  margin-bottom: 16px;
  padding: 0 13px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--border-s);
  color: var(--text);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.confirm-password-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .12);
}
.idle-timeout-countdown {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--red);
  line-height: 1;
  margin: 2px 0 8px;
}

/* Info tooltip */
.info-tip { position: relative; display: inline-flex; }
.info-tip-icon {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border-s); background: #fff; color: var(--muted);
  font-size: 12px; font-weight: 700; font-style: italic; font-family: Georgia, serif;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.info-tip-icon:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.info-tip-box {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 300px; padding: 14px 16px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--sh-lg); font-size: 12.5px; line-height: 1.6;
  color: var(--text2); z-index: 100;
}
.info-tip-box strong { color: var(--text); font-size: 13px; display: block; margin-bottom: 6px; }
.info-tip-box b { color: var(--text); }
.info-tip:hover .info-tip-box,
.info-tip:focus-within .info-tip-box { display: block; }

/* Global custom-theme tooltip (replaces native title hover) */
.custom-theme-tip {
  position: fixed;
  left: -9999px;
  top: -9999px;
  z-index: 12000;
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .14s ease, transform .14s ease;
  background: var(--blue);
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--blue) 78%, #000 22%);
  border-radius: 8px;
  padding: 4px 7px;
  max-width: min(260px, calc(100vw - 20px));
  box-shadow: 0 6px 14px rgba(var(--overlay-rgb), .18);
  font-size: 10px;
  line-height: 1.25;
  font-weight: 500;
  white-space: normal;
  text-align: left;
}
.custom-theme-tip.show {
  opacity: 1;
  transform: translateY(0);
}
.custom-theme-tip::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 6px;
  height: 6px;
  background: inherit;
  border-left: inherit;
  border-bottom: inherit;
  transform: translateX(-50%) rotate(-45deg);
}
.custom-theme-tip[data-placement="top"]::after {
  top: calc(100% - 3px);
}
.custom-theme-tip[data-placement="bottom"]::after {
  bottom: calc(100% - 3px);
  transform: translateX(-50%) rotate(135deg);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--brand-rgb), .24) transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb {
  background: rgba(var(--brand-rgb), .22);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--brand-rgb), .34);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ═══════════════════════════
   ANALYTICS VIEW
═══════════════════════════ */
.analytics-body {
  flex: 0 0 auto;
  overflow: visible;
  padding: 28px 32px;
  background: var(--bg2);
  display: flex; flex-direction: column; gap: 20px;
  min-width: 0;
  min-height: 100%;
}
#historie-view, #analyse-view {
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#historie-view .analytics-body,
#analyse-view .analytics-body,
#ausgang-view .analytics-body {
  padding: 10px 28px 10px;
  gap: 8px;
}
#governance-view .analytics-body {
  padding: 10px 28px 8px;
  gap: 8px;
}
.analytics-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  min-width: 0;
  align-items: stretch;
}
.analytics-main > .chart-card { min-width: 0; }
.analysis-cases-meta {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
@media (max-width: 1180px) {
  .analytics-main { grid-template-columns: 1fr; }
  .policy-layout { grid-template-columns: 1fr; min-height: 0; }
  .policy-list { max-height: 280px; }
}
.analytics-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 6px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}
.analytics-toolbar label { font-size: 12px; font-weight: 600; color: var(--text2); }
.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.toolbar-left > *,
.toolbar-right > * {
  flex-shrink: 0;
}
.toolbar-left .date-lbl { color: var(--text2); font-weight: 600; }
.toolbar-right {
  justify-content: flex-end;
  margin-left: 0;
}
.historie-toolbar .toolbar-right > .action-btn:nth-child(1) { order: 1; } /* Aktualisieren */
.historie-toolbar .toolbar-right > .action-btn:nth-child(2) { order: 2; } /* Export */
.historie-toolbar .toolbar-right > #btn-selection-delete { order: 3; }     /* Loeschen */
.historie-toolbar .toolbar-right > #btn-selection-mode { order: 4; }       /* Bestaetigen/Haken */

/* Historie/Analyse: Desktop eine Zeile, bei Resize kontrollierter Umbruch */
.historie-toolbar #pagesize-filter {
  width: auto;
  min-width: 110px;
}
.historie-toolbar .range-dd-count,
.analyse-toolbar .range-dd-count {
  width: 64px;
  min-width: 64px;
}
.historie-toolbar .range-dd-unit,
.analyse-toolbar .range-dd-unit {
  width: 108px;
  min-width: 108px;
}
.range-dd {
  position: relative;
  display: inline-flex;
}
.range-dd-btn {
  width: 100%;
  padding: 0 11px 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}
.range-dd-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.range-dd-caret {
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.range-dd-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--sh-lg);
  padding: 4px;
  max-height: 0;
  opacity: 0;
  transform: translateY(-5px);
  pointer-events: none;
  overflow: hidden auto;
  transition: max-height .28s cubic-bezier(.24,.7,.2,1), opacity .18s ease, transform .24s ease;
  z-index: 35;
}
.range-dd.open .range-dd-menu {
  max-height: 260px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.range-dd-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  border-radius: 9px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.range-dd-item:hover,
.range-dd-item.is-active {
  background: var(--blue-l);
  color: var(--blue);
}
.range-dd-count .range-count-inline-input {
  display: none;
  width: 48px;
  height: 24px;
  border-radius: 999px;
  border: 1.5px solid var(--border-s);
  background: #fff;
  color: var(--text2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 0 8px;
  outline: none;
}
.range-dd-count .range-count-inline-input:focus {
  border-color: rgba(var(--brand-rgb), .62);
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .12);
}
.range-dd-count .range-count-inline-input::-webkit-outer-spin-button,
.range-dd-count .range-count-inline-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.range-dd-count .range-count-inline-input[type="number"] {
  -moz-appearance: textfield;
}
.range-dd-count.is-editing .range-count-display {
  display: none;
}
.range-dd-count.is-editing .range-count-inline-input {
  display: inline-block;
}
.range-dd-count.is-editing .range-dd-caret {
  display: none;
}
.range-dd-count.is-editing .range-dd-btn {
  justify-content: center;
}
.historie-toolbar .date-dd,
.analyse-toolbar .date-dd,
.zup-toolbar-row .date-dd {
  width: 148px;
  min-width: 148px;
}
.date-dd .date-dd-btn {
  justify-content: space-between;
}
.date-dd .range-dd-value {
  font-variant-numeric: tabular-nums;
}
.range-dd-menu.date-dd-menu {
  left: 0;
  right: auto;
  width: 238px;
  min-width: 238px;
  padding: 8px;
  overflow: hidden !important;
  overflow-y: hidden !important;
  overflow-x: hidden !important;
}
.range-dd.open .range-dd-menu.date-dd-menu,
.date-dd.open .date-dd-menu {
  max-height: 560px !important;
  overflow: hidden !important;
  overflow-y: hidden !important;
  overflow-x: hidden !important;
}
.date-dd.align-right .date-dd-menu {
  left: auto;
  right: 0;
}
.date-dd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
}
.date-dd-month {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: .2px;
}
.date-dd-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1.5px solid var(--border-s);
  background: #fff;
  color: var(--blue);
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.date-dd-nav-btn:hover {
  border-color: rgba(var(--brand-rgb), .4);
  background: var(--blue-l);
}
.date-dd-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  margin-bottom: 4px;
}
.date-dd-weekdays span {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--light);
}
.date-dd-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.date-dd-day-blank {
  display: block;
  height: 28px;
}
.date-dd-day-btn {
  height: 28px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.date-dd-day-btn:hover {
  background: var(--blue-l);
  color: var(--blue);
}
.date-dd-day-btn.is-today {
  border-color: rgba(var(--brand-rgb), .32);
}
.date-dd-day-btn.is-selected {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.date-dd-foot {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.date-dd-foot button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.range-dd-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
@media (max-width: 1000px) {
  .analytics-toolbar {
    grid-template-columns: 1fr;
  }
  .toolbar-left,
  .toolbar-right {
    flex-wrap: wrap;
  }
  .toolbar-right {
    justify-content: flex-end;
  }
}
@media (max-width: 920px) {
  .toolbar-right {
    justify-content: flex-start;
  }
}
.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
}
.ctl {
  height: var(--pill-h);
  border-radius: 999px;
  border: var(--pill-bw) solid var(--border-s);
  background: #fff;
  color: var(--text2);
  font-family: var(--font);
  font-size: var(--pill-fs);
  font-weight: 600;
  outline: none;
  transition: border-color .15s, color .15s, background .15s;
}
.ctl:hover { border-color: var(--blue); color: var(--blue); }
.ctl:focus { border-color: var(--blue); }
select.ctl {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 30px 0 11px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300673b' stroke-width='2.4'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 11px center;
}
body[data-theme="blue"] select.ctl {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23005ea8' stroke-width='2.4'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 11px center;
}
input.ctl {
  padding: 0 11px;
  width: 120px;
}
input.ctl.ctl-date {
  color: var(--text2);
  -webkit-text-fill-color: var(--text2);
  font-weight: 600;
  border-color: var(--border-s);
  accent-color: var(--blue);
  caret-color: var(--blue);
}
input.ctl.ctl-date:hover,
input.ctl.ctl-date:focus,
input.ctl.ctl-date:active {
  color: var(--text2);
  -webkit-text-fill-color: var(--text2);
  border-color: rgba(var(--brand-rgb),.48);
  background: rgba(var(--brand-rgb),.06);
}
input.ctl.ctl-date:focus-visible {
  outline: none;
}
input.ctl.ctl-date::-webkit-datetime-edit {
  color: var(--text2);
  -webkit-text-fill-color: var(--text2);
}
input.ctl.ctl-date::-webkit-date-and-time-value,
input.ctl.ctl-date::-webkit-datetime-edit-text,
input.ctl.ctl-date::-webkit-datetime-edit-day-field,
input.ctl.ctl-date::-webkit-datetime-edit-month-field,
input.ctl.ctl-date::-webkit-datetime-edit-year-field {
  color: var(--text2);
  -webkit-text-fill-color: var(--text2);
}
input.ctl.ctl-date::-webkit-calendar-picker-indicator {
  opacity: .95;
  filter: saturate(1.15) contrast(1.05);
}
input.ctl.ctl-date::selection {
  background: rgba(var(--brand-rgb),.88);
  color: #fff;
}
input.ctl.ctl-date::-moz-selection {
  background: rgba(var(--brand-rgb),.88);
  color: #fff;
}
.historie-toolbar .date-lbl,
.analyse-toolbar .date-lbl {
  color: var(--text2) !important;
  font-weight: 600 !important;
}
.historie-toolbar #h-from,
.historie-toolbar #h-to,
.analyse-toolbar #a-from,
.analyse-toolbar #a-to {
  color: var(--text2) !important;
  -webkit-text-fill-color: var(--text2) !important;
  border-color: rgba(var(--brand-rgb),.32) !important;
  background: #fff !important;
  font-weight: 600 !important;
}
.historie-toolbar #h-from:hover,
.historie-toolbar #h-to:hover,
.analyse-toolbar #a-from:hover,
.analyse-toolbar #a-to:hover,
.historie-toolbar #h-from:focus,
.historie-toolbar #h-to:focus,
.analyse-toolbar #a-from:focus,
.analyse-toolbar #a-to:focus,
.historie-toolbar #h-from:active,
.historie-toolbar #h-to:active,
.analyse-toolbar #a-from:active,
.analyse-toolbar #a-to:active {
  border-color: rgba(var(--brand-rgb),.52) !important;
  background: rgba(var(--brand-rgb),.06) !important;
}
.historie-toolbar #h-from::-webkit-datetime-edit,
.historie-toolbar #h-to::-webkit-datetime-edit,
.analyse-toolbar #a-from::-webkit-datetime-edit,
.analyse-toolbar #a-to::-webkit-datetime-edit,
.historie-toolbar #h-from::-webkit-date-and-time-value,
.historie-toolbar #h-to::-webkit-date-and-time-value,
.analyse-toolbar #a-from::-webkit-date-and-time-value,
.analyse-toolbar #a-to::-webkit-date-and-time-value,
.historie-toolbar #h-from::-webkit-datetime-edit-text,
.historie-toolbar #h-to::-webkit-datetime-edit-text,
.analyse-toolbar #a-from::-webkit-datetime-edit-text,
.analyse-toolbar #a-to::-webkit-datetime-edit-text,
.historie-toolbar #h-from::-webkit-datetime-edit-day-field,
.historie-toolbar #h-to::-webkit-datetime-edit-day-field,
.analyse-toolbar #a-from::-webkit-datetime-edit-day-field,
.analyse-toolbar #a-to::-webkit-datetime-edit-day-field,
.historie-toolbar #h-from::-webkit-datetime-edit-month-field,
.historie-toolbar #h-to::-webkit-datetime-edit-month-field,
.analyse-toolbar #a-from::-webkit-datetime-edit-month-field,
.analyse-toolbar #a-to::-webkit-datetime-edit-month-field,
.historie-toolbar #h-from::-webkit-datetime-edit-year-field,
.historie-toolbar #h-to::-webkit-datetime-edit-year-field,
.analyse-toolbar #a-from::-webkit-datetime-edit-year-field,
.analyse-toolbar #a-to::-webkit-datetime-edit-year-field {
  color: var(--text2) !important;
  -webkit-text-fill-color: var(--text2) !important;
}
.action-btn {
  width: var(--pill-h);
  height: var(--pill-h);
  padding: 0;
  border-radius: 999px;
  border: var(--pill-bw) solid var(--border-s);
  background: #fff;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn-icon-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-icon-primary svg { stroke: #fff; }
.btn-icon-primary:hover { filter: brightness(1.1); border-color: var(--blue); }
.action-btn:hover {
  border-color: var(--blue);
  background: var(--blue-l);
}
.action-btn .btn-label { display: none; }
.action-btn.is-active {
  border-color: var(--blue);
  background: var(--blue-l);
}
.action-btn.danger {
  color: var(--red);
  border-color: rgba(196,36,74,.22);
}
.action-btn.danger:hover {
  border-color: var(--red);
  background: var(--red-l);
}
@media (min-width: 1500px) {
  .action-btn, .btn-icon {
    width: auto;
    padding: 0 10px;
  }
  .action-btn .btn-label, .btn-icon .btn-label {
    display: inline;
    font-size: 12px;
    font-weight: 600;
  }
}
@media (max-width: 1320px) {
  .header-action-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
  }
  .header-action-btn .label { display: none; }
}
.range-btn {
  padding: 6px 14px; border-radius: var(--radius-pill); border: var(--pill-bw) solid var(--border-s);
  background: #fff; color: var(--muted); font-family: var(--font); font-size: var(--pill-fs);
  font-weight: 600; cursor: pointer; transition: all .14s; line-height: 1;
}
.range-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.range-btn:hover:not(.active) { border-color: var(--blue); color: var(--blue); }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.kpi-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--rx);
  box-shadow: var(--sh-md); padding: 20px 22px;
  display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow var(--duration) var(--ease);
}
.kpi-card:hover {
  box-shadow: var(--sh-lg);
}
.kpi-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .55px; color: var(--muted); }
.kpi-value { font-size: 29px; font-weight: 700; letter-spacing: -1px; color: var(--text); line-height: 1; }
.kpi-sub { font-size: 11.5px; color: var(--light); }
.kpi-card.danger .kpi-value { color: var(--red); }
.kpi-card.warn .kpi-value { color: var(--warn); }
.kpi-card.blue .kpi-value { color: var(--blue); }

/* Charts grid (unused, kept for compat) */
.chart-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--rx);
  box-shadow: var(--sh-md); overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chart-hdr {
  padding: 14px 20px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.chart-title {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
}
.chart-body { padding: 20px; position: relative; min-height: 240px; flex: 1; }

/* Governance / Policy Layer */
.policy-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  min-height: 460px;
}
.gov-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
#governance-view .gov-toolbar-actions > .btn.btn-sm,
#governance-view .gov-toolbar-actions > .sb-edit-toggle {
  height: var(--pill-h);
  min-height: var(--pill-h);
  border-radius: 999px;
}
#governance-view .gov-toolbar-actions .btn.btn-sm {
  padding: 6px 12px;
  font-size: var(--pill-fs);
  font-weight: 600;
  line-height: 1;
}
#governance-view .gov-toolbar-actions .sb-edit-toggle {
  padding: 0 12px 0 9px;
  gap: 7px;
}
#governance-view .gov-toolbar-actions .sb-edit-toggle .tog {
  transform: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  border-width: 1.25px;
}
#governance-view .gov-toolbar-actions .sb-edit-toggle .tog::after {
  width: 14px;
  height: 14px;
  top: 2px;
  left: 2px;
}
#governance-view .gov-toolbar-actions .sb-edit-toggle .tog.on::after {
  transform: translateX(14px);
}
#governance-view .gov-toolbar-actions .sb-edit-toggle-label {
  font-size: var(--pill-fs);
  font-weight: 600;
  letter-spacing: .15px;
  line-height: 1;
}
.policy-list,
.policy-editor {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--rl);
}
.policy-list {
  max-height: 70vh;
  overflow: auto;
  padding: 8px;
}
.policy-item {
  border: 1px solid transparent;
  border-radius: var(--r);
  background: var(--bg2);
  padding: 10px 11px;
  margin-bottom: 6px;
  cursor: pointer;
}
.policy-item:hover { border-color: var(--border-s); }
.policy-item.active {
  border-color: rgba(var(--brand-rgb), .3);
  background: var(--blue-l);
}
.policy-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.policy-item-meta {
  margin-top: 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}
.policy-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-s);
  background: #fff;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.policy-badge.off {
  color: var(--muted);
  background: var(--bg3);
}
.policy-badge.pending { background: rgba(245,158,11,.12); color: #d97706; border-color: rgba(245,158,11,.25); }
.policy-badge.rejected { background: rgba(239,68,68,.1); color: #ef4444; border-color: rgba(239,68,68,.2); }
.policy-badge.auto { background: rgba(var(--brand-rgb),.08); color: var(--blue); border-color: rgba(var(--brand-rgb),.15); }
.policy-approve-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.policy-approve-btn { padding: 6px 16px; border-radius: 8px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--duration) var(--ease); }
.policy-approve-btn.approve { background: rgba(16,185,129,.1); color: #059669; }
.policy-approve-btn.approve:hover { background: rgba(16,185,129,.2); }
.policy-approve-btn.reject { background: rgba(239,68,68,.1); color: #ef4444; }
.policy-approve-btn.reject:hover { background: rgba(239,68,68,.2); }
.policy-editor {
  overflow: auto;
  padding: 14px;
}
.policy-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.policy-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.policy-help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.policy-empty {
  padding: 16px;
  border: 1.5px dashed var(--border-s);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--muted);
}

/* Cases table */
.cases-table-wrap {
  overflow: auto;
  max-height: min(70vh, 600px);
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--brand-rgb), .28) transparent;
}
.cases-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.cases-table-wrap::-webkit-scrollbar-track {
  background: rgba(var(--brand-rgb), .06);
  border-radius: 999px;
  margin: 6px 10px;
}
.cases-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(var(--brand-rgb), .24);
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.75);
}
.cases-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--brand-rgb), .36);
}
.cases-table thead th { position: sticky; top: 0; z-index: 2; }
.cluster-stat-wrap { overflow: auto; max-height: 360px; }
.cluster-stat-table thead th { position: sticky; top: 0; z-index: 2; }
.cases-table { width: 100%; border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
.cases-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: .01em;
  color: var(--muted); border-bottom: 1px solid var(--border); background: var(--bg2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.th-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}
.th-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.th-tools {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}
.cases-table th:hover .th-tools,
.th-tools:has(.active) {
  opacity: 1;
}
.th-icon-btn {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: var(--pill-bw) solid transparent;
  background: transparent;
  color: var(--light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: all var(--duration) var(--ease);
}
.th-icon-btn:hover { color: var(--blue); border-color: rgba(var(--brand-rgb),.22); background: #fff; }
.th-icon-btn.active { color: var(--blue); border-color: rgba(var(--brand-rgb),.3); background: var(--blue-l); }
.hist-filter-menu {
  position: fixed;
  z-index: 420;
  width: 270px;
  max-height: 320px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--sh-lg);
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(.98);
  transform-origin: top right;
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease), visibility 0s linear var(--duration);
}
.hist-filter-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease), visibility 0s;
}
.hist-filter-head {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hist-filter-search {
  width: 100%;
  height: 28px;
  border-radius: 999px;
  border: var(--pill-bw) solid var(--border-s);
  padding: 0 10px;
  font-size: 12px;
  outline: none;
}
.hist-filter-search:focus { border-color: var(--blue); }
.hist-filter-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.hist-filter-act {
  border: none;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.hist-filter-list {
  max-height: 230px;
  overflow: auto;
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hist-filter-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text2);
  padding: 4px 4px;
  border-radius: 8px;
}
.hist-filter-item:hover { background: var(--bg2); }
.hist-filter-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 4px;
}
.cases-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
}
.cases-table tbody tr {
  transition: background var(--duration) var(--ease);
}
.cases-table tr:hover td {
  background: rgba(var(--brand-rgb), .035);
}
.cases-table tr {
  transition: background var(--duration) var(--ease);
}
.cases-table tr:hover {
  box-shadow: inset 0 0 0 1px rgba(var(--brand-rgb), .06);
}
/* ═══════════════════════════
   SPLIT-VIEW (Master-Detail)
═══════════════════════════ */
#historie-view {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}
.historie-split-container {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.historie-master {
  flex: 1 1 100%;
  min-width: 0;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.historie-split-handle {
  display: none;
}
.historie-detail-pane {
  display: none;
}

@media (min-width: 1200px) {
  /* Override the global overflow-y:auto on #historie-view so the split fills height */
  #historie-view {
    overflow-y: hidden !important;
    overflow-x: hidden !important;
  }
  #historie-view > .analytics-body {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
  }
  /* Resize handle between master and detail */
  .historie-split-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 8px;
    cursor: col-resize;
    background: transparent;
    position: relative;
    z-index: 2;
  }
  .historie-split-handle::after {
    content: '';
    width: 4px;
    height: 36px;
    border-radius: 999px;
    background: var(--border-s);
    transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
  }
  .historie-split-handle:hover::after,
  .historie-split-handle.dragging::after {
    background: var(--blue);
    transform: scaleY(1.2);
  }
  /* Master panel — always 50% in split view */
  .historie-split-container .historie-master {
    border-right: none;
    flex: 0 0 50%;
  }
  /* Detail pane always visible at >= 1200px */
  .historie-split-container .historie-detail-pane {
    display: flex;
    flex: 1 1 0%;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg2);
    min-height: 0;
    animation: fadeSlideIn var(--duration-md, 280ms) var(--ease-out, cubic-bezier(.16, 1, .3, 1)) both;
  }
  .historie-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--border-s);
    font-size: 13px;
    font-weight: 500;
    user-select: none;
    letter-spacing: .01em;
    opacity: .7;
  }
  .historie-detail-content {
    display: flex;
    flex-direction: column;
    overflow: auto;
    flex: 1;
    min-height: 0;
  }
  /* Compact table in split view — fill full height */
  .historie-split-container .cases-table-wrap {
    max-height: none;
    flex: 1;
    min-height: 0;
  }
  .historie-split-container .chart-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .historie-split-container .cases-table-historie {
    min-width: 0 !important;
  }
  /* Compact workflow pills in split view — short text labels */
  .historie-split-container .status-badge {
    font-size: 10px;
    padding: 2px 8px;
    white-space: nowrap;
  }
  .historie-split-container .status-badge .stale-indicator {
    display: none;
  }
  .historie-split-container .workflow-cell-content {
    justify-content: center;
  }
  /* Tighter table padding in split view */
  .historie-split-container .cases-table td {
    padding: 9px 8px;
  }
  .historie-split-container .cases-table th {
    padding: 8px 8px;
  }
  /* In split view: hide i-button, keep attachment badge */
  .historie-split-container .cases-table-historie .hist-col-action .btn-info-dot:not(.hist-attach-icon-btn) {
    display: none;
  }
  /* Selected row accent */
  .historie-split-container .cases-table tr.is-split-active td {
    background: rgba(var(--brand-rgb), .07);
  }
  .historie-split-container .cases-table tr.is-split-active td:first-child {
    box-shadow: inset 4px 0 0 0 var(--split-accent-color, var(--blue));
  }
  /* Keyboard navigation highlight */
  .cases-table tr.is-kb-focus td {
    background: rgba(var(--brand-rgb), .05);
  }
  .cases-table tr.is-kb-focus td:first-child {
    box-shadow: inset 3px 0 0 0 rgba(var(--brand-rgb), .4);
  }
  .cases-table tbody:focus { outline: none; }
  .cases-table tr.is-split-active.is-kb-focus td {
    background: rgba(var(--brand-rgb), .1);
  }
  /* Slim clinic chip in split view */
  .historie-split-container .clinic-chip .txt {
    display: none;
  }
  .historie-split-container .clinic-chip .txt-short {
    display: inline;
  }
  /* Single-click rows in split view */
  .historie-split-container .cases-table tbody tr {
    cursor: pointer;
  }
  /* Detail pane header */
  .historie-detail-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    min-height: 44px;
    box-sizing: border-box;
    background: var(--blue);
    border-bottom: none;
    flex-shrink: 0;
    border-radius: var(--rl) var(--rl) 0 0;
    overflow: hidden;
    gap: 8px;
  }
  .historie-detail-hdr-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .historie-detail-hdr-title .clinic-chip { color: #fff !important; }
  .historie-detail-hdr-title .clinic-chip .txt-short { display: none; }
  .historie-detail-hdr-title .clinic-chip .txt { display: inline; color: #fff; }
  .historie-detail-hdr-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
  }
  .historie-detail-hdr-actions .btn,
  .btn.btn-on-dark {
    color: rgba(255,255,255,.85);
  }
  .historie-detail-hdr-actions .btn:hover,
  .btn.btn-on-dark:hover {
    color: #fff;
    background: rgba(255,255,255,.15);
  }
  .historie-detail-hdr-actions .btn svg,
  .btn.btn-on-dark svg {
    stroke: currentColor;
  }
  /* Split-view column widths */
  .historie-split-container .cases-table-historie .hist-col-date { width: 16%; }
  .historie-split-container .cases-table-historie .hist-col-patient { width: 34%; }
  .historie-split-container .cases-table-historie .hist-col-workflow { width: 18%; }
  .historie-split-container .cases-table-historie .hist-col-clinic { width: 18%; }
  .historie-split-container .cases-table-historie .hist-col-action { width: 6%; text-align: center; }
  /* Truncate long header labels */
  .historie-split-container .cases-table-historie th .th-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Inline attachment badge (split view) */
.hist-attach-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(var(--brand-rgb), .06);
}
.hist-attach-badge-inline svg { stroke: var(--muted); }

/* Detail body in split pane */
.historie-detail-body {
  padding: 20px 24px;
  overflow: auto;
  flex: 1;
}
.historie-detail-body .vcard-layout { display: block; }
.historie-detail-body .vcard-header { padding: 0 0 16px; }
.historie-detail-body .vcard-cluster-icon { display: none; }
.historie-detail-body .vcard-field-grid {
  grid-template-columns: 1fr;
}

/* ═══════════════════════════════════════
   ACTION HUB (Third pane)
═══════════════════════════════════════ */
.action-hub-handle {
  flex: 0 0 6px;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  touch-action: none;
}
.action-hub-handle::after {
  content: '';
  width: 4px;
  height: 36px;
  border-radius: 999px;
  background: var(--border-s);
  transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.action-hub-handle:hover::after,
.action-hub-handle:active::after {
  background: var(--blue);
  transform: scaleY(1.2);
}
.action-hub-pane {
  flex: 0 0 380px;
  min-width: 280px;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border-radius: var(--rl);
  overflow: hidden;
}
.action-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  min-height: 48px;
  box-sizing: border-box;
  background: var(--blue);
  flex-shrink: 0;
  border-radius: var(--rl) var(--rl) 0 0;
}
.action-hub-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-hub-header-title svg { stroke: #fff; }
/* .action-hub-close-btn: now handled by .btn-on-dark on the element */
.action-hub-close-btn { color: rgba(255,255,255,.85) !important; }
.action-hub-close-btn:hover { color: #fff !important; background: rgba(255,255,255,.15) !important; }
.action-hub-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.action-hub-section-hdr {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  padding: 10px 14px 6px;
  flex-shrink: 0;
}
.action-hub-todos {
  flex: 1 1 50%;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.action-hub-todos-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 8px;
}
.action-hub-empty {
  font-size: 12.5px;
  color: var(--light);
  text-align: center;
  padding: 20px 12px;
}
/* Todo card in hub */
.hub-todo-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: box-shadow var(--duration) var(--ease);
}
.hub-todo-card:hover {
  box-shadow: var(--sh-md);
}
.hub-todo-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.hub-todo-card .todo-check {
  flex-shrink: 0;
}
.hub-todo-target-chip {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-l);
  border: 1px solid rgba(var(--brand-rgb), .18);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.hub-todo-status {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 2px 7px;
  border-radius: 999px;
}
.hub-todo-status.is-open { color: var(--muted); background: rgba(var(--brand-rgb),.06); }
.hub-todo-status.is-progress { color: var(--warn); background: rgba(217,119,6,.08); }
.hub-todo-status.is-done { color: var(--green); background: rgba(0,138,79,.08); }
.hub-todo-status.is-cancelled { color: var(--red); background: rgba(196,36,74,.06); }
.hub-todo-reason {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}
.hub-todo-meta {
  font-size: 10.5px;
  color: var(--light);
  display: flex;
  align-items: center;
  gap: 6px;
}
.hub-todo-response {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
  line-height: 1.45;
}
.hub-todo-response-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
/* Vertical resize handle (between todos and chat) */
.action-hub-v-handle {
  flex: 0 0 6px;
  cursor: row-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  position: relative;
}
.action-hub-v-handle::after {
  content: '';
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-s);
  transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.action-hub-v-handle:hover::after,
.action-hub-v-handle:active::after {
  background: var(--blue);
  transform: scaleX(1.2);
}
/* Chat section */
.action-hub-chat {
  flex: 1 1 50%;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--border);
  position: relative;
}
.action-hub-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 8px;
}
/* User followup cards */
.hub-followup-card {
  cursor: pointer;
  transition: background .15s;
}
.hub-followup-card:hover {
  background: var(--bg2);
}
.hub-todo-target-chip.is-user {
  background: rgba(var(--brand-rgb), .1);
  color: var(--blue);
}
.hub-followup-reply-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--blue);
  background: rgba(var(--brand-rgb), .08);
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: auto;
}
.hub-followup-open-hint {
  color: var(--muted);
  font-size: 11px;
  margin-left: auto;
  opacity: .6;
}
.hub-followup-card:hover .hub-followup-open-hint {
  opacity: 1;
  color: var(--blue);
}
/* Mini-chat overlay */
.action-hub-minichat-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.action-hub-minichat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.action-hub-minichat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.action-hub-minichat-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0 4px;
}
.action-hub-minichat-close:hover { color: var(--text); }
.action-hub-minichat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.action-hub-minichat-input-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}
.action-hub-minichat-input-wrap .intake-pill-style {
  display: flex;
  align-items: flex-end;
  gap: 0;
  flex: 1;
  background: #fff;
  border: 1.5px solid var(--border-s);
  border-radius: 20px;
  padding: 4px 4px 4px 16px;
  box-shadow: var(--sh);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.action-hub-minichat-input-wrap .intake-pill-style:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .08), var(--sh);
}
.action-hub-chat-input-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: transparent;
}
.action-hub-chat-input-wrap .intake-pill-style {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  background: #fff;
  border: 1.5px solid var(--border-s);
  border-radius: 20px;
  padding: 4px 4px 4px 8px;
  box-shadow: var(--sh);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.action-hub-chat-input-wrap .intake-pill-style:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .08), var(--sh);
}
.action-hub-chat-input {
  flex: 1;
  resize: none;
  border: none;
  border-radius: 0;
  padding: 7px 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text);
  background: transparent;
  outline: none;
  max-height: 100px;
}
.action-hub-chat-input::placeholder { color: var(--light); }
.action-hub-chat-input:focus {
  border-color: transparent;
  box-shadow: none;
}
.action-hub-chat-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
  box-shadow: 0 2px 8px rgba(var(--brand-rgb), .18);
}
.action-hub-chat-send:hover { background: var(--blue-d, var(--blue)); transform: scale(1.05); }
.action-hub-chat-send:active { transform: scale(.95); }
.action-hub-chat-send:disabled { opacity: .5; cursor: default; transform: none; }
.action-hub-chat-send:focus, .action-hub-chat-send:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .3); }
.action-hub-chat-send svg { stroke: #fff; fill: none; }
/* Chat message bubbles */
.hub-chat-msg {
  margin-bottom: 10px;
  max-width: 92%;
  animation: rowFadeIn .2s var(--ease) both;
}
.hub-chat-msg.is-user {
  margin-left: auto;
}
.hub-chat-msg.is-bot {
  margin-right: auto;
}
.hub-chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.hub-chat-msg.is-user .hub-chat-bubble {
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.hub-chat-msg.is-bot .hub-chat-bubble {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.hub-chat-time {
  font-size: 10px;
  color: var(--light);
  margin-top: 3px;
  padding: 0 4px;
}
.hub-chat-msg.is-user .hub-chat-time { text-align: right; }
.hub-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}
.hub-chat-typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: hubTyping 1.2s ease-in-out infinite;
}
.hub-chat-typing-dot:nth-child(2) { animation-delay: .15s; }
.hub-chat-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes hubTyping {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
/* When hub is open: thirds layout */
.historie-split-container.has-hub .historie-master {
  flex: 1 1 33.3%;
}
.historie-split-container.has-hub .historie-detail-pane {
  flex: 1 1 33.3%;
  border-radius: var(--rl);
}
.historie-split-container.has-hub .historie-detail-hdr {
  border-radius: var(--rl) var(--rl) 0 0;
}
.historie-split-container.has-hub .action-hub-pane {
  display: flex !important;
  flex: 1 1 33.3%;
  border-radius: var(--rl);
}
.historie-split-container.has-hub .action-hub-header {
  border-radius: var(--rl) var(--rl) 0 0;
}
.historie-split-container.has-hub .action-hub-handle {
  display: flex !important;
}

.historie-detail-pane[style*="display: flex"],
.historie-detail-pane[style*="display:flex"] {
  animation: fadeSlideIn 280ms cubic-bezier(.16, 1, .3, 1) both;
}

/* Below 1200px: detail pane hidden, use overlay panel */
@media (max-width: 1199px) {
  .historie-detail-pane {
    display: none !important;
  }
  .historie-master {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .action-hub-pane,
  .action-hub-handle {
    display: none !important;
  }
}

.cases-table-historie { min-width: 700px; }
.cases-table-analyse { min-width: 980px; }
.cases-table-historie .hist-col-date { width: 15%; }
.cases-table-historie .hist-col-patient { width: 33%; }
.cases-table-historie .hist-col-workflow { width: 22%; }
.cases-table-historie .hist-col-clinic { width: 22%; }
.cases-table-historie .hist-col-action { width: 8%; text-align: right; }
.cases-table-historie td.hist-col-action { overflow: visible; }

/* ── Urgency row accents ── */
.cases-table tr.has-emergency {
  border-left: 3.5px solid #dc2626;
  background: rgba(220, 38, 38, .04);
}
.cases-table tr.has-emergency:hover {
  background: rgba(220, 38, 38, .07);
}
.cases-table tr.has-redflags {
  border-left: 3.5px solid #d97706;
  background: rgba(217, 119, 6, .03);
}
.cases-table tr.has-redflags:hover {
  background: rgba(217, 119, 6, .06);
}
.cases-table-historie th.hist-col-workflow,
.cases-table-historie td.hist-col-workflow,
.cases-table-analyse th.ana-col-workflow,
.cases-table-analyse th.ana-col-status,
.cases-table-analyse td.ana-col-workflow,
.cases-table-analyse td.ana-col-status {
  text-align: center;
}
.cases-table-historie th.hist-col-workflow .th-cell {
  justify-content: center;
}
.cases-table-historie th.hist-col-workflow .th-label {
  flex: 0 1 auto;
  text-align: center;
}
.cases-table-historie th.hist-col-workflow .th-tools {
  margin-left: 0;
}
.workflow-cell-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.status-cell-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.hist-action-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.hist-attach-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hist-attach-icon-btn svg {
  width: 12px;
  height: 12px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hist-attach-count {
  position: absolute;
  right: -5px;
  top: -5px;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}
.hist-attach-dd {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  max-width: min(420px, 72vw);
  background: #fff;
  border: 1px solid var(--border-s);
  border-radius: 12px;
  box-shadow: var(--sh-lg);
  padding: 10px;
  z-index: 120;
}
.hist-attach-dd::after {
  content: "";
  position: absolute;
  left: var(--hist-attach-arrow-x, 20px);
  top: -6px;
  width: 10px;
  height: 10px;
  transform: translateX(-50%) rotate(45deg);
  background: #fff;
  border-left: 1px solid var(--border-s);
  border-top: 1px solid var(--border-s);
}
.hist-attach-dd.is-up::after {
  top: auto;
  bottom: -6px;
  transform: translateX(-50%) rotate(225deg);
}
.hist-attach-dd-hdr {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .35px;
  margin-bottom: 8px;
}
.hist-attach-dd-grid {
  display: grid;
  grid-template-columns: repeat(var(--hist-attach-cols, 1), minmax(0, 1fr));
  gap: 8px;
  max-height: min(48vh, 360px);
  overflow: auto;
  padding-right: 2px;
  align-content: start;
}
.hist-attach-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 72px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 8px 9px;
  color: var(--text2);
  cursor: pointer;
  text-align: left;
}
.hist-attach-card:hover {
  border-color: rgba(var(--brand-rgb), .28);
  background: var(--blue-l);
}
.hist-attach-card-image {
  padding: 7px 8px 8px;
}
.hist-attach-preview-wrap {
  position: relative;
  width: 100%;
  height: 78px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
  overflow: hidden;
}
.hist-attach-card-image.is-stacked .hist-attach-preview-wrap::before,
.hist-attach-card-image.is-stacked .hist-attach-preview-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  z-index: 0;
}
.hist-attach-card-image.is-stacked .hist-attach-preview-wrap::before {
  transform: translate(4px, -4px);
  opacity: .55;
}
.hist-attach-card-image.is-stacked .hist-attach-preview-wrap::after {
  transform: translate(8px, -8px);
  opacity: .35;
}
.hist-attach-preview-wrap img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hist-attach-preview-empty {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.hist-attach-card-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--blue);
  letter-spacing: .35px;
}
.hist-attach-card-name {
  width: 100%;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-attach-card-meta {
  width: 100%;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-attach-doc-icon {
  width: 18px;
  height: 18px;
  color: var(--text2);
  display: inline-flex;
  flex: 0 0 auto;
}
.hist-attach-doc-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hist-attach-row-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hist-attach-row-head .hist-attach-card-name {
  flex: 1 1 auto;
  min-width: 0;
}
.hist-attach-doc-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(var(--brand-rgb), .22);
  background: var(--blue-l);
  color: var(--blue);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .25px;
  text-transform: uppercase;
}
.hist-attach-dd-empty,
.hist-attach-dd-loading,
.hist-attach-dd-error {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 2px 2px;
}
.hist-attach-dd-error {
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hist-attach-retry {
  border: none;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.cases-table-analyse .ana-col-date { width: 12%; }
.cases-table-analyse .ana-col-patient { width: 18%; }
.cases-table-analyse .ana-col-workflow { width: 12%; }
.cases-table-analyse .ana-col-cluster { width: 20%; }
.cases-table-analyse .ana-col-clinic { width: 17%; }
.cases-table-analyse .ana-col-status { width: 9%; }
.cases-table-analyse .ana-col-nd { width: 8%; }
.cases-table-analyse .ana-col-action { width: 4%; text-align: right; }
.cases-table-historie .hist-col-select { width: 36px; }
.hist-select-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  cursor: pointer;
  vertical-align: middle;
}
.hist-select-pill > input[type="checkbox"] {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.hist-select-pill-ui {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1.5px solid rgba(var(--brand-rgb), .34);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08), inset 0 0 0 1px rgba(255,255,255,.55);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.hist-select-pill-ui svg {
  width: 12px;
  height: 12px;
  display: block;
  opacity: 0;
  transform: scale(.86);
  transition: opacity .14s ease, transform .14s ease;
}
.hist-select-pill > input[type="checkbox"]:checked + .hist-select-pill-ui {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 2px 6px rgba(var(--brand-rgb), .35);
}
.hist-select-pill > input[type="checkbox"]:checked + .hist-select-pill-ui svg {
  opacity: 1;
  transform: scale(1);
}
.hist-select-pill > input[type="checkbox"]:focus-visible + .hist-select-pill-ui {
  outline: 2px solid rgba(var(--brand-rgb), .35);
  outline-offset: 2px;
}
.cell-truncate {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.patient-cell-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}
.patient-text-block {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}
.patient-name-text {
  font-weight: 600;
  line-height: 1.2;
}
.patient-dob-text {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}
.patient-emergency-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}
.clinic-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
  max-width: 100%;
}
.clinic-chip .txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clinic-chip .txt-short {
  display: none;
  font-weight: 700;
  letter-spacing: .5px;
  white-space: nowrap;
}
.clinic-chip-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.clinic-chip-group .clinic-chip {
  max-width: calc(50% - 10px);
}
.clinic-chip-sep {
  color: var(--light);
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600;
  letter-spacing: .01em; color: #fff; border: none;
}
.status-badge.completed {
  background: rgba(5, 150, 105, .95);
}
.status-badge.escalated {
  background: rgba(197, 48, 48, .95);
}
.status-badge.abandoned {
  background: rgba(122, 127, 134, .95);
}
.status-badge.in_progress {
  background: rgba(196, 138, 6, .95);
}
.status-badge.in_progress::before {
  display: none;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}
.stale-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: .85em;
  animation: stale-pulse 2s ease-in-out infinite;
  cursor: help;
}
@keyframes stale-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.status-badge.wf-new {
  background: rgba(212, 101, 42, .95);
  font-weight: 700;
}
.status-badge.wf-new::before {
  display: none;
}
.status-badge.wf-in-progress {
  background: rgba(196, 138, 6, .95);
}
.status-badge.wf-done {
  background: rgba(5, 150, 105, .95);
}
.status-badge.wf-cancelled {
  background: rgba(122, 127, 134, .95);
}
.cases-table-wrap.compact-workflow .workflow-cell-content .status-badge {
  position: relative;
  min-width: 18px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 999px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-indent: -9999px;
  overflow: hidden;
}
.cases-table-wrap.compact-workflow .status-badge.completed,
.cases-table-wrap.compact-workflow .status-badge.wf-done { color: #059669; }
.cases-table-wrap.compact-workflow .status-badge.in_progress,
.cases-table-wrap.compact-workflow .status-badge.wf-in-progress { color: #d97706; }
.cases-table-wrap.compact-workflow .status-badge.escalated { color: #c53030; }
.cases-table-wrap.compact-workflow .status-badge.wf-new { color: #d4652a; }
.cases-table-wrap.compact-workflow .status-badge.abandoned,
.cases-table-wrap.compact-workflow .status-badge.wf-cancelled { color: #7a7f86; }
.cases-table-wrap.compact-workflow .workflow-cell-content .status-badge::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.85);
}
.cases-table-wrap.compact-workflow .workflow-cell-content .workflow-badge-btn:hover {
  transform: none;
  box-shadow: none;
}
.workflow-badge-btn {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.workflow-badge-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.workflow-badge-btn:disabled {
  cursor: default;
  box-shadow: none;
  transform: none;
  opacity: .75;
}
.pagination { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); justify-content: flex-end; font-size: 13px; }

/* Loading overlay */
.chart-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.8); font-size: 13px; color: var(--muted); font-weight: 600;
}

/* Cluster stats table */
.cluster-stat-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cluster-stat-table th {
  text-align: left; padding: 10px 16px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--light); border-bottom: 2px solid var(--border); background: var(--bg2);
  white-space: nowrap;
}
.cluster-stat-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cluster-stat-table tr:hover td { background: var(--blue-l); cursor: pointer; }
.cluster-stat-bar-wrap { width: 100px; height: 6px; background: var(--border); border-radius: 99px; display:inline-block; vertical-align: middle; }
.cluster-stat-bar { height: 6px; border-radius: 99px; background: var(--blue); }
.cluster-stat-bar.danger { background: var(--red); }

/* Case rows – dblclick hint */
.cases-table tbody tr { cursor: pointer; }
.cases-table tbody tr:active td { background: var(--blue-l); }

/* vCard detail modal */
#case-detail-panel {
  justify-content: flex-start;
  padding: clamp(12px,2.6vw,26px);
}
#case-detail-panel .panel-box {
  width: min(980px, calc(100vw - clamp(24px,5.2vw,74px)));
  max-height: 88vh;
  transform-origin: left center;
  transition: width .28s cubic-bezier(.2,.7,.2,1), transform .25s cubic-bezier(.34,1.4,.64,1);
}
#case-detail-panel.attachments-rail-open .panel-box {
  width: min(1340px, calc(100vw - clamp(24px,5.2vw,74px)));
}
.vcard-layout { display: block; }
.vcard-layout.has-attachment-rail {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(250px,300px);
  gap: 14px;
  align-items: start;
}
.vcard-wrap { font-family: var(--font); }
.vcard-header {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 16px 20px; background: var(--bg2);
  border-bottom: 1px solid rgba(var(--brand-rgb),.15);
  border-radius: var(--r) var(--r) 0 0;
  margin-bottom: 16px;
}
.vcard-cluster-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--blue);
  color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vcard-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.vcard-meta-box {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 100%;
  min-height: 0;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.vcard-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 0; min-width: 0; }
.vcard-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vcard-sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px 12px;
  flex-wrap: wrap;
  align-items: center;
  line-height: 1.04;
  margin-top: 6px;
}
.vcard-status-inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: 2px;
}
.vcard-meta .vcard-attach-icon-btn {
  margin-left: 12px;
  align-self: center;
}
.vcard-header-side {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.action-hub-trigger-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border-s);
  background: #fff;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--sh);
}
.action-hub-trigger-btn:hover {
  border-color: var(--blue);
  background: var(--blue-l);
  box-shadow: var(--sh-md);
  transform: scale(1.05);
}
.action-hub-trigger-btn:active {
  transform: scale(.95);
}
.action-hub-trigger-btn svg {
  stroke: var(--blue);
}
.vcard-status-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  justify-content: center;
  min-height: 0;
}
.vcard-attach-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: var(--pill-bw) solid rgba(var(--brand-rgb), .22);
  background: #fff;
  color: var(--blue);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  flex: 0 0 36px;
}
.vcard-attach-icon-btn:hover {
  border-color: rgba(var(--brand-rgb), .38);
  background: rgba(var(--brand-rgb), .07);
}
.vcard-attach-icon-btn.is-active {
  border-color: rgba(var(--brand-rgb), .46);
  background: rgba(var(--brand-rgb), .1);
}
.vcard-attach-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
}
.vcard-attach-count {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  border: 1.5px solid var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vcard-attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.vcard-layout.has-attachment-rail .vcard-attachments-grid {
  flex-direction: column;
  flex-wrap: nowrap;
  margin-top: 0;
}
.vcard-attachments-rail {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg2);
  padding: 12px;
  max-height: calc(88vh - 190px);
  overflow: auto;
}
.vcard-attachments-rail-title {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: .01em;
  color: var(--text2);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(var(--brand-rgb), .08);
}
.vcard-layout.has-attachment-rail .vcard-attachments-grid > * {
  width: min(100%, 240px);
}
.vcard-layout.has-attachment-rail .vcard-attachments-grid embed {
  width: 100% !important;
}
.vcard-section { margin-bottom: 16px; }
.vcard-section-title {
  font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: .01em;
  color: var(--text2); margin-bottom: 8px; padding-bottom: 5px;
  border-bottom: 1px solid rgba(var(--brand-rgb), .08);
}
.vcard-section-head-inline {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.vcard-section-head-inline .vcard-section-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.vcard-conv-toggle-btn {
  min-height: 22px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 600;
}
.conv-list-modular {
  max-height: 50vh;
  overflow-y: auto;
}
.conv-msg-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.conv-msg-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.conv-msg {
  border: var(--pill-bw) solid var(--border-s);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.conv-msg-bot {
  border: 1.5px solid var(--blue);
}
.vcard-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.vcard-field { }
.vcard-field-label { font-size: 11px; color: var(--light); font-weight: 600; margin-bottom: 2px; }
.vcard-field-value { font-size: 13.5px; font-weight: 600; color: var(--text); }
.vcard-alert-panel {
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  background: #fff;
  padding: 10px 14px;
}
.vcard-alert-panel.is-warn {
  border-color: rgba(217, 119, 6, .35);
  border-left-color: rgb(217, 119, 6);
  border-left-width: 4px;
  background: rgba(217, 119, 6, .06);
}
.vcard-alert-panel.is-danger {
  border-color: rgba(196, 36, 74, .35);
  border-left-color: rgb(196, 36, 74);
  border-left-width: 4px;
  background: rgba(196, 36, 74, .06);
}
.vcard-alert-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .65px;
  margin-bottom: 8px;
}
.vcard-alert-panel.is-warn .vcard-alert-title { color: var(--warn); }
.vcard-alert-panel.is-danger .vcard-alert-title { color: var(--red); }
.vcard-alert-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.vcard-alert-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 0;
  border: 0;
  background: transparent;
  padding: 0;
  max-width: 100%;
  min-width: 0;
}
.vcard-alert-key {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .42px;
  flex: 0 0 auto;
}
.vcard-alert-key.is-warn {
  color: #92400e;
  border: 1px solid rgba(217, 119, 6, .45);
  background: rgba(217, 119, 6, .18);
}
.vcard-alert-key.is-danger {
  color: #fff;
  border: 1px solid rgba(196, 36, 74, .7);
  background: rgb(196, 36, 74);
}
.vcard-alert-msg {
  font-size: 13px;
  color: var(--text);
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
}
.vcard-edit-actions {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--brand-rgb),.2);
  background: var(--blue-l);
  border-radius: var(--r);
}
.vcard-edit-grid { display: flex; flex-direction: column; gap: 8px; }
.vcard-edit-row {
  padding: 9px 12px;
  border-radius: var(--r);
  background: var(--bg2);
  border: 1px solid var(--border);
}
.vcard-edit-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.vcard-edit-input {
  width: 100%;
  border: var(--pill-bw) solid var(--border-s);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
}
.vcard-edit-input:focus { outline: none; border-color: var(--blue); }
.vcard-history-box {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #fff;
  padding: 10px 12px;
}
.vcard-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.vcard-history-table th,
.vcard-history-table td {
  border-bottom: 1px solid var(--border);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}
.vcard-history-table th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  background: var(--bg2);
}
.vcard-history-old { color: var(--red); }
.vcard-history-new { color: var(--green); font-weight: 600; }
.vcard-followup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vcard-followup-item {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #fff;
  padding: 9px 11px;
}
.vcard-followup-item.is-replied {
  border-color: rgba(8,145,90,.28);
  background: rgba(8,145,90,.04);
}
.vcard-followup-item.is-failed {
  border-color: rgba(196,36,74,.26);
  background: rgba(196,36,74,.04);
}
.vcard-followup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.vcard-followup-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 190px;
  max-width: 56%;
}
.vcard-followup-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border-s);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
  background: #fff;
}
.vcard-followup-status.is-queued {
  color: #9d174d;
  border-color: rgba(157, 23, 77, .34);
  background: rgba(157, 23, 77, .08);
}
.vcard-followup-status.is-sent {
  color: #0f5da8;
  border-color: rgba(15, 93, 168, .34);
  background: rgba(15, 93, 168, .08);
}
.vcard-followup-status.is-replied {
  color: var(--green);
  border-color: rgba(8,145,90,.34);
  background: rgba(8,145,90,.1);
}
.vcard-followup-status.is-failed,
.vcard-followup-status.is-cancelled {
  color: var(--red);
  border-color: rgba(196,36,74,.34);
  background: rgba(196,36,74,.08);
}
.vcard-followup-time {
  font-size: 11px;
  color: var(--light);
}
.vcard-followup-response-plain {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
}
.vcard-followup-response-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .35px;
  text-transform: uppercase;
  font-weight: 700;
}
.vcard-followup-response-text {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text2);
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-weight: 600;
}
.vcard-followup-row {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
}
.vcard-followup-row + .vcard-followup-row {
  margin-top: 6px;
}
.vcard-followup-row b {
  color: var(--muted);
  font-weight: 700;
}
.vcard-followup-map {
  margin-top: 7px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg2);
}
.vcard-followup-map strong {
  color: var(--text2);
  font-weight: 700;
}
@media (max-width: 900px) {
  .vcard-followup-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .vcard-followup-meta {
    min-width: 0;
    max-width: 100%;
    align-items: flex-start;
  }
  .vcard-followup-response-plain {
    align-items: flex-start;
  }
  .vcard-followup-response-text {
    text-align: left;
  }
}
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.todo-empty {
  font-size: 12px;
  color: var(--muted);
}
.todo-row {
  display: grid;
  grid-template-columns: 22px minmax(260px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}
.todo-check {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1.4px solid var(--border-s);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}
.todo-check svg {
  width: 12px;
  height: 12px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.todo-check.is-done {
  background: #fff;
  border-color: rgba(15, 136, 88, .55);
  color: var(--green);
}
.todo-check.is-done svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.7;
}
.todo-check.is-progress {
  background: #fff5dc;
  border-color: rgba(217, 119, 6, .5);
}
.todo-check.is-progress::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--warn);
}
.todo-check.is-cancelled {
  background: #fff;
  border-color: rgba(196, 36, 74, .45);
  color: var(--red);
}
.todo-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.todo-main .todo-head {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .38px;
}
.todo-main .todo-text {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  white-space: normal;
  line-height: 1.3;
  max-width: 74ch;
}
.todo-main .todo-meta {
  font-size: 10px;
  color: var(--muted);
}
.todo-row.todo-row-task {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  border-radius: 999px;
  padding: 4px 0;
  border: 0;
  background: transparent;
}
.todo-row.todo-row-task .todo-main-shell {
  --todo-shell-color: var(--blue);
  --todo-shell-rgb: var(--brand-rgb);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  border-radius: 999px;
  border: 1px solid rgba(var(--todo-shell-rgb), .34);
  background: #fff;
  padding: 5px 10px;
  min-height: 42px;
}
.todo-row.todo-row-task .todo-main-shell .todo-check {
  flex: 0 0 auto;
  margin-right: 2px;
}
.todo-row.todo-row-task .todo-main {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: center;
  flex-wrap: nowrap;
}
.todo-row.todo-row-task .todo-route {
  flex: 0 1 auto;
  max-width: 54%;
  min-width: 0;
  justify-content: flex-end;
}
.todo-row.todo-row-task .todo-route .todo-route-pill {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo-task-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  padding: 0 12px;
  min-width: 0;
  max-width: 56ch;
  width: min(100%, 56ch);
  flex: 1 1 260px;
  margin: 0 auto;
  text-align: center;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 18px), transparent 100%);
}
.todo-route-pill.todo-route-pill-src {
  background: rgba(var(--todo-dept-rgb, var(--brand-rgb)), .08);
}
.todo-route-pill.todo-route-pill-tgt {
  background: rgba(var(--todo-dept-rgb, var(--brand-rgb)), .12);
}
.todo-row.todo-row-task .todo-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-self: center;
  margin: 0 0 0 auto;
  flex: 0 0 auto;
}
.todo-row.todo-row-task .todo-pill {
  width: 30px;
  height: 30px;
  border-color: rgba(var(--todo-shell-rgb, var(--brand-rgb)), .34);
  color: var(--todo-shell-color, var(--blue));
}
.todo-row.todo-row-task .todo-pill:hover {
  border-color: rgba(var(--todo-shell-rgb, var(--brand-rgb)), .5);
  background: rgba(var(--todo-shell-rgb, var(--brand-rgb)), .12);
}
.todo-row.todo-row-task .todo-pill.is-active {
  border-color: rgba(var(--todo-shell-rgb, var(--brand-rgb)), .48);
  background: rgba(var(--todo-shell-rgb, var(--brand-rgb)), .14);
  color: var(--todo-shell-color, var(--blue));
}
.todo-row.todo-row-task .todo-pill.todo-pill-cancel,
.todo-row.todo-row-task .todo-pill.todo-pill-cancel:hover,
.todo-row.todo-row-task .todo-pill.todo-pill-cancel.is-active {
  color: var(--red);
  border-color: rgba(196, 36, 74, .34);
}
.todo-row.todo-row-task .todo-pill.todo-pill-cancel:hover,
.todo-row.todo-row-task .todo-pill.todo-pill-cancel.is-active {
  background: var(--red-l);
}
.todo-row.todo-row-task .todo-pill svg {
  width: 14px;
  height: 14px;
}
.todo-row.todo-row-task .todo-text {
  display: none;
}
.todo-route {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.todo-route-arrow {
  color: var(--muted);
  font-weight: 700;
}
.todo-route-pill {
  --todo-dept-color: var(--blue);
  --todo-dept-rgb: var(--brand-rgb);
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(var(--todo-dept-rgb), .4);
  color: var(--todo-dept-color);
  padding: 2px 10px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.todo-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}
.todo-pill {
  border: 1px solid var(--border-s);
  background: #fff;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  cursor: pointer;
}
.todo-pill span {
  display: none;
}
.todo-pill:hover {
  border-color: rgba(var(--brand-rgb), .34);
  background: var(--blue-l);
}
.todo-pill:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: #fff;
}
.todo-pill svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.todo-pill.todo-pill-cancel {
  color: var(--red);
  border-color: rgba(196, 36, 74, .32);
}
.todo-pill.todo-pill-cancel:hover {
  background: var(--red-l);
  border-color: rgba(196, 36, 74, .45);
  color: var(--red);
}
.todo-pill.is-active {
  background: var(--blue-l);
  border-color: rgba(var(--brand-rgb), .34);
  color: var(--blue);
}
.todo-pill.todo-pill-cancel.is-active {
  background: var(--red-l);
  border-color: rgba(196, 36, 74, .32);
  color: var(--red);
}
.todo-draft-wrap {
  margin-top: 10px;
  padding: 5px 10px;
  border: 1.25px dashed rgba(var(--brand-rgb), .42);
  border-radius: 999px;
  background: #fff;
  min-height: 42px;
  display: block;
  position: relative;
}
.todo-draft-wrap.is-open {
  padding: 5px 10px 10px;
  border-radius: 12px;
  min-height: 0;
  height: auto;
  display: block;
}
.todo-draft-wrap:not(.is-open) .todo-draft-head {
  min-height: 30px;
}
.todo-draft-wrap:not(.is-open) .todo-draft-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0;
}
.todo-draft-wrap:not(.is-open) .todo-draft-composer {
  display: none;
}
.todo-draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  flex: 1 1 auto;
}
.todo-draft-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0;
}
.todo-draft-toggle-btn {
  width: 30px;
  height: 30px;
  margin-left: auto;
  border-radius: 999px;
  border: 1px solid rgba(var(--brand-rgb), .34);
  background: #fff;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .16s, background .16s, color .16s;
}
.todo-draft-toggle-btn:hover {
  border-color: rgba(var(--brand-rgb), .34);
  background: var(--blue-l);
  color: var(--blue);
}
.todo-draft-toggle-btn svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.todo-draft-toggle-btn.is-open {
  border-color: rgba(var(--brand-rgb), .34);
  background: var(--blue-l);
  color: var(--blue);
}
.todo-draft-composer {
  margin-top: 8px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height .24s ease, opacity .2s ease;
}
.todo-draft-composer.open {
  max-height: 280px;
  opacity: 1;
  pointer-events: auto;
}
.todo-row.todo-row-compose {
  border-radius: 999px;
  border-color: rgba(var(--brand-rgb), .34);
  padding: 5px 10px;
  grid-template-columns: minmax(0, 1fr);
}
.todo-draft-wrap.is-open .todo-row.todo-row-compose {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}
.todo-row.todo-row-compose .todo-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.todo-compose-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.todo-compose-line-target {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.todo-compose-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}
.todo-compose-actions .todo-pill {
  width: var(--pill-h);
  height: var(--pill-h);
}
.todo-compose-actions .todo-pill svg {
  width: 14px;
  height: 14px;
}
.todo-pill.todo-pill-send {
  color: var(--blue);
  border-color: rgba(var(--brand-rgb), .34);
  background: rgba(var(--brand-rgb), .06);
}
.todo-pill.todo-pill-send:hover {
  color: var(--blue);
  border-color: rgba(var(--brand-rgb), .5);
  background: rgba(var(--brand-rgb), .14);
}
.todo-compose-prefix {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .44px;
  color: var(--muted);
  flex: 0 0 auto;
}
.todo-inline-target {
  min-width: 0;
  max-width: min(56vw, 340px);
  width: auto;
  flex: 0 0 auto;
  padding-left: 11px;
  padding-right: 29px;
}
.todo-inline-target-control {
  min-width: 0;
  max-width: min(56vw, 340px);
  width: auto;
  flex: 0 0 auto;
}
.todo-inline-prompt {
  flex: 1 1 100%;
  min-width: 0;
  width: 100% !important;
  max-width: none;
}
.todo-target-pill {
  min-width: 0;
  max-width: none;
  width: auto;
}
.todo-target-dd {
  position: relative;
  display: inline-flex;
  min-width: 0;
  max-width: min(56vw, 360px);
}
.todo-target-dd-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--text2);
  border-color: var(--border-s);
  background: #fff;
  width: auto;
  min-width: 124px;
  max-width: min(56vw, 360px);
  padding-left: 14px;
  padding-right: 34px;
}
.todo-target-dd-value {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.todo-target-dd-caret {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  flex: 0 0 auto;
}
.todo-target-dd-caret svg {
  width: 12px;
  height: 12px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.todo-target-dd-btn:hover {
  border-color: rgba(var(--brand-rgb), .48);
  color: var(--blue);
}
.todo-target-dd.open .todo-target-dd-btn {
  border-color: rgba(var(--brand-rgb), .58);
}
.todo-target-dd-menu {
  position: fixed;
  left: 0;
  top: 0;
  width: max-content;
  min-width: 180px;
  max-width: min(560px, 86vw);
  background: #fff;
  border: 1px solid var(--border-s);
  border-radius: 14px;
  box-shadow: var(--sh-lg);
  padding: 6px;
  max-height: 0;
  opacity: 0;
  transform: translateY(-5px);
  pointer-events: none;
  overflow: hidden auto;
  z-index: 9999;
  transition: max-height .26s cubic-bezier(.24,.7,.2,1), opacity .18s ease, transform .22s ease;
}
.todo-target-dd.open .todo-target-dd-menu {
  max-height: 392px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.todo-target-dd-item {
  width: 100%;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--text2);
  font-family: var(--font);
  font-size: var(--pill-fs);
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  transition: background .14s, color .14s;
}
.todo-target-dd-item:hover,
.todo-target-dd-item.is-active {
  background: var(--blue-l);
  color: var(--blue);
}
.todo-target-dd-item.is-disabled {
  opacity: .55;
  cursor: default;
}
.todo-target-dd-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.todo-target-pill.is-auto {
  color: var(--todo-target-color, var(--blue));
  border-color: rgba(var(--todo-target-rgb, var(--brand-rgb)), .48);
  background-color: rgba(var(--todo-target-rgb, var(--brand-rgb)), .1);
}
.todo-target-pill.is-auto:hover,
.todo-target-pill.is-auto:focus {
  color: var(--todo-target-color, var(--blue));
  border-color: rgba(var(--todo-target-rgb, var(--brand-rgb)), .62);
  background-color: rgba(var(--todo-target-rgb, var(--brand-rgb)), .14);
}
.todo-target-pill.is-user {
  color: var(--blue);
  border-color: rgba(var(--brand-rgb), .48);
  background-color: rgba(var(--brand-rgb), .12);
}
.todo-draft-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ═══════════════════════════
   RESPONSIVE
═══════════════════════════ */

/* Hamburger-Button (nur mobile) */
.mob-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer;
  color: var(--text2); flex-shrink: 0;
  transition: background .15s;
}
.mob-menu-btn:hover { background: var(--bg2); }

/* Sidebar-Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(var(--overlay-rgb),.45);
  backdrop-filter: blur(2px);
  z-index: 190;
}
.sidebar-overlay.show { display: block; }

/* ── Tablet (≤ 1100px) ── */
@media (max-width: 1100px) {
  #case-detail-panel {
    justify-content: center;
    padding: 0;
  }
  #case-detail-panel .panel-box,
  #case-detail-panel.attachments-rail-open .panel-box {
    width: min(900px, 93vw);
  }
  .vcard-layout.has-attachment-rail { display: block; }
  aside { width: 220px; min-width: 220px; }
  main { padding: 20px 22px; }
  .analytics-body { padding: 20px 22px; }
  #historie-view .analytics-body,
  #analyse-view .analytics-body,
  #governance-view .analytics-body { padding: 10px 18px 8px; gap: 8px; }
  .usz-logo-name span { display: none; }
  .q-row { flex-wrap: wrap; align-items: stretch; }
  .q-key { flex: 1 1 100%; width: 100%; max-width: none; }
  .q-text { flex: 1 1 100%; min-width: 0; }
  .q-acts { margin-left: auto; }
  .todo-row {
    grid-template-columns: 22px minmax(140px, 1fr);
  }
  .todo-row.todo-row-task .todo-main {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .todo-row.todo-row-task .todo-main-shell {
    width: 100%;
    gap: 8px;
    padding: 5px 8px;
  }
  .todo-row.todo-row-task .todo-route {
    max-width: 100%;
  }
  .vcard-alert-msg {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }
  .vcard-alert-item {
    border-radius: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .todo-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
  .todo-row.todo-row-task .todo-actions {
    grid-column: auto;
    justify-content: flex-end;
  }
  .todo-compose-line-target {
    flex-wrap: nowrap;
  }
  .todo-compose-actions {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }
  .todo-inline-target,
  .todo-inline-target-control {
    width: auto !important;
    min-width: 120px;
    max-width: 100%;
  }
  .todo-inline-prompt {
    width: 100% !important;
    min-width: 0;
    max-width: none;
  }
}

/* ── Narrow desktop / large tablet (≤ 900px) ── */
@media (max-width: 900px) {
  .usz-header-right { gap: 4px; }
  .header-action-btn .label { display: none; }
  .user-nm { display: none; }
  .clinic-select { min-width: 90px; font-size: 12px; }
  .usz-nav-item { padding: 10px 14px; font-size: 13px; }
  .toolbar-divider { display: none; }
  input.ctl { width: 118px; }
}

/* ── Mobile (≤ 760px) ── */
@media (max-width: 760px) {
  /* App-screen: fixed height für mobile Browser */
  #app-screen { height: 100dvh; }

  /* Header */
  .usz-header-inner { padding: 0 14px; height: 56px; gap: 10px; }
  .usz-logo-icon { width: 32px; height: 32px; font-size: 16px; }
  .usz-logo-name strong { font-size: 14px; letter-spacing: 1.4px; }
  body[data-theme="blue"] .usz-logo-icon { width: 34px; height: 34px; font-size: 10px; }
  body[data-theme="blue"] .usz-logo-name strong { font-size: 13px; letter-spacing: -.2px; }
  .usz-logo-name span { display: none; }
  .usz-header-right { gap: 4px; }
  .usz-header-right { display: none !important; } /* Header-Tools auf Mobile ausblenden */
  .theme-switch { transform: scale(.95); transform-origin: right center; }

  /* Subnav */
  .mob-menu-btn:not(.hidden) { display: flex; }
  .mob-menu-btn.hidden { display: none !important; }
  .usz-subnav { padding: 0 10px; gap: 0; overflow-x: auto; overflow-y: hidden; }
  .usz-nav-item { padding: 10px 12px; font-size: 13px; }
  .clinic-select-wrap { display: none !important; } /* im Sidebar sichtbar */
  .user-nm { display: none; }
  .user-pill { padding: 4px 8px; gap: 6px; }
  .user-av { width: 22px; height: 22px; font-size: 10.5px; }

  /* Sidebar als Overlay */
  aside {
    position: fixed;
    left: -280px;
    top: 0; bottom: 0;
    z-index: 200;
    width: 264px; min-width: 264px;
    box-shadow: var(--sh-lg);
    transition: left .25s cubic-bezier(.4,0,.2,1);
  }
  aside.open { left: 0; }

  /* Main */
  main { padding: 14px 16px; gap: 12px; }
  .card-body { padding: 16px; }
  .card-hdr { padding: 12px 16px; }

  /* Analytics */
  .analytics-body { padding: 14px 16px; gap: 14px; }
  #historie-view .analytics-body,
  #analyse-view .analytics-body,
  #governance-view .analytics-body { padding: 8px 12px 6px; gap: 6px; }
  .analytics-toolbar { gap: 6px; padding: 0; }
  .toolbar-left, .toolbar-right { gap: 6px; }
  .toolbar-right { margin-left: 0; }
  .toolbar-divider { display: none; }
  .ctl { height: var(--pill-h); font-size: 11.5px; }
  input.ctl { width: 106px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-value { font-size: 26px; }
  .charts-grid { grid-template-columns: 1fr; }

  /* Login */
  .login-h { font-size: 26px; letter-spacing: -.5px; }
  .login-sub { font-size: 13.5px; }
  .lc-body { padding: 22px; }
  .usz-footer {
    grid-template-columns: 1fr;
    row-gap: 2px;
    text-align: center;
    padding: 10px 16px;
    font-size: 11px;
  }
  .usz-footer .footer-left,
  .usz-footer .footer-center,
  .usz-footer .footer-right { justify-self: center; }

  /* Panels */
  .panel-box { width: 98vw; max-height: 92vh; border-radius: var(--rl); }
  #case-detail-panel .panel-box,
  #case-detail-panel.attachments-rail-open .panel-box { width: 98vw; }
  .panel-hdr { padding: 14px 18px; }
  .panel-body { padding: 16px 18px; }
  .panel-footer { padding: 12px 18px; }

  /* Editor topbar */
  .editor-topbar { margin: -14px -16px 12px; padding: 10px 16px; top: -14px; }
  .editor-topbar-title { font-size: 12px; }
  .editor-topbar-cluster { max-width: 120px; }

  /* Form rows */
  .form-row { flex-direction: column; }
  .field-row { flex-direction: column; }
  .field, .form-field { min-width: 0; }

  /* Tables: horizontal scroll */
  .cases-table-wrap, .u-table { overflow-x: auto; display: block; }
  .u-table tbody, .u-table tr, .u-table td { display: block; }
  .u-table th { display: none; }
  .u-table td { padding: 6px 10px; border-bottom: none; }
  .u-table tr { border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 8px; padding: 4px 0; }

  /* vCard */
  .vcard-field-grid { grid-template-columns: 1fr; }

  /* Dept list */
  .dept-list-row { flex-wrap: wrap; align-items: flex-start; }
  .dept-list-actions { width: 100%; justify-content: flex-end; }

  /* Dept access roles: wrap */
  .dept-access-row { flex-wrap: wrap; }
  .dept-access-role { flex-wrap: wrap; }
}

/* ── Skeleton loading ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 37%, var(--bg3) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--r);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}
.skeleton * { visibility: hidden; }
.skeleton-text {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-33 { width: 33%; }
.skeleton-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.skeleton-badge {
  width: 64px;
  height: 22px;
  border-radius: var(--radius-pill);
}

/* ═══════════════════════════
   ZUWEISER VIEW
═══════════════════════════ */
#zuweiser-view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}
.zuweiser-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  width: 100%;
}
.zuweiser-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}
.zuweiser-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 180ms var(--ease);
}
.zuweiser-tab:hover {
  color: var(--text);
  background: var(--bg2);
  border-color: var(--border);
}
.zuweiser-tab.active {
  color: var(--blue);
  background: var(--blue-l);
  border-color: rgba(var(--brand-rgb), .2);
  font-weight: 600;
}
.zuweiser-tab svg {
  flex-shrink: 0;
  opacity: .6;
}
.zuweiser-tab.active svg {
  opacity: 1;
}

/* Intake Card */
.zuweiser-intake-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--sh-lg);
  overflow: hidden;
}
.zuweiser-intake-progress {
  height: 3px;
  background: var(--bg3);
  position: relative;
  overflow: hidden;
}
.zuweiser-intake-progress-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
  transition: width .5s var(--ease-out);
}

/* Steps */
.zuweiser-step {
  padding: 36px 32px;
  display: none;
  animation: fadeSlideUp 350ms var(--ease-out) both;
}
.zuweiser-step.active { display: block; }

.zuweiser-step-kicker {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.zuweiser-step-kicker::before {
  content: '';
  width: 16px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}
.zuweiser-step-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.zuweiser-step-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* Textarea */
.zuweiser-textarea {
  width: 100%;
  min-height: 180px;
  padding: 16px 18px;
  border: 1.5px solid var(--border-s);
  border-radius: 14px;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg2);
  resize: vertical;
  outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.zuweiser-textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12);
}
.zuweiser-textarea::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* File Attach */
.zuweiser-attach {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: color var(--duration);
}
.zuweiser-attach:hover { color: var(--blue); }
.zuweiser-attach input { display: none; }
.zuweiser-attach-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1.5px dashed var(--border-s);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--duration), background var(--duration);
}
.zuweiser-attach:hover .zuweiser-attach-icon {
  border-color: var(--blue);
  background: var(--blue-l);
}

/* Actions */
.zuweiser-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
}

/* Buttons: consolidated into .btn .btn-lg (see BUTTONS section) */

/* Loading */
.zuweiser-loading {
  text-align: center;
  padding: 60px 32px !important;
}
@keyframes zuwPulseRing {
  0% { transform: scale(.8); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.zuweiser-loading-ring {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  position: relative;
}
.zuweiser-loading-ring::before,
.zuweiser-loading-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--blue);
}
.zuweiser-loading-ring::before {
  animation: zuwPulseRing 1.5s var(--ease-out) infinite;
}
.zuweiser-loading-ring::after {
  animation: zuwPulseRing 1.5s var(--ease-out) .4s infinite;
}
.zuweiser-loading-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--blue);
}
.zuweiser-loading-text {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

/* Smart Form */
.zuweiser-cluster-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--blue-l);
  border: 1px solid rgba(var(--brand-rgb), .2);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}
.zuweiser-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.zuweiser-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zuweiser-form-field.full-width {
  grid-column: 1 / -1;
}
.zuweiser-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.zuweiser-req { color: var(--red); font-size: 10px; }
.zuweiser-extracted-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--blue);
  background: var(--blue-l);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
}
/* Form inputs: consolidated into .form-input (see BUTTONS section) */

/* Urgency */
.zuweiser-urgency {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.zuweiser-urgency-opt {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--border-s);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  transition: all var(--duration) var(--ease);
}
.zuweiser-urgency-opt:hover {
  border-color: rgba(var(--brand-rgb), .3);
  background: var(--blue-l);
}
.zuweiser-urgency-opt.sel-normal {
  border-color: var(--blue);
  background: var(--blue-l);
  color: var(--blue);
}
.zuweiser-urgency-opt.sel-eilig {
  border-color: var(--warn);
  background: var(--warn-l);
  color: var(--warn);
}
.zuweiser-urgency-opt.sel-notfall {
  border-color: var(--red);
  background: var(--red-l);
  color: var(--red);
}
.zuweiser-urgency-opt input { display: none; }

/* Success */
.zuweiser-success {
  text-align: center;
  padding: 60px 32px !important;
}
.zuweiser-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--blue-l);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--blue);
  animation: scaleIn .4s var(--ease-out) both;
}

/* Cases List */
.zuweiser-cases-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
}
.zuweiser-cases-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.zuweiser-case-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: var(--sh);
  transition: box-shadow var(--duration-md) var(--ease), transform var(--duration-md) var(--ease);
  cursor: pointer;
}
.zuweiser-case-card:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-1px);
}
.zuweiser-case-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.zuweiser-case-cluster {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.zuweiser-case-date {
  font-size: 11px;
  color: var(--muted);
}
.zuweiser-case-summary {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.zuweiser-case-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/* Mobile */
@media (max-width: 640px) {
  .zuweiser-body { padding: 16px 12px 40px; }
  .zuweiser-step { padding: 24px 20px; }
  .zuweiser-step-title { font-size: 19px; }
  .zuweiser-textarea { min-height: 150px; font-size: 16px; }
  .zuweiser-form-grid { grid-template-columns: 1fr; }
  .form-input { font-size: 16px; min-height: 44px; }
  .zuweiser-urgency { flex-direction: column; }
  .btn-lg { width: 100%; justify-content: center; }
  .zuweiser-actions { flex-direction: column-reverse; }
  .zuweiser-intake-card { border-radius: 16px; }
}

/* ═══════════════════════════
   MOBILE OPTIMIZATION (≤768px)
═══════════════════════════ */

/* 8. Safe Area Insets for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .usz-subnav {
      padding-bottom: env(safe-area-inset-bottom);
    }
    body, #app-screen {
      padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
  }
}

@media (max-width: 768px) {

  /* 1. Bottom Navigation for Mobile */
  .usz-subnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    z-index: 200;
    background: #fff;
    border-top: 1px solid rgba(0,0,0,.06);
    border-bottom: none;
    padding: 0;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 -2px 12px rgba(0,0,0,.06);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    background: rgba(255,255,255,.92);
  }
  .usz-subnav .usz-nav-item {
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px 6px;
    font-size: 10px;
    flex: 1;
    text-align: center;
    justify-content: center;
    border-bottom: none;
    min-height: 52px;
  }
  .usz-subnav .usz-nav-item.active {
    border-bottom: none;
    color: var(--blue);
  }
  .usz-subnav .usz-nav-item .usz-nav-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
  }
  .usz-subnav-right {
    display: none;
  }
  /* Prevent content from being hidden behind bottom nav */
  body {
    padding-bottom: 60px;
  }
  #app-screen {
    padding-bottom: 60px;
  }

  /* 2. Header Compact for Mobile */
  .usz-header-inner {
    padding: 0 14px;
    height: 50px;
    gap: 10px;
  }
  .usz-logo-icon {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
  .usz-logo-name strong {
    font-size: 14px;
  }
  .usz-logo-name span {
    font-size: 9.5px;
  }

  /* 3. Cases Table Mobile Optimization */
  .cases-table {
    font-size: 12px;
  }
  .cases-table td {
    padding: 10px 8px;
  }
  .cases-table th {
    padding: 8px;
    font-size: 9.5px;
  }
  /* Hide less important columns on mobile */
  .cases-table .hist-col-workflow,
  .cases-table .hist-col-action {
    display: none;
  }
  .cases-table-pagination {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
  }

  /* 4. Panels Full-Screen on Mobile */
  .panel-box {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0 !important;
  }
  .panel-body {
    padding: 14px !important;
  }
  .panel-hdr {
    padding: 12px 14px;
    border-radius: 0;
  }
  #admin-panel .panel-body {
    padding: 12px !important;
  }
  #admin-panel .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 2px;
    padding-bottom: 6px;
  }
  #admin-panel .tab {
    flex-shrink: 0;
    font-size: 11.5px;
    padding: 6px 12px;
  }

  /* 5. Touch-Friendly Targets */
  .btn, .ctl {
    min-height: 44px;
    padding: 8px 16px;
  }
  .btn-sm {
    min-height: 38px;
    padding: 6px 14px;
  }
  .btn-xs {
    min-height: 34px;
    padding: 5px 12px;
  }
  input[type=text], input[type=number], input[type=password], input[type=email], textarea, select {
    min-height: 44px;
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }

  /* 6. Login Page Mobile */
  .login-body {
    padding: 20px 14px;
  }
  .login-h {
    font-size: 22px;
  }
  .login-sub {
    font-size: 13px;
  }
  .login-card {
    border-radius: 12px;
  }
  .lc-body {
    padding: 20px;
  }
  .l-input {
    min-height: 44px;
    font-size: 16px !important;
  }
  .l-btn {
    min-height: 48px;
    font-size: 15px;
  }

  /* 7. Action Hub Mobile */
  .action-hub-chat {
    height: auto;
    min-height: 200px;
  }
  .action-hub-chat-input-wrap textarea {
    min-height: 44px;
    font-size: 16px !important;
  }

}

/* ═══════════════════════════════════════
   ZUWEISER PORTAL (Ausgang / Anfrage)
═══════════════════════════════════════ */

/* ── Shell: split table + detail ── */
.zup-split-container { display: flex; flex: 1; min-height: 0; overflow: hidden; gap: 0; }
.zup-master { flex: 0 0 33%; min-width: 280px; max-width: 60%; overflow: hidden; display: flex; flex-direction: column; }
.zup-master .cases-table { table-layout: fixed; }
.zup-master .cases-table th, .zup-master .cases-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zup-master .chart-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.zup-master .cases-table-wrap { flex: 1; max-height: none; min-height: 0; }
.zup-split-handle { display: flex; align-items: center; justify-content: center; flex: 0 0 8px; cursor: col-resize; z-index: 2; }
.zup-split-handle::after { content: ''; width: 4px; height: 36px; border-radius: 999px; background: var(--border-s); transition: background var(--duration) var(--ease), transform var(--duration) var(--ease); }
.zup-split-handle:hover::after, .zup-split-handle.dragging::after { background: var(--blue); transform: scaleY(1.2); }
.zup-detail-pane { flex: 1 1 0%; display: flex; flex-direction: column; overflow: hidden; background: var(--bg2); min-height: 0; }
.zup-pane { display: none; flex: 1; flex-direction: column; overflow: hidden; min-height: 0; }
.zup-pane.active { display: flex; }
.zup-cases-table { min-width: 400px; }

/* Compact status dots in Ausgang table when column is narrow */
.zup-cases-table .status-badge {
  font-size: 10px;
  padding: 2px 8px;
  white-space: nowrap;
}
.zup-master .status-badge {
  position: relative;
  min-width: 18px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 999px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-indent: -9999px;
  overflow: hidden;
}
.zup-master .status-badge::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.85);
}
.zup-master .status-badge.completed,
.zup-master .status-badge.wf-done { color: #059669; }
.zup-master .status-badge.in_progress,
.zup-master .status-badge.wf-in-progress { color: #d97706; }
.zup-master .status-badge.escalated { color: #c53030; }
.zup-master .status-badge.wf-new { color: #d4652a; }
.zup-master .status-badge.abandoned,
.zup-master .status-badge.wf-cancelled { color: #7a7f86; }
.zup-cases-table tbody tr:hover td { background: rgba(var(--brand-rgb), .035); }
.zup-cases-table tbody tr.is-split-active td { background: rgba(var(--brand-rgb), .07); }
.zup-cases-table tbody tr.is-split-active td:first-child { box-shadow: inset 4px 0 0 0 var(--blue); }
@media (max-width: 900px) {
  .zup-split-container { flex-direction: column; }
  .zup-master { flex: 0 0 auto; max-height: 40vh; }
  .zup-detail-pane { flex: 1; border-left: none; border-top: 1px solid var(--border); }
}

/* Dept status pills */
.cc-dept-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .2px; }
.cc-dept-pill.waiting { background: rgba(var(--brand-rgb),.06); color: var(--muted); border: 1px solid var(--border); }
.cc-dept-pill.progress { background: rgba(245,158,11,.1); color: #d97706; border: 1px solid rgba(245,158,11,.22); }
.cc-dept-pill.answered { background: rgba(16,185,129,.1); color: #059669; border: 1px solid rgba(5,150,105,.2); }
.cc-dept-pill.resolved-pill { background: var(--bg3); color: var(--light); border: 1px solid var(--border); }

/* ── Intake: Empty state (ChatGPT-style pill) ── */
/* Zuweiser Dept-Auswahl Modal */
.zup-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9999; display: flex; align-items: center; justify-content: center; animation: rowFadeIn .15s var(--ease) both; }
.zup-modal-card { background: var(--bg); border-radius: 14px; box-shadow: var(--sh-lg); width: min(380px, 90vw); max-height: 70vh; display: flex; flex-direction: column; overflow: hidden; }
.zup-modal-title { font-size: 14px; font-weight: 700; color: var(--text); padding: 16px 20px 8px; }
.zup-modal-list { flex: 1; overflow-y: auto; padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.zup-modal-dept-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: transparent; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--text); cursor: pointer; transition: background var(--duration) var(--ease); text-align: left; width: 100%; }
.zup-modal-dept-item:hover { background: rgba(var(--brand-rgb), .06); }
.zup-modal-dept-item .dept-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.zup-modal-actions { padding: 8px 20px 16px; display: flex; justify-content: flex-end; }
.zup-modal-btn { border: none; background: none; font-size: 13px; font-weight: 600; color: var(--blue); cursor: pointer; padding: 6px 12px; border-radius: 6px; transition: background var(--duration) var(--ease); }
.zup-modal-btn:hover { background: rgba(var(--brand-rgb), .06); }
.zup-profile-section { padding: 0 20px 16px; }
.zup-profile-label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; margin-top: 12px; }
.zup-profile-input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: var(--font); color: var(--text); background: var(--bg); transition: border-color var(--duration) var(--ease); }
.zup-profile-input:focus { outline: none; border-color: var(--blue); }
.zup-profile-input::placeholder { color: var(--light); }
.zup-profile-subuser { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; position: relative; background: var(--bg2); }
.zup-profile-subuser .zup-profile-input { font-size: 12px; padding: 6px 10px; }
.zup-profile-remove-btn { position: absolute; top: 4px; right: 4px; border: none; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 6px; line-height: 1; }
.zup-profile-remove-btn:hover { color: var(--red, #ef4444); }

/* Drag & Drop visual feedback */
.zup-pane.drag-active { outline: 3px dashed var(--blue); outline-offset: -3px; background: rgba(var(--brand-rgb), .03); }
/* Zuweiser case detail attachments */
.zup-cd-attachments { padding: 12px 0 4px; border-top: 1px solid var(--border); margin-top: 8px; }
.zup-cd-att-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 8px; }
.zup-cd-att-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.zup-cd-att-grid .file-pill { text-decoration: none; cursor: pointer; }

.intake-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px 80px; }
.intake-pill-wrap { width: min(680px, 100%); }
.intake-guidance { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.guidance-q { display: inline-flex; align-items: center; padding: 5px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; color: var(--text2); font-size: 12px; font-weight: 600; cursor: pointer; transition: all var(--duration) var(--ease); white-space: nowrap; }
.guidance-q:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
/* Guidance Cards */
.guidance-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.guidance-card-cluster { border-left: 3px solid var(--blue); background: rgba(var(--brand-rgb), .02); }
.guidance-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.guidance-card-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.guidance-card-cluster .guidance-card-title { color: var(--blue); }
.guidance-card-count { font-size: 10px; font-weight: 700; color: var(--light); background: var(--bg); border-radius: 999px; padding: 1px 7px; }
.guidance-card-fields { display: flex; flex-wrap: wrap; gap: 4px; }
.guidance-field { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; transition: all var(--duration) var(--ease); }
.guidance-field.is-filled { color: var(--green); opacity: .6; }
.guidance-field.is-filled .guidance-field-check { color: var(--green); }
.guidance-field.is-missing { color: var(--text2); background: #fff; border: 1px solid var(--border); cursor: pointer; }
.guidance-field.is-missing:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.guidance-field-check { font-size: 11px; flex-shrink: 0; }
/* Guidance collapse toggle */
.guidance-toggle { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; cursor: pointer; border-radius: 8px; transition: background var(--duration) var(--ease); }
.guidance-toggle:hover { background: rgba(var(--brand-rgb), .04); }
.guidance-toggle-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.guidance-toggle-arrow { font-size: 10px; color: var(--light); }
.guidance-cards-wrap { display: none; flex-direction: column; gap: 4px; }
.dl-guidance.is-expanded .guidance-cards-wrap,
.intake-guidance.is-expanded .guidance-cards-wrap { display: flex; }
.is-expanded > .guidance-toggle .guidance-toggle-arrow { transform: rotate(180deg); }

/* Guidance loading shimmer */
.guidance-loading { position: relative; pointer-events: none; }
.guidance-loading::after { content: ''; position: absolute; inset: 0; border-radius: 8px; background: linear-gradient(90deg, transparent 0%, rgba(var(--brand-rgb),.06) 40%, rgba(var(--brand-rgb),.12) 50%, rgba(var(--brand-rgb),.06) 60%, transparent 100%); background-size: 200% 100%; animation: guidanceShimmer 1.2s ease-in-out infinite; }
@keyframes guidanceShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Akte shimmer (streaming-like loading) */
.akte-shimmer { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.akte-shimmer-row { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--bg2) 0%, rgba(var(--brand-rgb),.08) 40%, rgba(var(--brand-rgb),.14) 50%, rgba(var(--brand-rgb),.08) 60%, var(--bg2) 100%); background-size: 200% 100%; animation: guidanceShimmer 1.4s ease-in-out infinite; }
.akte-shimmer-row.short { width: 60%; }

/* Starter templates */
.intake-starters { text-align: center; margin-bottom: 16px; }
.starter-hint { font-size: 13px; color: var(--muted); margin-bottom: 10px; font-weight: 500; }
.starter-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.starter-chip { display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; color: var(--text2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--duration) var(--ease); box-shadow: var(--sh-sm); font-family: var(--font); }
.starter-chip:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.08); transform: translateY(-1px); }
.starter-chip:active { transform: translateY(0); }

/* Voice CTA */
.intake-voice-cta { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 14px; }
.voice-cta-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; color: var(--text2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--duration) var(--ease); font-family: var(--font); box-shadow: var(--sh-sm); }
.voice-cta-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.voice-cta-btn svg { flex-shrink: 0; }
.voice-cta-hint { font-size: 11px; color: var(--light); }

.mode-text { width: 100%; }
.intake-pill { display: flex; align-items: flex-end; gap: 0; background: #fff; border: 1.5px solid var(--border-s); border-radius: 20px; padding: 6px 6px 6px 18px; box-shadow: var(--sh-md); transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease); }
.intake-pill:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(var(--brand-rgb),.08), var(--sh-md); }
.intake-pill-input { flex: 1; border: none; background: transparent; resize: none; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); padding: 8px 0; min-height: 24px; max-height: 120px; outline: none; box-shadow: none; -webkit-appearance: none; }
.intake-pill-input:focus { outline: none; box-shadow: none; }
.intake-pill-input::placeholder { color: var(--light); }
.intake-pill-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.conv-icon-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--duration) var(--ease); flex-shrink: 0; }
.conv-icon-btn:hover { background: var(--bg2); color: var(--text2); }
.conv-icon-btn.conv-mic:hover { color: var(--blue); background: var(--blue-l); }
.intake-pill-send { background: var(--blue) !important; color: #fff !important; }
.intake-pill-send:hover { filter: brightness(1.1); }

/* File pills */
.file-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.file-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 12px; font-weight: 500; color: var(--text2); max-width: 100%; }
.file-pill.has-preview { flex-direction: row; flex-wrap: wrap; padding: 8px 10px; }
.fp-info { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.fp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-state-label { font-size: 10px; color: var(--blue); font-weight: 600; white-space: nowrap; }
.fp-preview { width: 100%; font-size: 11px; color: var(--muted); line-height: 1.4; margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; animation: dlRowIn .3s ease both; }
.fp-icon { font-size: 9px; font-weight: 800; padding: 2px 5px; border-radius: 4px; text-transform: uppercase; letter-spacing: .4px; }
.fp-icon.pdf { background: #fef2f2; color: #dc2626; border: 1px solid rgba(220,38,38,.2); }
.fp-icon.img { background: var(--blue-l); color: var(--blue); border: 1px solid rgba(var(--brand-rgb),.2); }
.fp-size { font-size: 10.5px; color: var(--light); }
.fp-state { font-size: 11px; }
.fp-spin { display: inline-block; animation: spin .8s linear infinite; }
.fp-ok { color: var(--green); }
.fp-x { border: none; background: none; color: var(--light); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; transition: color .15s; }
.fp-x:hover { color: var(--red); }

/* ── Intake: Split layout (text + akte) ── */
.intake-split { flex: 1; display: grid; grid-template-columns: 1fr 340px; gap: 16px; padding: 20px 24px; overflow: auto; min-height: 0; }
.intake-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.intake-right { display: flex; flex-direction: column; min-width: 0; }
.intake-input-card { background: #fff; border: 1px solid var(--border); border-radius: var(--rl); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.intake-toolbar { display: flex; align-items: center; gap: 6px; }
@media (max-width: 900px) { .intake-split { grid-template-columns: 1fr; } }

/* ── Akte card ── */
.akte-card { background: #fff; border: 1px solid var(--border); border-radius: var(--rl); box-shadow: var(--sh); display: flex; flex-direction: column; overflow: hidden; position: sticky; top: 0; }
.akte-header { padding: 14px 18px; background: var(--bg2); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.akte-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.akte-progress { font-size: 12px; font-weight: 700; color: var(--blue); }
.akte-section { padding: 12px 16px; display: flex; flex-direction: column; gap: 0; overflow: auto; max-height: 420px; }
.akte-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.akte-row:last-child { border-bottom: none; }
.akte-k { font-size: 11.5px; font-weight: 600; color: var(--muted); min-width: 90px; flex-shrink: 0; }
.akte-v { flex: 1; color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.akte-missing { color: var(--light); font-style: italic; }
.akte-ai { font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--blue-l); color: var(--blue); border: 1px solid rgba(var(--brand-rgb),.18); flex-shrink: 0; }
.akte-depts { padding: 10px 16px; border-top: 1px solid var(--border); }
.akte-dept-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.akte-footer { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--bg2); }
/* .conv-send-btn: consolidated into .btn .btn-primary .btn-lg .btn-block */

/* Dept chips (intake) */
.akte-dept-chips .dept-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all var(--duration) var(--ease); border: 1.5px solid rgba(var(--brand-rgb),.3); color: var(--blue); background: var(--blue-l); }
.akte-dept-chips .dept-chip.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.akte-dept-chips .dept-chip.inactive { opacity: .4; border-style: dashed; }
.akte-dept-chips .dept-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.akte-dept-chips .dept-chip-name { white-space: nowrap; }
.akte-dept-chips .dept-chip-x { border: none; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; opacity: .5; margin-left: 2px; padding: 0; }
.akte-dept-chips .dept-chip-x:hover { opacity: 1; }
.dept-add-btn { width: 28px; height: 28px; border-radius: 50%; border: 1.5px dashed var(--border-s); background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--duration) var(--ease); }
.dept-add-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }

/* ── Dictation live layout ── */
.dict-live-layout { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 0; }
.dl-status { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg2); flex-shrink: 0; }
.dl-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: statusPulse 2s ease-in-out infinite; flex-shrink: 0; }
.dl-status-label { font-size: 12px; font-weight: 700; color: var(--text2); }
.dl-status-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--blue); }
.dl-fields { flex: 1; overflow: auto; padding: 10px 16px; }
.dl-field { display: flex; flex-direction: column; gap: 3px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fff; animation: rowFadeIn var(--duration) var(--ease) both; }
.dl-field.dl-field-in { border-left: 3px solid var(--blue); }
.dl-field.dl-field-empty { border-style: dashed; color: var(--light); }
.dl-field-k { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.dl-field-v { font-size: 13px; color: var(--text); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Editable table layout */
.dl-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; border: 1px solid var(--border); border-radius: var(--rl); overflow: hidden; background: #fff; }
.dl-row td { padding: 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dl-row:last-child td { border-bottom: none; }
.dl-row-k { font-size: 11px; font-weight: 700; color: var(--muted); padding: 8px 12px !important; width: 120px; min-width: 100px; background: var(--bg2); white-space: nowrap; border-right: 1px solid var(--border); }
.dl-row-input { width: 100%; border: none; background: transparent; padding: 8px 12px; font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--text); outline: none; transition: background var(--duration) var(--ease); }
.dl-row-input:focus { background: rgba(var(--brand-rgb), .04); }
/* Staggered fade-in for rows appearing after analysis */
.dl-table .dl-row { animation: dlRowIn .3s ease both; }
.dl-table .dl-row:nth-child(1) { animation-delay: 0s; }
.dl-table .dl-row:nth-child(2) { animation-delay: .05s; }
.dl-table .dl-row:nth-child(3) { animation-delay: .1s; }
.dl-table .dl-row:nth-child(4) { animation-delay: .15s; }
.dl-table .dl-row:nth-child(5) { animation-delay: .2s; }
.dl-table .dl-row:nth-child(6) { animation-delay: .25s; }
.dl-table .dl-row:nth-child(7) { animation-delay: .3s; }
.dl-table .dl-row:nth-child(8) { animation-delay: .35s; }
.dl-table .dl-row:nth-child(n+9) { animation-delay: .4s; }
@keyframes dlRowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
/* Confidence bar also fades in */
.dl-confidence { animation: dlRowIn .35s ease both; }
.dl-row-input::placeholder { color: var(--light); }
.dl-row-v { position: relative; }
.dl-row-ai { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 8px; font-weight: 700; padding: 1px 5px; border-radius: 999px; background: var(--blue-l); color: var(--blue); border: 1px solid rgba(var(--brand-rgb),.15); opacity: .5; pointer-events: none; }

/* Confidence indicator */
.dl-confidence { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; margin-bottom: 2px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.dl-confidence.conf-high { background: rgba(34,197,94,.08); color: #16a34a; }
.dl-confidence.conf-mid { background: rgba(234,179,8,.08); color: #a16207; }
.dl-confidence.conf-low { background: rgba(239,68,68,.08); color: #dc2626; }
.dl-conf-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-conf-badge { font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; flex-shrink: 0; }
.dl-confidence.conf-high .dl-conf-badge { background: rgba(34,197,94,.15); }
.dl-confidence.conf-mid .dl-conf-badge { background: rgba(234,179,8,.15); }
.dl-confidence.conf-low .dl-conf-badge { background: rgba(239,68,68,.15); }
.dl-confidence.conf-local { background: rgba(var(--brand-rgb),.07); color: var(--blue); }
.dl-row-empty .dl-row-v input { color: var(--muted); font-style: italic; }
.dl-row-empty .dl-row-k { opacity: .55; }
.dl-row-empty { background: var(--bg2); }
.dl-row-empty .dl-row-v input::placeholder { color: var(--muted); opacity: .5; font-style: normal; }

/* Auto-Fragestellung suggestion */
.auto-frage { padding: 8px 16px; }
.auto-frage-inner { display: flex; flex-direction: column; gap: 6px; }
.auto-frage-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.auto-frage-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1.5px dashed var(--blue); background: rgba(var(--brand-rgb),.04); color: var(--blue); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--duration) var(--ease); font-family: var(--font); text-align: left; animation: dlRowIn .3s ease both; }
.auto-frage-chip:hover { background: var(--blue-l); border-style: solid; }
.dl-depts { padding: 8px 20px; border-top: 1px solid var(--border); }
.dl-guidance { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
.dl-guidance-ok { font-size: 12px; font-weight: 600; color: var(--green); }
.dl-composer { padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.dl-textarea { width: 100%; min-height: 60px; max-height: 200px; border: 1.5px solid var(--border); border-radius: 14px; padding: 12px 16px; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); resize: none; outline: none; background: var(--bg2); transition: border-color var(--duration) var(--ease); }
.dl-textarea:focus { border-color: var(--blue); background: #fff; }
.dl-actions { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px 16px; flex-shrink: 0; gap: 8px; position: sticky; bottom: 0; background: var(--bg); z-index: 2; }
.dl-actions-left { display: flex; gap: 4px; }
.dl-icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--border-s); background: #fff; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--duration) var(--ease); flex-shrink: 0; }
.dl-icon-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.dl-send { display: inline-flex; align-items: center; gap: 8px; padding: 0 22px; min-height: 42px; border-radius: 999px; border: none; background: var(--blue); color: #fff; font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--duration) var(--ease); box-shadow: 0 2px 8px rgba(var(--brand-rgb),.2); }
.dl-send:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(var(--brand-rgb),.3); }
.dl-send:disabled { opacity: .5; cursor: not-allowed; }

/* ── Case detail ── */
.cd-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.zup-pane .cd-area { height: 100%; }

/* ── Task detail (Aufgaben mode) ── */
.zup-task-detail { padding: 16px 0; }
.zup-task-section { padding: 8px 0; }
.zup-task-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
.zup-task-value { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.5; }
.zup-task-events { padding: 8px 0; border-top: 1px solid var(--border); }
.zup-task-event { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; font-size: 12px; color: var(--text2); }
.zup-task-event-time { font-size: 10px; color: var(--light); }
.cd-shared-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); background: #fff; flex-shrink: 0; }
.cd-shared-left { min-width: 0; }
.cd-title { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.cd-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-s); }
.cd-info-toggle { width: 30px; height: 30px; border-radius: 999px; border: 1.5px solid var(--border-s); background: #fff; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--duration) var(--ease); }
.cd-info-toggle:hover { border-color: var(--blue); color: var(--blue); }
.cd-info-dropdown { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .28s var(--ease-out), opacity .2s ease; background: var(--bg2); border-bottom: 1px solid transparent; }
.cd-info-dropdown.open { max-height: 400px; opacity: 1; border-bottom-color: var(--border); }
.cd-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; padding: 14px 18px; }
.cd-info-field { display: flex; flex-direction: column; gap: 3px; }
.cd-info-k { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.cd-info-v { font-size: 13px; color: var(--text); font-weight: 500; background: transparent; border: none; font-family: var(--font); padding: 0; width: 100%; }

/* Zuweiser completion banner */
.zup-completion-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; margin: 0;
  background: rgba(34,139,34,.08); color: #1a7a1a;
  font-size: 13px; font-weight: 600;
  border-bottom: 1px solid rgba(34,139,34,.15);
}
.zup-completion-banner svg { flex-shrink: 0; stroke: #1a7a1a; }

/* Dept switcher (mobile tabs) */
.dept-switcher { display: none; padding: 8px 16px; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--border); background: #fff; }
.dept-sw-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; color: var(--text2); font-size: 12px; font-weight: 600; font-family: var(--font); cursor: pointer; white-space: nowrap; transition: all var(--duration) var(--ease); }
.dept-sw-btn.selected { border-color: var(--blue); background: var(--blue-l); color: var(--blue); }
@media (max-width: 900px) { .dept-switcher { display: flex; } }

/* Dept columns */
.dept-columns { flex: 1; display: flex; gap: 0; overflow: hidden; min-height: 0; }
.dept-col { flex: 1; display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; overflow: hidden; transition: background var(--duration) var(--ease); }
.dept-col:last-child { border-right: none; }
.dept-col.selected { background: rgba(var(--brand-rgb),.03); box-shadow: inset 0 0 0 1.5px rgba(var(--brand-rgb),.15); border-radius: var(--r); }
.dept-col-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg2); flex-shrink: 0; cursor: pointer; border-left: 3px solid var(--dept-col-color, var(--border-s)); transition: background var(--duration) var(--ease); border-radius: var(--r) var(--r) 0 0; }
.dept-col.selected .dept-col-head { background: rgba(var(--brand-rgb),.05); border-left-color: var(--dept-col-color, var(--blue)); }
.dept-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--dept-col-color, var(--border-s)); }
.dept-col-name { font-size: 13px; font-weight: 700; color: var(--text); }
.badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: auto; }
.badge.waiting { background: var(--bg3); color: var(--muted); }
.badge.progress { background: rgba(245,158,11,.1); color: #d97706; }
.badge.answered { background: rgba(16,185,129,.1); color: #059669; }
.dept-col-chat { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.dept-col-msgs { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.dept-col-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--light); font-size: 13px; }

/* Messages */
.msg { max-width: 85%; animation: rowFadeIn .2s var(--ease) both; }
.msg.out { margin-left: auto; }
.msg.in { margin-right: auto; }
.msg-author { font-size: 10.5px; font-weight: 600; color: var(--muted); margin-bottom: 3px; padding: 0 4px; }
.msg.out .msg-author { text-align: right; }
.msg-bubble { padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; word-break: break-word; position: relative; }
.msg.out .msg-bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.in .msg-bubble { background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.msg-time { font-size: 10px; color: var(--light); margin-top: 3px; padding: 0 4px; }
.msg.out .msg-time { text-align: right; }
.msg-pin { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity var(--duration) var(--ease); }
.msg-bubble:hover .msg-pin { opacity: 1; }
.msg-pin:hover { color: var(--blue); border-color: var(--blue); }
.msg-pin.pinned { opacity: 1; color: var(--blue); border-color: var(--blue); background: var(--blue-l); }

/* Chat input bar */
.cd-input-bar { display: flex; align-items: center; gap: 0; padding: 8px 12px; border-top: 1px solid var(--border); background: transparent; flex-shrink: 0; }
.cd-input-bar .intake-pill-style { display: flex; align-items: center; gap: 0; flex: 1; min-height: 40px; padding-right: 4px; }
.cd-input-target { font-size: 11px; font-weight: 700; color: var(--blue); white-space: nowrap; flex-shrink: 0; padding: 0 10px 0 6px; border-right: 1px solid var(--border); margin-right: 4px; }
.chat-input { flex: 1; min-height: 38px; border: 1.5px solid var(--border); border-radius: 999px; padding: 0 16px; font-family: var(--font); font-size: 13.5px; color: var(--text); outline: none; transition: border-color var(--duration) var(--ease); }
.chat-input:focus { border-color: var(--blue); }
.chat-input::placeholder { color: var(--light); }


/* Mobile: single column */
@media (max-width: 900px) {
  .dept-columns { flex-direction: column; }
  .dept-col { display: none; border-right: none; border-bottom: 1px solid var(--border); }
  .dept-col.visible { display: flex; }
  .cd-input-bar { padding: 6px 8px; }
  .cd-input-bar .cd-input-target { font-size: 10px; }
}

/* ── Dictation overlay/modal ── */
.dict-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); backdrop-filter: blur(8px); z-index: 500; display: flex; align-items: center; justify-content: center; animation: fadeSlideUp .2s var(--ease-out) both; }
.dict-modal { background: #fff; border-radius: 20px; width: min(480px, 92vw); max-height: 85vh; overflow: auto; box-shadow: var(--sh-xl); padding: 28px; position: relative; }
.dict-modal-close { position: absolute; top: 14px; right: 16px; border: none; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px; }
.dict-modal-close:hover { color: var(--text); }
.dict-modal-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.dict-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.dict-tab { padding: 8px 18px; border-radius: 999px; border: 1.5px solid transparent; background: transparent; font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all var(--duration) var(--ease); }
.dict-tab:hover { color: var(--text); background: var(--bg2); border-color: var(--border); }
.dict-tab.active { color: var(--blue); background: var(--blue-l); border-color: rgba(var(--brand-rgb),.2); }
.dict-tab-content { display: none; }
.dict-tab-content.active { display: block; }
.dict-local-info { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border: 1px solid var(--border); border-radius: var(--rl); background: var(--bg2); margin-bottom: 16px; }
.dict-local-btn { width: 100%; min-height: 42px; border-radius: 999px; border: 1.5px solid var(--blue); background: var(--blue-l); color: var(--blue); font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--duration) var(--ease); }
.dict-local-btn:hover { background: var(--blue); color: #fff; }
.dict-mobile-state { min-height: 200px; }
.dict-mobile-loading { padding: 40px; text-align: center; }
.dict-qr { display: flex; justify-content: center; margin: 12px 0; }
.dict-token-display { text-align: center; font-size: 28px; font-weight: 800; letter-spacing: 4px; color: var(--text); font-family: var(--mono); margin: 8px 0; }
.dict-timer { text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.dict-connected-dot { width: 12px; height: 12px; border-radius: 50%; background: #22c55e; margin: 0 auto 10px; box-shadow: 0 0 8px rgba(34,197,94,.4); animation: statusPulse 2s ease-in-out infinite; }
.dict-hint-toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-top: 12px; border-radius: var(--rl); border: 1px solid var(--border); background: #fff; box-shadow: var(--sh-md); font-size: 13px; color: var(--text2); line-height: 1.5; animation: fadeSlideUp .25s var(--ease-out) both; }

/* ── Konsil-Thread in Case Detail ── */
.konsil-thread-section { border: 1px solid rgba(var(--brand-rgb), .15); border-radius: var(--rl); background: rgba(var(--brand-rgb), .02); padding: 0; overflow: hidden; }
.konsil-thread-section .vcard-section-head-inline { padding: 10px 14px; border-bottom: 1px solid rgba(var(--brand-rgb), .1); margin-bottom: 0; }
.konsil-origin-badge { font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--blue-l); color: var(--blue); border: 1px solid rgba(var(--brand-rgb), .18); }
.konsil-msgs-wrap { max-height: 320px; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.konsil-msg { max-width: 88%; animation: rowFadeIn .2s var(--ease) both; }
.konsil-msg.out { margin-left: auto; }
.konsil-msg.in { margin-right: auto; }
.konsil-msg-author { font-size: 10.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; padding: 0 4px; display: flex; align-items: center; gap: 4px; }
.konsil-msg.out .konsil-msg-author { justify-content: flex-end; }
.konsil-msg-time { font-size: 10px; color: var(--light); margin-left: auto; }
.konsil-msg-bubble { padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5; word-break: break-word; }
.konsil-msg.out .konsil-msg-bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.konsil-msg.in .konsil-msg-bubble { background: #fff; border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.konsil-msg-bubble.pinned { border-left: 3px solid var(--blue); background: var(--blue-l); color: var(--text); }
.konsil-reply-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid rgba(var(--brand-rgb), .1); background: #fff; }
.konsil-reply-input { flex: 1; min-height: 34px; border: 1.5px solid var(--border); border-radius: 999px; padding: 0 14px; font-family: var(--font); font-size: 13px; color: var(--text); outline: none; transition: border-color var(--duration) var(--ease); }
.konsil-reply-input:focus { border-color: var(--blue); }
.konsil-reply-input::placeholder { color: var(--light); }
.konsil-reply-send { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: all var(--duration) var(--ease); }
.konsil-reply-send:hover { filter: brightness(1.1); }

/* ── Hub: Smart Anchor ── */
.hub-anchor { border-bottom: 1px solid var(--border); background: var(--bg2); flex-shrink: 0; position: relative; }
.hub-anchor-summary { display: flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: 12px; font-weight: 700; color: var(--text2); cursor: pointer; transition: background var(--duration) var(--ease); user-select: none; }
.hub-anchor-summary:hover { background: rgba(var(--brand-rgb), .04); }
.hub-anchor-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: statusPulse 2s ease-in-out infinite; flex-shrink: 0; }

/* ── Hub: Unified Feed ── */
.hub-feed { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

/* Feed: Task cards */
.hub-feed-task { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; transition: border-color var(--duration) var(--ease); }
.hub-feed-task:hover { border-color: rgba(var(--brand-rgb), .15); }
.hub-feed-task-head { display: flex; align-items: center; gap: 6px; }
.hub-feed-task-icon { flex-shrink: 0; display: flex; align-items: center; }
.hub-feed-task-svg { stroke: var(--muted); }
.hub-feed-task-label { font-size: 12.5px; font-weight: 700; color: var(--text); }
/* hub-feed tasks reuse global .status-badge + .workflow-badge-btn */
.hub-feed-task-head .status-badge { margin-left: auto; flex-shrink: 0; }
.hub-feed-task-reason { font-size: 12px; color: var(--text2); margin-top: 4px; line-height: 1.4; }
.hub-feed-task-actions { margin-top: 6px; display: flex; justify-content: flex-end; }

/* Konsil task card: distinct styling */
.hub-feed-task.is-konsil { border-left: 3px solid var(--blue); background: rgba(var(--brand-rgb), .03); }
.hub-feed-task.is-konsil .hub-feed-task-svg { stroke: var(--blue); }
.hub-feed-task.is-konsil .hub-feed-task-label { color: var(--blue); }

/* Feed: Events */
.hub-feed-event { font-size: 11.5px; color: var(--muted); padding: 4px 0; display: flex; align-items: center; gap: 6px; }
.hub-feed-event-svg { flex-shrink: 0; stroke: var(--light); }
.hub-feed-event-time { margin-left: auto; font-size: 10px; color: var(--light); }

/* Feed: Messages (konsil + followup + chat) */
.hub-feed-msg { max-width: 88%; animation: rowFadeIn .2s var(--ease) both; }
.hub-feed-msg.out { margin-left: auto; }
.hub-feed-msg.in { margin-right: auto; }
.hub-feed-msg-author { font-size: 10.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; padding: 0 4px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.hub-feed-msg.out .hub-feed-msg-author { justify-content: flex-end; }
.hub-feed-msg-time { font-size: 10px; color: var(--light); margin-left: auto; }
.hub-feed-msg-bubble { padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5; word-break: break-word; }
.hub-feed-msg.out .hub-feed-msg-bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.hub-feed-msg.in .hub-feed-msg-bubble { background: #fff; border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.hub-feed-followup-status { font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: rgba(var(--brand-rgb), .06); color: var(--muted); }

/* Feed: Highlight animation for jump-to */
.hub-item-highlight { animation: hubHighlight 1.5s ease-out; }
@keyframes hubHighlight {
  0% { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .3); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── Hub: Reply context banner ── */
.hub-reply-context { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--blue-l); border-top: 1px solid rgba(var(--brand-rgb), .15); flex-shrink: 0; }
.hub-reply-label { font-size: 12px; font-weight: 700; color: var(--blue); flex: 1; }
.hub-reply-cancel { border: none; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 4px; line-height: 1; }
.hub-reply-cancel:hover { color: var(--text); }

/* ── Hub: Input mode toggle ── */
.hub-mode-toggle { width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: all var(--duration) var(--ease); margin: 0; }
.hub-mode-toggle:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.hub-mode-toggle.is-message { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }

/* Konsil badges in case table */
.konsil-badge { display: inline-flex; font-size: 9.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-top: 1px; white-space: nowrap; }
.konsil-badge-int { background: var(--blue-l); color: var(--blue); border: 1px solid rgba(var(--brand-rgb), .18); }
.konsil-badge-ext { background: rgba(139,92,246,.08); color: #7c3aed; border: 1px solid rgba(139,92,246,.2); }

/* ── Generator file drop ── */
.gen-file-drop { border: 1.5px dashed var(--border-s); border-radius: var(--rl); padding: 10px 14px; margin-top: 8px; text-align: center; transition: all var(--duration) var(--ease); cursor: pointer; }
.gen-file-drop:hover, .gen-file-drop.dragover { border-color: var(--blue); background: var(--blue-l); }
.gen-file-label { font-size: 12.5px; color: var(--muted); cursor: pointer; }

/* ── Governance subtabs ── */
.gov-subtab { padding: 7px 14px; border-radius: 999px; border: 1.5px solid transparent; background: transparent; font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all var(--duration) var(--ease); }
.gov-subtab:hover { background: var(--bg2); color: var(--text); }
.gov-subtab.active { background: var(--blue-l); color: var(--blue); border-color: rgba(var(--brand-rgb),.2); }
.gov-subpane { display: none; }
.gov-subpane.active { display: block; }

/* Relation graph */
.rel-card { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r); background: #fff; margin-bottom: 6px; flex-wrap: wrap; }
.rel-card-trigger, .rel-card-action { font-size: 13px; }
.rel-card-arrow { color: var(--muted); font-weight: 700; }
.rel-card-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.rel-card-badge.routine { background: var(--bg3); color: var(--muted); }
.rel-card-badge.urgent { background: rgba(245,158,11,.1); color: #d97706; }
.rel-card-badge.emergency { background: rgba(220,38,38,.08); color: #dc2626; }
.rel-card-badge.learned { background: var(--blue-l); color: var(--blue); }
.rel-card-confidence { font-size: 11px; color: var(--muted); margin-left: auto; display: flex; align-items: center; gap: 6px; }
.confidence-bar { width: 48px; height: 4px; border-radius: 999px; background: var(--bg3); display: inline-block; vertical-align: middle; }
.confidence-fill { display: block; height: 100%; border-radius: 999px; background: var(--blue); }

/* Learned rules */
.learned-card { border: 1px solid var(--border); border-radius: var(--r); background: #fff; padding: 14px 16px; margin-bottom: 8px; }
.learned-card-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.learned-card-desc { font-size: 13px; color: var(--text2); line-height: 1.5; margin-bottom: 8px; }
.learned-card-stats { font-size: 12px; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.learned-card-actions { display: flex; gap: 6px; }

/* TODO: Folgende Regeln nach css/dictate.css extrahieren */
/* ════════════════════════════════════════════════════════
   DICTATION PAGE (dictate.html)
   ════════════════════════════════════════════════════════ */
  :root {
    --blue: #008a4f; --blue-d: #00673b; --blue-l: #eef8f1; --blue-mid: #00a862;
    --red: #c4244a; --red-l: #fdf2f4;
    --text: #1a1a1a; --text2: #4a4a4a; --muted: #8a8a8a;
    --bg: #fff; --bg2: #f8f9fb; --border: #e8eaed; --border-s: #d8dce0;
    --login-bg: #eff8f2;
    --font: 'DM Sans', -apple-system, system-ui, sans-serif;
    --brand-rgb: 0,138,79;
    --sh: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.03);
    --sh-md: 0 2px 4px rgba(0,0,0,.03), 0 4px 12px rgba(0,0,0,.06);
    --r: 6px; --rl: 8px; --rx: 10px; --rxx: 12px;
  }
  body[data-theme="blue"] {
    --blue: #005ea8; --blue-d: #004780; --blue-l: #f0f4f8; --blue-mid: #006bbf;
    --brand-rgb: 0,94,168; --login-bg: #f0f5f9;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { font-family: var(--font); background: var(--login-bg); color: var(--text); min-height: 100dvh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }

  /* ══ Shared ══ */
  .page { flex: 1; display: flex; flex-direction: column; padding: 0 20px env(safe-area-inset-bottom); max-width: 420px; margin: 0 auto; width: 100%; }
  .toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: var(--rx); background: var(--blue); color: #fff; font-size: 14px; font-weight: 500; z-index: 100; box-shadow: 0 4px 16px rgba(var(--brand-rgb),.3); animation: toastIn .3s ease-out; }
  @keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

  /* ══ PAIRING ══ */
  .pair { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 0; animation: fadeIn .3s; }
  .pair-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--blue-l); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
  .pair-icon svg { color: var(--blue); }
  .pair-title { font-size: 22px; font-weight: 700; margin-bottom: 24px; }

  /* QR Scanner — main element */
  .qr-wrap { width: 100%; border-radius: 16px; overflow: hidden; background: #000; margin-bottom: 20px; box-shadow: var(--sh-md); position: relative; }
  .qr-wrap video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
  .qr-crosshair { position: absolute; inset: 22%; border: 2px solid rgba(255,255,255,.5); border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.25); }
  .qr-corner { position: absolute; width: 24px; height: 24px; border-color: #fff; border-style: solid; border-width: 0; }
  .qr-corner.tl { top: -1px; left: -1px; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 14px; }
  .qr-corner.tr { top: -1px; right: -1px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 14px; }
  .qr-corner.bl { bottom: -1px; left: -1px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 14px; }
  .qr-corner.br { bottom: -1px; right: -1px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 14px; }
  .qr-msg { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; font-weight: 500; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
  canvas { display: none; }

  /* Code input — alternative */
  .code-row { display: flex; align-items: center; gap: 10px; width: 100%; }
  .code-input {
    flex: 1; text-align: center; font-size: 20px; font-weight: 700; letter-spacing: 3px;
    padding: 12px; border: 1.5px solid var(--border-s); border-radius: var(--rxx);
    background: #fff; color: var(--text); text-transform: uppercase; font-family: var(--font);
    box-shadow: var(--sh); transition: border-color .15s;
  }
  .code-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.1); }
  .code-input::placeholder { letter-spacing: 1px; color: var(--border-s); font-weight: 500; }
  .code-status { height: 20px; text-align: center; margin-top: 8px; font-size: 13px; font-weight: 500; }
  .code-status.err { color: var(--red); }
  .code-status.ok { color: var(--blue); }

  /* ══ DICTATION ══ */
  .dict { display: none; flex-direction: column; flex: 1; padding: 16px 0 8px; animation: slideUp .3s ease-out; }
  .dict.active { display: flex; }

  .dict-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .dict-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
  .dict-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex-shrink: 0; }
  .dict-link { font-size: 13px; font-weight: 500; color: var(--muted); background: none; border: none; font-family: var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
  .dict-link:hover { color: var(--blue); }

  .lang-select {
    width: 100%; padding: 9px 32px 9px 12px; margin-bottom: 10px;
    border: 1.5px solid var(--border-s); border-radius: var(--rxx); background: #fff;
    font-size: 14px; font-family: var(--font); color: var(--text); box-shadow: var(--sh);
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8a8a' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
  }
  .lang-select:focus { outline: none; border-color: var(--blue); }

  /* Transcript */
  .transcript {
    flex: 1; width: 100%; background: #fff; border: 1.5px solid var(--border-s);
    border-radius: 16px; padding: 16px; text-align: left; overflow-y: auto;
    min-height: 100px; box-shadow: var(--sh); font-size: 16px; line-height: 1.6; color: var(--text);
  }
  .transcript .placeholder { color: var(--border-s); font-weight: 400; }
  .transcript .interim { color: var(--muted); }
  .cursor { display: inline-block; width: 2px; height: 17px; background: var(--blue); vertical-align: text-bottom; animation: blink 1s step-end infinite; }
  @keyframes blink { 50% { opacity: 0; } }

  /* Fallback textarea */
  .fallback-ta {
    width: 100%; min-height: 100px; padding: 14px; border: 1.5px solid var(--border-s);
    border-radius: 16px; font-size: 16px; font-family: var(--font); line-height: 1.6;
    resize: none; background: #fff; box-shadow: var(--sh); color: var(--text);
  }
  .fallback-ta:focus { outline: none; border-color: var(--blue); }

  /* Bottom controls */
  .dict-bottom { padding-top: 12px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .waveform { display: flex; align-items: center; justify-content: center; gap: 3px; height: 24px; }
  .waveform span { width: 3px; border-radius: 2px; background: rgba(var(--brand-rgb),.2); }
  .waveform.on span { animation: wave .6s ease-in-out infinite; background: rgba(var(--brand-rgb),.4); }
  .waveform span:nth-child(1) { height: 5px; } .waveform span:nth-child(2) { height: 10px; animation-delay:.08s; }
  .waveform span:nth-child(3) { height: 16px; animation-delay:.16s; } .waveform span:nth-child(4) { height: 20px; animation-delay:.24s; }
  .waveform span:nth-child(5) { height: 16px; animation-delay:.32s; } .waveform span:nth-child(6) { height: 10px; animation-delay:.4s; }
  .waveform span:nth-child(7) { height: 5px; animation-delay:.48s; }
  @keyframes wave { 0%,100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }

  .mic-wrap { position: relative; width: 100px; height: 100px; }
  .mic-btn {
    width: 100px; height: 100px; border-radius: 50%; border: 2.5px solid var(--blue);
    background: var(--blue-l); color: var(--blue); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; position: relative; z-index: 2;
  }
  .mic-btn:active { transform: scale(.93); }
  .mic-btn.on { border-color: var(--red); background: var(--red-l); color: var(--red); }
  .mic-btn svg { width: 36px; height: 36px; }
  .mic-pulse { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--blue); opacity: 0; pointer-events: none; }
  .mic-btn.on ~ .mic-pulse { border-color: var(--red); animation: pulse 1.5s ease-out infinite; }
  .mic-btn.on ~ .mic-pulse:nth-child(3) { animation-delay: .5s; }
  @keyframes pulse { 0% { transform: scale(1); opacity: .4; } 100% { transform: scale(1.7); opacity: 0; } }

  .btn-row { display: flex; gap: 10px; width: 100%; }
  .btn-row .btn {
    flex: 1; padding: 13px; border-radius: var(--rxx); font-size: 15px;
    font-weight: 600; font-family: var(--font); cursor: pointer; transition: all .15s;
  }
  .btn-row .btn:active { transform: scale(.97); }
  .btn-row .btn-ghost { background: #fff; color: var(--text2); border: 1.5px solid var(--border-s); box-shadow: var(--sh); }
  .btn-row .btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
  .btn-row .btn-primary { background: var(--blue); color: #fff; border: none; box-shadow: 0 2px 8px rgba(var(--brand-rgb),.2); }
  .btn-row .btn-primary:hover { background: var(--blue-d); }
  .btn-row .btn-primary:disabled { opacity: .35; box-shadow: none; }

/* ════════════════════════════════════════════════════════
   INTAKE PAGE (intake.html)
   ════════════════════════════════════════════════════════ */
/* ── Reset + Base ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root {
  --brand: #008a4f;
  --brand-d: #00673b;
  --brand-l: #eef8f1;
  --brand-rgb: 0,138,79;
  --text: #1a1a1a;
  --text2: #4a4a4a;
  --muted: #8a8a8a;
  --border: #e8eaed;
  --border-s: #d8dce0;
  --bg: #ffffff;
  --bg2: #f8f9fb;
  --bg3: #f0f1f4;
  --red: #c4244a;
  --warn: #c27800;
  --r: 6px;
  --font: 'DM Sans', -apple-system, system-ui, sans-serif;
  --sh: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.03);
  --sh-md: 0 2px 4px rgba(0,0,0,.03), 0 4px 12px rgba(0,0,0,.06);
  --sh-lg: 0 4px 8px rgba(0,0,0,.04), 0 12px 28px rgba(0,0,0,.08);
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --dur: 180ms;
  --dur-md: 280ms;
}

body {
  font-family: var(--font);
  background: linear-gradient(165deg, var(--bg2) 0%, var(--brand-l) 40%, var(--bg2) 100%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.intake-header {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.intake-logo {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px;
}
.intake-logo-text {
  display: flex; flex-direction: column; gap: 0;
}
.intake-logo-text strong {
  font-size: 15px; font-weight: 700; color: #111; letter-spacing: .5px;
}
.intake-logo-text span {
  font-size: 10px; color: var(--muted); font-weight: 400;
}

/* ── Main Container ── */
.intake-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px 60px;
}
.intake-card {
  width: min(680px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--sh-lg);
  overflow: hidden;
  position: relative;
}

/* ── Progress Bar ── */
.intake-progress {
  height: 3px;
  background: var(--bg3);
  position: relative;
  overflow: hidden;
}
.intake-progress-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
  transition: width .5s var(--ease-out);
}

/* ── Steps ── */
.intake-step {
  padding: 36px 32px;
  display: none;
  animation: stepIn .35s var(--ease-out) both;
}
.intake-step.active { display: block; }

@keyframes stepIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.intake-step-kicker {
  font-size: 11px; font-weight: 600; color: var(--brand);
  text-transform: uppercase; letter-spacing: .8px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.intake-step-kicker::before {
  content: ''; width: 16px; height: 2px;
  background: var(--brand); border-radius: 2px;
}
.intake-step h2 {
  font-size: 22px; font-weight: 700;
  color: var(--text); letter-spacing: -.02em;
  line-height: 1.2; margin-bottom: 6px;
}
.intake-step-sub {
  font-size: 14px; color: var(--muted);
  margin-bottom: 28px; line-height: 1.5;
}

/* ── Textarea ── */
.intake-textarea {
  width: 100%;
  min-height: 180px;
  padding: 16px 18px;
  border: 1.5px solid var(--border-s);
  border-radius: 14px;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg2);
  resize: vertical;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.intake-textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12);
}
.intake-textarea::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ── File Attach ── */
.intake-attach {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; color: var(--muted);
  font-size: 13px; cursor: pointer;
  transition: color var(--dur);
}
.intake-attach:hover { color: var(--brand); }
.intake-attach input { display: none; }
.intake-attach-icon {
  width: 32px; height: 32px; border-radius: 10px;
  border: 1.5px dashed var(--border-s);
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--dur), background var(--dur);
}
.intake-attach:hover .intake-attach-icon {
  border-color: var(--brand);
  background: var(--brand-l);
}

/* ── Action Row ── */
.intake-actions {
  display: flex; justify-content: flex-end;
  gap: 10px; margin-top: 28px;
}

/* Buttons: consolidated into .btn .btn-lg (see BUTTONS section in main CSS) */

/* ── Loading State ── */
.intake-loading {
  padding: 60px 32px;
  text-align: center;
  display: none;
}
.intake-loading.active { display: block; }

@keyframes pulse-ring {
  0% { transform: scale(.8); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.intake-loading-ring {
  width: 56px; height: 56px;
  margin: 0 auto 20px;
  position: relative;
}
.intake-loading-ring::before,
.intake-loading-ring::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--brand);
}
.intake-loading-ring::before {
  animation: pulse-ring 1.5s var(--ease-out) infinite;
}
.intake-loading-ring::after {
  animation: pulse-ring 1.5s var(--ease-out) .4s infinite;
}
.intake-loading-dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--brand);
}
.intake-loading-text {
  font-size: 14px; color: var(--muted); font-weight: 500;
}

/* ── Smart Form (Step 2) ── */
.intake-cluster-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 999px;
  background: var(--brand-l);
  border: 1px solid rgba(var(--brand-rgb),.2);
  color: var(--brand); font-size: 12px; font-weight: 600;
  margin-bottom: 20px;
}
.intake-cluster-badge::before {
  content: ''; width: 7px; height: 7px;
  border-radius: 50%; background: var(--brand);
}

.intake-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.intake-form-field {
  display: flex; flex-direction: column; gap: 6px;
}
.intake-form-field.full-width {
  grid-column: 1 / -1;
}
.intake-form-label {
  font-size: 12px; font-weight: 600; color: var(--text2);
  display: flex; align-items: center; gap: 6px;
}
.intake-form-label .req {
  color: var(--red); font-size: 10px;
}
.intake-extracted-tag {
  font-size: 10px; font-weight: 500; color: var(--brand);
  background: var(--brand-l);
  padding: 1px 6px; border-radius: 4px;
  margin-left: auto;
}
/* Form inputs: consolidated into .form-input (see BUTTONS section in main CSS) */

/* ── Urgency Selector ── */
.intake-urgency {
  display: flex; gap: 8px; margin-top: 4px;
}
.intake-urgency-opt {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--border-s);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 13px; font-weight: 600;
  color: var(--text2);
  transition: all var(--dur) var(--ease);
}
.intake-urgency-opt:hover {
  border-color: rgba(var(--brand-rgb),.3);
  background: var(--brand-l);
}
.intake-urgency-opt.sel-normal {
  border-color: var(--brand);
  background: var(--brand-l);
  color: var(--brand);
}
.intake-urgency-opt.sel-eilig {
  border-color: var(--warn);
  background: #fef9ee;
  color: var(--warn);
}
.intake-urgency-opt.sel-notfall {
  border-color: var(--red);
  background: #fdf2f4;
  color: var(--red);
}
.intake-urgency-opt input { display: none; }

/* ── Optional Section ── */
.intake-optional-toggle {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.intake-optional-btn {
  background: none; border: none;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: color var(--dur);
}
.intake-optional-btn:hover { color: var(--text); }
.intake-optional-btn svg {
  transition: transform var(--dur) var(--ease);
}
.intake-optional-btn.open svg {
  transform: rotate(180deg);
}
.intake-optional-fields {
  display: none;
  margin-top: 14px;
}
.intake-optional-fields.open {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  animation: stepIn .25s var(--ease-out) both;
}

/* ── Success State ── */
.intake-success {
  padding: 60px 32px;
  text-align: center;
  display: none;
}
.intake-success.active { display: block; }
.intake-success-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  background: var(--brand-l);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  animation: scaleIn .4s var(--ease-out) both;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: scale(1); }
}
.intake-success h2 {
  font-size: 20px; font-weight: 700;
  margin-bottom: 8px;
}
.intake-success p {
  font-size: 14px; color: var(--muted);
  line-height: 1.6; margin-bottom: 24px;
}

/* ── Footer ── */
.intake-footer {
  text-align: center;
  padding: 16px 20px;
  font-size: 11px; color: var(--muted);
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .intake-header { padding: 0 16px; height: 50px; }
  .intake-main { padding: 20px 12px 40px; }
  .intake-card { border-radius: 16px; }
  .intake-step { padding: 24px 20px; }
  .intake-step h2 { font-size: 19px; }
  .intake-textarea { min-height: 150px; font-size: 16px; }
  .intake-form-grid { grid-template-columns: 1fr; gap: 14px; }
  .intake-optional-fields.open { grid-template-columns: 1fr; }
  .intake-urgency { flex-direction: column; }
  .intake-actions { flex-direction: column-reverse; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(var(--brand-rgb),.2); border-radius: 999px; }

/* Focus visible */
:focus-visible {
  outline: 2px solid rgba(var(--brand-rgb), .4);
  outline-offset: 2px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
}

/* ── Generator Preview Dialog ── */
.gp-section { margin-bottom: 8px; }
.gp-section-hdr { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; font-weight: 600; font-size: 12px; color: var(--text); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.gp-section-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-item { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; }
.gp-item-key { flex-shrink: 0; font-family: var(--mono); font-size: 10px; color: var(--muted); background: var(--bg2); padding: 1px 5px; border-radius: 4px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-item-text { flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; font: inherit; font-size: 12px; color: var(--text2); padding: 2px 4px; border-radius: 4px; }
.gp-item-text:hover { border-color: var(--border); }
.gp-item-text:focus { border-color: var(--blue); outline: none; background: #fff; }
.gp-item-sub { flex: 1; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-x { flex-shrink: 0; width: 20px; height: 20px; border: none; background: none; color: var(--muted); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.gp-x:hover { background: rgba(197,48,48,.1); color: rgba(197,48,48,.9); }
.gp-tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.gp-tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--border); font-size: 11px; color: var(--text2); }
.gp-tag-x { border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0 1px; line-height: 1; }
.gp-tag-x:hover { color: rgba(197,48,48,.9); }
.gp-empty { padding: 8px; font-size: 12px; color: var(--muted); text-align: center; }

/* ═══════════════════════════
   MAGIC MERGE
═══════════════════════════ */

/* ── Startseite ── */
.mm-startseite { max-width: 680px; margin: 0 auto; padding: 60px 20px 80px; }
.mm-greeting { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.mm-title { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -.02em; margin-bottom: 32px; }

/* ── Chips ── */
.mm-chips-area { margin-bottom: 28px; }
.mm-chips-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mm-chips-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.mm-chips-edit-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.25px solid var(--border); background: #fff;
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--duration) var(--ease);
}
.mm-chips-edit-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.mm-chips-edit-btn.active { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.mm-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mm-chip {
  display: inline-flex; align-items: center; gap: 0;
  height: 34px; padding: 0 16px;
  border: 1.25px solid var(--border-s); border-radius: 999px;
  background: #fff; font-family: var(--font);
  font-size: 13px; font-weight: 600; color: var(--text2);
  cursor: pointer; outline: none;
  transition: all var(--duration) var(--ease);
}
.mm-chip:hover { border-color: var(--dept-c, var(--blue)); color: var(--dept-c, var(--blue)); }
.mm-chip:active { transform: scale(.97); }
.mm-chip-dept {
  display: inline-block; font-size: 10px; font-weight: 700;
  color: var(--dept-c, var(--blue));
  background: var(--dept-bg, rgba(var(--brand-rgb),.1));
  padding: 1px 7px; border-radius: 999px;
  margin-left: 8px; letter-spacing: .3px;
}
.mm-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  margin-left: 8px; cursor: pointer; line-height: 1;
}
.mm-chip-plus {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue); color: #fff;
  font-size: 12px; font-weight: 700;
  margin-left: 8px; cursor: pointer; line-height: 1;
}
.mm-chip.suggestion { opacity: .5; border-style: dashed; }
.mm-chip.suggestion:hover { opacity: 1; }
.mm-chip-divider { width: 100%; font-size: 11px; color: var(--muted); padding: 8px 0 2px; font-weight: 500; }

/* ── Pill input (shared) ── */
.mm-pill-wrap { margin-top: 24px; }
.mm-start-pill, .mm-alt-pill {
  display: flex; align-items: center; gap: 4px;
  background: #fff; border: 1.5px solid var(--border-s);
  border-radius: 999px; padding: 4px 6px 4px 18px;
  box-shadow: var(--sh); transition: all var(--duration) var(--ease);
}
.mm-start-pill:focus-within, .mm-alt-pill:focus-within {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.08);
}
.mm-pill-input {
  flex: 1; border: none; outline: none;
  font-family: var(--font); font-size: 14px;
  color: var(--text); background: transparent;
  padding: 10px 0; resize: none; line-height: 1.4;
  box-shadow: none !important;
}
.mm-pill-input:focus, .mm-pill-input:focus-visible {
  box-shadow: none !important; outline: none !important;
  background: transparent !important;
}
.mm-pill-input::placeholder { color: var(--muted); }
.mm-pill-actions { display: flex; gap: 2px; align-items: center; }
.mm-pill-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration) var(--ease); flex-shrink: 0;
}
.mm-pill-btn:hover { color: var(--blue); background: var(--blue-l); }
.mm-pill-btn.send { background: var(--blue); color: #fff; }
.mm-pill-btn.send:hover { background: var(--blue-d); }

/* ── Form Screen ── */
.mm-form-screen { max-width: 740px; margin: 0 auto; padding: 24px 20px 80px; }
.mm-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px;
  border: 1.25px solid var(--border); background: #fff;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  color: var(--text2); cursor: pointer; margin-bottom: 16px;
  transition: all var(--duration) var(--ease);
}
.mm-back:hover { border-color: var(--blue); color: var(--blue); }
.mm-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--sh-lg); overflow: visible;
}

/* ── Cluster bar ── */
.mm-cluster-bar {
  padding: 14px 24px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.mm-cluster-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  border: 1.25px solid var(--dept-c, var(--blue));
  background: var(--dept-bg, var(--blue-l));
  color: var(--dept-c, var(--blue));
}
.mm-cluster-x { cursor: pointer; opacity: .5; font-size: 14px; line-height: 1; transition: opacity var(--duration); }
.mm-cluster-x:hover { opacity: 1; }
.mm-cluster-add-wrap { position: relative; }
.mm-cluster-add {
  display: inline-flex; align-items: center;
  padding: 5px 14px; border-radius: 999px;
  border: 1.25px dashed var(--border-s); background: transparent;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all var(--duration);
}
.mm-cluster-add:hover { border-color: var(--blue); color: var(--blue); }
.mm-konsil-dd {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 220px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--sh-xl); padding: 6px; z-index: 50;
}
.mm-konsil-dd-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text2);
  cursor: pointer; transition: all var(--duration);
  border: none; background: none; width: 100%;
  text-align: left; font-family: var(--font);
}
.mm-konsil-dd-item:hover { background: var(--blue-l); color: var(--blue); }
.mm-konsil-dd-item .dd-dept {
  font-size: 10px; font-weight: 700;
  color: var(--dept-c, var(--blue));
  background: var(--dept-bg, rgba(var(--brand-rgb),.1));
  padding: 1px 6px; border-radius: 999px; margin-left: auto;
}

/* ── Relation banner ── */
.mm-suggestion {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin: 0 24px 0;
  background: rgba(var(--brand-rgb),.04);
  border: 1px solid rgba(var(--brand-rgb),.12);
  border-radius: 10px; font-size: 12px; color: var(--text2);
}
.mm-suggestion strong { color: var(--blue); }
.mm-suggestion-add {
  margin-left: auto; padding: 4px 12px;
  border-radius: 999px; border: none;
  background: var(--blue); color: #fff;
  font-family: var(--font); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--duration); white-space: nowrap;
}
.mm-suggestion-add:hover { background: var(--blue-d); }
.mm-suggestion-dismiss {
  border: none; background: transparent;
  color: var(--muted); font-size: 16px;
  cursor: pointer; padding: 0 2px; line-height: 1;
}
.mm-suggestion-dismiss:hover { color: var(--text); }

/* ── Form body ── */
.mm-form-body { padding: 24px 28px 4px; display: flex; flex-direction: column; gap: 20px; }
.mm-section-label {
  font-size: 11px; font-weight: 800; color: var(--blue);
  text-transform: uppercase; letter-spacing: .8px;
  padding-bottom: 8px; border-bottom: 2px solid rgba(var(--brand-rgb),.12);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 2px;
}
.mm-section-badge {
  font-size: 9px; font-weight: 700; color: #fff;
  background: var(--blue); padding: 2px 10px;
  border-radius: 999px; text-transform: none; letter-spacing: 0;
}
.mm-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.mm-field {
  display: flex; flex-direction: column; gap: 0;
  border-radius: 12px; background: var(--bg2);
  padding: 12px 16px 10px; transition: all .2s var(--ease);
  border: 1.5px solid transparent;
  position: relative;
}
.mm-field:focus-within {
  background: #fff; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.08);
}
.mm-field.has-value {
  background: #fff; border-color: rgba(var(--brand-rgb),.18);
}
.mm-field.has-value .mm-label { color: var(--blue); }
.mm-field.full { grid-column: 1 / -1; }
.mm-label {
  font-size: 11px; font-weight: 700; color: var(--text2);
  letter-spacing: .2px; display: flex; align-items: center; gap: 4px;
  margin-bottom: 4px;
}
.mm-req { color: var(--red); font-size: 11px; }
.mm-rec { color: var(--warn); font-size: 9px; font-weight: 500; margin-left: 2px; }

/* Info-Icon mit Tooltip fuer Fragetexte */
.mm-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 6px;
  color: rgba(var(--brand-rgb),.55); cursor: help;
  position: relative; transition: all .15s var(--ease);
  outline: none; border-radius: 50%;
}
.mm-info:hover, .mm-info:focus {
  color: var(--blue);
  background: var(--blue-l);
  transform: scale(1.1);
}
.mm-field.has-value .mm-info { color: rgba(var(--brand-rgb),.7); }
.mm-info-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 200px; max-width: 320px;
  padding: 10px 14px;
  background: #1a1a1a; color: #fff;
  border-radius: 8px; font-size: 12px; font-weight: 400;
  line-height: 1.45; text-transform: none; letter-spacing: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
  z-index: 100; white-space: normal;
}
.mm-info-tip::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #1a1a1a;
}
.mm-info:hover .mm-info-tip,
.mm-info:focus .mm-info-tip {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.mm-input {
  padding: 6px 0; border: none; border-radius: 0;
  font-family: var(--font); font-size: 14px; font-weight: 500;
  color: var(--text); background: transparent;
  outline: none; transition: all var(--duration) var(--ease); width: 100%;
  box-shadow: none !important;
}
.mm-input:focus, .mm-input:focus-visible {
  box-shadow: none !important; outline: none !important;
  background: transparent !important; border: none !important;
}
.mm-input::placeholder { color: #aaa; font-weight: 400; font-size: 12px; }
select.mm-input { padding: 6px 0; cursor: pointer; }
.mm-ki-tag {
  font-size: 8px; font-weight: 700; color: var(--blue);
  background: var(--blue-l); padding: 2px 6px;
  border-radius: 4px; margin-left: auto; text-transform: uppercase; letter-spacing: .3px;
}
.mm-inline-field { display: flex; align-items: center; gap: 10px; }
.mm-inline-field .mm-label { flex-shrink: 0; }
.mm-pill-row { display: flex; gap: 5px; flex-wrap: wrap; padding-top: 2px; }
.mm-pill-opt {
  padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--border-s); background: #fff;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  color: var(--text2); cursor: pointer; transition: all var(--duration) var(--ease);
}
.mm-pill-opt:hover { border-color: rgba(var(--brand-rgb),.3); color: var(--blue); background: var(--blue-l); }
.mm-pill-opt.active { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }

/* ── Validation ── */
.mm-field.has-error { border-color: var(--red); }
.mm-field.has-error .mm-label { color: var(--red); }
.mm-field.has-warning { border-color: var(--warn); }
.mm-validation-hint { font-size: 12px; color: var(--red); font-weight: 500; min-height: 18px; }
.mm-validation-hint.soft { color: var(--warn); }

/* ── Hero-Diktat (Variante A) ── */
.mm-hero {
  padding: 22px 28px 18px;
  background: linear-gradient(180deg, rgba(var(--brand-rgb),.035) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}
.mm-hero-label {
  font-size: 11px; font-weight: 800; color: var(--blue);
  text-transform: uppercase; letter-spacing: .7px;
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.mm-hero-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.18);
}
.mm-hero-wrap { position: relative; }
.mm-hero-textarea {
  width: 100%; min-height: 96px;
  resize: vertical;
  border: 1.75px solid rgba(var(--brand-rgb),.2);
  border-radius: 14px;
  padding: 14px 16px 48px;
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  color: var(--text); background: #fff;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.mm-hero-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.1);
}
.mm-hero-textarea::placeholder { color: var(--muted); font-size: 13px; }
.mm-hero-actions {
  position: absolute; right: 8px; bottom: 8px;
  display: flex; gap: 2px; align-items: center;
}
.mm-ai-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px; margin-top: 10px;
  background: rgba(var(--brand-rgb),.08);
  border: 1px solid rgba(var(--brand-rgb),.15);
  border-radius: 999px; font-size: 11px;
  color: var(--blue); font-weight: 600;
}
.mm-ai-dot {
  width: 6px; height: 6px; background: var(--blue);
  border-radius: 50%; animation: mmPulse 1.6s ease infinite;
}
@keyframes mmPulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

/* ── Patient-Review-Block ── */
.mm-patient-block {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
}
.mm-patient-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-l), rgba(var(--brand-rgb),.18));
  color: var(--blue); font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.mm-patient-info { flex: 1; min-width: 0; }
.mm-patient-name {
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.mm-patient-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mm-patient-meta span + span::before {
  content: '·'; margin: 0 6px; opacity: .6;
}
.mm-inline-edit-btn {
  border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease); flex-shrink: 0;
}
.mm-inline-edit-btn:hover {
  background: var(--blue-l); color: var(--blue); border-color: rgba(var(--brand-rgb),.2);
}
.mm-patient-block.editing {
  display: block;
  padding: 18px 28px 20px;
}
.mm-patient-edit-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.mm-patient-edit-title {
  font-size: 11px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: .7px;
}
.mm-patient-edit-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
}

/* ── Kerninfo-Section + mm-core-field ── */
.mm-core-section {
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--border);
}
.mm-section-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.mm-section-title {
  font-size: 11px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: .7px;
}
.mm-section-count {
  font-size: 10px; font-weight: 600; color: var(--muted);
  padding: 2px 9px; border-radius: 999px;
  background: var(--bg2);
}
#mm-fields-core, .mm-patient-edit-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
}
.mm-core-field {
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
}
.mm-core-field.full { grid-column: 1 / -1; }
.mm-core-label {
  font-size: 11px; font-weight: 700; color: var(--text2);
  letter-spacing: .2px;
  display: flex; align-items: center; gap: 4px;
}
.mm-core-field.has-value .mm-core-label { color: var(--blue); }
.mm-core-field.has-error .mm-core-label { color: var(--red); }
.mm-core-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font); font-size: 14px;
  color: var(--text); background: var(--bg2);
  outline: none;
  transition: all .15s var(--ease);
  box-shadow: none;
}
.mm-core-input:focus, .mm-core-input:focus-visible {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.1);
  outline: none;
}
.mm-core-input::placeholder { color: #bbb; font-weight: 400; }
.mm-core-field.has-value .mm-core-input {
  background: #fff;
  border-color: rgba(var(--brand-rgb),.22);
}
.mm-core-field.has-error .mm-core-input { border-color: var(--red); }
.mm-core-field.has-warning .mm-core-input { border-color: var(--warn); }
select.mm-core-input { cursor: pointer; }

/* ── Collapse "Weitere Angaben" ── */
.mm-more-wrap {
  border-bottom: 1px solid var(--border);
}
.mm-more-head {
  width: 100%;
  padding: 14px 28px;
  background: transparent; border: none;
  font-family: var(--font);
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  transition: background .15s var(--ease);
}
.mm-more-head:hover { background: var(--bg2); }
.mm-more-head-left {
  font-size: 13px; font-weight: 700; color: var(--text2);
  display: flex; align-items: center; gap: 10px;
}
.mm-more-count {
  font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px;
  background: rgba(var(--brand-rgb),.1); color: var(--blue);
}
.mm-more-arrow {
  color: var(--muted); transition: transform .22s var(--ease);
  flex-shrink: 0;
}
.mm-more-wrap.open .mm-more-arrow { transform: rotate(180deg); }
.mm-more-body {
  display: none;
  padding: 4px 28px 20px;
}
.mm-more-wrap.open .mm-more-body {
  display: block;
  animation: mmSlideDown .28s var(--ease);
}
@keyframes mmSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Submit-Area ── */
.mm-submit-area {
  padding: 18px 28px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--bg2);
}
.mm-submit-btn {
  padding: 12px 28px; border-radius: 999px; border: none;
  background: var(--blue); color: #fff;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center;
  transition: all var(--duration) var(--ease);
}
.mm-submit-btn:hover { background: var(--blue-d); }
.mm-submit-btn:active { transform: scale(.97); }
.mm-submit-btn.disabled { opacity: .45; cursor: not-allowed; }

/* ── Success ── */
.mm-success {
  text-align: center; padding: 60px 20px;
  max-width: 680px; margin: 0 auto;
}
.mm-success-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--blue-l); display: flex;
  align-items: center; justify-content: center;
  margin: 0 auto 20px; font-size: 28px; color: var(--blue);
}
.mm-success h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.mm-success p { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.mm-success-btn {
  padding: 11px 28px; border-radius: 999px;
  border: 1.25px solid var(--border); background: #fff;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text); cursor: pointer; transition: all var(--duration) var(--ease);
}
.mm-success-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ── Embedded in split-view ── */
.zup-pane .mm-startseite { padding: 28px 20px 40px; }
.zup-pane .mm-form-screen { padding: 16px 16px 40px; }
.zup-pane .mm-card { border-radius: 12px; }
.zup-pane .mm-greeting { display: none; }
.zup-pane .mm-title { font-size: 18px; margin-bottom: 20px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .mm-startseite { padding: 32px 16px 60px; }
  .mm-title { font-size: 20px; }
  .mm-form-screen { padding: 16px 12px 60px; }
  .mm-form-body { padding: 16px 16px 0; }
  .mm-grid { grid-template-columns: 1fr; }
  .mm-cluster-bar { padding: 10px 16px; }
  .mm-suggestion { margin: 0 16px; }
  .mm-hero { padding: 16px 16px 14px; }
  .mm-hero-textarea { padding: 12px 14px 46px; font-size: 14px; }
  .mm-patient-block { padding: 14px 16px; }
  .mm-patient-block.editing { padding: 14px 16px 16px; }
  .mm-core-section { padding: 14px 16px 10px; }
  #mm-fields-core, .mm-patient-edit-grid { grid-template-columns: 1fr; gap: 12px; }
  .mm-more-head { padding: 12px 16px; }
  .mm-more-body { padding: 4px 16px 16px; }
  .mm-submit-area { padding: 14px 16px 18px; }
}
