/* Shared UI components. No fonts, scripts or styles are loaded from third parties. */
:root {
  color-scheme: light;
  --ink: #203342; --muted: #526575; --accent: #086657; --accent-hover: #054f44;
  --page: #f3f5f7; --surface: #fff; --line: #d6dfe5; --focus: #a44800;
  --success: #176044; --success-bg: #eaf5ef; --warning: #805000; --warning-bg: #fff5dc;
  --danger: #a12b29; --danger-bg: #fff0ef; --info: #245776; --info-bg: #edf5fa;
  --radius: .65rem; --shadow: 0 2px 8px #20334208;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 1rem/1.55 system-ui, -apple-system, 'Segoe UI', sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
.container { width: min(1280px, calc(100% - 3rem)); margin-inline: auto; min-width: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: absolute; left: 1rem; top: -8rem; padding: .8rem 1rem; background: white; z-index: 20; }
.skip-link:focus { top: .5rem; }
.site-header { background: #193343; color: white; }
.header-content { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; padding-block: 1.1rem; }
.brand { color: white; font-weight: 700; text-decoration: none; font-size: 1.1rem; overflow-wrap: anywhere; }
.header-caption { color: #d2e0e7; font-size: .875rem; }
.site-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.nav-items { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; padding-block: .5rem; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: .6rem .85rem; color: var(--muted); border-radius: .35rem; text-decoration: none; font-size: .9375rem; font-weight: 600; }
.site-nav a:hover { background: var(--page); color: var(--ink); }
.site-nav a[aria-current='page'] { background: #e6f1ed; color: #075c4f; box-shadow: inset 0 -3px var(--accent); }
.nav-account { margin-left: auto; position: relative; max-width: 100%; }
.nav-account summary { cursor: pointer; min-height: 44px; padding: .6rem .85rem; font-size: .9375rem; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: .4rem; }
.nav-account-active summary { border-color: var(--accent); color: var(--accent); }
.account-menu { position: absolute; z-index: 10; right: 0; min-width: 240px; max-width: min(90vw, 340px); padding: .7rem; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px #19334320; }
.account-menu a { display: flex; }
.account-menu form { margin: .5rem 0 0; }
.account-menu button { margin: 0; width: 100%; }
main { flex: 1; padding-block: 2rem 4rem; }
h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1.2; letter-spacing: -.025em; margin: .25rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.3rem; line-height: 1.35; margin: 2rem 0 .75rem; }
h3 { font-size: 1.05rem; line-height: 1.4; }
p { color: var(--muted); }
.intro { max-width: 820px; margin-bottom: 2rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-size: .75rem; font-weight: 750; margin: 0 0 .5rem; }
.page-heading { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.page-heading p { margin-bottom: 0; }
.site-footer { border-top: 1px solid var(--line); padding-block: 1.25rem; color: var(--muted); font-size: .8125rem; }
/* Buttons and grouped actions: 44px minimum touch area. */
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; gap: .5rem; border: 1px solid transparent; border-radius: .4rem; padding: .7rem 1.05rem; background: var(--accent); color: white; font: inherit; font-weight: 650; line-height: 1.35; text-align: center; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { background: var(--accent-hover); color: white; text-decoration: none; }
.button-secondary { background: white; border-color: #91a4b0; color: var(--ink); }
.button-secondary:hover { background: #edf2f5; color: var(--ink); }
.button-danger { background: var(--danger); }
.button-danger:hover { background: #7c201e; }
.button-large { min-height: 54px; padding: .9rem 1.4rem; }
button:disabled, .button[aria-disabled='true'] { opacity: .6; cursor: not-allowed; }
.actions, .pagination, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-block: 1rem; }
.actions > a:not(.button), .pagination a, .form-actions > a:not(.button) { display: inline-flex; align-items: center; min-height: 44px; }
/* Forms: labels stay above fields, hints below, no color-only errors. */
.form-panel { max-width: 660px; padding: clamp(1rem, 3vw, 2rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.machine-form { max-width: 1000px; }
label { display: block; font-size: .9375rem; font-weight: 650; margin: 1rem 0 .4rem; }
input, select, textarea { width: 100%; min-width: 0; min-height: 46px; padding: .7rem .8rem; border: 1px solid #869aa8; border-radius: .4rem; font: inherit; color: var(--ink); background: white; }
input[type='hidden'] { display: none; }
textarea { min-height: 110px; resize: vertical; }
input[readonly], textarea[readonly], input:disabled, select:disabled { background: #edf1f4; color: var(--muted); }
[aria-invalid='true'] { border: 2px solid var(--danger); }
.batch-list { display: grid; gap: 1rem; }
.batch-machine { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: white; overflow-wrap: anywhere; }
.batch-machine h3 { margin-top: 0; }
#batch-feedback { min-height: 3rem; overflow-wrap: anywhere; }
.checkbox { display: flex; align-items: center; gap: .75rem; min-height: 44px; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; min-height: 0; flex: 0 0 22px; accent-color: var(--accent); }
.form-grid, .filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 1rem; }
.form-grid > *, .filter-grid > * { min-width: 0; }
.form-grid label { margin-top: .35rem; }
.filter-grid { align-items: end; background: var(--surface); padding: 1.2rem; border: 1px solid var(--line); margin-block: 1.5rem; border-radius: var(--radius); }
.filter-grid label { margin-top: 0; }
.filter-grid > a { min-height: 46px; display: inline-flex; align-items: center; }
.filter-grid .actions { margin: 0; }
form button { margin: 1rem .5rem 0 0; }
.filter-grid button, .form-actions button { margin: 0; }
.form-hint, .form-grid p { font-size: .875rem; color: var(--muted); margin: .4rem 0 0; }
.field-error { color: var(--danger); font-size: .875rem; }
.warehouse-form input:not([type='hidden']), .warehouse-form select, .warehouse-form button { min-height: 52px; }
/* Feedback components: pair variants with explicit explanatory text. */
.notice, .alert, .error-message { padding: 1rem 1.15rem; border: 1px solid #b8d2e1; border-left: 4px solid var(--info); border-radius: .4rem; background: var(--info-bg); color: var(--info); overflow-wrap: anywhere; }
.notice-success, .alert-success { color: var(--success); background: var(--success-bg); border-color: #b8d9c8; border-left-color: var(--success); }
.notice-warning, .alert-warning { color: var(--warning); background: var(--warning-bg); border-color: #e3cd96; border-left-color: var(--warning); }
.error-message, .alert-error, .notice[role='alert'] { background: var(--danger-bg); color: var(--danger); border-color: #e3b7b4; border-left-color: var(--danger); }
.badge, .status-badge { display: inline-block; padding: .22rem .65rem; border: 1px solid #c8d2db; border-radius: 2rem; background: #eef2f5; color: #435565; font-size: .8125rem; font-weight: 650; line-height: 1.5; vertical-align: middle; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: #b8d9c8; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: #e3cd96; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: #e3b7b4; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: #b8d2e1; }
.status { color: var(--muted); font-size: .875rem; }
/* Tables preserve columns; narrow screens scroll the table, never the page. */
.table-scroll { overflow-x: auto; max-width: 100%; background: white; border: 1px solid var(--line); border-radius: var(--radius); margin-block: 1rem; }
table { width: 100%; border-collapse: collapse; background: white; font-size: .9375rem; }
caption { text-align: left; font-weight: 700; padding: .85rem 1rem; }
th, td { text-align: left; vertical-align: top; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
thead { background: #edf2f5; }
th { font-size: .8125rem; font-weight: 700; color: #435767; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:hover { background: #f0f6f4; }
td a { display: inline-flex; align-items: center; min-height: 36px; font-weight: 600; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
main > nav[aria-label] { display: flex; align-items: center; flex-wrap: wrap; gap: .85rem; margin-block: 1.5rem; }
main > nav[aria-label] a:not(.button) { padding: .6rem .8rem; min-height: 44px; border: 1px solid var(--line); background: white; border-radius: .4rem; }
/* Cards and dashboard building blocks. Metrics are optional, never fabricated. */
.module-grid, .dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); list-style: none; gap: 1rem; padding: 0; margin-block: 1rem; }
.module-card, .card, .dashboard-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); min-width: 0; }
.module-card h3, .card h2, .card h3, .dashboard-card h3 { margin: 0 0 .6rem; }
.card p:last-child, .dashboard-card p:last-child { margin-bottom: 0; }
.card-link { display: flex; flex-direction: column; gap: .65rem; height: 100%; text-decoration: none; color: var(--ink); }
.card-link:hover { border-color: var(--accent); background: #f6faf8; }
.card-link h3, .card-link p { margin: 0; }
.card-link .card-action { margin-top: auto; padding-top: .5rem; color: var(--accent); font-size: .875rem; font-weight: 700; }
.dashboard-value { font-size: 2rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.dashboard-label { color: var(--muted); font-size: .875rem; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0 2rem; }
.planned-modules { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1rem; color: var(--muted); }
.planned-modules summary { padding: .65rem 0; min-height: 44px; cursor: pointer; }
.details-grid, .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 1rem; }
.details-grid div, .detail-grid div { background: white; padding: 1rem; border: 1px solid var(--line); border-radius: .4rem; }
dt { color: var(--muted); font-size: .875rem; }
dd { margin: .3rem 0 0; font-weight: 600; overflow-wrap: anywhere; }
.multiline { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 40rem; }
@media (max-width: 800px) {
  .container { width: calc(100% - 2rem); }
  main { padding-top: 1.5rem; }
  .nav-items { gap: .25rem; }
  .nav-account { margin-left: 0; }
  td a { min-height: 44px; }
  .table-scroll th, .table-scroll td { min-width: 110px; }
}
@media (max-width: 520px) {
  .container { width: calc(100% - 1.5rem); }
  .header-content { padding-block: .9rem; gap: .25rem; }
  .header-caption { font-size: .75rem; }
  .nav-items { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .site-nav a { font-size: .875rem; padding-inline: .65rem; overflow-wrap: anywhere; }
  .nav-account { grid-column: 1 / -1; }
  .nav-account-active summary { border-color: var(--accent); color: var(--accent); }
.account-menu { position: static; max-width: 100%; min-width: 0; box-shadow: none; margin-top: .4rem; }
  .filter-grid, .form-grid { grid-template-columns: minmax(0,1fr); }
  .form-panel { padding: 1rem; }
  .quick-actions { display: grid; grid-template-columns: minmax(0,1fr); }
  .form-actions > *, .warehouse-form button[type='submit'] { width: 100%; }
  h1 { font-size: 1.65rem; }
  th, td { padding: .7rem .75rem; }
}
@media (max-width: 360px) { .site-nav a { font-size: .8125rem; padding-inline: .5rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
@media print {
  .site-nav, .skip-link, .quick-actions, .filter-grid, .actions, .site-footer, button { display: none; }
  body, .site-header { background: white; color: black; }
  .brand { color: black; }
  .container { width: 100%; }
  main { padding: 1rem 0; }
  .table-scroll { overflow: visible; border: 0; }
  table { font-size: 9pt; }
  th, td { padding: .3rem; }
  .card, .form-panel { box-shadow: none; }
}

/* QR scan, quick view and reusable physical label sizes. */
[hidden] { display: none !important; }
.qr-camera { margin-block: 1rem; }
.article-camera { margin-block: 1rem; }
.article-camera-panel { padding: 1rem; border: 1px solid var(--border); border-radius: .6rem; }
.article-camera-preview { position: relative; max-width: 52rem; margin-inline: auto; background: #142b34; }
.article-camera-preview video { display: block; width: 100%; max-height: 65vh; min-height: 220px; object-fit: contain; }
.article-camera-guide { position: absolute; inset: 30% 8%; border: 2px solid white; border-radius: .5rem; pointer-events: none; }
.article-camera button { min-height: 48px; }
@media (orientation: landscape) and (max-height: 600px) { .article-camera-preview video { min-height: 150px; max-height: 60vh; } }
.qr-camera video { display: block; width: min(100%, 36rem); max-height: 65vh; background: #142b34; border-radius: .6rem; }
.qr-quick { max-width: 48rem; margin-inline: auto; }
.qr-quick .badge { font-size: 1.05rem; padding: .65rem 1rem; }
.qr-preview { width: min(100%, 18rem); background: white; }
.qr-preview svg, .qr-symbol svg { display: block; width: 100%; height: auto; }
.qr-value { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1rem; background: white; border: 1px solid var(--line); }
.qr-machine-choice { display: flex; align-items: center; gap: .7rem; padding: .6rem; min-height: 48px; border-bottom: 1px solid var(--line); }
.qr-machine-choice input { width: 1.35rem; height: 1.35rem; min-height: 0; flex-shrink: 0; }
.qr-label-sheet { display: flex; flex-wrap: wrap; gap: 4mm; margin-top: 1rem; align-items: flex-start; }
.qr-label { box-sizing: border-box; color: black; background: white; border: .2mm solid #bbb; padding: 2mm; text-align: center; break-inside: avoid; page-break-inside: avoid; overflow-wrap: anywhere; }
.qr-label p { margin: 1mm 0; font-size: 9pt; line-height: 1.2; }
.qr-label small { font-size: 6pt; display: block; }
.qr-asset-number { display: block; font-size: 12pt; line-height: 1.15; }
.qr-layout-small .qr-label { width: 50mm; min-height: 55mm; }
.qr-layout-small .qr-symbol { width: 36mm; margin: auto; }
.qr-layout-medium .qr-label { width: 70mm; min-height: 75mm; }
.qr-layout-medium .qr-symbol { width: 50mm; margin: auto; }
.qr-layout-a4 .qr-label { width: 100%; min-height: 245mm; padding: 15mm; }
.qr-layout-a4 .qr-symbol { width: min(100%, 140mm); margin: auto; }
.qr-layout-a4 .qr-asset-number { font-size: 24pt; }
.qr-layout-a4 .qr-label p { font-size: 16pt; }
@media print {
  @page { size: A4; margin: 10mm; }
  body:has(.qr-label-sheet) .site-header, body:has(.qr-label-sheet) .container:has(> .notice), .qr-print-controls { display: none !important; }
  body:has(.qr-label-sheet) main { padding: 0; margin: 0; width: 100%; }
  .qr-label-sheet { margin: 0; gap: 3mm; }
  .qr-label { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qr-layout-a4 { display: block; }
  .qr-layout-a4 .qr-label { break-after: page; page-break-after: always; }
  .qr-layout-a4 .qr-label:last-child { break-after: auto; page-break-after: auto; }
}
@media (max-width: 520px) {
  /* Keep the primary task in view after a scan. Brand still links to all workspaces. */
  body:has(.qr-quick) .site-nav .nav-items { display: flex; }
  body:has(.qr-quick) .site-nav .nav-items > a:not([aria-current]) { display: none; }
  body:has(.qr-quick) .nav-account { margin-left: auto; }
}
.machine-thumbnail { width:80px; height:80px; object-fit:contain; }
.machine-main-image { max-width:100%; object-fit:contain; }

.pagination .page-number, .pagination .page-current { min-width: 44px; justify-content: center; }
.pagination .page-current { display: inline-flex; align-items: center; min-height: 44px; padding-inline: .5rem; border: 1px solid currentColor; border-radius: 6px; }
