@import url('./scrollbar.css');

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

:root {
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --danger-bg: rgba(248, 113, 113, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --side-width: 300px;
}

.hidden {
  /* important: Utility: .hidden muss jede display-Regel überstimmen */
  display: none !important;
}

html, body {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.admin-header {
  position: relative;
  z-index: var(--z-panel);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fp-space-3);
  flex-wrap: nowrap;
  padding: var(--fp-space-2) var(--fp-page-pad);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: var(--fp-space-3);
  min-width: 0;
}

.admin-header-brand > div {
  min-width: 0;
}

.admin-header > .btn {
  flex-shrink: 0;
}

.admin-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.admin-nav-toggle .material-symbols-outlined {
  font-size: var(--fs-22);
}

.admin-nav-toggle:hover {
  background: var(--surface-3);
  border-color: rgba(255, 255, 255, 0.18);
}

.admin-nav-toggle[aria-expanded="true"] {
  background: rgba(198, 40, 40, 0.16);
  border-color: rgba(198, 40, 40, 0.45);
  color: var(--white);
}

.admin-nav-backdrop {
  display: none;
}

.admin-header-icon {
  font-size: var(--fs-22);
  color: var(--primary);
  flex-shrink: 0;
}

.admin-header .admin-title {
  font-size: var(--fs-16);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-header .admin-subtitle {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-main {
  /* Breite, Rand und Abstände: css/fp-page.css (.fp-page, Design FP 11) */
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-gate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.admin-gate-message {
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
}

.admin-shell {
  display: grid;
  grid-template-columns: var(--side-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-side {
  /* Trello NbN2wrbi: fills the shell column and scrolls on its own */
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  /* Trello xg6ALdg3: keep the rounded corners when the pane scrolls */
  clip-path: inset(0 round 14px);
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.admin-nav-item .material-symbols-outlined {
  font-size: var(--fs-20);
  color: var(--text-muted);
}

.admin-nav-item:hover:not(:disabled) {
  background: var(--surface-hover);
}

.admin-nav-item.is-active {
  background: rgba(198, 40, 40, 0.16);
  color: var(--white);
}

.admin-nav-item.is-active .material-symbols-outlined {
  color: var(--primary-hover);
}

.admin-nav-item.is-disabled,
.admin-nav-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.admin-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}

.admin-nav-group-toggle .material-symbols-outlined {
  font-size: var(--fs-18);
  color: var(--text-muted);
  flex-shrink: 0;
}

.admin-nav-item .material-symbols-outlined {
  flex-shrink: 0;
}

.admin-nav-group-toggle > span:not(.material-symbols-outlined),
.admin-nav-item > span:not(.material-symbols-outlined) {
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}

.admin-nav-caret {
  margin-left: auto;
  transition: transform 0.15s ease;
}

.admin-nav-group.is-open .admin-nav-caret {
  transform: rotate(180deg);
}

.admin-nav-sub {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 4px 8px;
}

.admin-nav-group.is-open .admin-nav-sub {
  display: flex;
}

.admin-nav-sub .admin-nav-item {
  padding: 8px 10px;
  font-size: 0.88rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.admin-search-field {
  max-width: 420px;
}

/* Kästchen (.admin-check, .admin-content input[type=checkbox]): css/fp-field.css (.fp-check, Design FP 5a) */

.admin-section-actions .btn.admin-danger-btn {
  margin-left: 0;
}

.admin-panels {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-content {
  /* Abstand der Abschnitte: css/fp-page.css (.fp-page__body) */
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.admin-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Seitentitel und Abschnittstitel: css/fp-page.css (.fp-page__title, .fp-section__title, Design FP 11) */

.admin-status {
  min-height: 1.2em;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Listen und Zeilen (Fläche, Rand, Radius, Höhe, Innen, Zustände): css/fp-row.css (Design FP 6a) */
.admin-user-list,
.admin-depot-list {
  margin-block: 0;
}

.admin-user-row,
.admin-depot-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-depot-row {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
}

.admin-vehicle-row,
.admin-stichwort-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.admin-vehicle-row .admin-user-meta,
.admin-stichwort-row .admin-user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-user-email,
.admin-depot-name {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-depot-name {
  font-weight: 600;
}

.admin-depot-address {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

/* Trello NbN2wrbi: in a two-column split the list and the detail each fill the
   remaining height of the content pane and scroll on their own. */
@media (width > 1100px) {
  .admin-content:has(> .admin-split) {
    overflow: hidden;
  }

  .admin-content:has(> .admin-split) > .admin-split {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
  }

  .admin-content:has(> .admin-split) > .admin-split > * {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .admin-split > :last-child:not(:first-child) {
    clip-path: inset(0 round 14px);
  }
}

.admin-depot-detail {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.admin-detail-title {
  margin-bottom: 14px;
  font-size: 1rem;
  font-weight: 600;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-field-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Feldregeln (.admin-field input/select): css/fp-field.css (Design FP 2, hG69yv25) */

.admin-coords {
  min-height: 1.2em;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-coords.muted {
  opacity: 0.9;
}

.admin-form-error {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.85rem;
}

.admin-form-error:not(.hidden) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.admin-autosave-retry {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.admin-reset-link {
  display: inline-block;
  margin-top: 8px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}
.admin-reset-link:hover { color: var(--text); }
.admin-reset-link:disabled { opacity: 0.5; cursor: default; text-decoration: none; }
.admin-status.is-saving,
.admin-status.is-saved { color: var(--text-muted); }

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* Admin buttons: system classes from fp-button.css (pl2Fqjjf 6b group 3). admin-danger-btn is only a
   layout hook (.btn.admin-danger-btn beats the system margin: 0). */
.btn.admin-danger-btn {
  margin-left: auto;
}

/* Empty state: .fp-empty in fp-feedback.css (Design FP 13b). */

/* Toast: .fp-toast in fp-feedback.css (Design FP 13). */

/* Swiss address autocomplete (admin page has no header.css) */
.swiss-address-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.swiss-address-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + var(--fp-gap-suggest));
  z-index: var(--z-dropdown);
}

.swiss-address-list.hidden {
  display: none;
}

/* Liste und Einträge: Aussehen in css/fp-field.css (.fp-suggest, Design FP 4) */

@media (width <= 1100px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-nav-toggle {
    display: inline-flex;
  }

  .admin-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-panel) + 5);
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.admin-nav-open .admin-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: var(--z-dropdown);
    width: min(320px, 92vw);
    max-width: 300px;
    max-height: none;
    min-height: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    border-radius: 0 14px 14px 0;
    clip-path: inset(0 round 0 14px 14px 0);
    box-shadow: var(--shadow);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(calc(-100% - 12px));
    transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
  }

  body.admin-nav-open .admin-side {
    transform: none;
  }

  .admin-side.is-dragging {
    transition: none;
  }

  .admin-nav-item {
    width: 100%;
    flex: 0 0 auto;
  }

  .admin-split {
    grid-template-columns: 1fr;
  }

  .admin-split.is-editing > :not(.admin-depot-detail) {
    /* important: blendet im Bearbeiten-Modus alle Geschwister aus, auch gegen deren eigene display-Regeln */
    display: none !important;
  }

  .admin-split.is-editing > .admin-depot-detail {
    display: block;
  }
}

@media (width <= 560px) {
  .admin-user-row {
    flex-wrap: wrap;
  }

  .btn.admin-danger-btn {
    margin-left: 0;
    width: 100%;
  }
}

.admin-role-list {
  margin-block: 0;
}

.admin-role-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
}

.admin-role-assign {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-subhead {
  margin-top: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}

.admin-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.admin-hint code {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.admin-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 10px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border-radius: var(--radius-sm);
  clip-path: inset(0 round var(--radius-sm));
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.admin-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
}

.admin-check input {
  margin-top: 2px;
}

.admin-check-inline {
  align-items: center;
  white-space: nowrap;
}

.admin-perm-areas {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 360px;
  overflow: auto;
  padding: 8px;
  border-radius: var(--radius-sm);
  clip-path: inset(0 round var(--radius-sm));
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.admin-perm-area-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.admin-perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

.admin-perm-row:last-child {
  border-bottom: 0;
}

.admin-perm-resource {
  font-size: 0.86rem;
  font-weight: 500;
  min-width: 7rem;
}

.admin-perm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

/* —— Benutzer detail / avatar / multi-role —— */
.admin-user-row {
  align-items: center;
  gap: 0.75rem;
}

.admin-user-thumb {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.55);
}

.admin-user-thumb img,
.admin-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-user-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.admin-user-name {
  font-weight: 600;
  color: var(--text-bright);
}

.admin-user-badges {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}

.admin-user-profile {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.admin-avatar-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-start;
}

.admin-avatar-preview {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  font-size: 2rem;
}

.admin-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* input.is-readonly: css/fp-field.css */


/* —— Fahrzeuge list / symbol preview —— */
.admin-vehicle-row {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.admin-vehicle-row .admin-user-thumb {
  border-radius: 10px;
}

.admin-vehicle-row .admin-user-thumb img {
  object-fit: contain;
  padding: 2px;
  background: rgba(255, 255, 255, 0.04);
}

.admin-symbol-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-symbol-preview {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px;
}

/* .admin-field select mit Pfeil: css/fp-field.css (Design FP 4, shd7Yzr1) */



/* Drag-and-drop reorder (Fahrzeuge / Stichworte) */
.admin-depot-row.is-dragging {
  opacity: 0.55;
}
.admin-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-right: 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: grab;
  touch-action: none;
}
.admin-drag-handle:active {
  cursor: grabbing;
}
.admin-drag-handle .material-symbols-outlined {
  font-size: var(--fs-20);
}
.admin-check-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.admin-check-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}
.admin-check-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}


/* Ausrückreihenfolge — sortable vehicle assign list */
.admin-ausrueck-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  border-radius: var(--radius-sm);
  clip-path: inset(0 round var(--radius-sm));
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.admin-ausrueck-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  cursor: default;
}
.admin-ausrueck-row.is-assigned {
  background: rgba(232, 93, 4, 0.08);
  border-color: rgba(232, 93, 4, 0.2);
}
.admin-ausrueck-row.is-dragging {
  opacity: 0.55;
}
.admin-ausrueck-row.drag-over {
  border-color: rgba(198, 40, 40, 0.55);
  box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.2);
}
.admin-ausrueck-row .admin-check {
  flex: 1;
  min-width: 0;
  align-items: center;
}
.admin-ausrueck-row .admin-drag-handle {
  opacity: 0.7;
}
.admin-ausrueck-row:not(.is-assigned) .admin-drag-handle {
  opacity: 0.35;
}

/* Ausrückreihenfolge im Stichwort (Trello 6qdsr9ik): Symbol, Entfernen, «Hinzufügen»-Auswahl */
.admin-ausrueck-vehicle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.admin-ausrueck-vehicle .admin-check-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-ausrueck-symbol {
  width: 36px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
}
.admin-ausrueck-remove {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, inherit);
  cursor: pointer;
}
.admin-ausrueck-remove:hover,
.admin-ausrueck-remove:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, inherit);
}
.admin-ausrueck-empty {
  margin: 4px 2px;
}
.admin-ausrueck-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.admin-ausrueck-actions .btn .material-symbols-outlined {
  font-size: 1.125rem;
  margin-right: 4px;
  vertical-align: -4px;
}
.admin-ausrueck-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border-radius: var(--radius-sm);
  clip-path: inset(0 round var(--radius-sm));
  border: 1px dashed var(--border);
  background: var(--surface-2);
}
.admin-ausrueck-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.admin-ausrueck-pick:hover,
.admin-ausrueck-pick:focus-visible {
  border-color: rgba(232, 93, 4, 0.35);
  background: rgba(232, 93, 4, 0.08);
}

.admin-role-chat-settings {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Vehicle tablet QR-Auth (Admin) */
.admin-vehicle-qr {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.admin-detail-subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.admin-vehicle-qr-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
  align-items: flex-start;
}
.admin-vehicle-qr-preview canvas {
  background: var(--white);
  border-radius: 8px;
  padding: 8px;
}
.admin-vehicle-qr-claim {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}
.admin-vehicle-qr-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Organisation sub-blocks (Depots + Wasserbezugsorte) */
.admin-section-head--sub {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.admin-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
#section-fahrzeuge .admin-split .admin-depot-list,
#section-material .admin-split .admin-depot-list {
  margin-top: 1rem;
}
.admin-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (width <= 720px) {
  .admin-field-row { grid-template-columns: 1fr; }
}

.admin-invite-list {
  margin-top: 12px;
}

.admin-invite-roles {
  flex: 1 1 100%;
}

.admin-invite-filters {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(180px, 1fr);
  gap: 10px;
  margin: 14px 0 10px;
}

.admin-invite-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 0.85rem;
}

.admin-invite-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-invite-email {
  font-weight: 600;
  word-break: break-all;
}

.admin-invite-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Form: .fp-badge in fp-row.css; hier nur die Farben. */
.admin-invite-badge {
  background: rgba(255, 255, 255, 0.08);
}

.admin-invite-badge.is-open {
  color: var(--invite-open);
  background: rgba(34, 197, 94, 0.16);
}

.admin-invite-badge.is-accepted {
  color: var(--invite-accepted);
  background: rgba(59, 130, 246, 0.18);
}

.admin-invite-badge.is-expired {
  color: var(--invite-expired);
  background: rgba(248, 113, 113, 0.16);
}

@media (width <= 720px) {
  .admin-invite-filters {
    grid-template-columns: 1fr;
    display: grid;
  }

  .admin-invite-row {
    flex-direction: column;
  }
}

.admin-invite-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.admin-log-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 8px;
}

.admin-log-kpi {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.admin-log-kpi-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.admin-log-kpi strong {
  font-size: 1.35rem;
  font-weight: 600;
}

.admin-log-series {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 56px;
  margin: 8px 0 16px;
}

.admin-log-bar {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px 4px 0 0;
}

.admin-log-bar span {
  display: block;
  width: 100%;
  min-height: 2px;
  background: rgba(198, 40, 40, 0.75);
  border-radius: 4px 4px 0 0;
}

.admin-log-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}

.admin-log-list {
  margin-top: 8px;
}

.admin-log-row {
  display: grid;
  grid-template-columns: 150px 140px minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 8px 12px;
  font-size: 0.84rem;
}

.admin-log-when,
.admin-log-meta {
  color: var(--text-muted);
}

.admin-log-event {
  font-weight: 600;
}

@media (width <= 1100px) {
  .admin-log-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-log-row {
    grid-template-columns: 1fr 1fr;
  }

  .admin-log-meta {
    grid-column: 1 / -1;
  }
}

.support-banner {
  position: sticky;
  top: 0;
  z-index: var(--z-dropdown);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--support-violet);
  color: var(--white);
  font-size: 0.88rem;
}

.support-banner.hidden { display: none; }

.support-banner button {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--white);
  border-radius: 6px;
  padding: 2px 10px;
  font: inherit;
  cursor: pointer;
}


/* —— Empfängergruppen (Trello su8lm37o PR 3/6) —— */
.admin-rg-filter {
  margin-bottom: 6px;
}

.admin-rg-members {
  max-height: 320px;
}

.admin-rg-members .admin-check.hidden { display: none; }

/* Benachrichtigungen PR 6/6: Admin «Erinnerungen» (Zeitpunkte vor Beginn). */
.ro-panel { max-width: 560px; }

/* Admin «2FA-Pflicht» (Trello PpsG4oEI): drei Optionen als Zeilen, 36 px Desktop / 44 px Handy. */
.o2fa-options { border: 0; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.o2fa-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-sm);
  cursor: pointer;
}
.o2fa-option:has(input:checked) { border-color: var(--fp-signal); background: var(--fp-signal-soft); }
.o2fa-option input { flex: 0 0 auto; margin-top: 1px; }
.o2fa-option strong { display: block; font-size: 0.875rem; }
.o2fa-option__desc { display: block; color: var(--text-muted); font-size: 0.8125rem; }
#o2fa-notice { margin: 0 0 12px; }
#o2fa-notice.hidden { display: none; }
@media (width <= 720px) {
  .o2fa-option { min-height: 44px; }
}
.ro-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ro-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ro-row .ro-value,
.ro-row .ro-unit {
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
.ro-row .ro-value { width: 84px; }
.ro-row .ro-unit { min-width: 110px; }
.ro-suffix { flex: 1; color: var(--text-muted); font-size: 0.85rem; }
.ro-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.ro-delete:hover { background: var(--danger-bg); color: var(--danger); }
.ro-add { align-self: flex-start; }
.ro-empty { margin: 0; }

/* Admin «Bevorzugte Ortschaften» (Trello sDchuhEm): Felder 36/44 über .fp-field, keine neuen z-index. */
#section-ortschaften .ro-row .fp-field { flex: 1; min-width: 0; }
#section-ortschaften .bo-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
}
#section-ortschaften .bo-add .fp-field { flex: 1; min-width: 0; }
#section-ortschaften .ro-row .btn--icon[disabled] { opacity: 0.4; cursor: default; }
#section-ortschaften .bo-bbox {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--fp-border, var(--border-strong));
}
#section-ortschaften .bo-bbox .admin-field-label { margin: 0 0 4px; font-weight: 600; }
#section-ortschaften .bo-bbox #bo-bbox-status { margin: 0 0 8px; }
#bo-bbox-dialog .bo-bbox-foot { flex-wrap: wrap; }
#bo-bbox-dialog .bo-bbox-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}
.bo-bbox-map {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  border: 1px solid var(--fp-border, var(--border-strong));
  border-radius: var(--fp-radius-sm, var(--radius-sm));
  background: var(--surface-2);
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.bo-bbox-map.is-panning { cursor: grabbing; }
.bo-bbox-layer {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}
.bo-bbox-map img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}
.bo-bbox-rect {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--fp-signal);
  background: var(--fp-signal-soft);
  pointer-events: none;
}
.bo-bbox-rect.hidden { display: none; }
.bo-bbox-edge {
  position: absolute;
  pointer-events: auto;
  cursor: move;
}
.bo-bbox-edge[data-bo-edge="n"],
.bo-bbox-edge[data-bo-edge="s"] { left: 10px; right: 10px; height: 36px; }
.bo-bbox-edge[data-bo-edge="e"],
.bo-bbox-edge[data-bo-edge="w"] { top: 10px; bottom: 10px; width: 36px; }
.bo-bbox-edge[data-bo-edge="n"] { top: -18px; }
.bo-bbox-edge[data-bo-edge="s"] { bottom: -18px; }
.bo-bbox-edge[data-bo-edge="e"] { right: -18px; }
.bo-bbox-edge[data-bo-edge="w"] { left: -18px; }
.bo-bbox-handle {
  position: absolute;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}
.bo-bbox-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  background: var(--white);
  border: 2px solid var(--fp-signal);
  border-radius: var(--fp-radius-sm, 4px);
}
.bo-bbox-handle[data-bo-corner="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.bo-bbox-handle[data-bo-corner="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.bo-bbox-handle[data-bo-corner="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.bo-bbox-handle[data-bo-corner="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
@media (width <= 720px) {
  .bo-bbox-edge[data-bo-edge="n"],
  .bo-bbox-edge[data-bo-edge="s"] { height: 44px; }
  .bo-bbox-edge[data-bo-edge="e"],
  .bo-bbox-edge[data-bo-edge="w"] { width: 44px; }
  .bo-bbox-edge[data-bo-edge="n"] { top: -22px; }
  .bo-bbox-edge[data-bo-edge="s"] { bottom: -22px; }
  .bo-bbox-edge[data-bo-edge="e"] { right: -22px; }
  .bo-bbox-edge[data-bo-edge="w"] { left: -22px; }
  .bo-bbox-handle { width: 44px; height: 44px; }
}
.bo-bbox-credit {
  margin: 6px 0 0;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.75rem;
}
@media (width <= 720px) {
  .bo-bbox-map { height: 220px; }
}
@media (width <= 560px) {
  .ro-row .ro-value { width: 64px; }
  .ro-row .ro-unit { min-width: 0; flex: 1; }
  .ro-suffix { display: none; }
}

/* Admin «Sicherung» (Trello Qy3K2gxe) */
.admin-subtitle {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.admin-backup-list {
  margin-block: 0;
}

.admin-backup-row {
  display: grid;
  grid-template-columns: minmax(9rem, 12rem) 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.88rem;
}

.admin-backup-size {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.admin-backup-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

@media (width <= 720px) {
  .admin-backup-row {
    grid-template-columns: 1fr auto;
  }

  .admin-backup-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* Admin «Fahrzeug-Standort» (Trello 3a3jMJTM): Beschriftung der Radien auch auf dem Handy;
   ungültiges Feld rot umrandet. */
#section-standort .ro-row .ro-suffix { display: block; }
.ro-row .ro-value[aria-invalid="true"] { border-color: var(--danger); }

/* Pikettplan (Trello CR3T8N1A PR 3): Wochenliste mit Autosave, Status farbig. */
#section-pikett { --pk-ok: var(--save-ok); --pk-abklaerung: var(--accent-orange); --pk-konflikt: var(--accent-red); }
.pk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-bottom: 12px;
}
.pk-jahr-field { min-width: 120px; margin: 0; }
.pk-filter { align-self: center; }
.pk-count { align-self: center; margin: 0; }
.pk-toolbar-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.pk-loeschen:hover { color: var(--danger); border-color: var(--danger); }
.pk-neu-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.pk-neu-form .admin-field { margin: 0; max-width: 140px; }
.pk-neu-form .admin-hint { flex: 1; min-width: 200px; margin: 0; }
.pk-head,
.pk-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(150px, 1fr) minmax(130px, 0.8fr) minmax(150px, 1fr) minmax(160px, 1.4fr);
  gap: 8px;
  align-items: center;
}
.pk-head {
  padding: 0 10px 6px 14px;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pk-wochen { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.pk-row {
  position: relative;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.pk-row::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--border-strong);
}
.pk-row[data-status="ok"]::before { background: var(--pk-ok); }
.pk-row[data-status="in_abklaerung"]::before { background: var(--pk-abklaerung); }
.pk-row[data-status="terminkonflikt"]::before { background: var(--pk-konflikt); }
.pk-row.is-leer { background: transparent; border-style: dashed; }
.pk-row.is-aktuell { border-color: var(--accent-blue); box-shadow: 0 0 0 1px var(--accent-blue); }
.pk-row.is-saving { opacity: 0.7; }
.pk-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pk-cell-label { display: none; color: var(--text-muted); font-size: 0.75rem; }
.pk-cell--woche { gap: 0; }
.pk-kw { font-size: 0.92rem; }
.pk-zeit { color: var(--text-muted); font-size: 0.78rem; }
.pk-jetzt {
  display: none;
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-blue);
  color: var(--text);
  font-size: 0.7rem;
}
.pk-row.is-aktuell .pk-jetzt { display: inline-block; }
.pk-row select,
.pk-row input[type="text"] {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  color-scheme: dark;
}
.pk-row select:disabled,
.pk-row input:disabled { opacity: 0.75; cursor: default; }
.pk-row select[data-field="status"][data-status="ok"] { color: var(--pk-ok); }
.pk-row select[data-field="status"][data-status="in_abklaerung"] { color: var(--pk-abklaerung); }
.pk-row select[data-field="status"][data-status="terminkonflikt"] { color: var(--pk-konflikt); }
.pk-row-error { grid-column: 1 / -1; margin: 0; }
.pk-vl-head { margin-top: 8px; }
#section-pikett .ro-row .ro-suffix { display: block; }
@media (width <= 1100px) {
  .pk-head { display: none; }
  .pk-row { grid-template-columns: 1fr 1fr; }
  .pk-cell--woche { grid-column: 1 / -1; }
  .pk-cell-label { display: block; }
  .pk-toolbar-actions { margin-left: 0; }
}
@media (width <= 560px) {
  .pk-row { gap: 6px 8px; padding: 8px 8px 8px 12px; }
  .pk-cell-label { font-size: 0.7rem; }
  .pk-row select,
  .pk-row input[type="text"] { padding: 6px; font-size: 0.82rem; }
}

/* —— Org-Logo (Trello JkBoDXEA L2) —— */
.ol-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}

.ol-preview {
  width: min(16rem, 100%);
  aspect-ratio: 2 / 1;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 0.5rem;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  font-size: 2rem;
}

.ol-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.admin-material-row {
  cursor: pointer;
}

.admin-material-empty {
  padding: 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
}
