/* Right rail: Tabs (Team / Agent), Team-Liste, Konversation, Composer.
   Klassische Messenger-/Helpdesk-Optik mit Avataren, gefuellten Bubbles. */

.rail-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 0 4px;
  flex-shrink: 0;
}
.rail-tabs button {
  appearance: none; background: transparent; border: 0;
  padding: 14px 16px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.rail-tabs button:hover { color: var(--ink-2); }
.rail-tabs button.is-active {
  color: var(--primary-2);
  border-bottom-color: var(--primary-2);
  font-weight: 600;
}
.rail-tabs .tab-badge {
  font-size: 10px; font-weight: 700;
  background: var(--bad);
  color: #ffffff;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  min-width: 18px; text-align: center;
}
.rail-tabs .has-suggestion {
  display: inline-flex; align-items: center; gap: 7px;
}
.rail-tabs .has-suggestion::after {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bad);
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
  animation: pulse-soft 1.8s ease-in-out infinite;
}

.rail-body {
  flex: 1;
  overflow-y: auto;
  background: var(--canvas);
  display: flex; flex-direction: column;
  min-height: 0;
}

/* ---------- TEAM LIST ---------- */
.team { display: flex; flex-direction: column; padding: 14px 14px 6px; gap: 8px; }
.team-section-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  padding: 12px 4px 4px;
  display: flex; align-items: center; gap: 8px;
}
.team-section-label::after {
  content: ""; flex: 1;
  height: 1px;
  background: var(--line);
}

.team-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px; align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.team-row:hover {
  border-color: var(--primary-3);
  box-shadow: 0 0 0 3px var(--primary-softer);
}
.team-row .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--av, var(--primary-2));
  color: #ffffff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
  position: relative;
  flex-shrink: 0;
}
.team-row .av::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  width: 11px; height: 11px;
  border: 2px solid var(--canvas);
  border-radius: 50%;
  background: var(--ok-2);
}
.team-row.is-pause .av::after { background: var(--warn); }
.team-row.is-alarm .av::after { background: var(--bad); animation: pulse-soft 1.4s ease-in-out infinite; }

.team-row .info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.team-row .nm { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.team-row .unread {
  display: inline-block;
  background: var(--bad);
  color: #ffffff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  margin-left: 6px;
  vertical-align: middle;
}
.team-row .role { font-size: 11.5px; color: var(--muted); }
.team-row .right {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted);
}
.team-row .right .st-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600;
  background: var(--ok-softer);
  color: var(--ok);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em; text-transform: uppercase;
}
.team-row .right .st-pill.is-pause { background: var(--warn-softer); color: var(--warn); }
.team-row .right .st-pill.is-alarm { background: var(--bad-softer); color: var(--bad); }
.team-row .right .st-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.team-row.is-alarm {
  grid-template-columns: 44px 1fr auto;
  border-color: var(--bad-soft);
  background: linear-gradient(95deg, var(--bad-softer), var(--surface));
  border-left: 3px solid var(--bad);
  padding: 12px 14px;
}
.team-row.is-alarm .av { width: 44px; height: 44px; font-size: 14px; }
.team-row.is-alarm .nm { font-size: 14px; font-weight: 600; }
.team-row.is-alarm .alarm-line {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  color: var(--bad);
  margin-top: 3px;
}
.team-row.is-alarm .alarm-line .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); animation: pulse-soft 1.4s ease-in-out infinite; }
.team-row.is-alarm .note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.team-row.is-alarm .btn { padding: 0 12px; height: 32px; font-size: 12.5px; }

.team-pause {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--surface);
  overflow: hidden;
}
.team-pause-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 12px; color: var(--ink-2);
}
.team-pause-row:hover { background: var(--canvas); }
.team-pause-row .lbl {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  background: var(--warn-softer); color: var(--warn);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}
.team-pause-row .names { color: var(--muted); flex: 1; font-size: 11.5px; }
.team-pause-row .toggle { font-size: 11px; color: var(--muted); }
.team-pause-row .chev { display: inline-block; margin-left: 4px; transition: transform 160ms ease; }
.team-pause.is-open .team-pause-row .chev { transform: rotate(180deg); }
.team-pause .expanded { padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line-2); }
.team-pause .expanded .team-row { border-color: var(--line); }

/* ---------- CONVERSATION ---------- */
.conv-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.conv-head .back {
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: var(--radius-1);
  display: grid; place-items: center;
  color: var(--muted);
  font-size: 18px;
  transition: background-color 120ms ease, color 120ms ease;
}
.conv-head .back:hover { background: var(--canvas); color: var(--ink); }
.conv-head .who-block { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.conv-head .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--av, var(--primary-2));
  color: #ffffff;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600;
  position: relative;
}
.conv-head .av::after {
  content: ""; position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--ok-2);
}
.conv-head.is-alarm .av::after { background: var(--bad); }
.conv-head .who { display: flex; flex-direction: column; line-height: 1.2; }
.conv-head .nm { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.conv-head .ctx { font-size: 11.5px; color: var(--muted); }
.conv-head .conv-actions { display: flex; gap: 4px; }
.conv-head .conv-actions button {
  appearance: none;
  background: transparent;
  border: 0;
  width: 30px; height: 30px;
  border-radius: var(--radius-1);
  color: var(--muted);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background-color 120ms ease, color 120ms ease;
}
.conv-head .conv-actions button:hover { background: var(--canvas); color: var(--ink); }

.conv-anchor {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: var(--warn-softer);
  border-bottom: 1px solid var(--warn-soft);
  font-size: 12px; color: var(--ink-2);
}
.conv-anchor .anchor-text { display: inline-flex; align-items: center; gap: 6px; }
.conv-anchor .anchor-ic { color: var(--warn); flex-shrink: 0; }
.conv-anchor .x {
  cursor: pointer;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--muted);
  font-size: 14px;
}
.conv-anchor .x:hover { background: rgba(245, 158, 11, 0.15); color: var(--ink); }

.conv {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.conv .empty {
  text-align: center;
  font-size: 12.5px; color: var(--muted);
  padding: 30px 0;
}

.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg.is-me { align-self: flex-end; flex-direction: row-reverse; }
.msg.is-sys { align-self: center; max-width: 100%; }
.msg .msg-av {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--av, var(--muted-2));
  color: #ffffff;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 600;
  flex-shrink: 0;
}
.msg.is-me .msg-av { background: var(--primary-2); }
.msg.is-bot .msg-av { background: var(--info); }

.msg .msg-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-3);
  padding: 9px 13px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.03);
  border-top-left-radius: var(--radius-1);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.is-me .msg-body {
  background: var(--primary-2);
  color: #ffffff;
  border-color: var(--primary-2);
  border-top-left-radius: var(--radius-3);
  border-top-right-radius: var(--radius-1);
}
.msg.is-bot .msg-body { border-top: 2px solid var(--info); }
.msg.is-sys .msg-body {
  background: var(--bad-softer);
  border: 1px solid var(--bad-soft);
  color: var(--bad);
  font-size: 12px;
  border-radius: var(--radius-2);
  text-align: center;
  width: 100%;
  font-weight: 500;
}
.msg .msg-meta {
  font-size: 10.5px; color: var(--muted);
  margin-top: 4px;
  display: flex; align-items: center; gap: 5px;
}
.msg.is-me .msg-meta { color: var(--muted); justify-content: flex-end; }
.msg .msg-meta .check { color: var(--ok); font-size: 11px; }

.voice {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px;
}
.voice .wf { display: inline-flex; align-items: center; gap: 2px; height: 16px; }
.voice .wf i {
  display: inline-block;
  width: 2px;
  background: currentColor;
  border-radius: 1px;
  opacity: 0.7;
}

/* ---------- AGENT ---------- */
.agent-suggestion {
  background: linear-gradient(135deg, var(--bad-softer), var(--bad-softer));
  border: 1px solid var(--bad-soft);
  border-left: 4px solid var(--bad);
  border-radius: var(--radius-3);
  padding: 14px;
  margin: 14px 14px 4px;
  box-shadow: var(--shadow-1);
}
.agent-suggestion .badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bad);
  color: #ffffff;
  font-size: 10px; font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.agent-suggestion .badge .dot { width: 6px; height: 6px; border-radius: 50%; background: #ffffff; animation: pulse-soft 1.6s ease-in-out infinite; }
.agent-suggestion .head {
  font-size: 15px; font-weight: 600;
  color: var(--ink);
  margin: 8px 0 8px;
}
.agent-suggestion .reason ul {
  margin: 0; padding-left: 18px;
  font-size: 12.5px; color: var(--ink-2);
  line-height: 1.55;
}
.agent-suggestion .reason li { margin: 3px 0; }
.agent-suggestion .actions {
  display: flex; gap: 8px; margin-top: 12px;
}

.prompts {
  padding: 12px 14px 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.prompts .lbl {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.prompts button {
  appearance: none;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-2);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}
.prompts button:hover { background: var(--primary-softer); color: var(--primary-2); border-color: var(--primary-3); }
.prompts button .arr { font-family: var(--mono); color: var(--muted); transition: transform 120ms ease, color 120ms ease; }
.prompts button:hover .arr { color: var(--primary-2); transform: translateX(2px); }

/* ---------- COMPOSER ---------- */
.composer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px 12px;
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
}
.composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  font-family: var(--ui); font-size: 13px;
  padding: 10px 12px;
  resize: none;
  color: var(--ink);
  background: var(--canvas);
  outline: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
  min-height: 56px;
}
.composer textarea:focus {
  border-color: var(--primary-3);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-softer);
}
.composer textarea::placeholder { color: var(--muted-2); }

.composer .row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.composer .left { display: flex; gap: 4px; }
.composer .row button {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-1);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.composer .row button:hover { background: var(--canvas); color: var(--ink); border-color: var(--line); }
.composer .row .is-rec { color: var(--bad); }
.composer .row .is-rec:hover { background: var(--bad-softer); color: var(--bad); border-color: var(--bad-soft); }
.composer .row .is-primary {
  background: var(--primary-2);
  color: #ffffff;
  border-color: var(--primary-2);
  padding: 0 16px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.22);
}
.composer .row .is-primary:hover { filter: brightness(1.06); background: var(--primary-2); color: #ffffff; border-color: var(--primary-2); }

.composer .kbd-hint {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--muted-2);
  text-align: right;
}
