@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/InterVariable.woff2") format("woff2");
}

:root {
  --ink: #242b31;
  --muted: #626c75;
  --line: #dce1e5;
  --input-line: #a1abb4;
  --paper: #fff;
  --canvas: #f5f6f8;
  --subtle: #f8f9fa;
  --forest: #24564c;
  --forest-soft: #edf4f1;
  --amber: #815c13;
  --amber-soft: #fff7e3;
  --danger: #a03532;
  --danger-soft: #fcf0ef;
  --info: #315f85;
  --info-soft: #edf4fa;
  --text-xs: .8125rem;
  --text-sm: .875rem;
  --text-base: .9375rem;
  --text-lg: 1rem;
  --text-section: 1.125rem;
  --text-title: 1.5rem;
  --regular: 400;
  --medium: 500;
  --semibold: 600;
  --radius-sm: 6px;
  --radius: 8px;
  --control-height: 40px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-size: var(--text-base); font-weight: var(--regular); line-height: 1.5; }
a { color: var(--forest); text-underline-offset: 3px; }
strong, b { font-weight: var(--semibold); }
button, input, select, textarea { font: inherit; }
input, select, textarea { width: 100%; min-width: 0; min-height: var(--control-height); border: 1px solid var(--input-line); border-radius: var(--radius-sm); background: var(--paper); padding: .5rem .625rem; color: var(--ink); }
input, select { height: var(--control-height); }
input[type="number"], .numeric { text-align: right; font-variant-numeric: tabular-nums; }
input[type="date"], .date-cell, .date-item { font-variant-numeric: tabular-nums; }
input, select, textarea, button { scroll-margin-block: 7rem 1rem; }
input:focus, select:focus, textarea:focus { border-color: var(--forest); outline: 2px solid var(--forest); outline-offset: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible { outline: 2px solid var(--forest); outline-offset: 3px; }
input:disabled, select:disabled, textarea:disabled { background: var(--subtle); color: var(--muted); }
textarea { resize: vertical; }
label, .field-label { display: block; font-size: var(--text-sm); font-weight: var(--medium); margin: .875rem 0 .375rem; }
small { display: block; color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }
address { font-style: normal; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { font-weight: var(--semibold); line-height: 1.35; }
h1, .page-title { font-size: var(--text-title); letter-spacing: -.025em; margin-bottom: .375rem; overflow-wrap: anywhere; }
h2, .section-title { font-size: var(--text-section); letter-spacing: -.015em; margin-bottom: .875rem; }
h3, h4 { font-size: var(--text-lg); margin-bottom: .5rem; }
p { margin-bottom: .875rem; }
form { margin: 0; }
summary { cursor: pointer; font-size: var(--text-sm); font-weight: var(--medium); }
summary::marker { color: var(--muted); }
.quiet, .optional { color: var(--muted); font-weight: var(--regular); }
.eyebrow, .form-help, .readonly-hint, .field-help { color: var(--muted); font-size: var(--text-xs); font-weight: var(--regular); }
.form-help { margin: .75rem 0 0; }
.field-help { margin: .375rem 0 0; }
.visually-hidden, .order-line-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 20; background: var(--paper); padding: .75rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: .5rem; }

/* Application layout */
.site-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner { width: min(1280px, calc(100% - 3rem)); min-height: 64px; margin: 0 auto; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: .625rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--paper); background: var(--forest); font-size: var(--text-xs); font-weight: var(--semibold); }
.brand-name { font-size: var(--text-sm); font-weight: var(--semibold); }
.demo-badge { padding: .125rem .375rem; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: .75rem; }
.site-header nav { display: flex; flex-wrap: wrap; min-width: 0; align-items: center; gap: .375rem; margin-right: auto; }
.site-header nav > a { padding: .5rem .625rem; border-radius: var(--radius-sm); color: var(--muted); font-size: var(--text-sm); font-weight: var(--medium); text-decoration: none; }
.site-header nav > a:hover { color: var(--ink); background: var(--subtle); }
.site-header nav > a[aria-current="page"] { color: var(--forest); background: var(--forest-soft); }
.identity { margin-left: auto; text-align: right; }
.identity span { display: block; font-size: var(--text-sm); font-weight: var(--medium); }
.identity small { font-size: .75rem; }
.page-shell { width: min(1280px, calc(100% - 3rem)); min-width: 0; flex: 1; margin: 1.5rem auto 3rem; }
.page-shell > .panel, .page-shell > .detail-grid, .page-shell > .section-block { margin-bottom: 1rem; }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem max(1.5rem, calc((100% - 1280px) / 2)); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--text-xs); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-heading > div { min-width: 0; }
.page-heading p:last-child { color: var(--muted); margin-bottom: 0; font-size: var(--text-sm); }
.heading-actions, .button-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.heading-actions { justify-content: flex-end; }
.back-link { display: inline-flex; align-items: center; min-height: 32px; margin-bottom: .375rem; font-size: var(--text-xs); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.panel { min-width: 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.narrow-panel { max-width: 600px; margin: 3rem auto; }
.section-block { margin: 1.5rem 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading h2 { margin-bottom: 0; }
.section-heading > .quiet { font-size: var(--text-xs); }
.section-title-row { display: flex; align-items: baseline; gap: .625rem; }
.section-title-row .quiet { font-size: var(--text-xs); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.key-values { margin: 0; }
.key-values > div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.key-values > div:last-child { border-bottom: 0; }
.key-values dt { color: var(--muted); font-size: var(--text-sm); }
.key-values dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.order-overview { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.order-overview h2 { color: var(--muted); font-size: var(--text-xs); font-weight: var(--regular); margin-bottom: .25rem; }
.order-overview address { font-size: var(--text-sm); overflow-wrap: anywhere; }
.order-overview address span { display: block; }
.order-facts { display: flex; flex-wrap: wrap; gap: .75rem 1.75rem; margin: 0; font-size: var(--text-sm); }
.order-facts dt { color: var(--muted); font-size: var(--text-xs); margin-bottom: .25rem; }
.order-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.order-note { grid-column: 1 / -1; margin: 0; font-size: var(--text-sm); }
.technical-details { margin-top: .875rem; }
.technical-details > summary { color: var(--muted); }
.technical-details[open] > summary { margin-bottom: .75rem; }
.revision-list { padding-left: 1.25rem; font-size: var(--text-sm); color: var(--muted); }
.revision-list li + li { margin-top: .375rem; }
.disclosure-row { margin: 0; padding: .75rem 0; border-top: 1px solid var(--line); }
.disclosure-row > summary { width: fit-content; padding: .375rem 0; color: var(--muted); }
.disclosure-row[open] > summary { margin-bottom: .75rem; }
.disclosure-row .detail-grid { margin-bottom: 0; }
.help-disclosure { font-size: var(--text-xs); color: var(--muted); }
.help-disclosure > summary { width: fit-content; padding: .375rem 0; font-size: var(--text-xs); font-weight: var(--regular); }
.help-disclosure p { max-width: 80ch; margin: .5rem 0 0; }

/* Dashboard and tables */
.dashboard-content { display: grid; gap: 1rem; }
.status-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 0; margin: 0; padding: .875rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.status-summary > div { display: flex; align-items: center; gap: .625rem; padding: 0 1.25rem; border-left: 1px solid var(--line); }
.status-summary > div:first-child { padding-left: 0; border-left: 0; }
.status-summary dt { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: var(--text-sm); }
.status-summary dd { margin: 0; font-size: var(--text-lg); font-weight: var(--semibold); font-variant-numeric: tabular-nums; }
.status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #87929a; }
.status-dot-approved, .status-dot-completed { background: var(--forest); }
.status-dot-in_progress { background: var(--info); }
.order-list-heading { flex-wrap: wrap; }
.order-list-controls { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.order-list-controls label { display: flex; align-items: center; gap: .625rem; margin: 0; color: var(--muted); }
.order-list-controls select { width: auto; min-width: 165px; font-size: var(--text-sm); }
.dashboard-toolbar { display: flex; justify-content: flex-end; }
#order-list { scroll-margin-top: 80px; }
.table-wrap { width: 100%; min-width: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
th { color: var(--muted); background: var(--subtle); text-align: left; font-size: var(--text-sm); font-weight: var(--medium); }
th, td { padding: .625rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child > td { border-bottom: 0; }
tbody tr:hover { background: var(--subtle); }
th.sortable-heading { padding: 0; }
.column-sort { display: flex; align-items: center; gap: .375rem; min-height: 44px; padding: .625rem .75rem; color: inherit; text-decoration: none; white-space: nowrap; }
.column-sort:hover, .column-sort:focus-visible { background: var(--forest-soft); color: var(--forest); }
.column-sort:focus-visible { outline-offset: -3px; }
.sort-indicator { width: 1em; text-align: center; font-size: var(--text-xs); line-height: 1; color: var(--muted); }
th[aria-sort] .column-sort, th[aria-sort] .sort-indicator { color: var(--forest); }
.order-table td { vertical-align: middle; }
.order-number { font-weight: var(--medium); white-space: nowrap; text-decoration: none; }
.order-number:hover { text-decoration: underline; }
.date-item { display: inline-block; white-space: nowrap; }
.order-row-actions { display: flex; align-items: center; gap: .25rem; white-space: nowrap; }
.creator-cell { white-space: nowrap; }
.table-action { display: inline-flex; align-items: center; min-height: 36px; padding: .375rem .5rem; border-radius: var(--radius-sm); font-size: var(--text-sm); text-decoration: none; }
.table-action:hover { background: var(--forest-soft); }
.archive-action { margin: 0; }
.archive-action .button { min-height: 36px; padding: .375rem .5rem; white-space: nowrap; }
.archive-label { color: var(--muted); }
.line-table { min-width: 730px; }
.customer-line-table { min-width: 480px; }
.document-summary-table { min-width: 660px; }
.document-primary-row > td { vertical-align: middle; }
.document-history-row > td { padding: 0 .75rem .75rem; background: var(--subtle); }
.document-history > summary, .document-create-disclosure > summary { width: fit-content; padding-block: .375rem; color: var(--forest); }
.document-history > summary:hover, .document-create-disclosure > summary:hover { text-decoration: underline; }
.document-history[open] > summary, .document-create-disclosure[open] > summary { margin-bottom: .625rem; }
.document-history-table { min-width: 1000px; background: var(--paper); }
.document-create-form { width: min(340px, 70vw); padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.document-create-form label:first-of-type { margin-top: 0; }
.document-create-form .button { margin-top: .875rem; }
.cell-details { margin-top: .25rem; }
.cell-details summary { color: var(--muted); font-size: var(--text-xs); }
.cell-details small { margin-top: .25rem; }

/* Shared controls and order entry */
.button { display: inline-flex; align-items: center; justify-content: center; gap: .375rem; min-height: var(--control-height); border: 1px solid transparent; border-radius: var(--radius-sm); padding: .5rem .875rem; font-size: var(--text-sm); font-weight: var(--medium); line-height: 1.4; text-align: center; text-decoration: none; cursor: pointer; }
.button-primary { background: var(--forest); color: var(--paper); }
.button-primary:hover { background: #1c443d; }
.button-secondary { background: var(--paper); color: var(--ink); border-color: var(--input-line); }
.button-secondary:hover { background: var(--subtle); }
.button-danger { background: var(--danger); color: var(--paper); }
.button-danger:hover { background: #852b28; }
.button-danger-outline { background: transparent; border-color: #d4b7b5; color: var(--danger); }
.button-danger-outline:hover { background: var(--danger-soft); border-color: var(--danger); }
.danger-link { color: var(--danger); }
.danger-link:hover { background: var(--danger-soft); }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover { color: var(--ink); background: #eef0f2; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-wide { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; padding: .75rem 0 0; border-top: 1px solid var(--line); }
.stack-form { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid label, .form-grid .field-label, .form-field > label:first-child { margin-top: 0; }
.form-field { min-width: 0; }
.form-section > h2 { margin-bottom: 1rem; }
.form-section > .field-help { margin: -.5rem 0 1rem; }
.delivery-section > h2 { margin-bottom: .5rem; }
.delivery-section > .field-help { margin: 0 0 .75rem; }
.product-rule-fields { margin-top: 1rem; }
.product-checkbox { display: flex; align-items: center; gap: .75rem; min-height: 44px; margin: .375rem 0; cursor: pointer; }
.product-checkbox input { flex: 0 0 20px; width: 20px; height: 20px; min-height: 20px; padding: 0; }
.product-checkbox span { min-width: 0; overflow-wrap: anywhere; }
.product-table { min-width: 740px; }
.product-table td { overflow-wrap: anywhere; max-width: 360px; }
.product-table tr:target { background: var(--forest-soft); }
.user-table { min-width: 660px; }
.user-table td { overflow-wrap: anywhere; max-width: 320px; }
.user-table tr:target { background: var(--forest-soft); }
.user-history { margin-top: 1rem; padding-left: 1.5rem; }
.user-history li { padding: .5rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.user-history p { margin: .25rem 0; }
.unit-table { min-width: 560px; }
.unit-table td { overflow-wrap: anywhere; max-width: 320px; }
.unit-table tr:target { background: var(--forest-soft); }
.optional-field { margin-top: .875rem; }
.optional-field > summary { color: var(--muted); }
.optional-field[open] > summary { margin-bottom: .5rem; }
.optional-field label { margin-top: 0; }
.customer-options-feedback { margin-top: .5rem; color: var(--muted); font-size: var(--text-xs); }
.group-grid { display: grid; gap: 1rem; }
.group-fieldset, .packing-line { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--paper); }
.group-fieldset legend, .packing-line legend { padding: 0 .375rem; color: var(--ink); font-size: var(--text-sm); font-weight: var(--semibold); }
.group-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: .375rem; }
.group-card-toolbar { display: flex; justify-content: flex-end; }
.group-card-toolbar .button { min-height: 32px; padding: .25rem .5rem; font-size: var(--text-xs); }
.group-meta-grid { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(140px, .6fr) minmax(180px, 1.7fr); gap: .75rem; align-items: end; }
.group-meta-grid label { margin-top: 0; }
.delivery-group-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.delivery-group-actions p { margin: 0; font-size: var(--text-sm); }
.group-limit-message { color: var(--danger); }
.new-group-marker { display: inline-flex; margin-left: .375rem; border-radius: 4px; padding: .125rem .375rem; background: var(--info-soft); color: var(--info); font-size: var(--text-xs); font-weight: var(--medium); vertical-align: middle; }
.order-lines-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.order-lines-heading h3 { margin: 0; font-size: var(--text-sm); }
.order-lines-heading .quiet { font-size: var(--text-xs); }
.order-lines-column-headings, .order-line-row { display: grid; grid-template-columns: minmax(230px, 2.6fr) minmax(150px, 1.15fr) minmax(80px, .6fr) minmax(140px, 1.25fr) 84px; gap: .625rem; align-items: end; }
.order-lines-column-headings { margin-top: .5rem; padding: .5rem 0; color: var(--muted); font-size: var(--text-sm); font-weight: var(--medium); }
.order-lines-column-headings > :nth-child(3) { text-align: right; padding-right: .625rem; }
.order-line-row { padding: .625rem 0; border-top: 1px solid var(--line); }
.order-line-field, .order-line-action { min-width: 0; }
.order-line-row input, .order-line-row select { padding: .5rem; }
.order-line-action .button { width: 100%; padding-inline: .375rem; }
.order-line-add { display: flex; margin-top: .375rem; }
.readonly-field { border: 1px solid var(--line); background: var(--subtle); border-radius: var(--radius-sm); min-height: var(--control-height); padding: .5rem .625rem; }
.readonly-field span { display: block; color: var(--muted); font-size: var(--text-xs); }
.readonly-field strong { font-weight: var(--medium); }
.line-editor { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.inline-action { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; padding: 1rem; border-radius: var(--radius); background: var(--subtle); border: 1px solid var(--line); }
.inline-action .form-field { flex: 1 1 180px; }
.inline-action label { margin-top: 0; }
.secondary-action { margin-top: .875rem; }
.secondary-action > summary { width: fit-content; min-height: 36px; padding-block: .375rem; color: var(--muted); }
.secondary-action > .inline-action { margin-top: .375rem; }
.danger-zone { background: var(--danger-soft); border-color: #dfb9b6; }
.field-error { color: var(--danger); font-weight: var(--medium); font-size: var(--text-xs); margin: .375rem 0 0; }

/* Operational status, packing, and history */
.status { display: inline-flex; align-items: center; gap: .375rem; width: fit-content; border-radius: 5px; padding: .1875rem .5rem; font-size: var(--text-xs); font-weight: var(--medium); white-space: nowrap; }
.status-draft, .status-pending, .status-cancelled, .status-discarded { color: #56616a; background: #eef0f2; }
.status-approved, .status-current, .status-completed, .status-issued { color: #2b6150; background: #edf4ef; }
.status-in_progress { color: var(--info); background: var(--info-soft); }
.status-attention { color: var(--danger); background: var(--danger-soft); }
.flash-stack { display: grid; gap: .5rem; margin-bottom: 1rem; }
.flash { padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); font-size: var(--text-sm); }
.flash-success { background: var(--forest-soft); border-color: #b8d0c3; }
.flash-warning { background: var(--amber-soft); border-color: #ddc99b; }
.callout { display: flex; align-items: flex-start; gap: .75rem; border-radius: var(--radius); padding: .875rem 1rem; margin-bottom: 1rem; border: 1px solid; font-size: var(--text-sm); }
.callout p:last-child { margin-bottom: 0; }
.callout-danger { color: #832f2c; background: var(--danger-soft); border-color: #d8a7a3; }
.callout-info { color: var(--info); background: var(--info-soft); border-color: #bbcede; }
.callout-icon { font-size: 1.125rem; line-height: 1.25; }
.action-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-left: 3px solid var(--forest); }
.action-bar p { margin: .125rem 0 0; color: var(--muted); font-size: var(--text-sm); }
.group-list { display: grid; gap: 1rem; }
.group-card { min-width: 0; }
.group-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: .875rem; border-bottom: 1px solid var(--line); background: var(--paper); }
.group-header > div { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.group-header .group-actions { justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.group-actions .button { font-size: var(--text-xs); }
.group-header h3 { margin-bottom: .125rem; }
.group-header p { margin: 0; color: var(--muted); font-size: var(--text-xs); }
.group-index { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.compact-facts { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: .75rem 0; font-size: var(--text-sm); }
.compact-facts div { display: flex; gap: .5rem; }
.compact-facts dt { color: var(--muted); }
.compact-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.shipment-note { margin: .75rem 0; padding: .625rem .75rem; background: var(--subtle); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.shortage-marker { display: block; margin-top: .375rem; padding: .375rem .5rem; color: var(--amber); background: var(--amber-soft); border-left: 2px solid #b68627; font-size: var(--text-xs); font-weight: var(--medium); text-align: left; }
.packing-form { margin-top: 1rem; }
.packing-line { padding: .375rem 0 .875rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.packing-line legend { padding: 0; max-width: 100%; font-size: var(--text-base); overflow-wrap: anywhere; }
.packing-line + .packing-line { margin-top: 1.25rem; }
.packing-line-meta { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .375rem 1rem; color: var(--muted); font-size: var(--text-xs); margin-bottom: .5rem; }
.packing-line-meta .table-action { min-height: 32px; font-size: var(--text-xs); padding: .25rem .5rem; }
.packing-note { margin: 0 0 .75rem; font-size: var(--text-xs); color: var(--muted); }
.packing-fields { display: grid; grid-template-columns: minmax(64px, .5fr) minmax(140px, .85fr) minmax(165px, 1fr) minmax(95px, .6fr); gap: 1rem; max-width: 800px; align-items: start; }
.packing-fields .field-label { margin: 0 0 .375rem; }
.packing-ordered { text-align: right; }
.quantity-value { display: flex; align-items: center; justify-content: flex-end; min-height: 44px; font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.packing-notes { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 1rem; max-width: 980px; margin-top: .75rem; }
.packing-line .shortage-marker { width: fit-content; margin: .5rem 0 0; }
.packing-line .secondary-action { margin-top: .5rem; }
.packing-form > .help-disclosure { margin-top: .5rem; }
.packing-footer { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1.5rem; padding-top: 1rem; }
.packing-footer > .form-field { flex: 1 1 240px; max-width: 380px; }
.packing-actions { border: 0; padding: 0; }
.completion-help { text-align: right; }
.line-history { margin-top: 1rem; }
.packing-line input, .packing-line select, .packing-form > input, .packing-form .button, .completion-form .button { min-height: 44px; }
.packing-line input, .packing-line select { font-size: var(--text-lg); }
.packing-actions .button, .packing-footer input { min-height: 44px; }
.packing-view .group-header { position: sticky; top: 64px; z-index: 4; padding-top: .75rem; }
.readonly-hint { margin: .75rem 0 0; }
.completion-form { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .75rem; margin-top: .875rem; }
.completion-form .form-help { margin: 0; }
.completion-panel { display: flex; align-items: center; gap: .625rem; padding: .75rem 1rem; background: var(--forest-soft); border: 1px solid #bdd1c7; border-radius: var(--radius); color: var(--forest); font-size: var(--text-sm); }
.completion-icon { font-size: var(--text-lg); }
.note-panel { border-left: 3px solid var(--info); }
.note-panel h2 { font-size: var(--text-sm); margin-bottom: .375rem; }
.note-panel p { margin: 0; }
.timeline { list-style: none; padding: .875rem 0 0; margin: 0; }
.timeline li { padding: .875rem 0; border-top: 1px solid var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline p { margin-bottom: 0; }
.timeline-content > small { margin-top: .125rem; }
.timeline-meta { width: fit-content; margin: .5rem 0 0; color: var(--muted); font-size: var(--text-xs); }
.timeline-reason { margin-top: .625rem; color: var(--amber); font-size: var(--text-sm); }
.change-list { display: grid; gap: .375rem; margin: .625rem 0 0; }
.change-list > div { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 1.3fr); gap: .75rem; padding: .5rem .625rem; border-radius: var(--radius-sm); background: var(--subtle); }
.change-list dt { color: var(--muted); font-size: var(--text-sm); }
.change-list dd { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: baseline; gap: .5rem; margin: 0; overflow-wrap: anywhere; font-size: var(--text-sm); }
.change-arrow { color: var(--muted); }
.audit-panel > summary { font-weight: var(--medium); }
.alert-panel { border-left: 3px solid var(--info); }
.alert-panel .section-heading { margin-bottom: .5rem; }
.alert-list { display: grid; }
.alert-row { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 0; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); font-size: var(--text-sm); }
.alert-row:hover { background: var(--subtle); }
.alert-row-warning { color: #832f2c; background: var(--danger-soft); padding-inline: .75rem; border-left: 3px solid var(--danger); }
.alert-row small { margin-top: .125rem; }
.empty-inline { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.empty-state { padding: 1.25rem .75rem; color: var(--muted); font-size: var(--text-sm); }
.empty-state p { margin: .25rem 0 0; }
.artifact-grid { display: grid; gap: .75rem; }
.artifact-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.artifact-card:hover { border-color: var(--forest); background: var(--subtle); }
.pdf-icon { display: grid; place-items: center; width: 36px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--subtle); color: var(--muted); font-size: .75rem; font-weight: var(--medium); }
.artifact-content { min-width: 0; }
.artifact-metadata { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(130px, .7fr) minmax(180px, 1.8fr); gap: .5rem 1rem; margin: .75rem 0 0; padding-top: .625rem; border-top: 1px solid var(--line); }
.artifact-metadata div { min-width: 0; }
.artifact-metadata dt { color: var(--muted); font-size: var(--text-xs); }
.artifact-metadata dd { margin: .125rem 0 0; color: var(--ink); font-size: var(--text-sm); overflow-wrap: anywhere; }
.artifact-download { align-self: center; font-size: var(--text-sm); font-weight: var(--medium); }
.document-buttons { justify-content: flex-end; margin-top: 1rem; }
.action-panel form + form { margin-top: .875rem; }
.action-panel .button-row form { margin: 0; }

.confirmation-dialog { width: min(460px, calc(100% - 2rem)); max-height: calc(100% - 2rem); padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--paper); }
.confirmation-dialog::backdrop { background: rgb(24 32 38 / 45%); }
.confirmation-dialog h2 { margin-bottom: .75rem; }
.confirmation-dialog p { margin: 0 0 .75rem; }
.confirmation-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
.confirmation-actions .button { min-height: 44px; }

/* Sign in */
.auth-layout { min-height: calc(100vh - 240px); display: grid; place-items: center; padding: 2rem 0; }
.auth-card { width: min(100%, 400px); padding: 1.75rem; }
.auth-card h1 { margin-bottom: .375rem; }
.auth-card > p { color: var(--muted); font-size: var(--text-sm); margin-bottom: 1.5rem; }
.auth-card .button { margin-top: .25rem; }

@media (max-width: 1000px) {
  .packing-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .header-inner { gap: .75rem; }
  .identity { display: none; }
  .order-lines-column-headings, .order-line-row { grid-template-columns: minmax(190px, 2.2fr) minmax(145px, 1.25fr) minmax(70px, .65fr) 84px; }
  .order-lines-column-headings > :nth-child(4) { display: none; }
  .order-line-note { grid-column: 1 / 4; grid-row: 2; }
  .order-line-note .order-line-label { position: static; width: auto; height: auto; margin: .125rem 0 .375rem; overflow: visible; clip: auto; white-space: normal; }
  .order-line-action { grid-column: 4; grid-row: 1; }
}

@media (max-width: 780px) {
  :root { --control-height: 44px; }
  input, select, textarea { font-size: var(--text-lg); }
  .detail-grid, .order-overview { grid-template-columns: 1fr; gap: 1rem; }
  .packing-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .packing-ordered { text-align: left; }
  .packing-ordered .quantity-value { justify-content: flex-start; }
  .packing-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .packing-line-meta .table-action, .disclosure-row > summary, .help-disclosure > summary { min-height: 44px; }
  .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-instructions-field { grid-column: 1 / -1; }
  .order-lines-column-headings { display: none; }
  .order-line-row { grid-template-columns: minmax(0, 1fr) minmax(90px, .55fr); gap: .75rem; padding-block: .875rem; }
  .order-line-product, .order-line-note { grid-column: 1 / -1; grid-row: auto; }
  .order-line-action { grid-column: 2; grid-row: auto; justify-self: end; }
  .order-line-label { position: static; width: auto; height: auto; margin: 0 0 .375rem; overflow: visible; clip: auto; white-space: normal; }
  .order-line-action .order-line-label { display: none; }
  .order-line-action .button { width: auto; }
  .artifact-metadata { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .artifact-metadata div:last-child { grid-column: 1 / -1; }
  .status-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .status-summary > div { padding: 0; border: 0; }
}

@media (max-width: 620px) {
  :root { --control-height: 44px; }
  input, select, textarea { font-size: var(--text-lg); }
  .header-inner, .page-shell { width: calc(100% - 1.5rem); }
  .header-inner { flex-wrap: wrap; gap: .5rem .75rem; padding: .75rem 0; }
  .brand { margin-right: auto; }
  .site-header { position: static; }
  .site-header nav { order: 3; width: 100%; margin: 0; flex-wrap: wrap; }
  .site-header nav > a { min-height: 44px; display: inline-flex; align-items: center; }
  .site-header .button { padding-inline: .5rem; }
  .page-shell { margin-top: 1.25rem; }
  .page-heading, .section-heading, .action-bar { align-items: flex-start; flex-direction: column; gap: .75rem; }
  .heading-actions { justify-content: flex-start; }
  .panel { padding: 1rem; }
  .status-summary { padding: .75rem; }
  .status-summary > div { gap: .375rem; }
  .status-summary dt { font-size: var(--text-xs); }
  .order-list-controls { width: 100%; justify-content: flex-start; }
  .order-list-controls label { flex: 1; }
  .order-list-controls select { min-width: 0; width: 100%; }
  .dashboard-toolbar { justify-content: flex-start; }
  .form-grid, .form-grid-4 { grid-template-columns: 1fr; }
  .group-meta-grid { grid-template-columns: 1fr; }
  .group-instructions-field { grid-column: 1; }
  .group-fieldset { padding: .75rem; }
  .packing-line { padding: .375rem 0 .875rem; }
  .packing-notes { grid-template-columns: 1fr; }
  .packing-actions { width: 100%; }
  .completion-help { text-align: left; }
  .group-header { align-items: flex-start; flex-wrap: wrap; }
  .group-index { display: none; }
  .packing-view .group-header { top: 0; }
  .compact-facts { flex-direction: column; gap: .375rem; }
  .document-summary-table { min-width: 0; }
  .document-summary-table > thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .document-summary-table > tbody { display: grid; gap: .75rem; }
  .document-summary-table > tbody > .document-primary-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
  .document-summary-table > tbody > .document-primary-row > td { display: block; min-width: 0; padding: .75rem; border: 0; overflow-wrap: anywhere; }
  .document-summary-table > tbody > .document-primary-row > td::before { content: attr(data-label); display: block; margin-bottom: .25rem; color: var(--muted); font-size: var(--text-xs); }
  .document-summary-table .status { white-space: normal; }
  .document-summary-table > tbody > .document-history-row { display: block; margin-top: -.75rem; }
  .document-summary-table > tbody > .document-history-row > td { display: block; padding: .75rem; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
  .change-list > div { grid-template-columns: 1fr; gap: .375rem; }
  .form-actions { padding-top: .75rem; }
  .packing-actions { padding: 0; }
  .form-actions .button { flex: 1 1 auto; }
  .table-action, .archive-action .button, .group-card-toolbar .button, .secondary-action > summary, .document-history > summary, .document-create-disclosure > summary { min-height: 44px; }
  .artifact-card { grid-template-columns: auto minmax(0, 1fr); }
  .artifact-metadata { grid-template-columns: 1fr; }
  .artifact-metadata div:last-child, .artifact-download { grid-column: 1 / -1; }
  .artifact-download { justify-self: start; }
  .auth-layout { min-height: auto; padding-top: 1rem; }
  .auth-card { padding: 1.5rem; }
  .site-footer { padding: 1rem .75rem; font-size: .75rem; }
}

@media (max-width: 420px) {
  .document-summary-table > tbody > .document-primary-row { grid-template-columns: 1fr; }
  .brand { gap: .5rem; }
  .brand-name { font-size: var(--text-xs); }
}

@media (pointer: coarse) {
  :root { --control-height: 44px; }
  input, select, textarea { font-size: var(--text-lg); }
  .table-action, .archive-action .button, .group-card-toolbar .button, .secondary-action > summary, .document-history > summary, .document-create-disclosure > summary { min-height: 44px; }
  .packing-line-meta .table-action, .disclosure-row > summary, .help-disclosure > summary { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Internal attention indicators remain readable without color. */
.attention-indicator { margin-block: .4rem; }
.attention-note { margin: .35rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.order-attention { margin-bottom: 1rem; }
.attention-fields { margin-block: .75rem; }
