/* ---------------------------------------------------------------------- */
/* Login                                                                  */
/* ---------------------------------------------------------------------- */

.login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--accent) var(--login-gradient-anteil), var(--bg)) 0%, var(--bg) 70%);
  font-family: var(--font-sans);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
}

.login-brand {
  margin-bottom: 24px;
}

.login-logo {
  display: block;
  height: 40px;
  width: auto;
}

.login-logo-dark {
  display: none;
}

:root[data-theme="dark"] .login-logo-light {
  display: none;
}

:root[data-theme="dark"] .login-logo-dark {
  display: block;
}

.login-fehler {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.82rem;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
}

.login-hinweis {
  color: var(--text-secondary);
  font-size: 0.86rem;
  margin: 0 0 16px;
}

/* Erinnerung auf der Login-Seite an überfällige/heute fällige Aufgaben
   dessen, der sich in diesem Browser zuletzt angemeldet hat. */
.login-erinnerung {
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.86rem;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
}

.login-btn {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
}

/* Fehlerseiten (templates/_fehlerseite.html) im Rahmen der Login-Seite. */
.fehlerseite-titel {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 8px;
}

.login-nebenlink {
  text-align: center;
  margin: 16px 0 0;
  font-size: 0.84rem;
}

.login-nebenlink a {
  color: var(--text-secondary);
}

.login-nebenlink a:hover {
  color: var(--accent);
}

.login-version {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 14px;
  margin: 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-secondary);
  opacity: 0.55;
}

.logout-form {
  display: contents;
}

/* ---------------------------------------------------------------------- */
/* Wissensdatenbank                                                        */
/* ---------------------------------------------------------------------- */

.artikel-inhalt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px 32px;
  max-width: 760px;
  line-height: 1.7;
  font-size: 0.95rem;
}

.artikel-inhalt p {
  margin: 0 0 1em;
}

.artikel-inhalt p:last-child {
  margin-bottom: 0;
}

.artikel-dateien {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 32px;
  max-width: 760px;
  margin-top: 16px;
}

/* ---------------------------------------------------------------------- */
/* Nutzerverwaltung                                                        */
/* ---------------------------------------------------------------------- */

.nutzer-liste {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nutzer-zeile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

.nutzer-zeile.ist-inaktiv {
  opacity: 0.65;
}

.nutzer-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nutzer-info .user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-soft);
  color: var(--accent);
}

.nutzer-haupt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nutzer-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.nutzer-aktionen {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------- */
/* Tickets                                                                 */
/* ---------------------------------------------------------------------- */

.btn-ghost.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: var(--accent);
}

.ticket-zeile {
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.ticket-zeile .aufgabe-zeile-inhalt {
  gap: 6px;
}

.ticket-kommentar-liste {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.ticket-kommentar {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 12px 16px;
  max-width: 760px;
}

.ticket-kommentar .user-avatar {
  width: 30px;
  height: 30px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.ticket-kommentar-inhalt {
  flex: 1;
  min-width: 0;
}

.ticket-kommentar-kopf {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.ticket-kommentar-autor {
  font-weight: 600;
  color: var(--text-secondary);
}

.ticket-kommentar-text {
  white-space: pre-line;
  font-size: 0.9rem;
  line-height: 1.5;
}

.ticket-status-formular {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticket-status-formular select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-family: inherit;
}

/* Safari (und andere WebKit-Browser) rendern <select> sonst mit dem
   nativen System-Pfeil, der nicht zu den eigenen Radien/Farben passt –
   daher überall einheitlich zurücksetzen und einen eigenen Pfeil zeichnen. */
.form-field select,
.dokument-upload-form select,
.vorlage-form select,
.filter-toolbar select,
.ticket-status-formular select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}

.ticket-kommentar-form {
  max-width: 760px;
  margin-top: 16px;
}

.ticket-kommentar-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  resize: vertical;
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------------- */
/* Cockpit                                                                 */
/* ---------------------------------------------------------------------- */

.cockpit-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

@media (max-width: 920px) {
  .cockpit-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stat-karte {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-karte.ist-gefahr {
  border-color: var(--danger);
}

.stat-karte.ist-gefahr .stat-wert {
  color: var(--danger);
}

.stat-karte.ist-warnung {
  border-color: var(--warning);
}

.stat-karte.ist-warnung .stat-wert {
  color: var(--warning);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text-secondary);
}

.stat-wert {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-sub {
  font-size: 0.76rem;
  color: var(--text-tertiary);
}

.stat-leiste {
  width: 100%;
  margin: 2px 0;
}

.cockpit-section {
  margin-bottom: 28px;
}

.cockpit-section-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cockpit-section-titel {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text-secondary);
  margin: 0;
}

.cockpit-section-titel.ist-gefahr {
  color: var(--danger);
}

.cockpit-mehr-hinweis {
  margin: 10px 2px 0;
}

.rollen-badge.gefahr {
  background: var(--danger-soft);
  color: var(--danger);
  margin-left: 0;
}

.bereich-fortschritt-liste {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bereich-fortschritt-zeile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.bereich-fortschritt-zeile:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.bereich-fortschritt-zeile:active {
  transform: translateY(0);
}

.bereich-fortschritt-zeile:hover .chevron {
  color: var(--accent);
  transform: translateX(2px);
}

.bereich-fortschritt-name {
  font-weight: 600;
  font-size: 0.88rem;
  flex: 1;
  min-width: 0;
}

/* ---------------------------------------------------------------------- */
/* Suche                                                                    */
/* ---------------------------------------------------------------------- */

.suche-ergebnisse {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 720px;
}

.suche-abschnitt-titel {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 650;
}

.suche-treffer-liste {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suche-treffer {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.suche-treffer:hover {
  border-color: var(--accent);
  background: var(--surface-sunken);
}

.suche-treffer-titel {
  font-size: 0.88rem;
  font-weight: 600;
}

.suche-treffer-meta {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.suche-treffer-ausschnitt {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

mark {
  background: var(--warning-soft);
  color: var(--warning);
  border-radius: 3px;
  padding: 0 2px;
}

/* ---------------------------------------------------------------------- */
/* Assistent (Chatbot)                                                    */
/* ---------------------------------------------------------------------- */

#chatbot-bubble {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chatbot-bubble img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

#chatbot-bubble:hover {
  filter: brightness(1.08);
}

#chatbot-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 16, 0.4);
  z-index: 39;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

#chatbot-overlay.ist-sichtbar {
  opacity: 1;
  pointer-events: auto;
}

dialog#dialog-chatbot {
  width: min(380px, 92vw);
  position: fixed;
  inset: auto 24px 92px auto;
  margin: 0;
  max-height: min(600px, calc(100vh - 120px));
  z-index: 50;
}

dialog#dialog-chatbot .dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: min(600px, calc(100vh - 120px));
}

.chatbot-verlauf {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 120px;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding: 4px 2px;
}

.chatbot-nachricht {
  font-size: 0.86rem;
  line-height: 1.45;
  padding: 9px 13px;
  white-space: pre-wrap;
  max-width: 85%;
  box-shadow: 0 1px 2px rgba(10, 11, 16, 0.08);
}

.chatbot-nachricht-nutzer {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-radius: 15px 15px 3px 15px;
}

.chatbot-nachricht-bot {
  align-self: flex-start;
  background: var(--surface-sunken);
  color: var(--text-primary);
  border-radius: 15px 15px 15px 3px;
}

.chatbot-quellen {
  list-style: none;
  margin: -4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-self: flex-start;
  max-width: 85%;
}

.chatbot-quellen a {
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--surface-sunken);
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
}

.chatbot-form {
  display: flex;
  gap: 8px;
}

.chatbot-form input {
  flex: 1;
}
