:root {
  color-scheme: light;
  --bg: #f4f8fb;
  --surface: #ffffff;
  --text: #162033;
  --muted: #667085;
  --line: #d9e1ec;
  --primary: #0ea5a4;
  --primary-dark: #087f7d;
  --soft: #ecfeff;
  --shadow: 0 14px 28px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.logout-form button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 6px 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 8px;
}

.brand span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.1;
}

.brand strong,
.brand small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.main-nav a,
.nav-group > a {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
}

.main-nav a:hover,
.nav-group:hover > a {
  background: var(--soft);
  color: var(--primary-dark);
}

.nav-group {
  position: relative;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: none;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 6px;
}

.nav-toggle,
.nav-toggle-button {
  display: none;
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
  display: block;
}

.nav-menu a {
  display: block;
  padding: 9px 10px;
  white-space: nowrap;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

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

.page-header.compact {
  margin-bottom: 16px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.muted {
  max-width: 680px;
  color: var(--muted);
}

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

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.summary-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

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

.metric-card {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 32px;
  line-height: 1;
}

.metric-card.primary {
  border-color: #b6d9e4;
}

.metric-card.warning {
  border-color: #facc15;
  background: #fffbeb;
}

.metric-card.danger {
  border-color: #fca5a5;
  background: #fff1f2;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: 16px;
}

.dashboard-list,
.dashboard-panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.status-row {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(120px, 1fr) 54px;
  align-items: center;
  gap: 10px;
}

.status-row div:first-child {
  min-width: 0;
}

.status-row strong,
.status-row span {
  display: block;
}

.status-row span,
.status-row small {
  color: var(--muted);
}

.progress-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #e5edf5;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.wide-track {
  width: 100%;
}

.inventory-snapshot,
.attention-item {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.inventory-snapshot {
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.inventory-snapshot span,
.inventory-snapshot small,
.attention-item span,
.attention-item small {
  color: var(--muted);
}

.attention-item {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.attention-item.danger {
  border-color: #fca5a5;
  background: #fff1f2;
}

.attention-item div {
  min-width: 0;
}

.attention-item strong,
.attention-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-card {
  display: flex;
  min-height: 154px;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.module-card strong {
  font-size: 18px;
}

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

.module-code {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.muted-card {
  opacity: .72;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 14px;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.table-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.section-gap {
  margin-top: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading,
.page-header,
.table-toolbar,
.form-actions,
.pagination-bar {
  min-width: 0;
  flex-wrap: wrap;
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

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

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

textarea {
  resize: vertical;
}

input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

.table-toolbar select {
  max-width: 220px;
}

.table-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable;
}

.discovery-scroll {
  overflow-x: auto;
  overflow-y: visible;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.discovery-table {
  min-width: 1320px;
  table-layout: auto;
}

.discovery-table th,
.discovery-table td {
  white-space: nowrap;
}

.discovery-filter {
  padding: 14px;
}

.collector-download-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.collector-download-form h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.collector-download-form p {
  margin: 0;
}

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

.discovery-filter .form-grid {
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
}

.discovery-filter .form-actions {
  margin-top: 12px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.pagination-bar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.secondary-button.disabled {
  pointer-events: none;
  opacity: .45;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: #f9fbfd;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.number {
  text-align: right;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.row-actions a {
  display: inline-flex;
  color: var(--primary-dark);
}

.row-actions form {
  margin: 0;
}

.row-actions button {
  border: 0;
  background: transparent;
  color: #b91c1c;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.form-panel,
.detail-panel,
.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.form-panel {
  padding: 18px;
}

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

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label > span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.field-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-line {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 auto;
}

.checkbox-line span {
  color: var(--text);
  font-size: 14px;
}

.checkbox-line small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

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

.permission-group {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.permission-group h2 {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 16px;
}

.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.compact-button {
  min-height: 40px;
  padding: 8px 12px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.work-panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

.checklist-list,
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checklist-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.check-toggle {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #fff;
  cursor: pointer;
}

.check-toggle.done {
  border-color: var(--primary);
  background: var(--primary);
}

.done-text {
  color: var(--muted);
  text-decoration: line-through;
}

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

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-form .secondary-button {
  align-self: flex-end;
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.comment-item div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-item strong {
  font-size: 14px;
}

.comment-item small {
  color: var(--muted);
}

.comment-item p {
  margin: 0;
  white-space: pre-wrap;
}

.attachment-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.attachment-item div {
  min-width: 0;
}

.attachment-item a {
  display: block;
  overflow: hidden;
  color: var(--primary-dark);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.danger-link {
  border: 0;
  background: transparent;
  color: #b91c1c;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

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

.json-box {
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.json-preview {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 10px;
  white-space: pre-wrap;
}

.dynamic-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.qr-scan-card {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.qr-scan-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.qr-scan-card p {
  margin: 0;
}

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

.qr-video {
  width: min(100%, 420px);
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.qr-asset-info {
  display: grid;
  gap: 3px;
  min-height: 38px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 10px;
  color: var(--muted);
}

.qr-asset-info strong {
  color: var(--text);
}

.qr-asset-info span {
  display: block;
}

.qr-asset-info.is-warning {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

.inline-heading {
  padding: 12px 14px;
}

.compact-fields {
  padding: 14px;
}

.maintenance-complete-form {
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(180px, 1fr) auto;
  min-width: 620px;
}

.print-body {
  background: #fff;
  color: #111827;
}

.print-sheet {
  width: min(100% - 32px, 960px);
  margin: 24px auto;
  background: #fff;
}

.print-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #111827;
  padding-bottom: 16px;
}

.print-header h1 {
  font-size: 24px;
}

.print-section {
  margin-top: 18px;
}

.print-section h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.attachment-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.attachment-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.attachment-grid figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.signature-grid div {
  min-height: 120px;
  border-top: 1px solid #111827;
  padding-top: 8px;
  text-align: center;
}

.signature-grid span {
  display: block;
  margin-top: 54px;
}

@media print {
  .no-print {
    display: none !important;
  }

  .print-sheet {
    width: 100%;
    margin: 0;
  }
}

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

.wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.compact-form {
  margin-top: 4px;
}

.detail-panel {
  padding: 18px;
}

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

.technical-summary h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.detail-grid div {
  min-width: 0;
}

.detail-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.detail-grid dd {
  margin: 0;
  min-height: 22px;
}

.qr-preview img {
  width: 128px;
  height: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.danger-zone {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.danger-button {
  min-height: 38px;
  border: 1px solid #dc2626;
  border-radius: 8px;
  background: #fff;
  color: #b91c1c;
  padding: 9px 14px;
  cursor: pointer;
}

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

.login-shell {
  width: min(420px, 100%);
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}

.login-heading {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-heading .muted {
  margin: 0;
}

.validation-summary,
.field-validation {
  color: #b91c1c;
  font-size: 13px;
}

.full-width {
  width: 100%;
}

.success-message {
  border: 1px solid #86efac;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  padding: 10px 12px;
}

.scan-message {
  margin-top: 12px;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.site-file-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
}

.site-file-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
}

.site-file-preview img {
  width: 96px;
  height: 40px;
  object-fit: contain;
}

.site-file-preview.small-preview img {
  width: 36px;
  height: 36px;
}

.site-media-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-media-current {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
}

.site-media-current img {
  width: 72px;
  height: 32px;
  object-fit: contain;
}

.site-media-current.small-preview img {
  width: 32px;
  height: 32px;
}

.site-media-current span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.media-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
}

.media-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
}

.media-modal-panel {
  position: relative;
  width: min(720px, calc(100% - 32px));
  max-height: min(680px, calc(100vh - 48px));
  margin: 24px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  padding: 14px;
}

.media-modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.media-modal-heading h2 {
  margin: 0;
  font-size: 18px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.media-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 8px;
}

.media-picker.modal-picker {
  max-height: min(560px, calc(100vh - 150px));
}

.media-option {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px;
  cursor: pointer;
}

.media-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.media-option img {
  width: 72px;
  height: 48px;
  object-fit: contain;
}

.media-option span {
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.scan-input {
  min-height: 54px;
  font-size: 22px;
}

.label-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50mm, max-content));
  gap: 3mm;
  align-items: start;
}

.label-qr {
  width: var(--label-qr-size);
  height: var(--label-qr-size);
  background: #fff;
}

.label-qr svg {
  display: block;
  width: var(--label-qr-size);
  height: var(--label-qr-size);
}

.asset-label {
  display: grid;
  grid-template-columns: var(--label-qr-size) minmax(0, 1fr);
  gap: var(--label-gap);
  align-items: center;
  width: var(--label-width);
  height: var(--label-height);
  border: 1px solid #111;
  border-radius: 2px;
  background: #fff;
  padding: var(--label-padding);
  break-inside: avoid;
  overflow: hidden;
  --label-width: 50mm;
  --label-height: 30mm;
  --label-qr-size: 22mm;
  --label-padding: 2mm;
  --label-gap: 2mm;
  --label-title-size: 9pt;
  --label-text-size: 7.5pt;
}

.asset-label.label-size-35x22 {
  --label-width: 35mm;
  --label-height: 22mm;
  --label-qr-size: 16mm;
  --label-padding: 1.5mm;
  --label-gap: 1.5mm;
  --label-title-size: 7pt;
  --label-text-size: 6pt;
}

.asset-label.label-size-50x30 {
  --label-width: 50mm;
  --label-height: 30mm;
  --label-qr-size: 22mm;
}

.asset-label.label-size-60x40 {
  --label-width: 60mm;
  --label-height: 40mm;
  --label-qr-size: 28mm;
  --label-title-size: 10pt;
  --label-text-size: 8pt;
}

.asset-label.label-size-70x30 {
  --label-width: 70mm;
  --label-height: 30mm;
  --label-qr-size: 22mm;
  --label-title-size: 10pt;
}

.asset-label.label-size-80x50 {
  --label-width: 80mm;
  --label-height: 50mm;
  --label-qr-size: 36mm;
  --label-title-size: 11pt;
  --label-text-size: 8.5pt;
}

.asset-label div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.asset-label strong,
.asset-label span,
.asset-label small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-label strong {
  font-size: var(--label-title-size);
  line-height: 1.15;
}

.asset-label span {
  font-size: var(--label-text-size);
  line-height: 1.15;
}

.asset-label small {
  color: var(--muted);
  font-size: var(--label-text-size);
  line-height: 1.12;
}

.label-size-form {
  min-width: 170px;
}

@media print {
  body {
    background: #fff;
  }

  .no-print,
  .topbar {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  .label-sheet {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
  }

  .asset-label {
    margin: 0;
    page-break-inside: avoid;
  }
}

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

  .topbar {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px 16px;
  }

  .nav-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 8px 12px;
    cursor: pointer;
  }

  .main-nav {
    grid-column: 1 / -1;
    display: none;
    width: 100%;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
  }

  .nav-toggle:checked ~ .main-nav {
    display: flex;
    flex-direction: column;
  }

  .logout-form {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
  }

  .main-nav a,
  .nav-group > a {
    display: block;
    text-align: center;
  }

  .label-sheet {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-toolbar select {
    max-width: none;
  }

  .form-grid,
  .two-columns,
  .detail-grid,
  .check-grid,
  .assignment-row,
  .work-grid,
  .audit-json-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .status-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .attention-item {
    align-items: stretch;
    flex-direction: column;
  }

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

  .qr-scan-controls,
  .maintenance-complete-form {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .attachment-upload,
  .attachment-item {
    grid-template-columns: 1fr;
  }

  .attachment-item {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-group {
    width: 100%;
  }

  .nav-group > a {
    display: block;
    text-align: center;
  }

  .nav-menu {
    position: static;
    margin-top: 4px;
    box-shadow: none;
  }

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

  .collector-download-form {
    align-items: stretch;
    flex-direction: column;
  }

  .collector-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .site-media-row {
    align-items: stretch;
    flex-direction: column;
  }

  .media-modal-panel {
    max-height: calc(100vh - 24px);
    margin: 12px auto;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .label-sheet {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  .pagination-bar,
  .pagination-bar > div,
  .form-actions,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    width: 100%;
  }
}
