:root {
  --bg: #edf1f5;
  --panel: #ffffff;
  --panel-subtle: #f6f8fa;
  --text: #172331;
  --muted: #526171;
  --line: #c7d1dc;
  --line-strong: #aab8c6;
  --border: var(--line);
  --blue: #0f62fe;
  --blue-dark: #0b4bc1;
  --green: #16833a;
  --yellow: #936d00;
  --red: #c7332f;
  --neutral: #5d6673;
  --shadow: 0 8px 22px rgba(22, 34, 51, 0.09);
  --shadow-low: 0 2px 8px rgba(22, 34, 51, 0.07);
  --topbar-height: 70px;
}

.device-inventory-list {
  display: grid;
  gap: 12px;
}

.device-inventory-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.device-inventory-head,
.device-inventory-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.device-inventory-head h3 {
  margin: 4px 0 0;
  font-size: 1.08rem;
}

.device-inventory-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--border);
}

.device-inventory-meta div {
  min-width: 0;
  padding: 10px 12px;
  background: #f8fafc;
}

.device-inventory-meta dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.device-inventory-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.device-archive-info {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-left: 4px solid #64748b;
  background: #f1f5f9;
}

.device-archive-info span {
  color: var(--muted);
}

.device-inventory-actions {
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.device-inventory-actions form {
  margin: 0;
}

.device-archive-action {
  width: min(100%, 560px);
}

.device-archive-action > summary {
  width: fit-content;
  list-style: none;
  cursor: pointer;
}

.device-archive-action > summary::-webkit-details-marker {
  display: none;
}

.device-archive-action[open] > summary {
  margin-bottom: 12px;
}

.device-archive-action .form {
  padding: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

@media (max-width: 820px) {
  .device-inventory-head,
  .device-inventory-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .device-inventory-meta {
    grid-template-columns: 1fr 1fr;
  }

  .device-inventory-actions .button,
  .device-archive-action,
  .device-archive-action > summary {
    width: 100%;
  }
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
}

body {
  margin: 0;
  max-width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

body.image-lightbox-open {
  overflow: hidden;
}

a {
  color: inherit;
}

img,
video,
canvas {
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand,
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  text-decoration: none;
}

.brand {
  min-width: 0;
}

.brand span:last-child {
  overflow-wrap: anywhere;
}

.brand-mark {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-weight: 800;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.notification-center {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-bell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf2f7;
  color: var(--neutral);
  font-size: 18px;
  cursor: pointer;
}

.notification-bell.has-notifications {
  border-color: #f3b6b4;
  background: #fff1f0;
  color: var(--red);
}

.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(340px, calc(100vw - 28px));
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notification-panel[hidden] {
  display: none;
}

.notification-panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  display: grid;
  gap: 3px;
  min-height: 54px;
  padding: 10px;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.notification-item:hover,
.notification-item:focus-visible {
  border-color: #9bbcff;
  outline: none;
}

.notification-item span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.mobile-header-notifications {
  display: none;
}

.mobile-menu-toggle,
.mobile-menu-session,
.mobile-install-app,
.mobile-logout-form {
  display: none;
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.sidebar {
  padding: 20px 12px;
  background: #eef2f6;
  border-right: 1px solid var(--line);
}

.sidebar ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #344054;
  text-decoration: none;
}

.nav-label {
  min-width: 0;
}

.menu-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: #d92d20;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.14);
}

.sidebar a.active,
.sidebar a:hover {
  background: var(--panel);
  color: var(--blue);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.content {
  width: min(1180px, 100%);
  min-width: 0;
  padding: 28px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-heading h1,
.login-brand h1,
.legal-page h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(0, 180px));
  gap: 10px;
  margin-bottom: 16px;
}

.tab-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.tab-switch a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  margin: 0 4px -1px 0;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line);
  border-radius: 8px 8px 0 0;
  background: #f3f7fb;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.tab-switch a:hover {
  background: #e8f1fb;
  color: var(--text);
  text-decoration: none;
}

.tab-switch a.is-active {
  position: relative;
  border-color: var(--blue);
  border-bottom-color: var(--panel);
  background: var(--panel);
  color: var(--blue);
  box-shadow: 0 -2px 0 var(--blue) inset;
}

.tab-switch span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #d7e3f3;
  color: var(--muted);
  font-size: 12px;
}

.tab-switch a.is-active span {
  background: var(--blue);
  color: white;
}

.dashboard-toolbar {
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(0, 1fr)) minmax(0, 140px) minmax(0, 170px);
}

.dashboard-toolbar label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.dashboard-toolbar .button {
  align-self: end;
}

.employee-toolbar {
  grid-template-columns: minmax(220px, 1fr) 220px 120px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font: inherit;
}

input:disabled,
select:disabled {
  color: #98a2b3;
  background: #f8fafc;
}

.button {
  max-width: 100%;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  overflow-wrap: anywhere;
  white-space: normal;
  cursor: pointer;
}

.button-primary {
  width: 100%;
  min-height: 48px;
  background: var(--blue);
  color: white;
}

.button-primary:hover {
  background: var(--blue-dark);
}

.button-secondary {
  background: #edf2f7;
  color: #344054;
}

.button-success {
  background: #e7f6eb;
  color: var(--green);
  border: 1px solid #bfe8ca;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.82;
}

.button-danger {
  background: var(--red);
  color: white;
}

.button-danger:hover {
  background: #9f2825;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  text-decoration: none;
}

.card-list {
  display: grid;
  gap: 12px;
}

.card,
.empty-state,
.metric,
.login-panel,
.legal-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card,
.empty-state,
.metric {
  min-width: 0;
  padding: 18px;
}

.card-clickable {
  cursor: pointer;
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-link:hover {
  border-color: #9bbcff;
}

.collapsible-order-card {
  gap: 10px;
  padding: 14px 16px;
}

.collapsible-order-card .card-header {
  align-items: flex-start;
}

.collapsible-order-card .badge-row {
  margin: 4px 0 0;
}

.card-collapse {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease;
}

.collapsible-order-card.is-expanded .card-collapse {
  opacity: 1;
  transform: translateY(0);
}

.compact-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.compact-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
}

.toggle-chevron {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
  transition: transform 180ms ease;
}

.collapsible-order-card.is-expanded .toggle-chevron {
  transform: rotate(180deg);
}

.compact-open-link {
  flex: 0 0 auto;
}

.admin-order-card {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.admin-card-badges {
  margin-top: -4px;
}

.admin-card-meta {
  margin-top: 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

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

.card h2,
.card h3,
.empty-state h2,
.metric h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.card p,
.empty-state p,
.metric p {
  margin: 0;
  color: var(--muted);
}

.admin-order-card h2,
.admin-order-card p,
.admin-card-meta dd {
  overflow-wrap: anywhere;
}

.date {
  font-weight: 700;
  color: var(--blue) !important;
}

.badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
  white-space: normal;
}

.badge-neutral {
  background: #edf2f7;
  color: var(--neutral);
}

.badge-blue {
  background: #e8f0ff;
  color: var(--blue-dark);
}

.badge-green {
  background: #e7f6eb;
  color: var(--green);
}

.badge-yellow {
  background: #fff4d6;
  color: #7a5200;
}

.badge-red {
  background: #fff1f0;
  color: var(--red);
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}

.meta-list dt {
  color: var(--muted);
  font-size: 13px;
}

.meta-list dd {
  margin: 2px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  margin-top: 18px;
}

.employee-detail-grid,
.action-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
  margin-top: 18px;
}

.employee-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  margin: -6px 0 18px;
}

.employee-quick-actions .button {
  flex: 1 1 220px;
  width: auto;
  justify-content: center;
}

.employee-panel,
.employee-action-card {
  min-width: 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.employee-panel h2,
.employee-action-card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.employee-panel p,
.employee-action-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.employee-panel .button {
  width: 100%;
  justify-content: center;
  margin-bottom: 10px;
}

.order-information-panel {
  grid-column: 1 / -1;
}

.order-information-panel .compact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
}

.order-information-panel .compact-list > div {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.contact-line {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.contact-line:last-child {
  border-bottom: 0;
}

.contact-line a {
  overflow-wrap: anywhere;
}

.compact-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.compact-list div {
  display: grid;
  gap: 3px;
}

.compact-list dt {
  font-size: .8rem;
  color: var(--muted);
}

.compact-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.employee-action-card {
  border-style: dashed;
}

.employee-action-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-style: solid;
}

.employee-action-card span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sync-panel,
.draft-restore {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 6px solid var(--neutral);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.draft-restore {
  grid-template-columns: minmax(0, 1fr) auto;
}

.sync-panel h2,
.draft-restore h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.sync-panel p,
.draft-restore p {
  margin: 0;
  color: var(--muted);
}

.sync-panel .button {
  white-space: normal;
}

.sync-indicator {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--neutral);
}

.sync-panel-green {
  border-left-color: var(--green);
}

.sync-panel-green .sync-indicator {
  background: var(--green);
}

.sync-panel-yellow {
  border-left-color: var(--yellow);
}

.sync-panel-yellow .sync-indicator {
  background: var(--yellow);
}

.sync-panel-red {
  border-left-color: var(--red);
}

.sync-panel-red .sync-indicator {
  background: var(--red);
}

.sync-device-note,
.sync-connection-note {
  margin-top: 6px !important;
  font-weight: 700;
}

.local-data-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 41, 51, 0.42);
}

.local-data-dialog[hidden] {
  display: none;
}

.local-data-dialog-card {
  width: min(560px, 100%);
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.local-data-dialog-card h2 {
  margin: 0 0 10px;
}

.local-data-dialog-card p {
  margin: 8px 0 0;
}

.action-row,
.card-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.action-row > *,
.card-actions > *,
.form-actions > * {
  min-width: 0;
  max-width: 100%;
}

.action-row form,
.card-actions form,
.form-actions form {
  min-width: 0;
  max-width: 100%;
}

.card-actions {
  margin-top: 16px;
}

.inline-delete-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.inline-delete-form label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.inline-delete-form input {
  margin-top: 6px;
}

.question-admin-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.question-admin-actions form {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.question-admin-actions label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.question-admin-actions textarea {
  width: 100%;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

.question-admin-actions .button {
  width: fit-content;
}

.section-block {
  min-width: 0;
  max-width: 100%;
  margin-top: 28px;
}

.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
}

.form-card {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-card label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.form-card [hidden] {
  display: none !important;
}

.backup-schedule-summary {
  margin: 0;
  font-weight: 700;
}

.form-card textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

.field-hint {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.notice-list {
  display: grid;
  gap: 8px;
}

.notice-list-warning p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7df;
  color: #7a5200;
  font-weight: 700;
}

.success-notice {
  border-color: #bfe8ca;
  background: #f0fbf3;
  color: var(--green);
  font-weight: 700;
}

.admin-time-report-card {
  scroll-margin-top: 92px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.admin-time-report-card.is-reviewed {
  border-color: #bfe8ca;
  background: linear-gradient(180deg, #f7fff9 0%, #ffffff 56%);
}

.admin-time-report-card.is-corrected {
  border-color: #ffe1a3;
}

.admin-time-report-card:target {
  box-shadow: 0 0 0 4px rgba(29, 132, 68, 0.16), var(--shadow);
}

.pilot-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 8px 18px;
  margin: 0;
  padding-left: 22px;
}

.pilot-checklist li {
  padding: 4px 0;
  font-weight: 700;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 10px;
}

.compact-form {
  margin-top: 14px;
  padding: 14px;
}

.confirmation-row {
  align-items: flex-start;
  font-weight: 700;
}

.photo-placeholder,
.danger-card {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.photo-upload {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.photo-picker {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  cursor: pointer;
}

.photo-picker input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
}

.photo-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-picker-actions .photo-picker {
  flex: 1 1 180px;
}

.photo-picker.photo-picker-secondary {
  border: 1px solid var(--blue);
  background: white;
  color: var(--blue);
}

.photo-preview,
.photo-existing,
.defect-thumb {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.photo-existing,
.photo-preview {
  min-height: 180px;
}

.photo-preview img,
.photo-existing img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  object-position: center center;
}

.photo-preview span,
.photo-error {
  color: var(--muted);
  font-weight: 700;
}

.photo-error {
  margin: 0;
  color: var(--red);
}

.defect-card-layout {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.defect-thumb {
  width: 112px;
  height: 112px;
}

.defect-thumb img {
  display: block;
  width: 86%;
  height: 86%;
  object-fit: contain;
  object-position: center center;
}

.image-lightbox-trigger {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-lightbox-trigger:focus-visible {
  outline: 3px solid rgba(15, 98, 254, 0.28);
  outline-offset: -3px;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 51, 0.78);
}

.image-lightbox-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  padding: 12px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.image-lightbox-panel img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 112px);
  object-fit: contain;
  background: #f8fafc;
  border-radius: 8px;
}

.image-lightbox-close {
  justify-self: end;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f7;
  color: #344054;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.scroll-top-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 45;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(15, 98, 254, 0.28);
  border-radius: 999px;
  background: rgba(15, 98, 254, 0.78);
  color: white;
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.scroll-top-button[hidden] {
  display: none;
}

.scroll-top-button:hover,
.scroll-top-button:focus-visible {
  background: var(--blue);
  outline: none;
}

.defect-thumb span {
  padding: 10px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.photo-placeholder h2,
.danger-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.photo-placeholder p,
.photo-placeholder span,
.danger-card p {
  margin: 0;
  color: var(--muted);
}

.defect-card.is-cancelled {
  background: #f8fafc;
  border-style: dashed;
}

.sub-title {
  margin-top: 18px;
}

.choice-group {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.choice-group legend {
  padding: 0 6px;
  font-weight: 800;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px !important;
  min-height: 36px;
  font-weight: 600 !important;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.muted {
  color: var(--muted);
}

.span-2 {
  grid-column: 1 / -1;
}

.alert-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.alert-list p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--red);
  font-weight: 700;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 24px;
  font-weight: 800;
}

.metric-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.metric-link:hover {
  border-color: #9bbcff;
}

.export-status-card,
.export-check-card,
.export-type-card {
  min-width: 0;
}

.export-check-list {
  gap: 10px;
}

.export-message {
  border-left: 6px solid var(--neutral);
}

.export-message p,
.export-message-list {
  margin: 0;
}

.export-message-list {
  display: grid;
  gap: 6px;
  padding-left: 20px;
  color: var(--muted);
}

.export-message-blocker {
  border-left-color: var(--red);
}

.export-message-warning {
  border-left-color: var(--yellow);
}

.export-type-card {
  display: grid;
  gap: 14px;
}

.export-type-card .button:disabled {
  cursor: not-allowed;
  opacity: .72;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-panel {
  width: min(440px, 100%);
  padding: 24px;
}

.login-brand {
  align-items: flex-start;
  margin-bottom: 18px;
}

.login-brand p,
.notice {
  margin: 4px 0 0;
  color: var(--muted);
}

.notice {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.install-app-card {
  display: none;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--red);
  font-weight: 700;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
  color: var(--muted);
}

.portal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.legal-page {
  width: min(760px, calc(100% - 40px));
  margin: 40px auto;
  padding: 24px;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--blue);
  font-weight: 700;
}

@media (max-width: 820px) {
  :root {
    --topbar-height: 64px;
  }

  html,
  body {
    overflow-x: hidden;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open::before {
    position: fixed;
    inset: 64px 0 0;
    z-index: 15;
    background: rgba(31, 41, 51, 0.32);
    content: "";
  }

  .topbar {
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 10px 14px;
  }

  .brand {
    flex: 1 1 auto;
    font-size: 0.95rem;
  }

  .desktop-session {
    display: none;
  }

  .mobile-header-notifications {
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .mobile-header-notifications .notification-bell {
    width: 44px;
    height: 44px;
  }

  .mobile-header-notifications .notification-panel {
    position: fixed;
    top: 72px;
    right: 14px;
    left: 14px;
    width: auto;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  .inline-delete-form {
    grid-template-columns: 1fr;
  }

  .mobile-menu-toggle:focus-visible,
  .sidebar a:focus-visible,
  .mobile-logout-form .button:focus-visible {
    outline: 3px solid rgba(15, 98, 254, 0.28);
    outline-offset: 2px;
  }

  .hamburger-lines,
  .hamburger-lines::before,
  .hamburger-lines::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .hamburger-lines {
    position: relative;
  }

  .hamburger-lines::before,
  .hamburger-lines::after {
    position: absolute;
    left: 0;
    content: "";
  }

  .hamburger-lines::before {
    top: -6px;
  }

  .hamburger-lines::after {
    top: 6px;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    z-index: 20;
    width: min(320px, calc(100vw - 32px));
    padding: 16px;
    overflow-y: auto;
    transform: translateX(100%);
    border-right: 0;
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: transform 160ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-menu-session {
    display: block;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-weight: 700;
  }

  .sidebar ul {
    display: grid;
    gap: 8px;
    min-width: 0;
  }

  .sidebar a {
    min-height: 48px;
    padding: 12px 14px;
    font-weight: 700;
  }

  .mobile-logout-form {
    display: block;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .mobile-install-app {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 14px 12px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--blue);
    border-radius: 8px;
    background: var(--panel);
  }

  .mobile-install-app[hidden] {
    display: none;
  }

  .mobile-install-app h2 {
    margin: 0;
    font-size: 1rem;
  }

  .mobile-install-app p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
  }

  .mobile-install-app .button {
    width: 100%;
    min-height: 46px;
  }

  .mobile-logout-form .button {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .content {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    overflow-x: clip;
  }

  .install-app-card {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 5px solid var(--blue);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .install-app-card[hidden] {
    display: none;
  }

  .install-app-card h2 {
    margin: 0 0 4px;
    font-size: 1rem;
  }

  .install-app-card p {
    margin: 0;
    color: var(--muted);
  }

  .install-app-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .install-app-actions .button {
    width: 100%;
    min-height: 46px;
  }

  .install-app-card-login {
    margin: 0 0 16px;
  }

  .page-heading,
  .card-header {
    flex-direction: column;
  }

  .employee-quick-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin: -2px 0 16px;
  }

  .employee-quick-actions .button {
    width: 100%;
    min-height: 50px;
  }

  .toolbar,
  .dashboard-toolbar,
  .employee-toolbar,
  .meta-list,
  .form-grid {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .action-row,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .question-admin-actions .button {
    width: 100%;
  }

  .sync-panel,
  .draft-restore {
    grid-template-columns: 1fr;
  }

  .sync-panel .button,
  .draft-restore .button {
    width: 100%;
  }

  .defect-card-layout {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  .defect-thumb {
    width: 96px;
    height: 96px;
  }
}

@media (max-width: 380px) {
  .content {
    padding: 14px;
  }

  .defect-card-layout {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
  }

  .defect-thumb {
    width: 88px;
    height: 88px;
  }
}

/* Stromerzeugerprüfung */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.button-small {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 0.84rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--red);
  font: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}

.icon-button:hover {
  background: #fff2f2;
}

.generator-toolbar,
.generator-workflow-head,
.repeater-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.generator-toolbar h2,
.generator-toolbar p,
.generator-workflow-head h2,
.generator-workflow-head p {
  margin: 0;
}

.generator-defect-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.generator-defect-add {
  white-space: nowrap;
}

.generator-defect-add > span {
  font-size: 1.15rem;
  line-height: 1;
}

.generator-defect-count {
  color: var(--red);
  font-weight: 700;
  white-space: nowrap;
}

.generator-defect-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgb(23 36 50 / 28%);
}

.generator-defect-dialog::backdrop {
  background: rgb(14 28 44 / 58%);
}

.generator-defect-dialog-card {
  padding: 24px;
  background: #fff;
}

.generator-defect-dialog-head,
.generator-defect-edit-heading,
.generator-defect-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.generator-defect-dialog-head h2,
.generator-defect-edit-heading h2,
.generator-defect-card-head h3 {
  margin: 3px 0 0;
}

.generator-defect-photo-upload {
  margin: 4px 0;
}

.generator-inline-defect {
  display: block;
  width: fit-content;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--red);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.generator-inline-defect:hover {
  text-decoration: underline;
}

.generator-defect-section {
  margin-top: 26px;
}

.generator-defect-list {
  display: grid;
  gap: 12px;
}

.generator-defect-card {
  padding: 16px;
  border: 1px solid #efc7c7;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: #fff;
}

.generator-defect-card > p {
  margin: 14px 0;
  white-space: pre-wrap;
}

.generator-defect-thumbs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.generator-defect-thumbs .image-lightbox-trigger {
  width: 72px;
  height: 72px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #eef3f8;
}

.generator-defect-thumbs img,
.generator-defect-image-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.generator-defect-more {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f5e8e8;
  color: var(--red);
  font-weight: 800;
}

.generator-defect-edit-heading {
  margin-bottom: 20px;
}

.generator-defect-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.generator-defect-image-card {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.generator-defect-image-card .image-lightbox-trigger {
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #eef3f8;
}

.generator-defect-image-card form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.generator-defect-photo-form {
  max-width: 760px;
}

.generator-grid {
  display: grid;
  gap: 14px;
}

.generator-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.generator-card-image {
  display: grid;
  place-items: center;
  min-height: 170px;
  background: #eef3f8;
  color: var(--muted);
}

.generator-card-image img {
  width: 100%;
  height: 100%;
  max-height: 210px;
  object-fit: contain;
}

.generator-card-body {
  padding: 18px;
}

.generator-card-title,
.generator-card-actions,
.inventory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.generator-card-title h3,
.generator-card-body p {
  margin: 0 0 8px;
}

.generator-card-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 16px;
}

.generator-toolbar .button-primary,
.generator-card-actions .button-primary {
  width: auto;
  min-height: 40px;
}

.compact-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.compact-meta div {
  min-width: 0;
}

.compact-meta dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.compact-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.section-band {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.generator-inventory {
  display: grid;
  border-top: 1px solid var(--border);
}

.inventory-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.inventory-row div {
  display: grid;
  gap: 3px;
}

.inventory-row span {
  color: var(--muted);
  font-size: 0.88rem;
}

.generator-master-form,
.generator-step-panel {
  min-width: 0;
}

.generator-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.generator-photo-grid .photo-upload {
  grid-template-columns: minmax(130px, 190px) minmax(0, 1fr);
}

.generator-photo-grid .photo-upload-preview {
  aspect-ratio: 4 / 3;
  height: auto;
}

.generator-photo-grid .photo-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.danger-zone {
  margin-top: 30px;
  padding: 20px;
  border: 1px solid #d83b3b;
  border-radius: 8px;
  background: #fff7f7;
}

.danger-zone h2 {
  margin-top: 0;
  color: #a61b1b;
}

.danger-zone form {
  display: grid;
  grid-template-columns: minmax(240px, 420px) auto;
  align-items: end;
  gap: 12px;
}

.generator-progress {
  display: grid;
  min-width: 220px;
  gap: 6px;
  text-align: right;
}

.generator-progress > span {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #dfe7ef;
}

.generator-progress i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.generator-workflow {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.generator-step-nav {
  position: sticky;
  top: 86px;
  display: grid;
  max-height: calc(100vh - 110px);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}

.generator-step-nav a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
}

.generator-step-nav a:last-child {
  border-bottom: 0;
}

.generator-step-nav a > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid #b7c4d1;
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.generator-step-nav a:hover {
  background: #f3f7fb;
}

.generator-step-nav a.active {
  background: #e9f2ff;
  color: #074fae;
  font-weight: 700;
}

.generator-step-nav a.active > span {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.generator-step-nav a.done:not(.active) > span {
  border-color: #218739;
  background: #e2f5e7;
  color: #17672c;
}

.generator-step-panel {
  padding-bottom: 16px;
}

.generator-step-fields {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.generator-step-heading {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.generator-step-heading h2 {
  margin: 4px 0 6px;
}

.generator-step-heading p {
  max-width: 850px;
  margin: 0;
  color: var(--muted);
}

.generator-guidance {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-left: 4px solid #5b89b8;
  background: #f0f5fa;
}

.generator-guidance h3,
.generator-guidance p {
  margin: 0 0 10px;
}

.generator-guidance dl {
  display: grid;
  gap: 5px;
  margin: 0 0 10px;
}

.generator-guidance dl div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
}

.generator-guidance dt {
  font-weight: 700;
  color: #244f7b;
}

.generator-guidance dd {
  margin: 0;
}

.generator-checklist {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.generator-check-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.generator-check-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.generator-check-label {
  margin: 0;
  font-weight: 700;
}

.generator-check-note {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.generator-check-note[hidden] {
  display: none;
}

.generator-check-note label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.generator-check-note textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
}

.generator-check-note-help {
  color: var(--muted);
  font-size: 0.8rem;
}

.generator-check-note-toggle {
  justify-self: start;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.generator-check-note-toggle:hover {
  text-decoration: underline;
}

.generator-check-note-toggle:focus-visible {
  outline: 3px solid rgba(15, 98, 254, 0.25);
  outline-offset: 3px;
}

.measurement-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.measurement-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.65fr) minmax(150px, 0.75fr) minmax(196px, 0.85fr);
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.measurement-row > span {
  align-self: center;
  font-weight: 700;
}

.measurement-limit {
  display: grid;
  gap: 3px;
  align-self: stretch;
  align-content: center;
  min-height: 48px;
  padding: 8px 10px;
  border-left: 3px solid #7aa7d6;
  background: #eef5fc;
  color: #173f69;
}

.measurement-limit small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.measurement-limit strong {
  line-height: 1.25;
}

select.is-auto-ok {
  border-color: #72b881;
  background: #eef8f0;
  color: #17672c;
}

select.is-auto-not-ok {
  border-color: #dc8a8a;
  background: #fff0f0;
  color: #a51f1f;
}

.generator-result-field {
  display: grid;
  gap: 7px;
  align-self: end;
}

.generator-result-field > span {
  font-size: 0.9rem;
  font-weight: 600;
}

.result-control,
.result-choice-group {
  min-width: 0;
}

.result-choice-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-choice,
.result-auto-reset {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  border: 1px solid #aebdca;
  border-radius: 6px;
  background: #fff;
  color: #364655;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.result-choice span {
  font-size: 1.3rem;
  line-height: 1;
}

.result-choice-na {
  min-width: 52px;
  font-size: 0.78rem;
}

.result-auto-reset {
  min-width: 38px;
  width: 38px;
  color: var(--blue);
  font-size: 1.15rem;
}

.result-choice:hover,
.result-auto-reset:hover {
  border-color: var(--blue);
}

.result-choice:focus-visible,
.result-auto-reset:focus-visible {
  outline: 3px solid rgba(15, 98, 254, 0.25);
  outline-offset: 2px;
}

.result-choice-ok.is-selected {
  border-color: #23843a;
  background: #23843a;
  color: #fff;
}

.result-choice-not-ok.is-selected {
  border-color: #c62828;
  background: #c62828;
  color: #fff;
}

.result-choice-na.is-selected {
  border-color: #5d6b78;
  background: #5d6b78;
  color: #fff;
}

.result-control.is-invalid .result-choice-group {
  padding: 3px;
  border: 2px solid #c62828;
  border-radius: 8px;
}

.result-validation {
  display: block;
  margin-top: 5px;
  color: #a51f1f;
  font-size: 0.8rem;
  font-weight: 700;
}

.result-validation[hidden] {
  display: none;
}

.socket-measurement-field {
  margin: 0;
}

.input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.input-with-unit input {
  border-radius: 6px 0 0 6px;
}

.input-with-unit span {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 48px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #eef3f8;
  color: var(--muted);
}

.generator-repeat-row {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.generator-socket-row {
  grid-template-columns: 1fr 1.05fr 0.8fr minmax(130px, 0.8fr) minmax(190px, 1fr) 1.25fr 42px;
  align-items: end;
}

.generator-rcd-row {
  display: block;
  padding: 16px;
}

.generator-rcd-row legend {
  padding: 0 6px;
  font-weight: 700;
}

.rcd-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.rcd-meta-grid label {
  margin: 0;
}

.rcd-note {
  grid-column: span 2;
}

.rcd-measurements {
  margin: 4px 0 14px;
}

.generator-class-summary {
  display: grid;
  grid-template-columns: max-content minmax(140px, 1fr) max-content minmax(100px, 0.6fr);
  gap: 8px 18px;
  margin-bottom: 20px;
  padding: 14px;
  border-left: 4px solid var(--blue);
  background: #eef5fc;
}

.generator-class-summary span {
  color: var(--muted);
}

.completion-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--border);
  background: #f5f8fb;
}

.button-full {
  width: 100%;
}

.generator-draft-state {
  margin-right: auto;
  color: #17672c;
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .generator-workflow {
    grid-template-columns: 1fr;
  }

  .generator-step-nav {
    position: static;
    max-height: none;
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .generator-step-nav a:nth-last-child(2) {
    border-bottom: 0;
  }

  .generator-photo-grid {
    grid-template-columns: 1fr;
  }

  .generator-socket-row,
  .rcd-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .machine-step-nav {
    max-height: 276px;
    overflow-y: auto;
  }

  .generator-toolbar,
  .generator-workflow-head,
  .repeater-head,
  .inventory-row {
    align-items: stretch;
    flex-direction: column;
  }

  .generator-defect-actions,
  .generator-defect-edit-heading,
  .generator-defect-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .generator-defect-add,
  .generator-defect-card-head .button {
    width: 100%;
  }

  .generator-defect-image-grid {
    grid-template-columns: 1fr;
  }

  .generator-defect-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .generator-defect-dialog-card {
    padding: 18px;
  }

  .generator-defect-dialog-head {
    align-items: center;
  }

  .generator-defect-image-card {
    grid-template-columns: 1fr;
  }

  .generator-toolbar .action-row,
  .generator-card-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .generator-toolbar .button-primary,
  .generator-card-actions .button-primary {
    width: 100%;
  }

  .generator-card {
    grid-template-columns: 1fr;
  }

  .generator-card-image {
    min-height: 190px;
  }

  .generator-progress {
    min-width: 0;
    text-align: left;
  }

  .generator-step-nav {
    grid-template-columns: 1fr;
  }

  .generator-step-nav a:nth-last-child(2) {
    border-bottom: 1px solid var(--border);
  }

  .generator-check-main {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .measurement-row,
  .generator-socket-row,
  .rcd-meta-grid,
  .generator-class-summary,
  .danger-zone form {
    grid-template-columns: 1fr;
  }

  .rcd-note {
    grid-column: auto;
  }

  .generator-class-summary {
    gap: 4px;
  }

  .generator-class-summary strong {
    margin-bottom: 8px;
  }

  .generator-photo-grid .photo-upload {
    grid-template-columns: 1fr;
  }

  .generator-photo-grid .photo-upload-preview {
    max-height: 260px;
  }
}

/* Einheitliches Bedien- und Gestaltungssystem */
button,
input,
select,
textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 28%, transparent);
  outline-offset: 2px;
}

.topbar {
  z-index: 40;
  min-height: var(--topbar-height);
  border-bottom-color: var(--line-strong);
  box-shadow: var(--shadow-low);
}

.brand-mark {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.shell {
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  align-self: start;
  height: calc(100vh - var(--topbar-height));
  padding: 18px 12px;
  overflow-y: auto;
  background: #e5ebf1;
  border-right-color: var(--line-strong);
}

.sidebar ul {
  gap: 4px;
}

.sidebar a {
  position: relative;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #334252;
  font-weight: 650;
}

.sidebar a.active {
  border-color: color-mix(in srgb, var(--blue) 24%, var(--line));
  background: var(--panel);
  color: var(--blue-dark);
  box-shadow: var(--shadow-low);
}

.sidebar a.active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -1px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--blue);
  content: "";
}

.content {
  width: min(1260px, 100%);
  padding: 30px 32px 40px;
}

.page-heading {
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
}

.page-heading > div:first-child {
  min-width: 0;
}

.page-heading h1,
.login-brand h1,
.legal-page h1 {
  color: #122033;
  font-size: clamp(1.7rem, 2.3vw, 2rem);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.eyebrow {
  color: #5e6d7c;
  font-size: 0.75rem;
  letter-spacing: 0;
}

.back-link {
  margin-bottom: 10px;
  text-decoration: none;
}

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

.page-context-bar {
  display: none;
  position: sticky;
  top: var(--topbar-height);
  z-index: 30;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  margin: -12px -2px 20px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-low);
  backdrop-filter: blur(8px);
}

.page-context-bar.is-active {
  display: flex;
}

.page-context-back {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 9px;
  border-radius: 5px;
  color: var(--blue-dark);
  font-weight: 750;
  text-decoration: none;
}

.page-context-back:hover {
  background: color-mix(in srgb, var(--blue) 9%, white);
}

.page-context-back > span:first-child {
  font-size: 1.2rem;
  line-height: 1;
}

.page-context-divider {
  align-self: stretch;
  width: 1px;
  background: var(--line);
}

.page-context-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.page-context-copy > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-context-copy > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input,
select,
textarea,
.question-admin-actions textarea {
  border-color: var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

textarea {
  width: 100%;
  padding: 10px 12px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #8799aa;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
  outline: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 6px;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button-primary {
  width: auto;
  min-height: 44px;
  box-shadow: 0 2px 5px color-mix(in srgb, var(--blue) 24%, transparent);
}

.button-secondary {
  border-color: var(--line-strong);
  background: #f3f6f8;
  color: #28394a;
}

.button-secondary:hover {
  border-color: #8799aa;
  background: #e8edf2;
}

.button-success {
  border-color: #89c69a;
  background: #e8f6ec;
}

.card,
.empty-state,
.metric,
.employee-panel,
.employee-action-card,
.form-card,
.login-panel,
.legal-page {
  border-color: var(--line-strong);
  border-radius: 6px;
  box-shadow: none;
}

.card,
.employee-panel,
.employee-action-card,
.form-card {
  border-left-width: 3px;
}

.card-link:hover,
.employee-action-link:hover,
.metric-link:hover {
  border-color: color-mix(in srgb, var(--blue) 52%, var(--line));
  box-shadow: var(--shadow-low);
}

.employee-action-card {
  border-style: solid;
}

.employee-action-link {
  position: relative;
  padding-right: 42px;
}

.employee-action-link::after {
  position: absolute;
  top: 50%;
  right: 16px;
  color: var(--blue);
  font-size: 1.35rem;
  font-weight: 700;
  transform: translateY(-50%);
  content: "›";
}

.badge {
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 5px;
}

.badge-neutral { border-color: #cbd4dd; }
.badge-blue { border-color: #b9cff5; }
.badge-green { border-color: #b5dcbf; }
.badge-yellow { border-color: #ead391; }
.badge-red { border-color: #efb7b4; }

.toolbar {
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-subtle);
}

.section-block {
  margin-top: 34px;
}

.section-title {
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.section-title h2 {
  color: #1b2b3c;
  font-size: 1.3rem;
}

.form-section {
  margin: 0 0 18px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
}

.form-section > h2,
.section-heading h2 {
  margin: 0 0 8px;
  color: #1b2b3c;
  font-size: 1.2rem;
}

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

.form-card label,
.form label {
  color: #26384a;
}

.choice-group,
.photo-upload,
.photo-placeholder,
.notice {
  border-color: var(--line-strong);
  border-radius: 6px;
  background: var(--panel-subtle);
}

.meta-list {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--line);
}

.meta-list > div {
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel-subtle);
}

.sync-panel,
.draft-restore {
  border-color: var(--line-strong);
  border-radius: 6px;
  box-shadow: none;
}

.generator-card,
.generator-check-row,
.measurement-row,
.generator-repeat-row,
.generator-defect-card,
.generator-defect-image-card,
.danger-zone {
  border-radius: 6px;
}

.generator-card {
  border-color: var(--line-strong);
  box-shadow: none;
}

.generator-card-image {
  border-right: 1px solid var(--line);
  background: #e8edf2;
}

.generator-workflow-head {
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: var(--panel);
}

.generator-step-nav {
  top: calc(var(--topbar-height) + 68px);
  border-color: var(--line-strong);
  border-radius: 6px;
  box-shadow: var(--shadow-low);
}

.generator-step-nav a.active {
  box-shadow: inset 4px 0 0 var(--blue);
}

.generator-check-row,
.measurement-row,
.generator-repeat-row {
  border-color: var(--line-strong);
}

.generator-check-row:has(.result-choice-not-ok.is-selected),
.measurement-row:has(.result-choice-not-ok.is-selected) {
  border-color: #d7837f;
  background: #fff8f7;
}

.generator-check-row:has(.result-choice-ok.is-selected),
.measurement-row:has(.result-choice-ok.is-selected) {
  border-left: 4px solid var(--green);
}

.sticky-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  align-items: center;
  margin: 18px -2px 0;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -4px 14px rgba(22, 34, 51, 0.09);
  backdrop-filter: blur(8px);
}

.alert,
.alert-list p {
  border: 1px solid #e5aaa7;
}

.notice-list-warning p {
  border: 1px solid #e6ce83;
}

.portal-footer {
  margin-top: 42px;
}

@media (max-width: 820px) {
  .order-information-panel .compact-list {
    grid-template-columns: 1fr;
  }

  html,
  body {
    overflow-x: clip;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
  }

  .content {
    padding: 18px 14px 32px;
  }

  .page-heading {
    align-items: stretch;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }

  .page-heading h1,
  .login-brand h1,
  .legal-page h1 {
    font-size: 1.65rem;
  }

  .page-heading .action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-context-bar {
    gap: 8px;
    min-height: 52px;
    margin: -8px -14px 18px;
    padding: 6px 10px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .page-context-back {
    min-width: 44px;
    min-height: 44px;
    padding: 6px 8px;
  }

  .page-context-back > span:last-child {
    display: none;
  }

  .page-context-copy > strong {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
  }

  .toolbar {
    padding: 12px;
  }

  .card,
  .empty-state,
  .metric,
  .employee-panel,
  .employee-action-card,
  .form-card,
  .form-section {
    padding: 15px;
  }

  .form-section {
    margin-right: -2px;
    margin-left: -2px;
  }

  .form-actions .button,
  .action-row .button,
  .card-actions .button {
    width: 100%;
    min-height: 48px;
  }

  .sticky-form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-right: -14px;
    margin-left: -14px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .sticky-form-actions > span:empty {
    display: none;
  }

  .generator-workflow-head {
    padding: 14px;
  }

  .generator-step-nav {
    display: flex;
    position: sticky;
    top: calc(var(--topbar-height) + 64px);
    z-index: 18;
    max-height: none;
    margin: 0 -14px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: var(--shadow-low);
    scrollbar-width: thin;
  }

  .generator-step-nav a {
    flex: 0 0 auto;
    grid-template-columns: 25px auto;
    min-width: 150px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .generator-step-nav a.active {
    box-shadow: inset 0 -4px 0 var(--blue);
  }

  .generator-card-image {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .meta-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding: 8px 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .page-heading h1 {
    font-size: 1.5rem;
  }

  .meta-list {
    grid-template-columns: 1fr;
  }

  .generator-workflow-head h2,
  .generator-card-title h3 {
    font-size: 1.05rem;
  }
}

@media (max-width: 360px) {
  .brand span:last-child {
    display: none;
  }
}
