:root {
  --ink: #10211d;
  --muted: #667a73;
  --line: #d9e3df;
  --canvas: #edf2ef;
  --surface: #ffffff;
  --brand: #0a6b55;
  --brand-light: #dff4eb;
  --danger: #a93129;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 90% 0, #d8eee6, transparent 30rem), var(--canvas); }
button, input { font: inherit; }
button:focus-visible, a:focus-visible, label:focus-within { outline: 3px solid rgba(10, 107, 85, 0.28); outline-offset: 3px; }
main { width: min(100% - 32px, 860px); margin: 0 auto; padding: 34px 0 60px; }
.masthead { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 26px; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 3px); align-items: center; justify-content: center; gap: 5px; width: 50px; height: 50px; border-radius: 12px; background: var(--brand); box-shadow: 0 10px 25px rgba(10, 107, 85, 0.2); }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ""; display: block; width: 3px; height: 24px; border-radius: 2px; background: white; }
.brand-mark::after { height: 16px; }
.brand-mark span { height: 29px; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(1.7rem, 5vw, 2.4rem); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 1.28rem; letter-spacing: -.025em; }
h3 { margin-bottom: 0; font-size: 1.12rem; letter-spacing: -.02em; }
.lede, .muted { color: var(--muted); line-height: 1.5; }
.lede { margin-bottom: 0; }
.scanner-link, .text-link { color: var(--brand); font-weight: 750; }
.current-card, .panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 15px 40px rgba(18, 48, 40, .07); }
.current-card { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 24px; background: linear-gradient(125deg, #fff, #edf9f4); }
.current-card p:last-child { margin: 8px 0 0; }
.status-pill, .mini-pill { display: inline-flex; border-radius: 999px; background: #ecf0ee; color: var(--muted); font-size: .75rem; font-weight: 800; }
.status-pill { padding: 8px 12px; }
.status-pill.live, .mini-pill { background: var(--brand-light); color: var(--brand); }
.panel { margin-top: 18px; padding: clamp(22px, 5vw, 32px); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.drop-zone { display: grid; place-items: center; min-height: 190px; margin-top: 24px; padding: 25px; border: 2px dashed #a9bdb5; border-radius: 12px; background: #f7faf8; cursor: pointer; text-align: center; transition: .15s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--brand); background: var(--brand-light); transform: translateY(-1px); }
.drop-zone span:last-child { margin-top: 7px; color: var(--muted); font-size: .82rem; }
.upload-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; border-radius: 50%; background: var(--brand); color: white; font-size: 1.5rem; }
.primary-button, .quiet-button { border-radius: 9px; font-weight: 800; cursor: pointer; }
.primary-button { width: 100%; min-height: 52px; margin-top: 18px; border: 0; background: var(--brand); color: white; }
.primary-button:disabled { opacity: .45; cursor: not-allowed; }
.quiet-button { min-height: 38px; padding: 8px 12px; border: 1px solid #b8c8c2; background: white; color: var(--ink); }
.message { margin-top: 18px; padding: 13px 15px; border-radius: 9px; background: #eef2f0; line-height: 1.45; }
.message.success { background: var(--brand-light); color: #07513f; }
.message.error { background: #fff0ed; color: var(--danger); }
.history { border-top: 1px solid var(--line); }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row p { margin: 6px 0 0; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.history-title { display: flex; align-items: center; gap: 9px; }
.mini-pill { padding: 4px 7px; }

.checklist-section { margin-top: 34px; padding-top: 30px; border-top: 1px solid #c9d8d2; }
.section-heading { max-width: 680px; margin-bottom: 4px; }
.section-heading h2 { font-size: clamp(1.45rem, 4vw, 1.85rem); }
.section-heading .muted { margin: 9px 0 0; }
.checklist-upload-panel { border-color: #bdd8ce; }
.field-label { display: block; margin-top: 24px; font-size: .86rem; font-weight: 800; }
.text-input { width: 100%; min-height: 48px; margin-top: 8px; padding: 11px 13px; border: 1px solid #a9bdb5; border-radius: 9px; background: #fff; color: var(--ink); }
.text-input::placeholder { color: #82938d; }
.text-input:focus { border-color: var(--brand); outline: 3px solid rgba(10, 107, 85, .18); }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.compact-drop-zone { min-height: 160px; margin-top: 20px; }
.checklist-list { overflow-x: auto; border-top: 1px solid var(--line); }
.checklist-list > .muted { margin: 18px 0 0; }
.checklist-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.checklist-table th { padding: 13px 10px; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.checklist-table td { padding: 15px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; line-height: 1.4; vertical-align: middle; overflow-wrap: anywhere; }
.checklist-table th:first-child, .checklist-table td:first-child { width: 25%; padding-left: 0; }
.checklist-table th:nth-child(2), .checklist-table td:nth-child(2) { width: 22%; }
.checklist-table th:nth-child(3), .checklist-table td:nth-child(3) { width: 12%; }
.checklist-table th:nth-child(4), .checklist-table td:nth-child(4) { width: 18%; }
.checklist-table th:nth-child(5), .checklist-table td:nth-child(5) { width: 12%; }
.checklist-table th:last-child, .checklist-table td:last-child { width: 11%; padding-right: 0; text-align: right; }
.checklist-name { display: block; color: var(--ink); font-size: .9rem; }
.checklist-filename { display: block; }
.mini-pill.archived { background: #ecf0ee; color: var(--muted); }
.archive-button { color: var(--danger); border-color: #ddb2ad; }
.archive-button:hover { background: #fff3f1; }
.empty-state { margin: 18px 0 0; padding: 18px; border-radius: 10px; background: #f7faf8; color: var(--muted); line-height: 1.45; }
.error-state { background: #fff0ed; color: var(--danger); }

.pallet-section { margin-top: 34px; padding-top: 30px; border-top: 1px solid #c9d8d2; }
.pallet-upload-panel { border-color: #bdd8ce; }
.pallet-file-input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.drop-zone[aria-disabled="true"] { opacity: .6; cursor: wait; }
.pallet-upload-results { padding: 0; margin: 20px 0 0; list-style: none; }
.pallet-upload-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.pallet-upload-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pallet-upload-heading strong { min-width: 0; overflow-wrap: anywhere; font-size: .88rem; }
.upload-status { flex: 0 0 auto; }
.upload-status.queued, .upload-status.skipped { background: #ecf0ee; color: var(--muted); }
.upload-status.uploading { background: #e8effb; color: #24559b; }
.upload-status.error { background: #fff0ed; color: var(--danger); }
.pallet-upload-row p { margin: 7px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; overflow-wrap: anywhere; }
.pallet-upload-row.error p { color: var(--danger); }
.pallet-column-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 14px; }
.pallet-column-fields .field-label { margin-top: 14px; font-size: .9rem; }
.pallet-column-fields select { min-width: 0; font-size: 1rem; }
.pallet-column-fields select:disabled { opacity: .65; }
.pallet-sample { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.pallet-sample table { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 10px; }
.pallet-sample th, .pallet-sample td { width: 50%; padding: 8px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; font-size: .9rem; vertical-align: top; }
.pallet-sample th { color: var(--brand); }
.pallet-sample tr:last-child td { border-bottom: 0; }
.upload-status.reading { background: #e8effb; color: #24559b; }
.upload-status.mapping { background: #fff4d9; color: #785400; }
.pallet-import-list { margin-top: 18px; border-top: 1px solid var(--line); }
.pallet-import-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.pallet-import-row:last-child { border-bottom: 0; }
.pallet-import-row > div { min-width: 0; }
.pallet-import-filename { display: block; overflow-wrap: anywhere; font-size: .94rem; }
.pallet-import-row p { margin: 7px 0; color: var(--muted); font-size: .82rem; line-height: 1.5; overflow-wrap: anywhere; }
.pallet-import-row .quiet-button, .pallet-list-panel .quiet-button { min-height: 44px; }
.pallet-import-row .quiet-button { flex: 0 0 auto; }
.pallet-section .quiet-button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 620px) {
  main { width: min(100% - 24px, 860px); padding-top: 20px; }
  .masthead { grid-template-columns: auto 1fr; }
  .scanner-link { grid-column: 2; }
  .current-card { align-items: flex-start; }
  .panel-heading, .history-row { align-items: flex-start; }
  .history-row { flex-direction: column; }
  .checklist-section { margin-top: 28px; padding-top: 24px; }
  .checklist-table, .checklist-table tbody, .checklist-table tr, .checklist-table td { display: block; width: 100%; }
  .checklist-table { table-layout: auto; }
  .checklist-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .checklist-table tr { padding: 15px 0; border-bottom: 1px solid var(--line); }
  .checklist-table tr:last-child { border-bottom: 0; }
  .checklist-table td,
  .checklist-table td:first-child,
  .checklist-table td:nth-child(2),
  .checklist-table td:nth-child(3),
  .checklist-table td:nth-child(4),
  .checklist-table td:nth-child(5),
  .checklist-table td:last-child { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; width: 100%; padding: 5px 0; border-top: 0; text-align: right; }
  .checklist-table td::before { flex: 0 0 38%; content: attr(data-label); color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
  .checklist-table td:last-child { padding-top: 12px; }
  .checklist-table td:last-child::before { content: ""; }
  .checklist-name, .checklist-filename { text-align: right; }
  .pallet-section { margin-top: 28px; padding-top: 24px; }
  .pallet-import-row { align-items: flex-start; flex-direction: column; }
  .pallet-upload-heading { gap: 10px; }
  .pallet-column-fields { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pallet-section .panel-heading { flex-wrap: wrap; gap: 12px; }
}
/* Batch management uses the same form and panel styling as data administration. */
#batch-list details { margin: 16px 0; }
#batch-list summary { cursor: pointer; font-weight: 650; padding: 10px 0; }
#batch-list .text-input { margin-bottom: 12px; }

#batch-list .batch-qr { margin: 16px 0; }
#batch-list .batch-qr img { display: block; max-width: 100%; height: auto; margin: 12px 0; background: white; }
