/* Univers Pro – H+B Corporate Font (Condensed = Hauptschrift) */
@font-face { font-family: 'Univers'; src: url('UniversCnRg.ttf') format('truetype'); font-weight: 300; font-style: normal; }
@font-face { font-family: 'Univers'; src: url('UniversCnRg.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Univers'; src: url('UniversCnBold.ttf') format('truetype'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'Univers'; src: url('UniversCnBold.ttf') format('truetype'); font-weight: 700; font-style: normal; }

:root {
  --hb-red: #c8102e; /* Pantone 1797 Approx */
  --hb-dark: #2c2a29;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --border: #e0e3eb;
  --text: #1f1f25;
  --muted: #6a6c72;
}

* {
  box-sizing: border-box;
}

[hidden], .hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: 'Univers', 'Helvetica Neue', Helvetica, Arial, sans-serif;
      /* UniversCnRg hat ein defektes Kern-Paar 'Leerzeichen + T' — es schrumpft
         das Leerzeichen auf ein Fuenftel, sodass '5 Tage' als '5Tage' erscheint
         (gemessen 18.08.2026). Kerning aus; bei dieser Schriftgroesse kein Verlust. */
      font-kerning: none;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.login-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #ffffff 0%, #f1f1f4 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 1rem;
  padding: 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-card {
  background: #fff;
  padding: 2.5rem;
  border-radius: 1.5rem;
  width: min(420px, 100%);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.login-logo {
  width: 200px;
  margin-bottom: 1rem;
}

.login-card h1 {
  margin: 0;
  font-family: 'Univers', 'Helvetica Neue', Helvetica, Arial, sans-serif;
      /* UniversCnRg hat ein defektes Kern-Paar 'Leerzeichen + T' — es schrumpft
         das Leerzeichen auf ein Fuenftel, sodass '5 Tage' als '5Tage' erscheint
         (gemessen 18.08.2026). Kerning aus; bei dieser Schriftgroesse kein Verlust. */
      font-kerning: none;
  color: var(--hb-dark);
  letter-spacing: 0.02em;
}

.login-subtitle {
  color: var(--muted);
  margin-bottom: 2rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

#login-form label {
  font-size: 0.9rem;
  font-weight: 600;
}

#login-form input {
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  font-size: 1rem;
}

button {
  font: inherit;
  cursor: pointer;
}

#login-form button {
  background: var(--hb-red);
  color: #fff;
  border: none;
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
  font-weight: 600;
}

.login-error {
  color: var(--hb-red);
  min-height: 1.2em;
}

.sidebar {
  width: 320px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
  transition: transform 0.3s ease;
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hamburger {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: transparent;
  justify-content: center;
  align-items: center;
}

.hamburger span {
  width: 18px;
  height: 2px;
  background: var(--hb-dark);
  border-radius: 999px;
}

#hamburger {
  display: none;
}

.mobile-only {
  display: none;
}

.new-chat {
  flex: 1;
  border: none;
  background: var(--hb-red);
  color: #fff;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  font-weight: 600;
}

/* Search box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  padding: 0.7rem 2.2rem 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.search-box input:focus {
  outline: none;
  border-color: var(--hb-red);
}

#search-clear {
  position: absolute;
  right: 4px;
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--muted);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  line-height: 1;
}

#search-clear:hover {
  color: var(--hb-red);
}

/* Search results */
.search-result {
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.75rem 0.85rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.search-result:hover {
  border-color: var(--hb-red);
}

.search-result .sr-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
}

.search-result .sr-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
}

.search-result .sr-snippet {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result .sr-date {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.conversation-item {
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.conversation-item.active,
.conversation-item-wrap.active .conversation-item {
  border-color: var(--hb-red);
  box-shadow: 0 8px 20px rgba(229, 0, 0, 0.15);
}

.conversation-item h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.conversation-item time {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- Sidebar v2 (2026-05-26): sections, context menu, projects ---- */
.conversation-item-wrap {
  position: relative;
  display: block;
}
.conversation-item-wrap .conversation-item {
  width: 100%;
  padding-right: 2.6rem; /* room for the ⋯ button */
}
.conv-menu-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.conv-menu-btn:hover,
.conv-menu-btn:focus {
  background: #f3f3f3;
  border-color: var(--border);
  color: var(--hb-red);
}
.conv-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.conv-title-row h4 {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-star-indicator {
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.conv-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-bottom: 0.2rem;
}
.conv-section-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.35rem 0.15rem;
  border-bottom: 1px solid var(--border);
  margin-top: 0.35rem;
}
.conv-section-count {
  margin-left: auto;
  background: #f1f1f1;
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border-radius: 0.6rem;
  font-size: 0.72rem;
  font-weight: 500;
}
.conv-section-starred .conv-section-header {
  color: #b88600;
}
.conv-section-starred .conv-section-count {
  background: #fff5dc;
  color: #8a6500;
}
.conv-section-project {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.5rem 0.55rem;
}
.conv-project-header {
  cursor: pointer;
  border-bottom: none;
  margin: 0;
  padding: 0.25rem 0.2rem;
  user-select: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--hb-dark);
}
.conv-project-header:hover { color: var(--hb-red); }
.conv-project-caret {
  font-size: 0.8rem;
  transition: transform 0.15s;
  display: inline-block;
}
.conv-section-project.collapsed .conv-project-caret {
  transform: rotate(-90deg);
}
.conv-project-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.conv-project-menu-btn {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.conv-project-menu-btn:hover {
  background: #efefef;
  border-color: var(--border);
  color: var(--hb-red);
}
.conv-section-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.45rem;
}
.conv-section-project.collapsed .conv-section-body {
  display: none;
}

.projects-header {
  padding: 0.4rem 0.1rem 0.25rem;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 0.45rem;
}
.projects-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.projects-header-title {
  font-weight: 600;
  letter-spacing: 0.03em;
}
.projects-new-btn {
  margin-left: auto;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--hb-red);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.projects-new-btn:hover {
  background: var(--hb-red);
  color: #fff;
}

/* Context popup menu */
.conv-popup-menu {
  position: fixed;
  z-index: 9000;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.conv-popup-menu button {
  background: transparent;
  border: none;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  color: var(--hb-dark);
  cursor: pointer;
}
.conv-popup-menu button:hover {
  background: #f3f3f3;
}
.conv-popup-menu .conv-popup-danger {
  color: var(--hb-red);
}
.conv-popup-menu .conv-popup-danger:hover {
  background: #ffe9e9;
}

/* Modal overlay (rename, project picker, project form) */
.conv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.conv-modal {
  background: #fff;
  border-radius: 0.9rem;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0,0,0,0.25);
}
.conv-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.conv-modal .modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.conv-modal .modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.conv-modal .modal-close:hover { color: var(--hb-red); }
.conv-modal .modal-body {
  padding: 1rem 1.1rem 1.1rem;
}
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.modal-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hb-dark);
}
.modal-form input[type="text"],
.modal-form textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  font: inherit;
}
.modal-form textarea { resize: vertical; min-height: 64px; }
.modal-form input[type="text"]:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: var(--hb-red);
}
.modal-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.modal-actions-spread { justify-content: space-between; flex-wrap: wrap; }
.modal-actions .btn-cancel,
.modal-actions .btn-secondary,
.modal-actions .btn-primary {
  padding: 0.55rem 0.95rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}
.modal-actions .btn-cancel:hover,
.modal-actions .btn-secondary:hover {
  background: #f3f3f3;
}
.modal-actions .btn-primary {
  background: var(--hb-red);
  color: #fff;
  border-color: var(--hb-red);
}
.modal-actions .btn-primary:hover { filter: brightness(1.05); }

.project-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.project-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.project-picker-row:hover {
  border-color: var(--hb-red);
  background: #fff7f7;
}
.project-picker-row.active {
  border-color: var(--hb-red);
  background: #fff0f0;
}
.project-picker-active-tag {
  font-size: 0.78rem;
  color: var(--hb-red);
  font-weight: 600;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--hb-dark);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.user-meta {
  flex: 1;
}

.user-meta strong {
  display: block;
}

.admin-badge {
  font-size: 0.75rem;
  color: var(--hb-red);
  font-weight: 700;
}

.main {
  flex: 1;
  /* Ohne min-width:0 gilt fuer ein Flex-Item min-width:auto = min-content des Inhalts.
     Eine breite Tabelle oder ein langer TecRMI-Chip zieht dann die ganze Chat-Spalte auf
     (gemessen 27.08.2026 auf 353 CSS-px: 551 px). #chat-view hat overflow:hidden — der
     Ueberhang wird abgeschnitten und ist auch durch Scrollen nicht erreichbar. */
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  min-height: 60px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-title img {
  width: 48px;
}

.chat-header h1 {
  margin: 0;
  font-family: 'Univers', 'Helvetica Neue', Helvetica, Arial, sans-serif;
      /* UniversCnRg hat ein defektes Kern-Paar 'Leerzeichen + T' — es schrumpft
         das Leerzeichen auf ein Fuenftel, sodass '5 Tage' als '5Tage' erscheint
         (gemessen 18.08.2026). Kerning aus; bei dieser Schriftgroesse kein Verlust. */
      font-kerning: none;
  font-size: 1.5rem;
}

.conversation-meta {
  margin: 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* Fahrzeug-Steckbrief des Chats (siehe vehicle_json in server.js) */
.vehicle-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 2rem;
  background: #fff6f7;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  min-width: 0;
}

.vehicle-bar-icon { flex-shrink: 0; }

.vehicle-bar-label {
  font-weight: 600;
  color: var(--hb-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.vehicle-bar-btn {
  flex-shrink: 0;
  border: 1px solid var(--hb-red);
  background: transparent;
  color: var(--hb-red);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.vehicle-bar-btn:hover { background: var(--hb-red); color: #fff; }

.vehicle-bar-clear {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
}

.vehicle-bar-clear:hover { color: var(--hb-red); }

@media (max-width: 900px) {
  .vehicle-bar { padding: 0.5rem 1rem; font-size: 0.9rem; }
  .vehicle-bar-btn { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
}

.header-actions button {
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: #fff;
  padding: 0.6rem 1rem;
}

.chat-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1rem 2rem 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 2rem 1rem;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.message {
  display: flex;
  gap: 1rem;
}

.message .avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  border-radius: 1rem;
  background: var(--hb-dark);
  color: #fff;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.message.assistant .avatar {
  background: transparent;
  overflow: hidden;
  padding: 0;
}
.message.assistant .avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: contain;
}

.message-content {
  background: #fff;
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  max-width: 850px;
  width: fit-content;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

.message-content p {
  margin: 0 0 0.5rem;
}

.message-content pre {
  background: #1f1f25;
  color: #fff;
  padding: 0.75rem;
  border-radius: 0.75rem;
  overflow-x: auto;
}

/* TecAlliance-Reparaturtexte enthalten Hinweiskaesten als ```alert-info / ```alert-warning /
   ```alert-danger. marked rendert die als Code-Block: kein Zeilenumbruch, dadurch bis zu
   3700 px breit — die Blase bekam einen eigenen Schiebebalken und der Text war nur zur
   Haelfte lesbar (VK 2026-07-28). Es ist kein Code, sondern ein Hinweis: umbrechen und
   als farbige Box darstellen. */
.message-content pre:has(> code[class*="language-alert"]) {
  background: transparent;
  color: inherit;
  padding: 0;
  overflow-x: visible;
}
.message-content code[class*="language-alert"] {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f4f7fb;
  color: #222;
  border-left: 3px solid #8fa5c8;
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 0.7rem 0.9rem;
  font-family: inherit;
  font-size: 0.94em;
  line-height: 1.5;
}
.message-content code.language-alert-warning { background: #fff8e1; border-left-color: #e0a800; }
.message-content code.language-alert-danger  { background: #fff5f5; border-left-color: #d33; }
.message-content code.language-alert-info    { background: #f0f6ff; border-left-color: #4a6cc0; }

/* Sicherheitsnetz: nichts im Nachrichtentext darf die Blase sprengen. */
.message-content { min-width: 0; overflow-wrap: anywhere; }
.message-content pre { max-width: 100%; }
.message-content table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.message-content code {
  background: rgba(229, 0, 0, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 0.3rem;
}

.solution-feedback {
  margin-top: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  background: #fff8f4;
  font-size: 0.95rem;
  color: var(--text);
}
.solution-feedback .feedback-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
}
.solution-feedback .feedback-sub {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.solution-feedback small {
  color: var(--muted);
}
.solution-feedback .feedback-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.solution-feedback .feedback-buttons.stacked {
  flex-direction: column;
  align-items: stretch;
}
.btn-feedback {
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}
.btn-feedback.primary {
  /* neutral weiß wie die Sekundär-Buttons (kein farbiger Hintergrund) */
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn-feedback.secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn-feedback:hover {
  opacity: 0.9;
}

.empty-state {
  text-align: center;
  margin-top: 5rem;
  color: var(--muted);
}

.chat-input {
  padding: 1rem 2rem 1.5rem;
  background: var(--bg);
}

#message-form {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border-radius: 1.2rem;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  padding: 0.75rem;
  gap: 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#message-form.input-flash {
  border-color: var(--hb-red, #e50000);
  box-shadow: 0 0 0 3px rgba(229, 0, 0, 0.18);
}
@keyframes inputFlash {
  0%, 100% { border-color: var(--border); box-shadow: none; }
  40% { border-color: var(--hb-red, #e50000); box-shadow: 0 0 0 3px rgba(229,0,0,0.18); }
}

#message-input {
  flex: 1;
  border: none;
  resize: none;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  max-height: 200px;
}

#message-input:focus {
  outline: none;
}

#message-form button {
  background: var(--hb-red);
  border: none;
  color: #fff;
  border-radius: 1rem;
  padding: 0.8rem 1.4rem;
  font-weight: 600;
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.admin-panel {
  width: 400px;
  max-width: 90vw;
  border-left: 1px solid var(--border);
  background: var(--panel);
  height: 100%;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  overflow-y: auto;
}

.admin-panel.open {
  transform: translateX(0);
}

.admin-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,0.3);
  animation: fadeIn 0.2s ease;
}

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

.admin-header button {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
}

.admin-content {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-card {
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.85rem;
}

.admin-card strong {
  display: block;
}

.admin-card button {
  margin-top: 0.5rem;
  width: 100%;
  border: 1px solid var(--hb-red);
  background: transparent;
  border-radius: 0.8rem;
  padding: 0.6rem;
  color: var(--hb-red);
  font-weight: 600;
}

@media (max-width: 1024px) {
  /* === SIDEBAR === */
  .sidebar {
    position: fixed; z-index: 100;
    top: 0; left: 0; bottom: 0;
    width: 80vw; max-width: 300px;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    background: var(--panel);
    transition: transform 0.25s ease;
    padding-top: 0.5rem;
  }
  .sidebar.open { transform: translateX(0); }
  #hamburger { display: inline-flex; }
  .mobile-only { display: inline-flex; }

  /* === CHAT HEADER — single line, no overflow === */
  .chat-header {
    padding: 0.4rem 0.5rem;
    min-height: 38px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    overflow: hidden;
  }
  .header-title { gap: 0.4rem; min-width: 0; overflow: hidden; }
  .header-title img { width: 20px; flex-shrink: 0; }
  .header-title div { min-width: 0; }
  .chat-header h1 {
    font-size: 0.85rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .conversation-meta { display: none; }
  .header-actions { display: none; }

  /* === CHAT BODY === */
  .chat-body { padding: 0; min-width: 0; }
  .messages { padding: 0.5rem 0.6rem; min-width: 0; }
  .chat-header, .chat-input { min-width: 0; max-width: 100%; }

  /* Nichts darf die Spalte breiter machen als den Bildschirm (27.08.2026, Honor Magic V5,
     Coverdisplay 353 CSS-px): Chips umbrechen statt sperren, Tabellen in der Blase
     schieben statt die Seite aufzuziehen. */
  .msg-schaltplan-btn { white-space: normal; overflow-wrap: anywhere; }
  .tecrmi-group, .msg-tecrmi-docs { min-width: 0; max-width: 100%; }
  .message-bubble > * { min-width: 0; max-width: 100%; }
  .message-content table { display: block; width: max-content; max-width: 100%; overflow-x: auto; }
  /* Ohne Mindestbreite quetscht eine sechsspaltige TecRMI-Tabelle die Ueberschriften in
     Silben ("Kenn/ung"). Mit 6ch je Zelle bleibt sie lesbar und wird stattdessen in der
     Blase seitlich geschoben (gemessen 27.08.2026). */
  .message-content th, .message-content td { min-width: 6ch; }
  .message-content img, .message-content video, .message-content svg { max-width: 100%; height: auto; }

  /* === MESSAGES — WhatsApp style === */
  .message { gap: 0; margin-bottom: 0.35rem; }
  .message .avatar { display: none; }
  .message-bubble { max-width: 85%; }
  .message-content {
    padding: 0.5rem 0.7rem;
    max-width: 100%;
    overflow-wrap: break-word; word-break: break-word;
    font-size: 0.9rem; line-height: 1.45;
    border-radius: 1rem;
    box-shadow: none;
  }
  /* Assistant — left, light bg */
  .message.assistant { justify-content: flex-start; }
  .message.assistant .message-content {
    background: var(--panel); border: 1px solid var(--border);
    border-bottom-left-radius: 0.2rem;
  }
  /* User — right, red bg */
  .message.user { justify-content: flex-end; }
  .message.user .message-content {
    background: var(--hb-red); color: #fff; border: none;
    border-bottom-right-radius: 0.2rem;
  }
  .message-content pre {
    overflow-x: auto; font-size: 0.78rem;
    /* 27.08.2026: vorher calc(85vw - 40px) — das war schmaler als die Blase selbst.
       Die Blase ist jetzt sauber begrenzt, 100 % reicht und nutzt den Platz aus. */
    max-width: 100%;
  }
  .message-content a { color: inherit; text-decoration: underline; }
  .message.user .message-content a { color: #ffd; }

  /* === EMPTY STATE === */
  .empty-state h2 { font-size: 1.1rem; }
  .empty-state p { font-size: 0.85rem; padding: 0 0.5rem; }

  /* === INPUT BAR === */
  .chat-input {
    padding: 0.4rem;
    padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
    background: var(--bg); border-top: 1px solid var(--border);
  }
  #message-form {
    border-radius: 1.5rem; padding: 0.3rem;
    gap: 0.2rem; background: var(--panel); border: 1px solid var(--border);
    max-width: 100%; overflow: hidden;
  }
  #message-input { font-size: 0.88rem; padding: 0.3rem 0.4rem; min-height: 20px; min-width: 0; }
  /* Der lange Platzhalter brach auf schmalen Geraeten in eine zweite Zeile, die das
     einzeilige Feld dann halb abschnitt (Honor Magic V5, 27.08.2026). Einzeilig mit
     Auslassungspunkten statt angeschnittener Buchstaben. */
  #message-input::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #message-form button[type="submit"] {
    padding: 0.4rem 0.7rem; font-size: 0.78rem;
    border-radius: 1rem; flex-shrink: 0; white-space: nowrap;
  }
  .attach-btn, .voice-btn {
    width: 30px !important; height: 30px !important;
    min-width: 30px !important; padding: 0.25rem !important;
    border-radius: 50% !important; flex-shrink: 0;
  }
  .attach-btn svg, .voice-btn svg { width: 16px; height: 16px; }

  /* === FEEDBACK === */
  .solution-feedback { padding: 0.5rem 0; }
  .solution-feedback .feedback-buttons { flex-direction: column; gap: 0.3rem; }
  .solution-feedback .feedback-buttons.stacked { gap: 0.3rem; }
  .solution-feedback .btn-feedback { font-size: 0.82rem; padding: 0.45rem 0.7rem; }
  .solution-feedback .feedback-title { font-size: 0.88rem; }

  /* === LOGIN === */
  .login-card { padding: 1.5rem; border-radius: 1rem; }
}

/* Sidebar overlay backdrop on mobile */
@media (max-width: 1024px) {
  .sidebar.open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 100%;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.3);
  }
}

/* Safe area for notch devices */
@supports (padding: env(safe-area-inset-bottom)) {
  .chat-input {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
}

/* Solution review cards */
.solution-card { border-left: 3px solid #D20A11; }
.solution-header { margin-bottom: 8px; }
.solution-header small { display: block; color: #888; margin-top: 2px; }
.solution-body p { margin: 4px 0; font-size: 0.9em; line-height: 1.4; }
.solution-actions { display: flex; gap: 8px; margin-top: 10px; }
.solution-actions button { flex: 1; padding: 6px 12px; border: none; border-radius: 6px; cursor: pointer; font-size: 0.85em; font-weight: 600; }
.btn-approve { background: #e8f5e9; color: #2e7d32; }
.btn-approve:hover { background: #c8e6c9; }
.btn-reject { background: #fbe9e7; color: #c62828; }
.btn-reject:hover { background: #ffccbc; }

/* Points badge */
.points-badge {
  font-size: 0.75rem;
  color: #d4a017;
  font-weight: 600;
  margin-left: 0.3rem;
}

/* Solution save button */
.message-bubble { display: flex; flex-direction: column; max-width: 850px; min-width: 0; }
.btn-save-solution {
  align-self: flex-start;
  background: #fff3cd;
  border: 1.5px solid #ffc107;
  border-radius: 0.6rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  color: #856404;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.3rem;
  opacity: 0.85;
  transition: opacity 0.2s, background 0.2s, box-shadow 0.2s;
}
.btn-save-solution:hover { opacity: 1; background: #ffe69c; box-shadow: 0 0 0 2px rgba(255,193,7,0.4); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: grid; place-items: center; z-index: 100;
}
.modal-card {
  background: #fff; border-radius: 1.2rem; width: min(500px, 92vw);
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}
.modal-card.wide { width: min(960px, 95vw); max-height: 90vh; }

/* TecRMI Reparaturanleitungen (Manual-HTML rendered inside modal) */
.tecrmi-manual-html {
  font-family: Tahoma, Arial, sans-serif;
  font-size: 14px; line-height: 1.55; color: #1a1a1a;
}
.tecrmi-manual-html img {
  max-width: 100%; height: auto; cursor: zoom-in;
  border: 1px solid #e0e0e0; border-radius: 4px;
  display: inline-block; margin: 4px 0;
}
.tecrmi-manual-html table { border-collapse: collapse; max-width: 100%; margin: 6px 0; }
.tecrmi-manual-html td, .tecrmi-manual-html th { padding: 4px 8px; vertical-align: top; }
.tecrmi-manual-html hr { border: 0; border-top: 1px solid #ddd; margin: 12px 0; }
.tecrmi-manual-html .tecrmi-doc-header { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--hb-red); }
.tecrmi-manual-html .tecrmi-doc-kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--hb-red); font-weight: 600; }
.tecrmi-manual-html .tecrmi-doc-title { font-size: 20px; font-weight: 700; margin: 4px 0 6px; color: #111; }
.tecrmi-manual-html .tecrmi-doc-sub { font-size: 12px; color: #555; }
.tecrmi-manual-html .n6,  .tecrmi-manual-html .n8  { font-size: 12px; }
.tecrmi-manual-html .n10, .tecrmi-manual-html .n11 { font-size: 13px; }
.tecrmi-manual-html .n14 { font-size: 15px; }
.tecrmi-manual-html .n18 { font-size: 18px; }
.tecrmi-manual-html .b6,  .tecrmi-manual-html .b8  { font-weight: bold; font-size: 12px; }
.tecrmi-manual-html .b10, .tecrmi-manual-html .b11 { font-weight: bold; font-size: 13px; }
.tecrmi-manual-html .b14 { font-weight: bold; font-size: 15px; }
.tecrmi-manual-html .b18 { font-weight: bold; font-size: 18px; }
.tecrmi-manual-html .b30 { font-weight: bold; font-size: 22px; }
.tecrmi-manual-html .bu6, .tecrmi-manual-html .bu8, .tecrmi-manual-html .bu10,
.tecrmi-manual-html .bu11, .tecrmi-manual-html .bu14, .tecrmi-manual-html .bu18 { font-weight: bold; text-decoration: underline; }
.tecrmi-manual-html .i11 { font-style: italic; }
.tecrmi-manual-html .n8_N, .tecrmi-manual-html .n8_A { font-size: 12px; }
.tecrmi-manual-html .b8_N, .tecrmi-manual-html .b8_A { font-size: 12px; font-weight: bold; }
.tecrmi-manual-html .n8_N { background: #f5f5f5; }
.tecrmi-manual-html .b8_N { background: #eaeaea; }
.tecrmi-manual-html .borderSB1 { border: 1px solid #888; }
.tecrmi-manual-html .borderSB2 { border: 1px solid #154e76; }
.tecrmi-manual-html .borderRSB3 { border-right: 3px solid #333; }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.2rem; background: var(--hb-red); color: #fff;
  border-radius: 1.2rem 1.2rem 0 0;
}
.modal-header h3 { margin: 0; }
.modal-header button { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 4px 10px; min-width: 36px; min-height: 36px; line-height: 1; z-index: 10; position: relative; }
.modal-body { padding: 1.2rem; }

/* Bilder in Modal-Inhalten. Eine H+B-Techniker-Lösung mit 1166-px-Screenshot
   sprengte die 500-px-Standardkarte (VK 04.08.2026, Chat Wissmann): das Bild lief
   seitlich aus dem Popup heraus. .modal-md ist der Rahmen für per Markdown
   gerenderte Modal-Inhalte — Bilder skalieren auf Kartenbreite, Klick zoomt. */
.modal-body img { max-width: 100%; }
.modal-md { overflow-wrap: anywhere; }
.modal-md img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  display: block;
  margin: 0.6rem 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #fff;
  cursor: zoom-in;
  transition: box-shadow 0.2s;
}
.modal-md img:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.modal-md pre { overflow-x: auto; }
.modal-md table { max-width: 100%; border-collapse: collapse; }
.modal-md h3:first-child { margin-top: 0; }

/* Solution form */
/* ─── Step Picker Note Section ─── */
.sp-note-section {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sp-note-label {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text);
}
.sp-note-textarea {
  width: 100%;
  min-height: 72px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--text);
}
.sp-note-textarea:focus { outline: none; border-color: var(--hb-red); }
.sp-media-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.sp-media-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sp-media-btn:hover { border-color: var(--hb-red); background: rgba(200,16,46,0.04); }
.sp-media-btn.sp-recording {
  background: #ffe0e0;
  border-color: var(--hb-red);
  color: var(--hb-red);
  animation: spPulse 1s ease-in-out infinite;
}
@keyframes spPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.sp-file-label { display: inline-flex; align-items: center; }
.sp-media-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.2rem;
}
.sp-preview-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 80px;
}
.sp-preview-item img,
.sp-preview-item video {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
}
.sp-audio-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 60px;
  background: #f0f4ff;
  border-radius: 0.4rem;
  border: 1px solid #c0cff0;
  font-size: 1.6rem;
}
.sp-preview-name {
  font-size: 0.68rem;
  color: var(--muted);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.sp-preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: var(--hb-red);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 0.65rem;
  cursor: pointer;
  line-height: 18px;
  text-align: center;
  padding: 0;
}

.solution-form { display: flex; flex-direction: column; gap: 0.75rem; }
.solution-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; font-weight: 600; position: relative; }
.solution-form input, .solution-form textarea {
  padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 0.7rem;
  font-family: inherit; font-size: 0.95rem;
}
.sol-with-mic textarea {
  padding-right: 3rem;
}
.btn-dictate {
  position: absolute;
  top: 2px;
  right: 2px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--hb-red);
  padding: 0.2rem 0.4rem;
}
.btn-dictate.recording {
  color: #b30000;
  animation: voice-pulse 1s infinite;
}
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }
.btn-cancel { background: #f0f0f0; border: 1px solid var(--border); border-radius: 0.8rem; padding: 0.6rem 1.2rem; }
.btn-submit { background: var(--hb-red); color: #fff; border: none; border-radius: 0.8rem; padding: 0.6rem 1.2rem; font-weight: 600; }

/* Highscore table */
.highscore-table { width: 100%; border-collapse: collapse; }
.highscore-table th, .highscore-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.highscore-table thead th { font-size: 0.85rem; color: var(--muted); }
.highscore-table tr.top-1 { background: #fff8e1; font-weight: 700; }
.highscore-table tr.top-2 { background: #f5f5f5; font-weight: 600; }
.highscore-table tr.top-3 { background: #fff3e0; font-weight: 600; }

/* Admin points button */
.btn-points { border-color: #d4a017 !important; color: #d4a017 !important; }

/* File upload */
.attach-btn {
  background: var(--hb-red);
  border: none;
  border-radius: 0.8rem;
  padding: 0.6rem 0.7rem;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
  color: #fff;
}
.attach-btn:hover { opacity: 0.85; }
.voice-btn {
  background: var(--hb-red);
  border: none;
  border-radius: 0.8rem;
  padding: 0.6rem 0.7rem;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.2s, border-color 0.2s;
  flex-shrink: 0;
  color: #fff;
}
.voice-btn:hover { opacity: 0.85; }
.voice-btn.recording {
  background: #fdeaea;
  border-color: #e50000;
  animation: voice-pulse 1s infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,0,0,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(229,0,0,0); }
}

.file-preview {
  padding: 0 2rem;
}
.file-preview-inner {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 400px;
}
.file-preview-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 0.5rem;
}
.file-preview-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.file-preview-info span:first-child {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-preview-info span:last-child {
  font-size: 0.8rem;
  color: var(--muted);
}
.file-preview-remove {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}
.file-preview-remove:hover { color: var(--hb-red); }

/* Inline file display in messages */
.file-inline-image {
  max-width: 300px;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  cursor: pointer;
  display: block;
  margin: 0.3rem 0;
}
.file-inline-image:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.18); }

.file-inline-pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.5rem 0.8rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  margin: 0.3rem 0;
}
.file-inline-pdf:hover { border-color: var(--hb-red); }

.upload-progress {
  color: var(--muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* Fullscreen image overlay */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: grid;
  place-items: center;
  z-index: 200;
  cursor: pointer;
}
.fullscreen-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 0.5rem;
}

@media (max-width: 1024px) {
  .file-preview { padding: 0 0.75rem; }
}

/* Solution tabs */
.solutions-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.sol-tab { padding: 6px 14px; border: none; border-radius: 6px 6px 0 0; cursor: pointer; font-size: 0.85em; font-weight: 600; background: #eee; color: #666; }
.sol-tab.active { background: #D20A11; color: white; }
.sol-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.75em; font-weight: 600; }
.sol-status.approved { background: #e8f5e9; color: #2e7d32; }
.sol-status.rejected { background: #fbe9e7; color: #c62828; }
.sol-status.pending { background: #fff3e0; color: #e65100; }

/* Drop overlay */
.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(229, 0, 0, 0.08);
  border: 3px dashed var(--hb-red);
  border-radius: 1rem;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.drop-overlay-inner {
  background: #fff;
  padding: 1.5rem 2.5rem;
  border-radius: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--hb-red);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

/* Empty state actions */
.empty-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}
.empty-action-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--hb-red);
  border-radius: 0.9rem;
  background: #fff;
  color: var(--hb-red);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.empty-action-btn:hover {
  background: var(--hb-red);
  color: #fff;
}

/* Solution form layout */
.sol-row { display: flex; gap: 0.75rem; }
.sol-half { flex: 1; }
.sol-file-section { margin-top: 0.25rem; }
.sol-file-label { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.btn-attach {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-attach:hover { border-color: var(--hb-red); color: var(--hb-red); }
.sol-file-list { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.4rem; }
.sol-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
}
.sol-file-remove {
  background: none;
  border: none;
  color: var(--hb-red);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.3rem;
}

/* Solution form drag-over */
.solution-form.drag-over {
  outline: 3px dashed var(--hb-red);
  outline-offset: -3px;
  background: rgba(229, 0, 0, 0.04);
}

/* Message action buttons */
.message-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.message-timestamp {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.message-actions-inline {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.message-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.btn-community-ask {
  background: none;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.btn-community-ask:hover {
  border-color: var(--hb-red);
  color: var(--hb-red);
  background: rgba(229, 0, 0, 0.04);
}
.btn-team-ask {
  background: none;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.btn-team-ask:hover {
  border-color: var(--hb-red);
  color: var(--hb-red);
  background: rgba(229, 0, 0, 0.04);
}

/* Bilder in Bot-Antworten (Wissens-DB + Screenshots aus internen Loesungen).
   Frueher hart auf 300x200 gestaucht — ein hochaufloester Screenshot landete
   dadurch bei ~7 % seiner Originalgroesse und war unlesbar. Jetzt: volle
   Blasenbreite, Hoehe nur noch gedeckelt, Klick oeffnet die Lightbox in 1:1. */
.message-content img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  margin: 0.5rem 0;
  cursor: zoom-in;
  transition: box-shadow 0.2s;
  display: block;
  background: #fff;
}
.message-content img:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Lightbox overlay for zoomable images (Schaltpläne, Bauteillage, Uploads) */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.85);
  animation: fadeIn 0.15s ease;
  display: flex;
  flex-direction: column;
  cursor: zoom-out; /* clicking on backdrop closes */
}
.img-lightbox-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(20,20,20,0.92);
  color: #fff;
  cursor: default;
  flex-shrink: 0;
}
.img-lightbox-toolbar .img-zoom-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.img-lightbox-toolbar .img-zoom-btn:hover { background: rgba(255,255,255,0.22); }
.img-lightbox-toolbar .img-zoom-btn[data-act="out"] { margin-left: auto; }
.img-lightbox-toolbar .img-zoom-btn[data-act="legende"] {
  width: auto;
  padding: 0 0.6rem;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.img-lightbox-toolbar .img-zoom-btn[data-act="legende"][aria-expanded="true"] {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.45);
}
.img-lightbox-toolbar .img-zoom-btn[data-act="close"] { background: rgba(220,40,40,0.55); }
.img-lightbox-toolbar .img-zoom-btn[data-act="close"]:hover { background: rgba(220,40,40,0.9); }
.img-lightbox-toolbar .img-zoom-level {
  min-width: 4rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.img-lightbox-caption {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}
.img-lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: zoom-out;
  touch-action: none; /* let JS handle pinch */
}
.img-lightbox-content {
  transform-origin: center center;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  display: inline-block;
}
.img-lightbox-content svg {
  display: block;
  background: #fff;
  border-radius: 0.4rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
/* Bewusst KEIN max-width/max-height: das Bild wird in seiner Originalgroesse
   layoutet, das Einpassen in die Buehne macht JS ueber die Anfangs-Skalierung.
   Nur so entspricht "100 %" in der Leiste echten 1:1-Pixeln und der Zoom
   rastert auf voller Aufloesung statt eine geschrumpfte Fassung hochzuziehen. */
.img-lightbox-img {
  max-width: none;
  max-height: none;
  border-radius: 0.4rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  background: #fff;
  display: block;
}
.img-lightbox-hint {
  background: rgba(20,20,20,0.78);
  color: rgba(255,255,255,0.85);
  text-align: center;
  font-size: 0.78rem;
  padding: 0.35rem 1rem;
  cursor: default;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .img-lightbox-hint { display: none; }
  .img-lightbox-toolbar .img-zoom-btn { width: 2rem; height: 2rem; font-size: 1rem; }
  .img-lightbox-toolbar .img-zoom-btn[data-act="legende"] { width: 2rem; padding: 0; }
  .img-lightbox-toolbar .legend-btn-text { display: none; }
  .img-lightbox-toolbar .img-zoom-level { min-width: 3rem; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Navigation Bar ─── */
/* Hover: Text heller, Hintergrund leicht */
/* Aktiv: weißer Tab, roter Text; Icon-Farbe wird per Asset/JS gesteuert */

/* ─── Hub Screen ─── */
.hub-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.5rem 2rem;
  background: var(--bg);
  overflow-y: auto;
}
.hub-logo {
  width: 120px;
  margin-bottom: 0.5rem;
}
.hub-welcome {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--hb-dark);
  margin: 0 0 0.2rem;
  text-align: center;
}
.hub-subtitle {
  color: var(--muted);
  margin: 0 0 1.2rem;
  text-align: center;
  font-size: 0.95rem;
}
.hub-cards {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 700px;
  width: 100%;
}
.hub-card {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 1.2rem;
  padding: 1.2rem 1rem;
  width: 260px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.hub-card:hover {
  border-color: var(--hb-red);
  box-shadow: 0 8px 24px rgba(229,0,0,0.12);
  transform: translateY(-2px);
}
.hub-card-icon {
  font-size: 2.5rem;
  line-height: 1;
}
.hub-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--hb-dark);
}
.hub-card-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}
.hub-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}
.hub-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}
.hub-link:hover { color: var(--hb-red); }

/* --- Step Picker Modal --- */
.step-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 50vh;
  overflow-y: auto;
}
.step-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-size: 0.92em;
  line-height: 1.5;
  color: #222;
}
.step-picker-item:hover {
  background: #fff0f0;
  border-color: var(--hb-red, #cc0000);
}
.step-picker-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--hb-red, #cc0000);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.step-picker-item span {
  flex: 1;
}
.step-picker-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.step-picker-actions button {
  background: none;
  border: 1px solid var(--border, #3a3a4e);
  color: var(--muted, #888);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82em;
  font-family: inherit;
}
.step-picker-actions button:hover {
  border-color: var(--hb-red, #cc0000);
  color: var(--hb-red, #cc0000);
}

/* Mobile nav hamburger toggle */

@media (max-width: 600px) {
  .hub-screen { padding: 1rem; }
  .hub-cards { flex-direction: column; align-items: center; gap: 0.8rem; }
  .hub-card { width: 100%; max-width: 320px; padding: 1rem; }
  .hub-card-icon img { width: 90px !important; border-radius: 12px !important; }
  .hub-logo { width: 80px; margin-bottom: 0.3rem; }
  .hub-welcome { font-size: 1.2rem; }
  .hub-subtitle { margin-bottom: 0.8rem; font-size: 0.9rem; }

  /* Hide nav-links container, show as dropdown when open */
}

/* ─── TecRMI Document Panel ─── */
.msg-tecrmi-docs {
  margin-top: 0.75rem;
  border: 1px solid #d8e4f0;
  border-left: 3px solid #4a6cc0;
  border-radius: 0 0.5rem 0.5rem 0;
  background: rgba(42, 64, 128, 0.03);
  overflow: hidden;
}
.tecrmi-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem 0.45rem 0.85rem;
  border-bottom: 1px solid #e8eef8;
}
.tecrmi-group:last-child {
  border-bottom: none;
}
.tecrmi-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #2a4080;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  min-width: 120px;
}
.msg-schaltplan-btn {
  background: #f0f4ff;
  border: 1px solid #c8d8f0;
  color: #2a4080;
  border-radius: 1rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-align: left;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
}
.msg-schaltplan-btn:hover:not(:disabled) {
  background: #e0eaff;
  border-color: #7090d0;
  box-shadow: 0 1px 3px rgba(42,64,128,0.15);
}
.msg-schaltplan-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ─── Message Suggestion Buttons ─── */
.msg-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem 0.65rem 0.9rem;
  background: rgba(200, 16, 46, 0.04);
  border-left: 3px solid var(--hb-red);
  border-radius: 0 0.5rem 0.5rem 0;
}
.msg-suggestions-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--hb-red);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.2rem;
  flex-shrink: 0;
}
.msg-suggestion-btn {
  border-radius: 1rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  text-align: left;
  line-height: 1.3;
}
/* VORSCHLAG — blau-neutral (Bot liefert Info) */
.msg-suggestion-vorschlag {
  background: #f0f4ff;
  border: 1px solid #c0cff0;
  color: #2a4080;
}
.msg-suggestion-vorschlag:hover {
  background: #e0eaff;
  border-color: #7090d0;
  color: #1a2c60;
  box-shadow: 0 1px 4px rgba(42,64,128,0.15);
}
/* FRAGE — amber/warm (User muss antworten) */
.msg-suggestion-frage {
  background: #fff8ee;
  border: 1px solid #f0d090;
  color: #7a5000;
}
.msg-suggestion-frage:hover {
  background: #fff0d0;
  border-color: #d0900a;
  color: #5a3800;
  box-shadow: 0 1px 4px rgba(122,80,0,0.15);
}

/* Feedback reminder highlight */
.feedback-highlight {
  animation: feedbackPulse 0.5s ease-in-out 3;
  box-shadow: 0 0 0 3px #e50000 !important;
}
@keyframes feedbackPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Lightbox custom tooltip (Schaltplan-Komponenten + Kabelfarben) */
.lightbox-tooltip {
  position: absolute;
  z-index: 5;
  background: #fff;
  color: #1a1a1a;
  border: 2px solid var(--hb-red, #e50000);
  border-radius: 0.4rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  max-width: min(60vw, 24rem);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  transform: translate(-50%, 0);
  user-select: text;
}
.lightbox-tooltip .lightbox-tip-text { white-space: normal; word-break: break-word; }
.lightbox-tooltip .lightbox-tip-close {
  border: 0;
  background: rgba(229,0,0,0.1);
  color: var(--hb-red, #e50000);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.3rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.lightbox-tooltip .lightbox-tip-close:hover { background: rgba(229,0,0,0.2); }
/* Highlight the active SVG text element */
svg text.lightbox-tip-active {
  fill: var(--hb-red, #e50000) !important;
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 2;
}
svg a.lightbox-tip-active polygon,
svg a.lightbox-tip-active rect,
svg a.lightbox-tip-active path {
  stroke: var(--hb-red, #e50000) !important;
  stroke-width: 4 !important;
  fill: var(--hb-red, #e50000) !important;
  fill-opacity: 0.12 !important;
}
svg a[data-itemmpid] { cursor: pointer; }
svg a[data-itemmpid] polygon { pointer-events: all; }

/* Legenden-Panel (slide-in von rechts) */
.lightbox-legend-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(22rem, 92vw);
  background: #fff;
  border-left: 1px solid rgba(0,0,0,0.15);
  box-shadow: -4px 0 18px rgba(0,0,0,0.25);
  z-index: 6;
  transform: translateX(100%);
  transition: transform 0.18s ease;
  display: flex;
  flex-direction: column;
}
.lightbox-legend-panel.open { transform: translateX(0); }
.lightbox-legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--hb-red, #e50000);
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
}
.lightbox-legend-close {
  background: rgba(255,255,255,0.15);
  border: 0;
  color: #fff;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.3rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.lightbox-legend-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-legend-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.lightbox-legend-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #f0f0f0;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  color: #222;
}
.lightbox-legend-row:hover { background: #fff5f5; }
.lightbox-legend-row .legend-id {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--hb-red, #e50000);
  min-width: 3.5rem;
  flex-shrink: 0;
}
.lightbox-legend-row .legend-name { flex: 1; line-height: 1.3; }

/* ===== DOD Ticket + markanter Aktions-Baukasten ===== */
.msg-action-card {
  margin-top: 0.75rem;
  border: 1px solid var(--hb-red, #c8102e);
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #fff 0%, #fff5f3 100%);
  box-shadow: 0 2px 10px rgba(200,16,46,0.08);
}
.msg-action-card .action-card-title {
  margin: 0 0 0.6rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text, #1a1a1a);
}
.msg-action-card .action-card-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.btn-action {
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
}
.btn-action:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.12); }
.btn-action-primary { background: #fff; color: var(--text, #1a1a1a); border-color: var(--border, #e0e3eb); } /* "Lösung speichern": neutral weiß wie die anderen Buttons */
.btn-action-dod {
  background: #1f2937; color: #fff; border-color: #1f2937;
  box-shadow: 0 2px 6px rgba(31,41,55,0.25);
}
.btn-action-dod:hover { background: #111827; }
.btn-action-secondary { background: #fff; color: var(--text, #1a1a1a); border-color: var(--border, #e0e3eb); }
.btn-action-ghost { background: transparent; color: var(--muted, #777); border-color: var(--border, #e0e3eb); }

/* DOD-Nachricht im Kundenchat */
.message.dod .avatar {
  background: #1f2937; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.message.dod .message-bubble {
  background: #fff2ee;
  border: 1px solid var(--hb-red, #c8102e);
}
.dod-sender {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--hb-red, #c8102e);
  margin-bottom: 0.3rem;
}
.message.dod-system {
  justify-content: center;
  margin: 0.5rem 0;
}
.dod-system-chip {
  background: #eef2ff;
  color: #3b3f6b;
  border: 1px solid #d6dcff;
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  margin: 0 auto;
}
@media (max-width: 640px) {
  .msg-action-card .action-card-buttons { flex-direction: column; }
  .btn-action { width: 100%; justify-content: center; }
}

/* ===== Interaktive Rueckfragen (FRAGE mit Antwortoptionen, Claude-Style) ===== */
/* Ueberholte Rueckfrage-Karten: lesbar, aber nicht mehr bedienbar (siehe markStaleFollowups). */
.msg-followup.followup-stale { opacity: 0.5; }
.msg-followup.followup-stale button,
.msg-followup.followup-stale input { cursor: not-allowed; }
.msg-followup.followup-stale .followup-q::after {
  content: ' — nicht mehr aktuell';
  font-size: 0.8em;
  font-weight: 400;
  color: var(--muted, #6a6c72);
}

.msg-followup {
  margin-top: 0.75rem;
  border: 1.5px solid var(--hb-red, #c8102e);
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #fff 0%, #fff5f3 100%);
  box-shadow: 0 2px 10px rgba(200,16,46,0.08);
}
.msg-followup .followup-q {
  margin: 0 0 0.65rem;
  font-weight: 700;
  font-size: 0.97rem;
  color: var(--text, #1a1a1a);
  line-height: 1.35;
}
.msg-followup .followup-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.msg-followup .followup-opt {
  border-radius: 999px;
  padding: 0.5rem 1.05rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  color: var(--hb-red, #c8102e);
  border: 1.5px solid var(--hb-red, #c8102e);
  transition: background 0.12s, color 0.12s, transform 0.1s;
}
.msg-followup .followup-opt:hover {
  background: var(--hb-red, #c8102e);
  color: #fff;
  transform: translateY(-1px);
}
.msg-followup .followup-free {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.msg-followup .followup-free-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border, #e0e3eb);
  border-radius: 0.6rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text, #1a1a1a);
}
.msg-followup .followup-free-input:focus {
  outline: none;
  border-color: var(--hb-red, #c8102e);
}
.msg-followup .followup-free-send {
  border: none;
  border-radius: 0.6rem;
  padding: 0.5rem 1.05rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--hb-red, #c8102e);
  color: #fff;
}
.msg-followup .followup-free-send:hover { opacity: 0.92; }
.msg-followup .followup-free-mic {
  flex-shrink: 0;
  border: 1px solid var(--border, #e0e3eb);
  border-radius: 0.6rem;
  padding: 0.5rem 0.7rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  background: #fff;
  color: var(--text, #1a1a1a);
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}
.msg-followup .followup-free-mic:hover { border-color: var(--hb-red, #c8102e); }
.msg-followup .followup-free-mic.recording {
  background: #fdeaea;
  border-color: #e50000;
  animation: voice-pulse 1s infinite;
}
.msg-followup .followup-free-mic:disabled { opacity: 0.6; cursor: default; }
@media (max-width: 640px) {
  .msg-followup .followup-opts { flex-direction: column; }
  .msg-followup .followup-opt { width: 100%; }
}

/* Summenzeile unter der Dateiliste einer Loesung: die Gesamtgroesse ist die
   Grenze, die in der Praxis zuschlaegt (alle Anhaenge gehen in EINER Nachricht
   raus) — sie muss vor dem Absenden sichtbar sein. */
.sol-file-sum {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: #666;
}
.sol-file-sum.is-over {
  color: #b00020;
  font-weight: 600;
}

/* Vorschau im Teilen-Dialog: ein Werkstattfoto ist 4000 px breit und wuerde
   das Modal aufziehen. Hier zaehlt nur, dass man erkennt, welches Bild mitgeht. */
.share-preview-body img {
  max-width: 100%;
  max-height: 180px;
  width: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  display: block;
  margin: 0.4rem 0;
}

/* Weitere Reparaturanleitungen stehen eingeklappt (VK 01.09.2026): ausgeliefert wird nur
   die beste im Volltext, der Rest auf Klick. Ueber zehn Tage standen 404.569 Zeichen
   Antwort gegen 9.760 Zeichen Frage — die laengste Einzelantwort hatte 21.123 Zeichen,
   davon der groesste Teil Anleitungen, die der Kunde nicht angefragt hatte. */
.message-content details.vr-mehr {
  margin: 0.55rem 0;
  border: 1px solid #dfe3e8;
  border-left: 3px solid var(--hb-red, #c8102e);
  border-radius: 0 0.5rem 0.5rem 0;
  background: #fbfcfd;
  overflow: hidden;
}
.message-content details.vr-mehr > summary {
  cursor: pointer;
  padding: 0.6rem 0.85rem;
  font-weight: 600;
  font-size: 0.95em;
  line-height: 1.45;
  color: var(--hb-dark, #2c2a29);
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  overflow-wrap: anywhere;
}
.message-content details.vr-mehr > summary::-webkit-details-marker { display: none; }
/* Eigener Pfeil, damit er in beiden Zustaenden gleich sitzt und nicht springt. */
.message-content details.vr-mehr > summary::before {
  content: "▸";
  flex: 0 0 auto;
  color: var(--hb-red, #c8102e);
  font-size: 0.9em;
  transform: translateY(-1px);
  transition: transform 0.15s ease;
}
.message-content details.vr-mehr[open] > summary::before { content: "▾"; }
.message-content details.vr-mehr > summary:hover { background: #f2f5f8; }
.message-content details.vr-mehr > summary:focus-visible {
  outline: 2px solid var(--hb-red, #c8102e);
  outline-offset: -2px;
}
/* Inhalt bekommt Luft und eine feine Trennlinie zum Kopf. */
.message-content details.vr-mehr[open] > summary { border-bottom: 1px solid #e6eaee; }
.message-content details.vr-mehr > :not(summary) { padding: 0 0.85rem; }
.message-content details.vr-mehr > :not(summary):first-of-type { padding-top: 0.7rem; }
.message-content details.vr-mehr > :not(summary):last-child { padding-bottom: 0.8rem; }
.message-content details.vr-mehr img { max-width: 100%; height: auto; }

@media (prefers-color-scheme: dark) {
  .message-content details.vr-mehr { background: #1b1f24; border-color: #2f363e; }
  .message-content details.vr-mehr > summary { color: #e6eaee; }
  .message-content details.vr-mehr > summary:hover { background: #232930; }
  .message-content details.vr-mehr[open] > summary { border-bottom-color: #2f363e; }
}



/* Bearbeiten-Leiste unter einer im Chat geoeffneten Loesung (VK 2026-09-02).
   Nur tech-admins sehen sie — der Server entscheidet das, nicht das Stylesheet. */
.sol-edit-bar {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border, #e5e5e5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.sol-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--hb-red, #e2001a);
  color: #fff;
  border: 1px solid var(--hb-red, #e2001a);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.sol-edit-btn:hover { filter: brightness(0.92); }
.sol-edit-btn .ic { fill: currentColor; }
.sol-edit-note {
  font-size: 0.82rem;
  color: var(--muted, #777);
  flex: 1 1 16rem;
  min-width: 0;
  line-height: 1.35;
}

/* --- Teammodus: solange ein F2F-Ticket laeuft, schreibt der Kunde an Menschen --- */
.ticket-mode-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fff2ee;
  border: 1px solid #f3c4b6;
  border-radius: 8px;
  color: #8a3a22;
  font-size: 0.85rem;
  line-height: 1.35;
}
.ticket-mode-banner .ic { flex: 0 0 auto; }
.dod-unread {
  color: var(--hb-red, #e2001a);
  font-size: 0.8em;
  font-weight: 600;
  margin-left: 0.35rem;
  white-space: nowrap;
}

/* --- Ticketbalken der Operator-Ansicht (gleiche Anmutung wie die Fahrzeugleiste) --- */
.ticket-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: #fff2ee;
  border-bottom: 1px solid #f3c4b6;
  font-size: 0.88rem;
  color: #8a3a22;
  flex-wrap: wrap;
}
.ticket-bar-label { flex: 1; min-width: 180px; }
.ticket-bar-btn, .ticket-bar-back {
  border: 1px solid #e0a591;
  background: #fff;
  color: #8a3a22;
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}
.ticket-bar-btn:hover, .ticket-bar-back:hover { background: #fdece6; }
/* Was dem Kunden gehoert, ist im Operator-Blick nur zum Lesen da. */
.ops-view .followup-opt,
.ops-view .followup-free-input,
.ops-view .followup-free-send,
.ops-view .followup-free-mic,
.ops-view .msg-suggestion-btn { opacity: 0.55; cursor: not-allowed; }
