body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #020617;
  color: #e5e7eb;
}

.page-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.app-header {
  margin-bottom: 24px;
}

.app-header h1 {
  margin-bottom: 4px;
}

.subtitle {
  margin-top: 0;
  color: #94a3b8;
}

.card {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 14px;
  padding: 22px;
  max-width: 520px;
}

form {
  display: grid;
  gap: 10px;
}

label {
  font-weight: 600;
  margin-top: 8px;
}

input {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #020617;
  color: #e5e7eb;
  font-size: 15px;
}

button {
  margin-top: 14px;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  background: #1d4f73;
  color: #c7eaff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #25638f;
}

.result-box {
  margin-top: 18px;
  padding: 12px;
  border-radius: 10px;
  background: #020617;
  color: #cbd5e1;
  min-height: 20px;
}

.result-box.success {
  border: 1px solid #14532d;
  color: #86efac;
}

.result-box.error {
  border: 1px solid #7f1d1d;
  color: #fecaca;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.top-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.top-nav a,
.card a {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 600;
}

.top-nav a:hover,
.card a:hover {
  text-decoration: underline;
}

.small-muted {
  color: #94a3b8;
  font-size: 14px;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border: 1px solid #374151;
  border-radius: 999px;
  background: #111827;
  color: #c7eaff;
  text-decoration: none;
  font-weight: 700;
}

.top-nav a:hover {
  background: #1f2937;
  border-color: #4b5563;
  text-decoration: none;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.orben-logo {
  height: 58px;
  width: auto;
  display: block;
}

.title-block {
  margin-bottom: 24px;
}

.title-block h1 {
  margin: 0 0 4px 0;
}

.top-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border: 1px solid #374151;
  border-radius: 999px;
  background: #111827;
  color: #c7eaff;
  text-decoration: none;
  font-weight: 700;
}

.top-nav a:hover {
  background: #1f2937;
  border-color: #4b5563;
  text-decoration: none;
}

.wide-card {
  max-width: none;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.small-button {
  padding: 9px 14px;
  border: 1px solid #374151;
  border-radius: 999px;
  background: #111827;
  color: #c7eaff;
  font-weight: 700;
  cursor: pointer;
}

.small-button:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.table-wrapper {
  overflow-x: auto;
}

.device-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.device-table th,
.device-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #374151;
  text-align: left;
  vertical-align: top;
}

.device-table th {
  color: #94a3b8;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.device-name {
  font-weight: 700;
  color: #e5e7eb;
}

.secondary-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid #374151;
  border-radius: 10px;
  background: #020617;
  color: #cbd5e1;
  font-weight: 700;
  text-decoration: none;
}

.secondary-action:hover {
  background: #1f2937;
  text-decoration: none;
}

.danger-small-button {
  padding: 8px 12px;
  border: 1px solid #7f1d1d;
  border-radius: 999px;
  background: #450a0a;
  color: #fecaca;
  font-weight: 700;
  cursor: pointer;
}

.danger-small-button:hover {
  background: #7f1d1d;
}

.section-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.management-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.management-card {
  background: #020617;
  border: 1px solid #374151;
  border-radius: 14px;
  padding: 18px;
}

.management-card h3 {
  margin-top: 0;
}

.management-section-title {
  margin-top: 28px;
  margin-bottom: 12px;
  color: #c7eaff;
}

.accordion-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: 8px 12px;
  border: 1px solid #374151;
  border-radius: 999px;
  background: #111827;
  color: #c7eaff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.accordion-toggle:hover {
  background: #1f2937;
  border-color: #4b5563;
  color: #e5e7eb;
}
.accordion-hidden {
  display: none !important;
}

.managed-device-list {
  margin-top: 14px;
}

.management-table-wrapper {
  margin-top: 10px;
}

.management-card .device-table th,
.management-card .device-table td {
  font-size: 14px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #0f172a;
}

.selected-row {
  background: #111827;
}

.device-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.row-arrow {
  flex: 0 0 18px;
  color: #93c5fd;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 2px;
}

.device-name-inline {
  min-width: 0;
}

.accordion-row td {
  background: #020617;
  border-bottom: 1px solid #374151;
}

.accordion-content {
  padding: 14px 10px 18px 34px;
}

.detail-grid-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.detail-item {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 12px;
}

.detail-label {
  display: block;
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-value {
  color: #e5e7eb;
  font-weight: 700;
  word-break: break-word;
}


.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.badge-alarm {
  background: #7f1d1d;
  color: #fecaca;
  animation: alarm-pulse 1.8s infinite;
}

.badge-filling {
  background: #1e3a8a;
  color: #bfdbfe;
}

.badge-done {
  background: #14532d;
  color: #86efac;
}

.badge-ready {
  background: #1d4f73;
  color: #c7eaff;
}

.badge-offline {
  background: #374151;
  color: #d1d5db;
}

.badge-warning {
  background: #78350f;
  color: #fde68a;
  animation: alarm-pulse 1.8s infinite;
}

@keyframes alarm-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.45);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(248, 113, 113, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0);
  }
}
.sortable-header {
  cursor: pointer;
  user-select: none;
}

.sortable-header:hover {
  color: #c7eaff;
}

.app-footer {
  margin-top: 28px;
  padding: 18px 0 8px 0;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.footer-main {
  margin-bottom: 6px;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
}

.footer-links a {
  color: #64748b;
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.footer-links span {
  color: #475569;
}

.auth-card {
  margin-left: auto;
  margin-right: auto;
}

.location-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
}

.location-button {
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid #374151;
  border-radius: 999px;
  background: #111827;
  color: #c7eaff;
  font-weight: 700;
  cursor: pointer;
}

.location-button:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.map-link {
  display: inline-block;
  margin-top: 10px;
  color: #93c5fd;
  font-weight: 700;
  text-decoration: none;
}

.map-link:hover {
  text-decoration: underline;
}

.simulator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

/* V2.3 Smartphone-Fix: ORBEN-Logo und Navigation stapeln */
@media (max-width: 600px) {

  .header-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    overflow: visible;
  }

  .orben-logo {
    max-width: 100%;
    height: auto;
  }

  .top-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    overflow: visible;
  }

  .top-nav a {
    flex: 0 1 auto;
    min-width: 135px;
    text-align: center;
    white-space: nowrap;
  }
}

/* V2.3 Login/Register: Header und Formular als gemeinsame Spalte zentrieren */
.auth-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-shell .app-header,
.auth-shell .card {
  width: 100%;
  max-width: 708px;
}

.auth-shell .app-header {
  margin-left: auto;
  margin-right: auto;
}

.auth-shell .header-top {
  width: 100%;
}

.auth-shell .title-block {
  width: 100%;
}

/* V2.3 Verwaltung: Geräteliste intern scrollbar */
.device-admin-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
}

/* V2.3 Verwaltung: deaktivierter Entfernen-Button besser sichtbar */
.danger-small-button.disabled-button,
.danger-small-button:disabled {
  background: #3b4658;
  border-color: #6b7280;
  color: #cbd5e1;
  opacity: 1;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

/* V2.3 Verwaltung: E-Mail-Benachrichtigungen */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-weight: 500;
}

.checkbox-row input {
  width: auto;
  transform: scale(1.15);
}

#notificationEmail {
  display: inline-block;
  margin-top: 4px;
  color: #dbeafe;
  font-weight: 600;
}
/* V2.3 Registrierung: Erfolgsmeldung optisch zentrieren */
.center-message {
  text-align: center;
  line-height: 1.6;
}

.inline-highlight {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 700;
  white-space: nowrap;
}

/* V2.3 Übersicht: Zuständig-Anzeige */
.assigned-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
  white-space: nowrap;
}

/* V2.3 Übersicht: Tabellenkopf nicht umbrechen */
.nowrap-header {
  white-space: nowrap;
}

/* V2.3 Übersicht: Zuständig als normale Tabelleninformation */
.assigned-cell {
  font-weight: 500;
  white-space: normal;
}

/* V2.3 Geräte-Accordion: Zuständigkeit / Benachrichtigung */
.detail-notify {
  grid-column: 1 / -1;
}

.sub-accordion-toggle {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.sub-accordion-content {
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.sub-accordion-content label {
  display: block;
  margin-top: 10px;
}

.sub-accordion-content .checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* V2.3 Verwaltung: Abstand für Monteur-Zugang */
.technician-access-label {
  margin-top: 26px;
  margin-bottom: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* V2.3 Passwort anzeigen/verbergen */
.password-field {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.password-field input {
  flex: 1;
  margin: 0;
}

.password-toggle {
  width: auto;
  min-width: 110px;
  margin: 0;
  padding: 0 16px;
  align-self: stretch;
  white-space: nowrap;
}

/* V2.3 Verwaltung: Systemstatus */
.system-status-card {
  margin-top: 18px;
  margin-bottom: 24px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.status-tile {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
}

.status-tile-label {
  display: block;
  font-size: 0.82rem;
  opacity: 0.78;
  margin-bottom: 6px;
}

.status-tile strong {
  font-size: 1.5rem;
}

.system-status-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* V2.3 Übersicht: Systemstatus-Accordion */
.customer-status-card {
  margin: 14px 0 18px 0;
}

/* V2.3 Simulator V2 */
.sim-button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

/* V2.3 Simulator V2: Messwerte */
.sim-values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

/* V2.3 Archiv: Leitwert / Temperatur sauber anzeigen */
.measurement-cell {
  white-space: nowrap;
}

.measurement-main {
  display: block;
  white-space: nowrap;
}

.measurement-sub {
  display: block;
  margin-top: 3px;
  white-space: nowrap;
  opacity: 0.78;
  font-size: 0.85rem;
}

/* V2.3 Archiv: Gerät und Job-ID sauber darstellen */
.archive-device-cell {
  white-space: nowrap;
}

.archive-device-name {
  font-weight: 700;
  white-space: nowrap;
}

.archive-job-id {
  margin-top: 3px;
  font-size: 0.78rem;
  opacity: 0.72;
  white-space: nowrap;
}

/* V2.3 Übersicht: Gerät und technische ID sauber anzeigen */
.device-cell {
  white-space: nowrap;
}

.device-cell .device-name {
  white-space: nowrap;
}

.device-cell .small-muted {
  white-space: nowrap;
}

/* V2.3 Archiv: eigenes Scrollfenster für große Tabellen */
.archive-scroll-wrapper {
  max-height: 65vh;
  overflow: auto;
  border-radius: 14px;
}

/* Tabellenkopf beim vertikalen Scrollen sichtbar halten */
.archive-scroll-wrapper thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Verhindert unschöne Zeilenumbrüche in kompakten Zellen */
.archive-table th,
.archive-table td {
  white-space: nowrap;
}

.archive-scroll-wrapper thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #151c2b;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.14);
}

.archive-scroll-wrapper thead {
  position: sticky;
  top: 0;
  z-index: 6;
}

/* V2.3 Archiv: auf PC volle Seitenbreite besser nutzen */
@media (min-width: 1100px) {
  .archive-page .page-shell {
    max-width: none;
    width: 100%;
  }

  .archive-page .app-header,
  .archive-wide-card {
    width: min(96vw, 1500px);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }
}

/* V2.3 Simulator V2: QR-Code Druck */
.qr-print-area {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 190px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
}

.qr-code-box {
  background: #ffffff;
  padding: 8px;
  border-radius: 8px;
}

.qr-label {
  margin-top: 10px;
  font-weight: 800;
  color: #ffffff;
}

.qr-link {
  margin-top: 4px;
  font-size: 0.82rem;
  opacity: 0.75;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  body {
    background: #ffffff;
    color: #000000;
  }

  body * {
    visibility: hidden;
  }

  #qrPrintArea,
  #qrPrintArea * {
    visibility: visible;
  }

  #qrPrintArea {
  position: absolute;
  left: 8mm;
  top: 0;
  width: 180mm;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(2, 87mm);
  gap: 6mm;
  padding: 0;
}

.qr-card {
  box-sizing: border-box;
  width: 87mm;
  min-height: 50mm;
  padding: 3mm;
  break-inside: avoid;
  page-break-inside: avoid;
  background: #ffffff;
  color: #000000;
  border: 1px solid #000000;
  border-radius: 3mm;
}

  .qr-code-box {
    padding: 2mm;
    border-radius: 2mm;
  }

  .qr-code-box canvas,
  .qr-code-box img {
    width: 28mm !important;
    height: 28mm !important;
  }

  .qr-label {
    margin-top: 2mm;
    color: #000000;
    font-size: 11pt;
  }

  .qr-link {
    margin-top: 1mm;
    color: #000000;
    opacity: 1;
    font-size: 8pt;
  }
}

/* UI v2.5 Sprachumschalter */
.language-switch {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.language-switch button {
  width: auto;
  min-width: 44px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.language-switch button.active {
  outline: 2px solid rgba(255, 255, 255, 0.55);
}

/* UI v2.5 Header-Aktionen: Navigation + Sprache */
.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
}

.header-actions .top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions .language-switch {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: 0;
}

@media (max-width: 700px) {
  .header-actions {
    align-items: flex-start;
    width: 100%;
    margin-left: 0;
  }

  .header-actions .top-nav {
    justify-content: flex-start;
  }
}