/*
 * Console – "Night Shift Desk", weiterentwickelt.
 * Alle Farben, der Radius und die Schrift kommen aus den Theme-Variablen `--slc-*` (Betreiber-Theme);
 * weitere Töne werden daraus abgeleitet, damit hell, dunkel und jeder Akzent ohne Anpassung funktionieren.
 */

:root {
  --ring: var(--slc-text);
  --raise: color-mix(in srgb, var(--slc-text) 5%, var(--slc-surface));
  --raise-2: color-mix(in srgb, var(--slc-text) 9%, var(--slc-surface));
  --line: var(--slc-border);
  --line-strong: color-mix(in srgb, var(--slc-text) 26%, transparent);
  --dim: color-mix(in srgb, var(--slc-text) 72%, var(--slc-bg));
  --accent-soft: color-mix(in srgb, var(--slc-accent) 14%, var(--slc-bg));
  --own: color-mix(in srgb, var(--slc-accent) 22%, var(--slc-surface));
  --own-line: color-mix(in srgb, var(--slc-accent) 42%, transparent);
  --danger-ink: color-mix(in srgb, var(--slc-danger) 55%, var(--slc-text));
  --amber: #d19a1e;
  --amber-soft: color-mix(in srgb, var(--amber) 14%, var(--slc-bg));
  --amber-line: color-mix(in srgb, var(--amber) 55%, transparent);
  --amber-ink: color-mix(in srgb, var(--amber) 55%, var(--slc-text));
  --ok: #2fbf71;
  --warn: #f0a91f;
  --bad: #e5484d;
  --off: #8b98a5;
  --r-s: calc(var(--slc-radius) * 2);
  --r-m: calc(var(--slc-radius) * 3.5);
  --r-l: calc(var(--slc-radius) * 5);
  --shadow-pop: 0 16px 40px -12px rgb(0 0 0 / .55), 0 2px 8px rgb(0 0 0 / .22);
  --ease: cubic-bezier(.16, 1, .3, 1);
  /* Alte Variablennamen (ältere Formulare) folgen jetzt dem Theme */
  --border: var(--slc-border);
  --accent: var(--slc-accent);
  --surface-2: var(--raise);
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--slc-bg);
  color: var(--slc-text);
  font-family: var(--slc-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
#app {
  height: 100%;
}
h1,
h2,
h3,
h4 {
  letter-spacing: -.01em;
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
::selection {
  background: color-mix(in srgb, var(--slc-accent) 45%, transparent);
}
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--slc-text) 22%, transparent);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--slc-text) 38%, transparent);
  background-clip: padding-box;
  border: 2px solid transparent;
}
.ic {
  flex: none;
  display: block;
}
.muted {
  color: var(--dim);
}
.mono {
  font-family: "SLC Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.error {
  color: var(--danger-ink);
  margin: 6px 0;
}
.pad {
  padding: 0 16px;
}

/* ---------- Bedienelemente ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--slc-accent);
  color: var(--slc-accent-text);
  border: 1px solid transparent;
  border-radius: var(--r-m);
  padding: 0 14px;
  min-height: 36px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: filter .15s, background .15s, border-color .15s;
}
.btn:hover {
  filter: brightness(1.12);
}
.btn:disabled {
  opacity: .45;
  cursor: default;
  filter: none;
}
.btn.ghost {
  background: transparent;
  color: var(--slc-text);
  border-color: var(--line-strong);
}
.btn.ghost:hover {
  background: var(--raise-2);
  filter: none;
}
.btn.danger {
  background: var(--slc-danger);
  color: #fff;
}
.btn.ghost.danger {
  background: transparent;
  color: var(--danger-ink);
  border-color: color-mix(in srgb, var(--slc-danger) 50%, transparent);
}
.btn.ghost.danger:hover {
  background: color-mix(in srgb, var(--slc-danger) 14%, transparent);
}
.btn.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--r-m);
  background: transparent;
  color: color-mix(in srgb, var(--slc-text) 78%, var(--slc-bg));
  cursor: pointer;
  flex: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover,
.icon-btn[aria-expanded="true"],
.icon-btn[aria-pressed="true"] {
  background: var(--raise-2);
  color: var(--slc-text);
}
.link {
  background: none;
  border: 0;
  color: var(--dim);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}
.link:hover {
  color: var(--slc-text);
}
.link.on {
  font-weight: 600;
  color: var(--slc-text);
}
input,
textarea,
select {
  width: 100%;
  background: var(--slc-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  padding: 7px 10px;
  min-height: 36px;
}
input::placeholder,
textarea::placeholder {
  color: var(--dim);
}
input:hover,
textarea:hover,
select:hover {
  border-color: color-mix(in srgb, var(--slc-text) 42%, transparent);
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  border-color: transparent;
}
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--slc-accent);
}
input[type="file"] {
  padding: 6px;
}
textarea {
  resize: none;
}
select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b98a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
label {
  font-weight: 500;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-weight: 400;
}
.check input {
  width: 16px;
  flex: none;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 12px 14px;
  margin: 0;
}
legend {
  font-weight: 600;
  padding: 0 6px;
}
code {
  background: var(--raise);
  border-radius: var(--r-s);
  padding: 1px 6px;
  font-size: 12.5px;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--raise-2);
  color: var(--slc-text);
  font-size: 12px;
  font-weight: 600;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}
.count.hot {
  background: var(--slc-accent);
  color: var(--slc-accent-text);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 500;
  color: var(--slc-text);
  white-space: nowrap;
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--off);
  flex: none;
}
.dot.online,
.chip.active .dot {
  background: var(--ok);
}
.dot.away,
.chip.queued .dot {
  background: var(--warn);
}
.dot.busy {
  background: var(--bad);
}
.dot.offline,
.chip.closed .dot {
  background: var(--off);
}
.avatar {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--raise-2);
  color: var(--slc-text);
  font-size: 13px;
  font-weight: 650;
  user-select: none;
}
.avatar.agent {
  background: var(--accent-soft);
}
.avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}
.avatar.lg {
  width: 44px;
  height: 44px;
  font-size: 15px;
}
.avatar.xl {
  width: 72px;
  height: 72px;
  font-size: 24px;
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.avatar.flag-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--slc-text) 16%, transparent);
}
.avatar .dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--slc-surface);
}

/* ---------- Menü ---------- */
.menu {
  position: relative;
  display: inline-flex;
}
.menu-pop {
  position: absolute;
  z-index: 30;
  min-width: 232px;
  padding: 6px;
  background: var(--slc-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-pop);
  animation: pop .16s var(--ease);
}
.menu-pop.down {
  top: calc(100% + 6px);
}
.menu-pop.up {
  bottom: calc(100% + 6px);
}
.menu-pop.right {
  left: calc(100% + 8px);
  bottom: 0;
}
.menu-pop.down.end,
.menu-pop.up.end {
  right: 0;
}
.menu-pop.down.start,
.menu-pop.up.start {
  left: 0;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-s);
  background: none;
  text-align: left;
  cursor: pointer;
}
.menu-item span {
  flex: 1;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--raise-2);
}
.menu-item:focus-visible {
  outline-offset: -2px;
}
.menu-item.danger {
  color: var(--danger-ink);
}
.menu-item.mobile-only {
  display: none;
}
.menu-item[aria-disabled="true"] {
  opacity: .45;
  cursor: default;
}
.menu-check {
  color: var(--slc-text);
}
.menu-heading {
  padding: 8px 10px 4px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
}
.menu-custom {
  margin-top: 6px;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--line);
}
.menu-custom:empty {
  display: none;
}
.menu-custom .push {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.menu-custom .push .btn {
  width: 100%;
}
.menu-custom .push small {
  line-height: 1.4;
}
.menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--line);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(.98);
  }
}

/* ---------- Anmeldung ---------- */
.login {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--slc-bg);
}
.login form {
  width: 100%;
  max-width: 400px;
  background: var(--slc-surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--r-l) + 4px);
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-pop);
}
.login .brandmark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--slc-accent);
  color: var(--slc-accent-text);
}
.login h1 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
}
.login .lead {
  margin: -8px 0 4px;
  color: var(--dim);
}
.login label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.login input {
  min-height: 42px;
  font-size: 15px;
  font-weight: 400;
}
.login .btn {
  min-height: 42px;
  font-size: 15px;
}
.login .sso {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login .sso p {
  margin: 4px 0;
  text-align: center;
}
.login .sso .btn {
  width: 100%;
}

/* ---------- Gerüst ---------- */
.app {
  display: grid;
  height: 100%;
  grid-template-columns: 88px 340px minmax(0, 1fr);
  grid-template-areas: "rail nav work";
}
.app.nav-admin {
  grid-template-columns: 88px 264px minmax(0, 1fr);
}
.app.nav-none {
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-areas: "rail work";
}
.rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px 12px;
  background: var(--slc-surface);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.rail .brandmark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--slc-accent);
  color: var(--slc-accent-text);
}
.rail-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
}
.rail-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 8px 0 7px;
  border: 0;
  border-radius: var(--r-m);
  background: none;
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.rail-item .rl {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-item:hover {
  background: var(--raise-2);
  color: var(--slc-text);
}
.rail-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--slc-text);
}
.rail-item .badge {
  position: absolute;
  top: 3px;
  right: 14px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--slc-accent);
  color: var(--slc-accent-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}
.rail-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}
.rail-foot .menu > button {
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
}
.rail-foot .avatar {
  width: 40px;
  height: 40px;
}
.rail-foot .avatar .dot {
  border-color: var(--slc-surface);
}
.nav-col {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--slc-bg);
  border-right: 1px solid var(--line);
}
.navhead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.navhead h2 {
  margin: 0;
  font-size: 18px;
  flex: 1;
}
.nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 8px 16px;
}
.warn {
  margin: 8px;
  padding: 8px 12px;
  border-radius: var(--r-s);
  background: color-mix(in srgb, var(--slc-danger) 16%, var(--slc-bg));
  color: var(--danger-ink);
  font-size: 13px;
}
.sec {
  display: flex;
  align-items: center;
  margin: 16px 12px 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--dim);
}
.sec:first-child {
  margin-top: 8px;
}
.sec.sub {
  margin: 8px 12px 2px;
  font-weight: 500;
  font-size: 12px;
}
.nav-scroll ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px;
  padding: 10px 0;
  color: var(--dim);
  font-size: 13px;
}
.chat-item {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-m);
  background: none;
  text-align: left;
  cursor: pointer;
  margin-bottom: 2px;
}
.chat-item:hover {
  background: var(--raise);
}
.chat-item[aria-current="true"] {
  background: var(--raise);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.ci-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ci-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ci-top strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.ci-top time {
  font-size: 12px;
  color: var(--dim);
  flex: none;
}
.ci-top time.wait {
  font-variant-numeric: tabular-nums;
}
.ci-top time.wait.long {
  color: var(--slc-text);
  font-weight: 650;
}
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--slc-accent);
  color: var(--slc-accent-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  flex: none;
}
.chat-item.unread .ci-prev {
  color: var(--slc-text);
  font-weight: 600;
}
.chat-item.unread .ci-top time {
  color: var(--slc-text);
}
.ci-prev {
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ci-prev b {
  font-weight: 600;
  color: var(--slc-text);
}
.ci-meta {
  font-size: 12px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.teamstrip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}
.teamstrip .lbl {
  font-size: 12px;
  color: var(--dim);
  margin-right: 4px;
}
.subnav {
  padding: 8px 8px 16px;
  overflow-y: auto;
}
.subnav .sec {
  margin-top: 18px;
}
.subnav .sec:first-child {
  margin-top: 8px;
}
.subnav a,
.subnav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-m);
  background: none;
  color: var(--slc-text);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
}
.subnav .ic {
  color: var(--dim);
}
.subnav button:hover {
  background: var(--raise);
}
.subnav button[aria-current="page"] {
  background: var(--raise-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-weight: 600;
}
.subnav button[aria-current="page"] .ic {
  color: var(--slc-text);
}
.work {
  grid-area: work;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.empty-state {
  margin: auto;
  max-width: 320px;
  padding: 24px;
  text-align: center;
  color: var(--dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-state .ic {
  color: var(--dim);
}
.empty-state strong {
  color: var(--slc-text);
  font-size: 16px;
}

/* ---------- Chat ---------- */
.chatview {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "head ctx" "sheet ctx" "thread ctx" "comp ctx";
}
.chatview[data-ctx="closed"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "sheet" "thread" "comp";
}
.chat-head {
  grid-area: head;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 16px 10px 20px;
  border-bottom: 1px solid var(--line);
}
.chat-head .head-main {
  flex: 1;
  min-width: 0;
}
.chat-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--dim);
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.back {
  display: none;
}
.back.show {
  display: inline-flex;
}
.flag {
  display: inline-block;
  width: 21px;
  height: 14px;
  border-radius: 2px;
  vertical-align: -2px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--slc-text) 24%, transparent);
  flex: none;
}
.flag.code {
  width: auto;
  min-width: 21px;
  padding: 0 3px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  text-transform: uppercase;
  color: var(--dim);
}
.ctx dd .flag {
  margin-right: 8px;
}
.stars-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.rt-stars {
  display: inline-flex;
  gap: 1px;
  color: var(--amber-ink);
}
.rt-stars .off {
  color: var(--dim);
  opacity: .5;
}
.sheet {
  grid-area: sheet;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 14px 20px;
  background: var(--raise);
  border-bottom: 1px solid var(--line);
}
.sheet .full {
  flex-basis: 100%;
  margin: 0;
}
.sheet label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.sheet .grow {
  flex: 1;
  min-width: 180px;
}
.sheet fieldset {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 6px 12px;
}
.sheet .opt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-basis: 100%;
}
.thread {
  grid-area: thread;
  overflow-y: auto;
  padding: 20px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}
.day {
  align-self: center;
  margin: 14px 0 10px;
  padding: 2px 12px;
  border-radius: 12px;
  background: var(--raise);
  color: var(--dim);
  font-size: 12px;
  font-weight: 550;
}
.mrow {
  display: flex;
  flex-direction: column;
  max-width: min(72%, 680px);
}
.mrow.theirs {
  align-self: flex-start;
}
.mrow.mine,
.mrow.whisper {
  align-self: flex-end;
  align-items: flex-end;
}
.mrow.first {
  margin-top: 12px;
}
.mmeta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 4px 3px;
  font-size: 12px;
  color: var(--dim);
}
.mmeta b {
  font-weight: 600;
  color: var(--slc-text);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--amber-ink);
  font-weight: 600;
}
.msg {
  padding: 8px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--raise-2);
  line-height: 1.5;
}
.mrow.theirs .msg {
  border-top-left-radius: 5px;
}
.mrow.mine .msg {
  background: var(--own);
  box-shadow: inset 0 0 0 1px var(--own-line);
  border-top-right-radius: 5px;
}
.mrow.whisper .msg {
  background: var(--amber-soft);
  box-shadow: inset 0 0 0 1px var(--amber-line);
  border-top-right-radius: 5px;
}
.mrow.cont .msg {
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}
.mrow.cont {
  margin-top: 0;
}
.msg-sys {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
  color: var(--dim);
  font-size: 13px;
  text-align: center;
}
.filechip.gone {
  text-decoration: none;
  cursor: default;
  color: var(--dim);
}
.filechip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}
.tr {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-strong);
  font-size: 13px;
  color: var(--dim);
}
.tr-state {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tr-state.failed {
  color: var(--text);
}
.tr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: tr-pulse 1s ease-in-out infinite;
}
@keyframes tr-pulse {
  50% {
    opacity: 0.25;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tr-dot {
    animation: none;
  }
}
.closed-note {
  align-self: center;
  margin: 14px 0 6px;
  color: var(--dim);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ci-typing {
  color: var(--slc-accent-text);
  font-style: normal;
  font-weight: 600;
}
.typing-row {
  position: sticky;
  bottom: -8px;
  z-index: 1;
  padding: 6px 0 8px;
  background: linear-gradient(to bottom, transparent, var(--slc-bg) 8px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  color: var(--dim);
  font-size: 13px;
}
.typing-dots {
  display: inline-flex;
  gap: 3px;
}
.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) {
  animation-delay: .15s;
}
.typing-dots i:nth-child(3) {
  animation-delay: .3s;
}
@keyframes typing-bounce {
  0%,
  60%,
  100% {
    opacity: .35;
  }
  30% {
    opacity: 1;
  }
}
.typing-preview {
  max-height: 7.5em;
  overflow-y: auto;
  background: var(--slc-bg);
  flex-basis: 100%;
  max-width: min(560px, 90%);
  margin: 0;
  padding: 8px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-m);
  color: var(--slc-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-style: italic;
}
.typing-preview small {
  display: block;
  margin-bottom: 2px;
  color: var(--dim);
  font-style: normal;
  font-size: 11px;
}

/* Verfassen */
.composer {
  grid-area: comp;
  position: relative;
  margin: 8px 20px 18px;
  display: flex;
  flex-direction: column;
  background: var(--slc-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  transition: border-color .15s, background .15s;
}
.composer:focus-within {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  border-color: transparent;
}
.composer[data-whisper="true"] {
  background: var(--amber-soft);
  border-color: var(--amber-line);
}
.composer textarea {
  border: 0;
  background: none;
  border-radius: var(--r-l);
  padding: 14px 16px 6px;
  min-height: 52px;
  max-height: 220px;
  outline: 0 !important;
  line-height: 1.5;
}
.composer-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 8px 8px;
}
.composer-bar .grow {
  flex: 1;
}
.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--r-m);
  background: var(--raise);
  border: 1px solid var(--line);
  margin: 0 4px;
}
.seg label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: calc(var(--r-m) - 2px);
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  color: var(--dim);
  white-space: nowrap;
}
.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.seg label:has(input:checked) {
  background: var(--slc-surface);
  color: var(--slc-text);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.seg label:has(input:focus-visible) {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}
.seg label:has(input:disabled) {
  opacity: .5;
  cursor: default;
}
.send-btn {
  gap: 8px;
  padding: 0 14px;
}
.readonly {
  grid-area: comp;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 20px 18px;
  padding: 12px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-l);
  color: var(--dim);
}
.picker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  max-height: 280px;
  overflow-y: auto;
  background: var(--slc-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-pop);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 6px;
}
.picker button {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-items: baseline;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--r-s);
  padding: 8px 10px;
  cursor: pointer;
}
.picker button small {
  flex-basis: 100%;
  color: var(--dim);
}
.picker button.sel,
.picker button:hover {
  background: var(--raise-2);
}
.picker input {
  margin: 4px 0 8px;
  width: auto;
}

/* ---------- Kontext ---------- */
.ctx {
  grid-area: ctx;
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--slc-surface);
  font-size: 13.5px;
}
.chatview[data-ctx="closed"] .ctx {
  display: none;
}
.ctx-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 0 8px 0 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--slc-surface);
  z-index: 1;
}
.ctx-head h3 {
  margin: 0;
  flex: 1;
  font-size: 15px;
}
.ctx section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.ctx section:last-child {
  border-bottom: 0;
}
.ctx h3.sect {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--dim);
  display: flex;
  align-items: center;
}
.person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.person strong {
  display: block;
  font-size: 15px;
}
.ctx dl {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
}
.ctx dt {
  margin-top: 12px;
  color: var(--dim);
  font-size: 12px;
}
.ctx dt:first-child {
  margin-top: 0;
}
.ctx dd {
  margin: 1px 0 0;
  overflow-wrap: anywhere;
}
.ctx dd.url {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ctx .related,
.ctx .rate-note,
.ctx .ext {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.ctx .rate-note p,
.ctx .related p {
  margin: 0 0 6px;
}
.rt-comment {
  margin: 0;
  max-width: 75ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.copy {
  display: inline;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  user-select: text;
  overflow-wrap: anywhere;
}
.copy .copy-ic {
  display: inline-block;
  margin-left: 6px;
  color: var(--dim);
  vertical-align: -1px;
  opacity: 0;
  transition: opacity .12s;
}
.copy:hover .copy-text {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.copy:hover .copy-ic,
.copy:focus-visible .copy-ic,
.copy.done .copy-ic {
  opacity: 1;
  color: var(--slc-text);
}
@media (hover: none) {
  .copy .copy-ic {
    opacity: .7;
  }
}
.rel-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rel-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 10px 8px;
  margin: 0 -8px;
  border: 0;
  border-radius: var(--r-s);
  background: none;
  text-align: left;
  cursor: pointer;
}
.rel-item:hover {
  background: var(--raise-2);
}
.rel-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}
.rel-topic {
  overflow-wrap: anywhere;
}
.rel-why,
.rel-hint {
  font-size: 12px;
}

/* ---------- Seiten (Verwaltung, Berichte, Besucher …) ---------- */
.chat.admin {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat.admin > header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.chat.admin > header .head-main {
  flex: 1;
  min-width: 0;
}
.chat.admin > header h2 {
  margin: 0;
  font-size: 20px;
}
.chat.admin > header:has(> .back) > .btn:last-child {
  display: none;
}
.chat.admin .admin-body,
.chat.admin .reports {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 32px 40px;
}
.admin-body {
  display: grid;
  grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
  gap: 32px;
  align-content: start;
}
.admin-body.single {
  grid-template-columns: minmax(0, 880px);
}
.reports {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.canned-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.canned-form h3 {
  margin: 0;
  font-size: 16px;
}
.canned-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.canned-form label.check {
  flex-direction: row;
  font-weight: 400;
}
.canned-form small {
  font-weight: 400;
}
.canned-form fieldset {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.canned-form textarea {
  font-family: inherit;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.canned-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.canned-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.canned-list small {
  display: block;
}
.canned-list a.btn {
  text-decoration: none;
}
.sf-tabs.kb-tabs {
  margin: 16px 32px 0;
  align-self: flex-start;
}
.admin-body .pad,
.reports .pad {
  padding: 0;
}

/* Berichte */
.rep-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.rep-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.rep-filters label.check {
  flex-direction: row;
  align-items: center;
  min-height: 36px;
  font-weight: 400;
}
.rep-filters input,
.rep-filters select {
  width: auto;
  min-width: 140px;
}
.rep-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rep-body.stale {
  opacity: .6;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--slc-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 14px 16px;
}
.kpi-label {
  font-size: 13px;
  color: var(--dim);
}
.kpi-value {
  font-size: 26px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.02em;
}
.kpi-sub {
  font-size: 12px;
}
.rep-chart {
  margin: 0;
  background: var(--slc-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 14px 16px;
}
.rep-chart figcaption {
  font-weight: 600;
  margin-bottom: 8px;
}
.rep-chart {
  min-width: 0;
}
.rep-chart-box {
  width: 100%;
  min-height: 140px;
  overflow: hidden;
}
.rep-chart svg {
  display: block;
  max-width: 100%;
}
.rep-chart .bar {
  fill: var(--slc-accent);
}
.rep-chart .bar:hover {
  opacity: .7;
}
.rep-chart .axis {
  stroke: var(--line-strong);
  stroke-width: 1;
}
.rep-chart text {
  font-family: var(--slc-font);
  letter-spacing: 0;
}
.rep-chart .tick {
  fill: var(--dim);
  font-size: 11px;
}
.rep-scroll {
  overflow-x: auto;
}
.rep-table,
.sf-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}
.rep-table th,
.rep-table td,
.sf-table th,
.sf-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: top;
}
.sf-table td {
  white-space: normal;
}
.rep-table th,
.sf-table th {
  color: var(--dim);
  font-weight: 600;
  font-size: 12.5px;
}
.rep-details summary {
  cursor: pointer;
  color: var(--dim);
}
.rep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.rep-card {
  background: var(--slc-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 14px 16px;
}
.rep-card h3,
.reports h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.hbars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hbars li {
  display: grid;
  grid-template-columns: minmax(90px, 40%) 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13.5px;
}
.hbars i {
  display: block;
  height: 8px;
  width: var(--w);
  min-width: 2px;
  background: var(--slc-accent);
  border-radius: 4px;
}

/* Bewertungen */
.ratings {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ratings.stale {
  opacity: .6;
}
.ratings li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.rt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}
.rt-open {
  margin-left: auto;
}
.rt-summary {
  margin: 0;
  font-weight: 600;
}

/* Einstellungen */
.sf-box {
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 14px 16px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--slc-surface);
}
.sf-box legend {
  font-weight: 600;
  padding: 0 6px;
}
.sf-lang {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-bottom: 6px;
}
.sf-lang textarea {
  flex: 1;
}
.sf-code {
  width: 4.5em;
}
.sf-day {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}
.sf-day > b {
  width: 7em;
}
.sf-range {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.sf-range input {
  width: 5em;
}
.sf-opt {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr auto;
  gap: 6px;
  margin-bottom: 6px;
}
.sf-hol {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}
.sf-hollist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 4px 16px;
}
.sf-tabs {
  display: inline-flex;
  gap: 2px;
  margin: 12px 0 8px;
  padding: 3px;
  border-radius: var(--r-m);
  background: var(--raise);
  border: 1px solid var(--line);
}
.sf-tabs button {
  border: 0;
  background: transparent;
  color: var(--dim);
  padding: 6px 14px;
  border-radius: calc(var(--r-m) - 2px);
  cursor: pointer;
  font-weight: 550;
}
.sf-tabs button.active {
  background: var(--slc-surface);
  color: var(--slc-text);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.sf-theme {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 16px;
  align-items: start;
}
.sf-theme-fields {
  display: grid;
  gap: 8px;
}
.sf-color-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.sf-color-row input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  flex: none;
}
.sf-color-row input[type="text"] {
  flex: 1;
  min-width: 0;
}
.secret-box {
  background: var(--raise);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: var(--r-m);
  word-break: break-all;
  font-family: "SLC Mono", ui-monospace, monospace;
}
.theme-preview {
  position: sticky;
  top: 8px;
  background: var(--slc-bg);
  color: var(--slc-text);
  font-family: var(--slc-font);
  border: 1px solid var(--slc-border);
  border-radius: var(--slc-radius);
  overflow: hidden;
  font-size: 14px;
}
.tp-head {
  background: var(--slc-surface);
  border-bottom: 1px solid var(--slc-border);
  padding: 10px 12px;
}
.tp-body {
  padding: 12px;
  display: grid;
  gap: 8px;
}
.tp-msg {
  background: var(--slc-surface);
  border: 1px solid var(--slc-border);
  border-radius: var(--slc-radius);
  padding: 8px 10px;
  max-width: 85%;
}
.tp-msg.me {
  background: var(--slc-accent);
  color: var(--slc-accent-text);
  border-color: transparent;
  justify-self: end;
}
.tp-muted {
  color: var(--slc-muted);
}
.tp-input {
  border: 1px solid var(--slc-border);
  border-radius: var(--slc-radius);
  padding: 8px 10px;
  color: var(--slc-muted);
}
.context .ext {
  border-top: 1px solid var(--line);
}

/* Sprachen */
.loc {
  position: relative;
}
.loc-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.loc-bar h3 {
  margin: 0;
  flex: 1;
  min-width: 8em;
}
.loc-file {
  cursor: pointer;
}
.loc-file:focus-within {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.loc-langs,
.loc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.loc-langs li,
.loc-list li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.loc-lang-head,
.loc-key {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}
.loc-tag {
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--dim);
}
.loc-tag.miss {
  color: var(--danger-ink);
  border-color: color-mix(in srgb, var(--slc-danger) 55%, transparent);
}
.loc-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.loc-progress progress {
  appearance: none;
  width: 180px;
  max-width: 50%;
  height: 6px;
  border: 0;
  border-radius: 3px;
  background: var(--raise-2);
  overflow: hidden;
}
.loc-progress progress::-webkit-progress-bar {
  background: var(--raise-2);
}
.loc-progress progress::-webkit-progress-value {
  background: var(--ok);
  border-radius: 3px;
}
.loc-progress progress::-moz-progress-bar {
  background: var(--ok);
}
.loc-ref {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.loc-list li.changed {
  background: var(--accent-soft);
  margin: 0 -12px;
  padding: 14px 12px;
  border-radius: var(--r-m);
}
.loc-list textarea {
  resize: vertical;
  font-family: inherit;
}
.loc-pager {
  align-items: center;
  margin-top: 12px;
}
.loc-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}
.loc-save {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
  margin-top: 16px;
  padding: 12px 0;
  background: var(--slc-bg);
  border-top: 1px solid var(--line);
}
.loc-save span {
  margin-right: auto;
}

/* ---------- Schmale Fenster ---------- */
@media (max-width: 1279px) {
  .chatview {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "sheet" "thread" "comp";
  }
  .chatview .ctx {
    position: absolute;
    z-index: 15;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, 100%);
    box-shadow: var(--shadow-pop);
    animation: slide .22s var(--ease);
  }
  .chatview[data-ctx="closed"] .ctx {
    display: none;
  }
}
@keyframes slide {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}
@media (max-width: 1023px) {
  .sf-tabs.kb-tabs {
    margin: 12px 20px 0;
  }
  .app {
    grid-template-columns: 88px 300px minmax(0, 1fr);
  }
  .app.nav-admin {
    grid-template-columns: 88px 232px minmax(0, 1fr);
  }
  .mrow {
    max-width: 82%;
  }
  .chat.admin .admin-body,
  .chat.admin .reports {
    padding: 20px 20px 32px;
  }
}
@media (max-width: 860px) {
  .admin-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .sf-theme {
    grid-template-columns: 1fr;
  }
  .sf-opt {
    grid-template-columns: 1fr;
  }
  .sf-hol {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* Handy: eine Spalte, Navigation unten */
@media (max-width: 760px) {
  .app,
  .app.nav-admin,
  .app.nav-none {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
  }
  .app > .nav-col,
  .app > .work {
    flex: 1;
    min-height: 0;
    border-right: 0;
  }
  .app[data-area="list"] > .work,
  .app[data-area="adminnav"] > .work {
    display: none;
  }
  .app[data-area="chat"] > .nav-col,
  .app[data-area="panel"] > .nav-col,
  .app[data-area="none"] > .nav-col {
    display: none;
  }
  .rail {
    order: 2;
    flex-direction: row;
    justify-content: space-around;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    border-right: 0;
    border-top: 1px solid var(--line);
    gap: 0;
    flex: none;
  }
  .rail .brandmark {
    display: none;
  }
  .rail-items {
    flex-direction: row;
    justify-content: space-around;
    overflow: visible;
    gap: 0;
  }
  .rail-item {
    flex: 1;
    min-width: 0;
    padding: 6px 2px 4px;
    min-height: 52px;
    justify-content: center;
  }
  .rail-item[aria-current="page"] {
    flex: 2;
  }
  .rail-item:not([aria-current="page"]) .rl {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .menu-item.mobile-only {
    display: flex;
  }
  .desk-only {
    display: none !important;
  }
  .meta {
    flex-wrap: nowrap;
    overflow: hidden;
    white-space: nowrap;
  }
  .meta > :nth-child(3),
  .meta > :nth-child(n + 5) {
    display: none;
  }
  .chat-head .avatar.lg {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
  .seg label {
    padding: 0 8px;
  }
  .seg label .ic {
    display: none;
  }
  .composer-bar .icon-btn {
    width: 34px;
  }
  .rail-item .badge {
    right: 50%;
    margin-right: -26px;
  }
  .rail-foot {
    flex-direction: row;
    padding: 0 4px;
  }
  .rail-foot .avatar {
    width: 34px;
    height: 34px;
  }
  .menu-pop.right {
    left: auto;
    right: 0;
    bottom: calc(100% + 8px);
  }
  .app[data-area="chat"] .rail {
    display: none;
  }
  .back {
    display: inline-flex;
  }
  .chat.admin > header .back + .head-main {
    margin-left: 0;
  }
  .chat.admin > header:has(> .back) > .btn:last-child {
    display: none;
  }
  .chat.admin > header {
    padding: 0 8px 0 4px;
  }
  .chat-head {
    padding: 8px 8px 8px 4px;
    gap: 8px;
  }
  .chat-head .head-actions .btn span.lbl {
    display: none;
  }
  .thread {
    padding: 14px 12px 6px;
  }
  .mrow {
    max-width: 88%;
  }
  .composer,
  .readonly {
    margin: 6px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .composer textarea {
    font-size: 16px;
  }
  .send-btn .lbl {
    display: none;
  }
  .chat.admin .admin-body,
  .chat.admin .reports {
    padding: 16px 16px 32px;
  }
  .chatview .ctx {
    width: 100%;
  }
  .navhead {
    padding-left: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .menu-pop,
  .chatview .ctx {
    animation: none;
  }
  .thread {
    scroll-behavior: auto;
  }
  .btn,
  .icon-btn,
  .copy .copy-ic {
    transition: none;
  }
}

/* Persönliche Einstellungen */
.acct {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 640px;
}
.acct-sec {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.acct-sec h3 {
  margin: 0;
  font-size: 16px;
}
.acct-sec p {
  margin: 0;
}
.acct-avatar {
  display: flex;
  gap: 20px;
  align-items: center;
}
.acct-avatar > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.acct-sound {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}
.acct-sound legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px;
  font-weight: 650;
}
.acct-sound legend small {
  font-weight: 400;
}
.acct-sound label.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.acct-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}
.acct-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.acct-controls .acct-vol {
  flex: 1;
  min-width: 160px;
}
.acct-vol span {
  display: flex;
  justify-content: space-between;
}
.acct-vol output {
  font-weight: 400;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.acct-vol input {
  accent-color: var(--slc-accent);
}
@media (max-width: 640px) {
  .acct-avatar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Branding */
.brandmark.has-logo {
  background: var(--raise-2);
  padding: 5px;
}
.brandmark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.login .brandmark.has-logo {
  width: auto;
  min-width: 48px;
  max-width: 200px;
  height: 56px;
  padding: 6px 10px;
}
.login .brandmark.has-logo img {
  width: auto;
  max-width: 100%;
}
.login .brandname {
  margin: -4px 0 -8px;
  color: var(--dim);
  font-size: 13px;
  font-weight: 600;
}
.brand-asset {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 0;
}
.brand-preview {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 72px;
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-m);
  background: var(--raise);
  text-align: center;
  font-size: 12px;
}
.brand-preview.favicon {
  width: 72px;
}
.brand-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.brand-asset-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.file-btn {
  position: relative;
  cursor: pointer;
}
.file-btn:has(input:focus-visible) {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Flaggen (flag-icons, 4:3) */
img.flag {
  width: 19px;
  object-fit: cover;
}

/* Über */
.about {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 720px;
}
.about-sec {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.about-sec h3 {
  margin: 0;
  font-size: 18px;
}
.about-sec p {
  margin: 0;
}
.about-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 0;
}
.about-facts dt {
  color: var(--dim);
  font-size: 13px;
}
.about-facts dd {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin: 0;
  font-weight: 600;
}
.about-tech {
  list-style: none;
  margin: 0;
  padding: 0;
}
.about-tech li {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.about-tech li a {
  font-weight: 600;
}
.about-tech li small {
  white-space: nowrap;
}
@media (max-width: 640px) {
  .about-tech li {
    grid-template-columns: 1fr auto;
  }
  .about-tech li span {
    grid-column: 1 / -1;
    order: 3;
  }
}

/* Formatierter Chat-Text */
.msg a.lnk {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.msg .emo {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

/* Markdown-Blöcke in Nachrichten */
.msg .rt-p,
.msg .rt-list,
.msg .rt-pre,
.msg .rt-quote {
  margin: 0;
}
.msg > * + *,
.msg .rt-quote > * + *,
.msg li > * + * {
  margin-top: .5em;
}
.msg .rt-list {
  padding-left: 1.4em;
}
.msg .rt-code,
.msg .rt-pre {
  font-family: "SLC Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .92em;
  background: color-mix(in srgb, currentColor 11%, transparent);
  border-radius: 5px;
}
.msg .rt-code {
  padding: 1px 5px;
}
.msg .rt-pre {
  padding: 8px 10px;
  overflow-x: auto;
  white-space: pre;
}
.msg .rt-quote {
  padding: 6px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 8%, transparent);
}

/* Fett deutlich vom Fließtext absetzen (variable Schriften: 750, sonst echtes Bold 700) */
.msg strong,
.msg .rt-h {
  font-weight: 750;
  letter-spacing: .004em;
}
.acct-file {
  margin-top: 8px;
}

.acct-tr-field {
  display: grid;
  gap: 4px;
  max-width: 360px;
}

/* Übersetzung über dem Textfeld */
.tr-pop {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  width: min(520px, 100%);
  display: grid;
  gap: 12px;
  padding: 10px 12px 12px;
  background: var(--slc-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-pop);
  z-index: 20;
}
.tr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tr-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.tr-field {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
  font-weight: 600;
}
.tr-pop select,
.tr-pop input[type="search"] {
  width: 100%;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
}
.tr-btn {
  position: relative;
}
.tr-btn.custom::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slc-accent);
  box-shadow: 0 0 0 2px var(--slc-surface);
}
@media (max-width: 760px) {
  .tr-pop {
    width: 100%;
  }
  .tr-pop select,
  .tr-pop input[type="search"] {
    font-size: 16px;
  }
}

/* Durchsuchbares Dropdown */
.combo-box {
  position: relative;
}
.combo-box input {
  width: 100%;
  padding-right: 30px;
  text-overflow: ellipsis;
}
.combo-caret {
  position: absolute;
  right: 11px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -6px;
  border-right: 1.5px solid var(--dim);
  border-bottom: 1.5px solid var(--dim);
  transform: rotate(45deg);
  pointer-events: none;
}
.combo-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--slc-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-pop);
}
.combo-list li {
  padding: 7px 10px;
  border-radius: var(--r-s);
  cursor: pointer;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.combo-list li[data-active="true"] {
  background: var(--raise-2);
}
.combo-list li[aria-selected="true"] {
  font-weight: 600;
}
.combo-empty {
  color: var(--dim);
  cursor: default !important;
}

/* Schalter mit An/Aus */
.tr-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--slc-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.switch:disabled {
  opacity: .45;
  cursor: default;
}
.switch:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: var(--r-s);
}
.switch-track {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--slc-text) 24%, var(--slc-surface));
  transition: background .2s var(--ease);
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--slc-surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / .35);
  transition: transform .2s var(--ease);
}
.switch[aria-checked="true"] .switch-track {
  background: var(--slc-accent);
}
.switch[aria-checked="true"] .switch-thumb {
  transform: translateX(16px);
  background: var(--slc-accent-text);
}
.switch-state {
  min-width: 2.2em;
  color: var(--dim);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.switch[aria-checked="true"] .switch-state {
  color: var(--slc-text);
}
@media (prefers-reduced-motion: reduce) {
  .switch-track,
  .switch-thumb {
    transition: none;
  }
}
