:root {
  color-scheme: light;
  --ink: #202b28;
  --muted: #65736c;
  --line: #e5eae7;
  --paper: #f7f9f8;
  --panel: #fff;
  --accent: #23634c;
  --accent-hover: #194b39;
  --accent-soft: #edf5f0;
  --danger: #b14337;
  --danger-soft: #fff0ed;
  --shadow: 0 8px 32px rgb(26 48 37 / 9%), 0 2px 8px rgb(26 48 37 / 4%);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif; -webkit-font-smoothing: antialiased; }
.shell { width: min(1280px, calc(100% - 64px)); margin: 0 auto; padding: 36px 0 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.brand-heading { display: flex; align-items: center; gap: 16px; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: var(--panel); background: var(--accent); flex-shrink: 0; }
.brand-mark svg { width: 30px; height: 30px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: 26px; line-height: 1.35; letter-spacing: -.03em; font-weight: 650; }
h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
h3 { margin: 0; font-size: 14px; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.back-link, .text-link { color: var(--accent); text-decoration: none; font-size: 13px; }
.back-link { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); white-space: nowrap; }
.back-link:hover, .text-link:hover { color: var(--accent-hover); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.login-panel { max-width: 600px; margin: 64px auto; padding: 32px; }
.login-panel p { color: var(--muted); margin: 12px 0 24px; }
label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel); color: var(--ink); font: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 200px; padding: 16px; line-height: 1.9; font: 13px/1.9 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--paper); }
button { border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 550; cursor: pointer; transition: background .15s, border-color .15s; }
button:disabled, select:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary { background: var(--accent); color: var(--panel); box-shadow: 0 2px 4px rgb(35 99 76 / 12%); }
.primary:hover { background: var(--accent-hover); }
.primary span { margin-left: 16px; }
.secondary { background: var(--panel); border-color: var(--line); color: var(--ink); }
.secondary:hover, .quiet-button:hover { background: var(--paper); border-color: var(--muted); }
.quiet-button { color: var(--muted); background: transparent; font-size: 12px; }
.danger { background: var(--danger); color: var(--panel); }
.small { padding: 5px 10px; font-size: 12px; }
.shop-panel { position: relative; display: grid; grid-template-columns: minmax(220px, 360px) minmax(150px, 220px) 1fr auto; align-items: end; gap: 20px; padding: 18px 24px; z-index: 5; }
.selector-field { min-width: 0; }
.shop-panel label { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.shop-panel > .muted { align-self: center; margin-top: 20px; justify-self: end; font-size: 11px; }
.shop-panel > button { margin-bottom: 1px; }
.picker { position: relative; }
.picker-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; height: 40px; padding: 0 12px; background: var(--panel); color: var(--ink); border-color: var(--line); font-size: 13px; text-align: left; }
.picker-trigger > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-trigger:hover { border-color: var(--muted); }
.picker-trigger[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.picker-trigger svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.5; flex-shrink: 0; transition: transform .15s; }
.picker-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.picker-popover { position: absolute; top: calc(100% + 8px); left: 0; width: 100%; min-width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); z-index: 20; }
.picker-search { display: flex; align-items: center; gap: 8px; margin: 2px 4px 6px; padding: 0 4px; border-bottom: 1px solid var(--line); }
.picker-search svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.picker-search input { height: 38px; border: 0; padding: 6px 0; border-radius: 0; font-size: 12px; background: transparent; }
.picker-search input:focus-visible { outline: none; }
.picker-options { max-height: min(256px, 40vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.picker-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin: 2px 0; padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; overflow-wrap: anywhere; }
.picker-option:hover, .picker-option.is-highlighted { background: var(--paper); }
.picker-option[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.picker-check { color: var(--accent); }
.picker-empty { margin: 0; padding: 24px 8px; color: var(--muted); text-align: center; font-size: 12px; }
.picker-count { margin-top: 6px; padding: 8px 10px 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.tabs { display: flex; gap: 28px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.tab { padding: 12px 2px; border-radius: 0; background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; font-size: 13px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.enrollment-origin { display: inline-block; padding: 4px 9px; border-radius: 6px; background: #f1f3f2; color: var(--muted); font-size: 11px; white-space: nowrap; }
.enrollment-origin[data-origin="workbench"] { background: var(--accent-soft); color: var(--accent); }
.enrollment-origin[data-origin="amazon"] { background: #edf2fb; color: #365d94; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-description { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.subtle-badge { padding: 4px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.batch-builder { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.product-catalog { min-width: 0; }
.catalog-search { display: flex; align-items: center; gap: 8px; }
.catalog-search input { min-width: 0; flex: 1; font-size: 12px; }
.catalog-search button { flex-shrink: 0; font-size: 12px; }
#products-status { margin: 14px 0 0; font-size: 11px; }
.product-catalog .table-wrap { max-height: 540px; overflow: auto; overscroll-behavior: contain; margin: 14px -12px 0; }
#products-table th { position: sticky; top: 0; z-index: 1; }
#products-table .check-column { width: 44px; padding-right: 4px; text-align: center; vertical-align: middle; }
.check-column input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
#products-table .product-cell { min-width: 240px; }
#products-table .sku-cell { width: 210px; min-width: 180px; max-width: 260px; color: var(--muted); font: 11px/1.7 ui-monospace, monospace; }
#products-table .product-title, .selected-product .product-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#products-table tbody tr:hover { background: var(--paper); }
#products-table tbody tr.is-selected { background: var(--accent-soft); }
.catalog-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 18px; }
.catalog-footer .muted { font-size: 10px; }
.selection-panel { padding: 20px; border-top: 3px solid var(--accent); }
.selection-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.selection-heading h2 { font-size: 15px; }
.count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 5px; border-radius: 6px; color: var(--accent); background: var(--accent-soft); font-size: 11px; }
.selection-empty { padding: 42px 12px; text-align: center; color: var(--muted); }
.selection-empty > span { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px dashed var(--line); border-radius: 10px; font-size: 22px; }
.selection-empty p { margin: 12px 0 4px; font-size: 12px; }
.selection-empty small { font-size: 11px; }
#selected-products { max-height: 520px; overflow-y: auto; overscroll-behavior: contain; }
.selected-product { padding: 18px 0; border-bottom: 1px solid var(--line); }
.selected-product:last-child { border-bottom: 0; }
.selected-product .product-overview { gap: 10px; }
.selected-product .product-image { width: 44px; height: 44px; flex-basis: 44px; }
.selected-product .product-title { font-size: 11px; }
.quantity-row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.quantity-row label { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 11px; font-weight: 400; color: var(--muted); }
.quantity-row input { width: 76px; padding: 6px 8px; font-size: 12px; color: var(--ink); }
.quantity-row input:invalid { border-color: var(--danger); }
.selection-footer { padding-top: 16px; border-top: 1px solid var(--line); }
.selection-footer > p { margin: 0 0 14px; font-size: 11px; line-height: 1.8; }
.selection-footer .primary { width: 100%; }
#batch-status { margin: 10px 0 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.enrollment-filters { align-items: end; }
.enrollment-filters label { margin: 0; min-width: 132px; max-width: 100%; }
.enrollment-filters select { display: block; margin-top: 6px; }
.enrollment-filters input { width: min(100%, 260px); }
.enrollment-filters [role="status"] { align-self: center; }
.table-wrap { overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 16px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { padding-top: 10px; padding-bottom: 10px; color: var(--muted); background: var(--paper); font-size: 11px; font-weight: 500; white-space: nowrap; }
th:first-child { border-radius: 6px 0 0 6px; }
th:last-child { border-radius: 0 6px 6px 0; }
.summary { color: var(--muted); line-height: 1.7; font-size: 12px; margin-top: 8px; }
.summary ul { margin: 8px 0 0; padding-left: 20px; }
.muted { color: var(--muted); font-size: 12px; }
.error { margin: 16px 0 0; padding: 12px 16px; border: 1px solid var(--danger-soft); border-radius: 8px; background: var(--danger-soft); color: var(--danger); white-space: pre-wrap; font-size: 12px; }
.product-column { width: 38%; min-width: 320px; }
.product-overview { display: flex; align-items: flex-start; gap: 14px; }
.product-image { width: 56px; height: 56px; flex: 0 0 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.product-placeholder { display: grid; place-items: center; color: var(--muted); font-size: 10px; background: var(--paper); }
.product-copy { min-width: 0; }
.product-provenance { display: grid; gap: 2px; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.listing-status { display: inline-block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.sku-list { display: grid; gap: 6px; max-width: 260px; }
.sku-value { display: block; max-width: 100%; white-space: nowrap; overflow-x: auto; font: 11px/1.7 ui-monospace, monospace; }
.product-title { font-size: 12px; font-weight: 550; line-height: 1.6; overflow-wrap: anywhere; }
.asin { display: block; margin-top: 5px; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.product-details { margin-top: 8px; }
.product-details summary { width: fit-content; color: var(--accent); font-size: 11px; cursor: pointer; }
.product-details dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 0; padding: 14px; border-radius: 8px; background: var(--paper); font-size: 11px; }
.product-details dt { color: var(--muted); }
.product-details dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.status-note { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.empty-state { padding: 40px 16px; text-align: center; color: var(--muted); }
#enrollment-search { flex: 1; min-width: 180px; max-width: 360px; font-size: 12px; }
#enrollments-table { min-width: 1050px; }
@media (max-width: 1000px) {
  .shop-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .shop-panel > .muted { grid-column: 1 / 3; grid-row: 2; justify-self: start; margin-top: 0; }
  .shop-panel > button { grid-column: 3; grid-row: 1; }
  .batch-builder { grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
}
@media (max-width: 820px) { .batch-builder { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .shell { width: calc(100% - 32px); padding-top: 24px; }
  .topbar { align-items: flex-start; gap: 12px; margin-bottom: 24px; }
  .brand-heading { gap: 10px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .brand-mark svg { width: 24px; height: 24px; }
  h1 { font-size: 20px; }
  .eyebrow { font-size: 9px; }
  .subtitle { font-size: 11px; }
  .back-link { padding: 6px 8px; font-size: 11px; }
  .panel { padding: 18px; }
  .shop-panel { grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); gap: 14px; }
  .shop-panel > .muted { grid-column: 1 / 3; grid-row: 2; margin: 0; font-size: 10px; }
  .shop-panel > button { grid-column: 1 / 3; grid-row: 3; justify-self: start; margin: -8px 0 0 -10px; padding: 4px 10px; }
  #marketplace-popover { left: auto; right: 0; min-width: 180px; }
  .picker-popover { min-width: min(260px, calc(100vw - 72px)); }
  .picker-options { max-height: min(216px, 35vh); }
  .tabs { margin-bottom: 18px; }
  .section-heading { flex-direction: column; gap: 10px; margin-bottom: 20px; }
  .catalog-search { flex-wrap: wrap; }
  .catalog-search input { flex-basis: calc(100% - 68px); }
  #refresh-products-button { padding: 4px 8px; }
  .product-catalog .table-wrap { max-height: 360px; margin-left: -8px; margin-right: -8px; }
  #products-table .product-cell { min-width: 190px; }
  #products-table .sku-cell { min-width: 100px; }
  #products-table .product-overview { gap: 10px; }
  #products-table .product-image { width: 44px; height: 44px; flex-basis: 44px; }
  .product-column { min-width: 260px; }
  .product-details dl { grid-template-columns: 1fr; }
  .actions button { min-height: 40px; }
  #enrollments-table, #enrollments-table tbody { display: block; min-width: 0; }
  #enrollments-table thead { display: none; }
  #enrollments-table tbody { display: grid; gap: 16px; }
  #enrollments-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); padding-bottom: 16px; }
  #enrollments-table td { min-width: 0; padding: 8px; border: 0; overflow-wrap: anywhere; }
  #enrollments-table td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
  #enrollments-table .product-cell, #enrollments-table td[colspan] { grid-column: 1 / -1; width: auto; }
  #enrollments-table .product-cell::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

.preparation-panel { border-color: #cddfd4; background: linear-gradient(115deg, #f1f8f3, #fff 70%); }
.preparation-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.preparation-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; margin-top: 24px; }
.preparation-form > div { width: 180px; }
.preparation-form .preparation-filter { flex: 1; min-width: 220px; }
.preparation-form label { font-size: 11px; color: var(--muted); }
.preparation-form label span { font-weight: 400; margin-left: 6px; opacity: .7; }
.preparation-form input { height: 42px; font-size: 12px; }
.preparation-form button { min-height: 42px; }
.preparation-status { margin: 16px 0 0; color: var(--muted); font-size: 12px; }
#preparation-results { margin-top: 18px; padding-top: 16px; border-top: 1px solid #dbe8df; }
#preparation-results summary { color: var(--accent); font-size: 12px; cursor: pointer; }
#preparation-results .table-wrap { max-height: 360px; overflow: auto; }
#preparation-table { min-width: 600px; }
#preparation-table .product-cell { width: 55%; }
.preparation-ready { color: var(--accent); font-weight: 600; }
@media (max-width: 640px) {
  .preparation-heading { flex-direction: column; gap: 12px; }
  .preparation-form { gap: 12px; margin-top: 20px; }
  .preparation-form .preparation-filter { flex-basis: 100%; min-width: 0; }
  .preparation-form > div { flex: 1; min-width: 150px; }
  .preparation-form button { flex: 1; white-space: nowrap; font-size: 12px; }
}

/* Nightly preparation uses persisted results; the page does not own the scan. */
.nightly-panel { padding: 26px 28px 18px; margin-bottom: 24px; border-top: 3px solid var(--accent); }
.nightly-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.nightly-heading h2 { font-size: 21px; }
.scan-state { flex-shrink: 0; padding: 5px 10px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.scan-state[data-status="partial"], .scan-state[data-status="blocked"], .scan-state[data-status="failed"], .scan-state[data-status="deadline"] { background: #fff5e8; color: #98601c; }
.scan-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin: 16px 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.scan-count { color: var(--muted); font-size: 12px; }
.scan-count strong { margin: 0 4px; color: var(--ink); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.nightly-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.scan-search-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; align-items: end; gap: 12px; margin-top: 16px; }
.scan-search-form label { margin-bottom: 6px; color: var(--muted); }
.scan-search-form input { font-size: 12px; }
.scan-search-actions { display: flex; align-items: center; gap: 4px; }
.scan-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.scan-page-size { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.scan-page-size select { width: auto; padding: 5px 8px; font-size: 12px; }
.scan-page-buttons { display: flex; gap: 8px; margin-left: auto; }
#scan-table { min-width: 1050px; }
#scan-table .product-cell { min-width: 260px; }
#scan-table .sku-cell { min-width: 110px; max-width: 160px; overflow-wrap: anywhere; color: var(--muted); }
.scan-filters { display: flex; gap: 4px; padding: 3px; border-radius: 8px; background: var(--paper); }
.scan-filter { padding: 7px 12px; background: transparent; color: var(--muted); border: 0; border-radius: 6px; font: inherit; font-size: 12px; cursor: pointer; }
.scan-filter.active { background: var(--panel); box-shadow: 0 1px 4px #203c3210; color: var(--ink); font-weight: 600; }
.scan-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.scan-stale { display: block; margin-top: 4px; color: var(--muted); }
.scan-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.scan-footer p { color: var(--muted); font-size: 11px; margin: 0; }
#scan-status { font-size: 12px; margin: 12px 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .nightly-panel { padding: 20px 16px 16px; }
  .nightly-heading { flex-direction: column; gap: 12px; }
  .nightly-heading h2 { font-size: 19px; }
  .scan-footer { align-items: flex-start; flex-direction: column; }
  .scan-search-form { grid-template-columns: minmax(0, 1fr); }
  .scan-pagination { gap: 12px; }
  .scan-page-buttons { width: 100%; margin-left: 0; justify-content: space-between; }
}
.fleet-details { color: var(--muted); font-size: 12px; }
.fleet-details[open] { flex-basis: 100%; min-width: 0; }
.fleet-details summary { cursor: pointer; width: fit-content; padding: 4px 0; }
.fleet-table { max-height: 300px; margin-top: 8px; }
.scan-shop-link { padding: 0; background: transparent; border: 0; font: inherit; cursor: pointer; text-align: left; }
.scan-results-table { max-height: 480px; margin-top: 12px; }
.scan-enrollment { min-width: 240px; width: 250px; }
.scan-enrollment-controls { display: flex; align-items: flex-end; gap: 8px; }
.scan-quantity-label { flex: 0 0 76px; margin: 0; font-size: 11px; color: var(--muted); }
.scan-quantity-label input { display: block; width: 76px; margin-top: 6px; padding: 8px; font-size: 14px; }
.scan-enrollment-controls button { min-height: 38px; white-space: nowrap; }
.scan-enrollment-status { margin: 8px 0 0; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.scan-enrollment-status.is-error { color: var(--danger); }
@media (max-width: 640px) {
  .scan-results-table { max-height: none; overflow: visible; }
  #scan-table, #scan-table tbody { display: block; min-width: 0; }
  #scan-table thead { display: none; }
  #scan-table tbody { display: grid; gap: 16px; }
  #scan-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); padding-bottom: 16px; }
  #scan-table td { min-width: 0; max-width: none; padding: 8px; border: 0; overflow-wrap: anywhere; }
  #scan-table td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
  #scan-table .product-cell, #scan-table .scan-enrollment { grid-column: 1 / -1; min-width: 0; width: auto; }
  #scan-table .product-cell::before, #scan-table .scan-enrollment::before { display: none; }
  .scan-enrollment-controls button, .scan-quantity-label input { min-height: 44px; font-size: 16px; }
}

/* Preview, confirmation and results share the browser's accessible modal. */
body:has(#enrollment-dialog[open]) { overflow: hidden; }
.enrollment-dialog { width: min(1120px, calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 64px); padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
.enrollment-dialog[open] { display: flex; flex-direction: column; }
.enrollment-dialog::backdrop { background: rgb(20 38 30 / 48%); }
.enrollment-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 28px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.enrollment-dialog-header h2 { font-size: 22px; }
#enrollment-dialog-scope { margin: 6px 0 0; }
.dialog-close { width: 40px; height: 40px; padding: 0; flex-shrink: 0; font-size: 26px; line-height: 1; }
#enrollment-dialog-error { margin: 16px 28px 0; max-height: 25dvh; overflow-y: auto; flex-shrink: 0; }
.enrollment-dialog-body { padding: 24px 28px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.preview-loading { padding: 56px 16px; text-align: center; }
.preview-loading h3 { margin-top: 20px; font-size: 17px; }
.preview-loading p { color: var(--muted); }
.loading-ring { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: preview-spin 1s linear infinite; }
@keyframes preview-spin { to { transform: rotate(360deg); } }
.preview-overview { display: grid; grid-template-columns: 1fr 1fr 1.5fr; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.preview-overview > div { padding: 16px 20px; }
.preview-overview > div + div { border-left: 1px solid var(--line); }
.preview-overview span { display: block; color: var(--muted); font-size: 12px; }
.preview-overview strong { display: block; margin-top: 4px; font-size: 24px; font-weight: 600; }
#preview-notice { margin-bottom: 0; }
.enrollment-table .product-column { width: 34%; min-width: 260px; }
.enrollment-table .product-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.enrollment-table .product-provenance { display: none; }
.enrollment-table .product-image { width: 48px; height: 48px; flex-basis: 48px; }
.enrollment-table td:last-child { min-width: 140px; overflow-wrap: anywhere; }
.enrollment-check { display: inline-block; padding: 4px 8px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; font-size: 11px; }
.enrollment-check.blocked { color: var(--danger); background: var(--danger-soft); }
.enrollment-dialog-footer { flex-shrink: 0; padding: 16px 28px 20px; border-top: 1px solid var(--line); background: var(--panel); }
#enrollment-dialog-note { margin: 0 0 12px; }
.enrollment-dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.enrollment-dialog-actions > span:not(:empty) { margin-right: auto; }
.enrollment-dialog-actions button { min-height: 42px; }
#reopen-enrollment-button { width: 100%; margin-top: 12px; }
@media (max-width: 640px) {
  .enrollment-dialog { width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .enrollment-dialog-header { padding: 20px 16px 16px; }
  .enrollment-dialog-header h2 { font-size: 20px; }
  .enrollment-dialog-body { flex: 1; padding: 16px; }
  #enrollment-dialog-error { margin: 12px 16px 0; }
  .preview-overview { grid-template-columns: 1fr 1fr; }
  .preview-overview > div { padding: 12px 16px; }
  .preview-overview > div:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .preview-overview strong { font-size: 22px; }
  .enrollment-table, .enrollment-table tbody { display: block; }
  .enrollment-table thead { display: none; }
  .enrollment-table tbody { display: grid; gap: 16px; }
  .enrollment-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .enrollment-table td { min-width: 0; padding: 8px; border: 0; overflow-wrap: anywhere; }
  .enrollment-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
  .enrollment-table .product-cell, .enrollment-table td:last-child { grid-column: 1 / -1; min-width: 0; }
  .enrollment-table .product-cell::before { display: none; }
  .enrollment-table .product-overview { gap: 10px; }
  .enrollment-dialog-footer { padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
  .enrollment-dialog-actions { gap: 8px; }
  .enrollment-dialog-actions > span:not(:empty) { flex-basis: 100%; }
  .enrollment-dialog-actions button { flex: 1; padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { .loading-ring { animation: none; } }
