:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-soft: #f1f5f7;
  --text: #17212b;
  --muted: #60707f;
  --line: #dbe4ea;
  --line-strong: #c7d2da;
  --teal: #087f75;
  --teal-dark: #065f58;
  --teal-soft: #dff4f1;
  --amber: #b27609;
  --amber-soft: #fff2d1;
  --red: #b42318;
  --red-soft: #fee4df;
  --green: #157347;
  --green-soft: #e1f4e8;
  --blue: #2563eb;
  --blue-soft: #e9f0ff;
  --violet: #6d3fc0;
  --violet-soft: #f0e9ff;
  --slate: #526170;
  --slate-soft: #edf1f4;
  --shadow: 0 18px 40px rgba(23, 33, 43, 0.08);
  --radius: 8px;
  --font: "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: clamp(24px, 5vw, 40px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-brand { color: var(--teal-dark); font-weight: 700; }
.auth-card h1 { font-size: 26px; margin: 0 0 16px; }
.auth-card form { display: grid; gap: 18px; margin-top: 24px; }
.auth-card input { min-width: 0; width: 100%; font-size: 16px; }
.auth-card .button { min-height: 44px; }
.auth-card .form-error:empty { display: none; }
#authStatus, #passwordRequirements, #connectionStatus { color: var(--muted); line-height: 1.5; }
#connectionStatus { margin: 0 0 12px; overflow-wrap: anywhere; }

.startup-recovery {
  display: grid;
  gap: 20px;
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px;
}

.startup-recovery[hidden] {
  display: none;
}

.startup-recovery .form-error {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.startup-recovery > button {
  justify-self: start;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #b8ddd8;
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p,
.table-toolbar p,
.meta,
.empty,
.hint {
  color: var(--muted);
}

.data-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #405160;
  font-size: 0.76rem;
  line-height: 1.2;
}

.data-mode strong {
  font-weight: 800;
}

.data-mode span {
  color: var(--muted);
}

.data-mode-live {
  border-color: #b8ddd8;
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.data-mode-demo {
  border-color: #efdba1;
  background: var(--amber-soft);
  color: var(--amber);
}

.data-mode-live-empty {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--slate);
}

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

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.button {
  gap: 8px;
  padding: 8px 12px;
  font-weight: 650;
}

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.button:hover,
.icon-button:hover {
  border-color: var(--teal);
}

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

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.primary:disabled {
  border-color: var(--line-strong);
  background: #d7e0e5;
  color: #50616f;
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button.ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
}

.button.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

main {
  padding: 16px 22px 26px;
}

.landing-page {
  min-height: 100vh;
  padding: 28px;
}

.landing-inner {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 56px);
  max-width: 980px;
  margin: 0 auto;
  gap: 28px;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.landing-brand h1 {
  font-size: 28px;
}

.landing-brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 1rem;
}

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

.module-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 138px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.module-card-primary {
  border-left-color: var(--teal);
}

.module-card:hover {
  border-color: var(--teal);
}

.module-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--blue);
}

.module-card-primary .module-icon {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.module-card strong {
  display: block;
  font-size: 1.08rem;
  margin-bottom: 6px;
}

.module-card small {
  display: block;
  color: var(--muted);
  line-height: 1.4;
}

.brand-mark-delivery {
  border-color: #bfcef6;
  background: var(--blue-soft);
  color: var(--blue);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.kpi {
  --kpi-accent: var(--teal);
  --kpi-soft: var(--teal-soft);
  position: relative;
  overflow: hidden;
  min-height: 78px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--kpi-accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(23, 33, 43, 0.04);
}

.kpi::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 12px;
  width: 28px;
  height: 7px;
  border-radius: 4px;
  background: var(--kpi-accent);
  opacity: 0.78;
}

.kpi-inventory {
  --kpi-accent: var(--blue);
  --kpi-soft: var(--blue-soft);
}

.kpi-checks {
  --kpi-accent: var(--amber);
  --kpi-soft: var(--amber-soft);
}

.kpi-problem {
  --kpi-accent: var(--red);
  --kpi-soft: var(--red-soft);
}

.kpi-returned {
  --kpi-accent: var(--slate);
  --kpi-soft: var(--slate-soft);
}

.kpi-changed {
  --kpi-accent: var(--violet);
  --kpi-soft: var(--violet-soft);
}

.kpi .label {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi .value {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  color: var(--kpi-accent);
  font-size: 26px;
  font-weight: 760;
  letter-spacing: 0;
}

.kpi .note {
  position: relative;
  z-index: 1;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.focus-chip {
  --chip-accent: var(--teal);
  --chip-soft: var(--teal-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: #334453;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 720;
}

.focus-chip.tone-inventory {
  --chip-accent: var(--blue);
  --chip-soft: var(--blue-soft);
}

.focus-chip.tone-problem {
  --chip-accent: var(--red);
  --chip-soft: var(--red-soft);
}

.focus-chip.tone-warning {
  --chip-accent: var(--amber);
  --chip-soft: var(--amber-soft);
}

.focus-chip.tone-changed {
  --chip-accent: var(--violet);
  --chip-soft: var(--violet-soft);
}

.focus-chip.tone-returned {
  --chip-accent: var(--slate);
  --chip-soft: var(--slate-soft);
}

.chip-dot {
  width: 6px;
  height: 18px;
  border-radius: 4px;
  background: var(--chip-accent);
}

.focus-chip .count {
  display: inline-grid;
  min-width: 24px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--chip-soft);
  color: var(--chip-accent);
  font-size: 12px;
}

.focus-chip.active {
  border-color: var(--chip-accent);
  background: var(--chip-soft);
  color: #17212b;
}

.focus-chip.active .count {
  background: var(--chip-accent);
  color: white;
}

.import-preview-host {
  margin-bottom: 12px;
}

.import-preview {
  padding: 14px;
  border-top: 1px solid #d6e3ef;
  border-bottom: 1px solid #d6e3ef;
  border-left: 5px solid var(--amber);
  border-radius: 0;
  background: #fbfdff;
}

.import-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.import-preview-head > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.import-preview-head p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 13px;
}

.section-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.import-preview h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.import-preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.import-preview-stats span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.import-preview-stats strong {
  color: var(--ink);
}

.import-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 8px;
  margin-top: 12px;
}

.import-preview-list details {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.import-preview-list summary {
  cursor: pointer;
  font-size: 13px;
}

.import-preview-list summary strong {
  display: inline;
  margin-left: 6px;
}

.import-preview-list details p {
  max-height: 180px;
  overflow: auto;
}

.import-preview-list article {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.import-preview-list strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.import-preview-list article > span {
  display: inline-block;
  margin-top: 4px;
  color: var(--amber-dark);
  font-size: 18px;
  font-weight: 760;
}

.import-preview-list p {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.workspace {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr) 380px;
  gap: 14px;
  align-items: start;
}

.workspace-filter-toggle {
  margin-bottom: 12px;
  max-width: 100%;
  white-space: normal;
}

#llModule .table-panel {
  position: sticky;
  top: var(--workspace-sticky-top, 82px);
}

#llModule .table-wrap {
  max-height: max(220px, calc(100dvh - var(--workspace-sticky-top, 82px) - var(--workspace-toolbar-height, 90px) - 20px));
}

.delivery-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.delivery-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(620px, 2fr);
  gap: 14px;
  align-items: start;
}

.delivery-import-panel,
.delivery-list-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.delivery-import-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.delivery-list-panel {
  overflow: hidden;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 156px;
  padding: 18px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone svg {
  width: 34px;
  height: 34px;
  color: var(--blue);
}

.dropzone strong {
  color: var(--text);
  font-size: 1rem;
}

.dropzone span {
  max-width: 280px;
  line-height: 1.35;
}

.dropzone.drag-over {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.dropzone[aria-busy="true"] {
  cursor: progress;
  opacity: 0.72;
}

.dropzone[aria-busy="true"] input {
  cursor: progress;
}

.delivery-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
}

.inline-field {
  min-width: 240px;
}

.inline-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) 80px minmax(150px, 1fr) minmax(160px, 1fr) auto;
  gap: 8px;
  padding: 0 14px 14px;
}

.inline-create-form .form-field {
  min-width: 0;
  margin: 0;
}

.inline-create-form > button {
  align-self: start;
  margin-top: 25px;
}

.inline-create-form .field-error:empty {
  display: none;
}

.inline-create-form .field-error {
  overflow-wrap: anywhere;
}

.inline-create-form input {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 10px;
}

.filter-rail,
.table-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-rail,
.detail-panel {
  position: sticky;
  top: var(--workspace-sticky-top, 82px);
  max-height: calc(100dvh - var(--workspace-sticky-top, 82px) - 18px);
  overflow: auto;
  padding: 16px;
}

.detail-panel.editor-open {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 117, 0.16), var(--shadow);
}

.mobile-back-button {
  display: none;
}

.panel-heading,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.density-control {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.density-control button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 9px;
}

.density-control button:last-child {
  border-right: 0;
}

.density-control button[aria-pressed="true"] {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.density-control button:focus-visible {
  position: relative;
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

.panel-heading {
  margin-bottom: 16px;
}

.filter-state {
  display: grid;
  gap: 3px;
  min-height: 38px;
  margin: -4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.filter-state strong {
  color: var(--text);
  font-size: 12px;
}

.filter-state-reset {
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  padding: 2px 0;
  cursor: pointer;
}

.filter-state-reset:hover,
.filter-state-reset:focus-visible {
  color: var(--blue-dark);
  text-decoration: underline;
}

.filter-state-empty {
  align-self: center;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
}

.field,
.sort-group label {
  display: grid;
  gap: 6px;
}

.field {
  margin-bottom: 14px;
}

.field span,
.sort-group span,
.form-field span {
  color: #334453;
  font-size: 12px;
  font-weight: 700;
}

.required-marker {
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.conditional-required-marker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-left: 5px;
  padding: 1px 6px;
  border: 1px solid #f3c38c;
  border-radius: 999px;
  background: var(--yellow-soft);
  color: #835100;
  font-size: 10px;
  font-weight: 760;
  line-height: 1.4;
}

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

textarea {
  min-height: 78px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(8, 127, 117, 0.2);
  outline-offset: 1px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
  color: #334453;
  font-weight: 650;
}

.check-field input {
  width: 16px;
  min-height: 16px;
}

.mini-chart {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mini-chart-title {
  margin-bottom: 10px;
  font-weight: 760;
}

.bar-row {
  --status-accent: var(--teal);
  --status-soft: var(--teal-soft);
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.status-active_assigned {
  --status-accent: var(--blue);
  --status-soft: var(--blue-soft);
}

.status-loan_prepared {
  --status-accent: #996019;
  --status-soft: #fff5e5;
}

.status-returned,
.status-available {
  --status-accent: var(--green);
  --status-soft: var(--green-soft);
}

.status-open,
.status-needs_clarification_defective,
.status-missing_serial,
.status-missing_assignment {
  --status-accent: var(--amber);
  --status-soft: var(--amber-soft);
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.bar-label span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 14px;
  border-radius: 4px;
  background: var(--status-accent);
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--status-soft);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--status-accent);
}

.table-panel {
  min-width: 0;
}

.table-toolbar {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.sort-group {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  align-items: end;
  gap: 8px;
}

.sort-group select {
  min-width: 170px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 236px);
}

table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

table.density-compact th,
table.density-compact td {
  padding: 7px 9px;
}

table.density-compact .cell-sub {
  margin-top: 2px;
  font-size: 11px;
}

table.density-compact .device-id {
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-soft);
  color: #334453;
  font-size: 12px;
  font-weight: 760;
}

th.sorted {
  color: var(--teal);
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sort-header span {
  min-width: 12px;
  color: var(--teal);
  font-size: 13px;
  line-height: 1;
}

.sort-header:hover {
  color: var(--teal);
}

.sort-header:focus-visible {
  outline: 3px solid rgba(8, 127, 117, 0.24);
  outline-offset: 3px;
  border-radius: 5px;
}

tbody tr {
  --row-accent: transparent;
  --row-soft: transparent;
  cursor: pointer;
}

tbody tr > td:first-child {
  border-left: 4px solid var(--row-accent);
}

.select-col {
  width: 44px;
  text-align: center;
}

.select-col input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.select-col input:focus-visible {
  outline: 3px solid rgba(8, 127, 117, 0.25);
  outline-offset: 2px;
}

tbody tr.row-status-active_assigned {
  --row-accent: var(--blue);
  --row-soft: rgba(37, 99, 235, 0.08);
}

tbody tr.row-status-returned,
tbody tr.row-status-available {
  --row-accent: var(--green);
  --row-soft: rgba(21, 115, 71, 0.07);
}

tbody tr.row-status-open,
tbody tr.row-status-needs_clarification_defective,
tbody tr.row-status-missing_serial,
tbody tr.row-status-missing_assignment {
  --row-accent: var(--amber);
  --row-soft: rgba(178, 118, 9, 0.1);
}

tbody tr.row-condition-defective {
  --row-accent: #991b1b;
  --row-soft: #fef2f2;
}

tbody tr.row-condition-in_review {
  --row-accent: #854d0e;
  --row-soft: #fefce8;
}

tbody tr.row-condition-retired {
  --row-accent: #374151;
  --row-soft: #f3f4f6;
}

tbody tr:hover,
tbody tr.selected,
tbody tr:focus {
  background: var(--row-soft, #f0faf8);
}

tbody tr.selected > td:first-child {
  box-shadow: inset 4px 0 0 var(--row-accent);
}

tbody tr:focus {
  outline: 3px solid color-mix(in srgb, var(--row-accent) 22%, transparent);
  outline-offset: -3px;
}

.truncate {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-cell,
.category-cell,
.person-cell,
.serial-cell,
.status-cell,
.movement-cell,
.hints-cell,
.note-cell {
  min-width: 0;
}

.device-cell {
  width: 15%;
}

.category-cell {
  width: 14%;
}

.person-cell {
  width: 20%;
}

.status-cell {
  width: 14%;
}

.serial-cell {
  width: 14%;
}

.movement-cell {
  width: 14%;
}

.hints-cell {
  width: 18%;
}

.device-id {
  display: block;
  margin-bottom: 3px;
  font-size: 15px;
  font-weight: 800;
}

.row-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.row-flags span {
  display: inline-flex;
  min-height: 19px;
  align-items: center;
  border-radius: 999px;
  background: #eef3f6;
  color: #445565;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 760;
}

.quality-badges span.problem-badge {
  background: var(--amber-soft);
  color: #6f4a05;
}

.quality-badges span.warning-badge {
  background: #fff4db;
  color: #7a4f00;
}

.quality-badges span.changed-badge {
  background: var(--blue-soft);
  color: var(--blue);
}

.cell-main {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 720;
}

.cell-sub {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.copyable {
  user-select: all;
}

.table-copy-value {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: copy;
}

.table-copy-value:hover,
.table-copy-value:focus-visible {
  color: var(--teal-dark);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.missing-value {
  color: #8a5a00;
}

.note-cell {
  max-width: 100%;
}

.empty-row td,
.loading-row td {
  padding: 30px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state,
.loading-state {
  display: grid;
  gap: 4px;
  justify-items: center;
  line-height: 1.45;
}

.empty-state strong,
.loading-state strong {
  color: var(--text);
}

.loading-state::before {
  content: "";
  width: min(180px, 48vw);
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-soft), var(--teal), var(--teal-soft));
}

.status-pill,
.source-pill,
.small-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.status-pill.status-active_assigned {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-pill.status-loan_prepared {
  background: #fff5e5;
  color: #815213;
}

.status-pill.status-returned,
.status-pill.status-available {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.status-geliefert {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.status-registriert {
  background: var(--slate-soft);
  color: var(--slate);
}

.status-pill.status-open,
.status-pill.status-needs_clarification_defective,
.status-pill.status-missing_serial,
.status-pill.status-missing_assignment {
  background: var(--amber-soft);
  color: var(--amber);
}

.problem {
  background: var(--red-soft);
  color: var(--red);
}

.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.source-pill {
  background: #e8edf2;
  color: #445565;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.detail-header h2 {
  font-size: 20px;
}

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

.status-dimension {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: #fbfcfd;
}

.status-dimension span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-dimension strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #243440;
  font-size: 0.83rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dimension-info {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.status-dimension-success {
  border-left-color: var(--green);
  background: var(--green-soft);
}

.status-dimension-warning {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.status-dimension-critical {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.status-dimension-neutral {
  border-left-color: var(--slate);
  background: var(--slate-soft);
}

.condition-badge {
  display: inline-block;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.condition-defective {
  color: #991b1b;
  background: #fef2f2;
}

.condition-in_review {
  color: #854d0e;
  background: #fefce8;
}

.condition-retired {
  color: #374151;
  background: #f3f4f6;
}

.detail-quickfacts {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-quickfacts div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.detail-quickfacts span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.detail-quickfacts strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.detail-actionbar {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.detail-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 9px 10px 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

.detail-tab:hover,
.detail-tab:focus-visible {
  color: var(--text);
  background: var(--surface-soft);
}

.detail-tab.active {
  border-bottom-color: var(--teal);
  color: var(--teal-dark);
}

.detail-tab:focus-visible,
.detail-tab-panel:focus-visible {
  outline: 3px solid #1d4ed8;
  outline-offset: -3px;
}

.detail-tab-panel {
  display: none;
}

.detail-tab-panel.active {
  display: grid;
  gap: 10px;
}

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

.event-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.event-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 5px 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

.event-filter span {
  display: inline-flex;
  min-width: 20px;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 1px 5px;
  color: var(--text);
}

.event-filter.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.event-export-button {
  margin-left: auto;
}

.event-kind {
  margin: 0 0 5px;
  background: var(--slate-soft);
  color: #445565;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 2px;
}

.duplicate-alert {
  padding: 11px 12px;
  border: 1px solid #f1cf86;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: #6f4a05;
}

.duplicate-alert strong {
  display: block;
  margin-bottom: 4px;
}

.duplicate-alert p {
  line-height: 1.4;
}

.availability-alert {
  padding: 11px 12px;
  border: 1px solid #b9cdfd;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: #173d9a;
}

.availability-alert strong {
  display: block;
  margin-bottom: 4px;
}

.availability-alert p {
  line-height: 1.4;
}

.summary-tile {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.summary-tile strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
}

.detail-block {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-block h3 {
  margin-bottom: 9px;
  font-size: 13px;
  text-transform: uppercase;
  color: #334453;
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.data-item {
  position: relative;
  min-width: 0;
}

.data-item.with-copy {
  padding-right: 34px;
}

.data-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.data-item strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.copy-button {
  position: absolute;
  right: 0;
  top: 4px;
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.copy-button:hover,
.copy-button:focus-visible {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.copy-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

.edit-form {
  display: grid;
  gap: 10px;
}

.edit-form[hidden] {
  display: none;
}

.edit-form .detail-block {
  display: grid;
  gap: 10px;
}

.edit-form-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  background: var(--surface, #fff);
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-grid {
  display: grid;
  gap: 8px;
}

.form-grid.two {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
}

.input-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
  align-items: center;
}

.input-copy-button {
  width: 38px;
  height: 38px;
  align-self: stretch;
}

.input-copy-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-actions.full {
  grid-template-columns: 1fr;
  margin-top: -2px;
}

.form-state {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.form-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.field-error {
  min-height: 15px;
  color: var(--red);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.35;
}

.error-state {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #f0b7ad;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: #73352c;
}

.error-state h3 {
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.error-state-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #e26d5f;
  background: var(--red-soft);
}

.button.danger {
  border-color: #f4b8b1;
  background: var(--red-soft);
  color: var(--red);
}

.button.full-width {
  width: 100%;
}

.danger-block {
  border-top-color: #f4b8b1;
}

.danger-block .hint {
  margin-bottom: 9px;
}

.record-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.record {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.record p {
  margin-top: 4px;
  color: #334453;
  line-height: 1.4;
}

.checks-list {
  max-height: 280px;
}

.check-record {
  display: grid;
  gap: 8px;
  background: #fffdf6;
  border-color: #efdba1;
}

.check-record-reviewed {
  background: #f3f8fc;
  border-color: #b9d3e7;
}

.check-record-resolved {
  background: #f4faf6;
  border-color: #bddcc8;
}

.check-record-reviewed .record-status {
  color: #24577a;
  border-color: #b9d3e7;
}

.check-record-resolved .record-status {
  color: #24623c;
  border-color: #bddcc8;
}

.check-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.check-form .form-field,
.check-form .form-error {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
}

.check-form textarea {
  min-height: 64px;
}

.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.record-status {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid #cfd8df;
  border-radius: 999px;
  background: #ffffff;
  color: #465766;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.check-details {
  display: grid;
  gap: 7px;
  margin: 0;
}

.check-details div {
  display: grid;
  gap: 2px;
}

.check-details dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.check-details dd {
  margin: 0;
  color: #263643;
  line-height: 1.38;
}

.record-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.event-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.event {
  padding: 8px;
  border-left: 3px solid var(--teal);
  background: #f6fbfa;
}

.saved-signature {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.saved-signature img {
  display: block;
  width: min(100%, 260px);
  height: 76px;
  object-fit: contain;
  object-position: left center;
  border-bottom: 1px solid var(--line-strong);
  background: white;
}

.saved-signature figcaption {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 24px 8px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid #b8ddd8;
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-action {
  flex: 0 0 auto;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--teal);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 9px;
}

.toast-action:hover,
.toast-action:focus-visible {
  background: var(--teal-dark);
  outline: 2px solid rgba(21, 128, 121, 0.25);
  outline-offset: 2px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 43, 0.42);
}

dialog.modal-backdrop {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  color: inherit;
}

dialog.modal-backdrop::backdrop {
  background: transparent;
}

body.has-open-dialog {
  overflow: hidden;
}

dialog.modal-backdrop:not([open]) {
  display: none;
}

[data-dialog-status]:empty {
  display: none;
}

.modal-backdrop[hidden] {
  display: none;
}

.signature-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(23, 33, 43, 0.24);
}

.receipt-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(960px, 100%);
  height: min(880px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(23, 33, 43, 0.24);
}

.receipt-frame {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  background: white;
}

.receipt-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.backup-modal {
  width: min(780px, 100%);
}

.backup-content {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.backup-card,
.backup-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.backup-card-primary {
  border-color: #b8ddd8;
  background: var(--teal-soft);
}

.backup-card h3,
.backup-secondary h3,
.backup-preview h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.backup-card p,
.backup-secondary p,
.backup-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.backup-file-button {
  flex: 0 0 auto;
}

.backup-preview {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.backup-preview-valid {
  border-style: solid;
  border-color: #9ed1b3;
  background: var(--green-soft);
}

.backup-preview-error {
  border-style: solid;
  border-color: #e3b4ad;
  background: #fff4f2;
}

.backup-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.backup-summary-grid div {
  padding: 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
}

.backup-summary-grid strong,
.backup-summary-grid span {
  display: block;
}

.backup-summary-grid strong {
  color: var(--teal-dark);
  font-size: 18px;
}

.backup-summary-grid span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.backup-warning,
.backup-error-list {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.45;
}

.backup-warning {
  background: var(--amber-soft);
  color: #74500b;
}

.backup-error-list {
  background: #ffe8e4;
  color: #8b2f22;
}

.receipt-archive {
  display: grid;
  gap: 12px;
}

.receipt-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.receipt-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.receipt-card h4 {
  margin: 6px 0 0;
}

.receipt-signer {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.receipt-card-data {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.receipt-card-data div {
  min-width: 0;
}

.receipt-card-data dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.receipt-card-data dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header p {
  margin-top: 4px;
  color: var(--muted);
}

.signature-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.return-on-behalf-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}

.return-on-behalf-option:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.return-on-behalf-option input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--teal);
}

.return-on-behalf-option span {
  display: grid;
  gap: 4px;
}

.return-on-behalf-option small {
  font-size: 13px;
  color: var(--muted);
}

.on-behalf-confirmation {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.on-behalf-confirmation strong {
  display: block;
  font-size: 26px;
  font-weight: 600;
}

.on-behalf-confirmation p {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

#signatureSigner[readonly] {
  background: var(--surface-soft);
}

.receipt-preview {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: #334453;
  line-height: 1.45;
}

.accessory-fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.accessory-fieldset legend {
  padding: 0 4px;
  color: #334453;
  font-size: 12px;
  font-weight: 760;
}

.accessory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}

.accessory-fieldset .check-field {
  margin: 0;
}

.accessory-item {
  min-width: 0;
}

.signature-pad-wrap {
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(transparent calc(100% - 36px), rgba(8, 127, 117, 0.22) calc(100% - 35px), transparent calc(100% - 34px)),
    #ffffff;
}

#signatureCanvas {
  display: block;
  width: 100%;
  height: 220px;
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
}

.signature-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 8px;
}

.create-actions {
  grid-template-columns: 1fr 1.4fr;
}

.accessory-choice {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.accessory-choice-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.event-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.event-tools .button {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}

@media (max-width: 1220px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-rail {
    grid-column: 1 / -1;
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-height: none;
  }

  .filter-rail > .panel-heading,
  .filter-rail > .filter-state,
  .filter-rail > .mini-chart {
    grid-column: 1 / -1;
  }

  .delivery-workspace {
    grid-template-columns: 1fr;
  }

  .delivery-kpis {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .detail-panel {
    min-width: 0;
  }

  .mobile-back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface-soft);
    font: inherit;
    cursor: pointer;
  }

  .mobile-back-button svg {
    width: 18px;
    height: 18px;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

@media (min-width: 781px) and (max-width: 1220px) {
  .workspace.mobile-detail-active {
    grid-template-columns: minmax(0, 1fr) 380px;
  }

  .workspace.mobile-detail-active .detail-panel {
    grid-column: 2;
  }

  .workspace:not(.mobile-detail-active) .detail-panel {
    display: none;
  }
}

@media (max-width: 680px) {
  .receipt-modal {
    height: calc(100vh - 20px);
  }

  .receipt-card-head,
  .receipt-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

@media (max-width: 780px) {
  .topbar,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
    padding: 16px 14px;
  }

  main {
    padding: 14px;
  }

  .landing-page {
    padding: 18px;
  }

  .landing-inner {
    min-height: calc(100vh - 36px);
  }

  .landing-brand {
    align-items: flex-start;
  }

  .landing-brand h1 {
    font-size: 23px;
  }

  .module-grid,
  .delivery-kpis,
  .inline-create-form,
  .delivery-actions {
    grid-template-columns: 1fr;
  }

  .inline-create-form > button {
    margin-top: 0;
  }

  .module-card {
    min-height: 122px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .workspace.mobile-detail-active .filter-rail,
  .workspace.mobile-detail-active .table-panel {
    display: none;
  }

  .workspace:not(.mobile-detail-active) .detail-panel {
    display: none;
  }

  .workspace.mobile-detail-active .detail-panel {
    display: block;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi {
    min-height: 86px;
  }

  .kpi:last-child {
    grid-column: 1 / -1;
  }

  .workflow-strip {
    margin-right: -14px;
    margin-left: -14px;
    padding: 0 14px 2px;
  }

  .filter-rail {
    display: block;
    position: static;
    max-height: none;
  }

  .detail-panel {
    position: static;
    max-height: none;
  }

  #llModule .table-panel {
    position: static;
  }

  #llModule .table-wrap {
    max-height: 70dvh;
  }

  .mobile-back-button {
    position: sticky;
    top: 8px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(241, 245, 247, 0.96);
    backdrop-filter: blur(8px);
    color: var(--teal-dark);
    font-weight: 750;
    cursor: pointer;
  }

  .mobile-back-button:focus-visible {
    outline: 3px solid rgba(8, 127, 117, 0.24);
    outline-offset: 2px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .button {
    min-width: 0;
    flex: 1 1 auto;
  }

  .actions .button.primary {
    grid-column: 1 / -1;
  }

  .topbar .actions .button {
    min-height: 44px;
    gap: 6px;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .topbar .actions .button.primary {
    grid-column: auto;
  }

  table {
    min-width: 980px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .signature-modal {
    max-height: calc(100vh - 20px);
  }

  .signature-actions {
    grid-template-columns: 1fr;
  }

  .backup-card,
  .backup-secondary,
  .backup-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .backup-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .detail-quickfacts,
  .status-matrix,
  .detail-actionbar {
    grid-template-columns: 1fr;
  }

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

  #signatureCanvas {
    height: 180px;
  }
}

body :is(button, input, select, textarea, a[href], [tabindex]):focus-visible {
  outline: 2px solid var(--teal-dark);
  outline-offset: 3px;
}

.file-button:focus-within {
  outline: 2px solid var(--teal-dark);
  outline-offset: 3px;
}

body .density-control button:focus-visible,
body .detail-tab:focus-visible {
  outline-offset: -3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
.server-snapshots { display: block; }
.server-snapshots[hidden] { display: none; }
.server-snapshots-heading,
.server-snapshot-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.server-snapshot-list { list-style: none; padding: 0; margin: 12px 0 0; }
.server-snapshot-list li { padding: 12px 0; border-top: 1px solid var(--line); }
.server-snapshot-list time { display: block; margin-top: 4px; }
#serverSnapshotStatus { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .server-snapshots-heading,
  .server-snapshot-list li { align-items: stretch; flex-direction: column; }
}
