@import url("/site-assets/brand.css");

:root {
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  --surface: var(--sheet);
  --line: var(--rule);
  --sand: #faf0d8;
  --sand-text: #624a14;
  --error: #8b241d;
  line-height: 1.5;
}

* { box-sizing: border-box; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
body { padding-bottom: env(safe-area-inset-bottom, 0px); }
fieldset { min-width: 0; max-width: 100%; }
h1, h2, h3 { line-height: 1.16; }
button, input, select, textarea { font: inherit; }
button:not(:disabled) { cursor: pointer; }
a { color: var(--link); text-underline-offset: .19em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.purchase-grid-table { min-width: 770px; }
.purchase-grid-table input, .purchase-grid-table select { min-width: 75px; }
.purchase-grid-table .grid-item { min-width: 155px; }
#grid-editor { padding-bottom: 32px; }
.wrap { width: min(1312px, calc(100% - 64px)); margin-inline: auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px); }
.header-content { display: flex; align-items: center; justify-content: space-between; min-height: 65px; gap: 12px; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.brand { color: var(--ink); font: 800 1.8rem/1 var(--display); letter-spacing: -.06em; text-decoration: none; white-space: nowrap; }
.workspace-label { font-size: 13px; color: var(--muted); }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-block: 38px 27px; }
.intro h1, .auth .panel-heading > :is(h1, h2), #workspace-start h2 { font-family: var(--display); font-weight: var(--heading-weight); }
.intro h1 { font-size: clamp(36px,4.6vw,58px); letter-spacing: -.043em; margin-bottom: 7px; }
.auth .panel-heading > :is(h1, h2) { font-size: 2.3rem; }
.intro p { max-width: 590px; color: var(--muted); }
.workspace { display: grid; grid-template-columns: 234px minmax(0,1fr); align-items: start; gap: 18px; padding-bottom: 44px; }
.workspace > * { min-width: 0; }
.panel, .rail { min-width: 0; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.rail { padding: 13px; }
.rail-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.rail h2 { font-size: 15px; }
.rail p { font-size: 13px; }
.rail nav { display: grid; gap: 5px; }
.saved {
  display: block; width: 100%; min-width: 0; overflow-wrap: anywhere; text-align: left; padding: 8px 9px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--sheet); color: var(--ink); line-height: 1.3;
}
.saved[aria-current="true"] { background: var(--tint); border-color: var(--strong-rule); }
.saved strong, .saved small { display: block; }
.saved small { color: var(--muted); margin-top: 2px; }
.panel { padding: 23px; }
.panel + .panel { margin-top: 14px; }
.panel-heading { display: flex; align-items: flex-start; flex-wrap: wrap; justify-content: space-between; gap: 5px 18px; margin-bottom: 17px; }
.panel-heading h2 { font-size: 24px; letter-spacing: -.024em; overflow-wrap: anywhere; }
.panel-heading p { width: 100%; color: var(--muted); font-size: 14px; }
.panel-heading .ref { width: auto; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.button {
  display: inline-flex; justify-content: center; align-items: center; text-decoration: none; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 12px; color: var(--ink); font-weight: 650; font-size: 14px; line-height: 1.3;
}
.button.small { padding: 5px 7px; font-size: 12px; }
.button.secondary { flex: none; }
.button:hover:not(:disabled) { background: var(--tint); }
.button.primary { background: var(--accent); color: var(--sheet); border-color: var(--accent); padding: 10px 14px; }
.button.primary:hover:not(:disabled) { background: var(--accent-strong); }
.button:disabled { opacity: .55; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.case-fields { grid-template-columns: repeat(3,minmax(0,1fr)) minmax(100px,.58fr); }
label { display: block; font-size: 13px; font-weight: 650; }
input:not([type="checkbox"]), select { display: block; width: 100%; min-width: 0; margin-top: 5px; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 7px; padding: 8px; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
input[type="file"]::file-selector-button { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--tint); color: var(--ink); margin-right: 7px; }
.file-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-top: 18px; }
.file-fields > div { background: var(--paper); padding: 12px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.file-fields a { display: inline-block; margin-top: 6px; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 14px; }
#channel-connection-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: 8px; align-items: stretch; }
#channel-connection-links .button { width: 100%; overflow-wrap: anywhere; }
.notice { background: var(--good-wash); padding: 8px 12px; border-radius: 7px; margin-bottom: 12px; font-size: 14px; overflow-wrap: anywhere; }
.notice.error { background: #faeeea; color: var(--error); border: 1px solid #e2b4ab; border-inline-start: 4px solid var(--error); font-weight: 500; }
.metrics {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); margin-bottom: 16px;
}
.metrics div { padding: 9px 12px; min-width: 0; overflow-wrap: anywhere; }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics dt { font-size: 12px; color: var(--muted); }
.metrics dd { font-size: 21px; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.metrics .flag { background: var(--sand); color: var(--sand-text); }
.metrics .flag dt { color: var(--sand-text); }
.scroll-table { max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-table:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
table { display: table; border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; padding: 7px 9px; }
thead th { background: var(--paper); font-size: 12px; color: var(--muted); }
tbody th { min-width: 107px; }
tbody th small { display: block; font-weight: 400; color: var(--muted); }
td details { min-width: 125px; }
summary { cursor: pointer; color: var(--link); }
.source-row { display: block; margin-top: 3px; min-width: 140px; overflow-wrap: anywhere; }
.claim-builder { margin-top: 16px; }
.claim-builder h3, .credit-entry h3 { font-size: 17px; margin-bottom: 4px; }
.short-options { display: grid; gap: 7px; margin-top: 9px; }
.check-label { display: flex; align-items: center; gap: 8px; }
.status-text { display: inline-block; padding: 4px 7px; border-radius: 6px; background: var(--sand); color: var(--sand-text); font-size: 12px; }
.status-text.settled { background: var(--good-wash); color: var(--good); }
.credit-entry { margin-top: 19px; border-top: 1px solid var(--line); padding-top: 13px; }
.credit-entry .fields { margin-top: 10px; }
.credit-wide { grid-column: 1 / -1; }
.credit-entry > label { max-width: 300px; }
.ledger-ref { white-space: normal; overflow-wrap: anywhere; }
.small-line { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.top-nav, .account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.account { justify-content: flex-end; }
.top-nav .button { border-color: transparent; }
.top-nav [aria-current="page"] { background: var(--tint); border-color: var(--strong-rule); }
.main-notice { margin-top: 13px; margin-bottom: 0; }
.auth { max-width: 420px; margin: 48px auto; }
.auth label + label { margin-top: 12px; }
.source-section, .inventory-spaced { margin-top: 14px; }
.purchasing-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.purchasing-action { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.purchasing-action h3 { font-size: 1rem; }
.purchasing-action > * + * { margin-top: 6px; }
#channel-forecast td small { display: block; color: var(--muted); }
#channel-forecast code { overflow-wrap: anywhere; }
#channel-scenario fieldset { min-width: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 8px; }
#channel-scenario legend { padding-inline: 5px; color: var(--muted); font-size: 13px; font-weight: 650; }
#shopify-scope-list, #variant-results, #mapping-list, #catalog-file-history { overflow-wrap: anywhere; }
.source-controls { margin: 10px 0; }
.source-controls label:last-child { max-width: 150px; }
.evidence-layout, .inventory-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; align-items: start; }
.source-image { width: 100%; max-height: 360px; object-fit: contain; display: block; margin-block: 7px; background: #fff; }
.original-preview { padding: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.original-preview p { margin-top: 6px; }
textarea { width: 100%; margin-top: 5px; display: block; resize: vertical; border: 1px solid var(--line);
  border-radius: 7px; padding: 9px; color: var(--ink); background: var(--sheet); }
.source-confidence { margin-top: 10px; font-size: 13px; }
.source-confidence ul { padding-left: 18px; }
.review-suggestion { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 10px; margin-top: 13px; padding: 10px; background: var(--good-wash); border-radius: 7px; font-size: 14px; }
.review-suggestion p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.inventory-layout { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 15px; padding-bottom: 44px; }
.inventory-layout .panel { min-width: 0; margin: 0; }
.inventory-main, .full { grid-column: 1 / -1; }
.compact-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 9px; }
.compact-form > label { flex: 1 1 170px; max-width: 320px; overflow: hidden; }
.import-form { margin-top: 14px; }
.import-form a { align-self: center; font-size: 13px; }
.inventory-pair > form + form { border-left: 1px solid var(--line); padding-left: 14px; }
.item-labels { display: flex; flex-wrap: wrap; margin-top: 15px; gap: 5px; }
.item-labels button { max-width: 100%; overflow-wrap: anywhere; }

@media (max-width: 960px) {
  .wrap { width: calc(100% - 36px); }
  .workspace { grid-template-columns: 192px minmax(0,1fr); }
  .case-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .file-fields { grid-template-columns: 1fr; }
  .panel { padding: 17px; }
}
@media (max-width: 768px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 1rem;
    min-block-size: 44px;
  }
  .button,
  .button.small,
  .quantity-review-action,
  .check-label,
  .saved,
  .site-header a:not(.brand) {
    min-block-size: 44px;
  }
  .site-header a:not(.brand) {
    display: inline-flex;
    align-items: center;
  }
  summary {
    min-block-size: 44px;
    padding-block: 10px;
  }
}
@media (max-width: 680px) {
  .wrap { width: calc(100% - 26px); }
  .intro { display: block; padding-block: 23px 16px; }
  .intro p { font-size: 14px; }
  .intro .button { margin-top: 11px; }
  .workspace { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .rail nav { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metrics div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metrics div:nth-child(3) { border-left: 0; }
  .header-content { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; padding-block: 8px; }
  .account { gap: 6px; font-size: 13px; }
  .top-nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; scrollbar-width: thin; }
  .top-nav > * { flex: 0 0 auto; white-space: nowrap; }
  .workspace-label { display: none; }
  .inventory-layout, .evidence-layout, .inventory-pair { grid-template-columns: minmax(0,1fr); }
  .inventory-pair > form + form { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
}
@media (max-width: 640px) {
  .fields, .case-fields { grid-template-columns: minmax(0,1fr); }
  #channel-connection-links { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
}
.input-row { margin-block: 0.7rem; padding: 0.85rem; border: 1px solid var(--line); border-radius: 8px; min-width: 0; max-width: 100%; }
.input-group, .quantity-field, .staff-row { margin-block: 1.1rem; }
.quantity-page { display: inline-block; position: relative; max-width: 100%; }
.quantity-page img { display: block; width: min(600px, 100%); height: auto; touch-action: none; cursor: crosshair; }
.quantity-outline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.quantity-outline rect { stroke: var(--focus); stroke-width: 2px; fill: var(--focus-fill); }
.quantity-outline [data-region="original"] { stroke: #b04727; stroke-dasharray: 4 2; }
.quantity-outline [data-region="unit"] { stroke: #1b715d; }
.quantity-field { display: grid; grid-template-columns: minmax(70px, 145px) 1fr; gap: 1rem; align-items: start; }
.quantity-field img { max-width: 100%; max-height: 140px; }
.quantity-crops { display: grid; gap: .75rem; }
.quantity-crops figure { margin: 0; }
.quantity-crops figcaption { color: var(--muted); font-size: .85rem; }
@media (max-width: 650px) { .quantity-field { grid-template-columns: 1fr; } }
/* Layout refinements for the current audit and receiving markup. */
#review .panel-heading:has(.ref) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  row-gap: 5px;
}
#review .panel-heading:has(.ref) h2 { grid-area: 1 / 1; }
#review .panel-heading:has(.ref) .ref { grid-area: 2 / 1; }
#review .panel-heading:has(.ref) .actions { grid-area: 1 / 2 / span 2; margin: 0; }
#review .panel-heading:has(.ref) > p:not(.ref) { grid-column: 1 / -1; }
#review .panel-heading .ref { overflow-wrap: anywhere; }

.audit-exceptions { display: none; }
.invoice-layout { display: grid; gap: 1rem; }
.line-evidence { padding: .85rem; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; }
.line-evidence dt { color: var(--muted); font-size: 13px; margin-top: .7rem; }
.line-evidence dd { margin: 0; font-weight: 650; }
.line-evidence dd small { display: block; font-weight: 400; color: var(--muted); }
.inspect-line { margin-top: .35rem; white-space: nowrap; }
.inspect-line[aria-pressed="true"] { background: var(--tint); border-color: var(--accent); }
@media (min-width: 1170px) {
  .invoice-layout { grid-template-columns: minmax(0, 1fr) minmax(180px, .37fr); align-items: start; }
}
.evidence-note { margin-block: 7px 12px; }
.quantity-field img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
#quantity-review > summary {
  font-weight: 650;
  padding: 9px 0;
}
.crop-controls { margin-block: 10px; }
.crop-controls summary { padding-block: 5px; }
.scroll-hint { display: none; }

@media (max-width: 680px) {
  .line-evidence, .inspect-line { display: none; }
  .line-evidence.linked-evidence { display: block; }
  #review .panel-heading:has(.ref) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  #review .panel-heading:has(.ref) .ref { order: -1; }
  #review .panel-heading:has(.ref) .actions { margin-block: 4px 2px; }
  .intro h1 { font-size: clamp(29px, 8.5vw, 38px); }
  #review .panel-heading .button { padding-inline: 10px; }
  #review .metrics dt { font-size: 13px; }
  #review .metrics dd { font-size: 23px; }
  #quantity-review > summary { min-block-size: 44px; }
  .quantity-field { grid-template-columns: minmax(0, 1fr); }
  .quantity-crops { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
  .quantity-field img { max-height: 180px; }
  #quantity-crop .actions > .button,
  .quantity-field .actions > .button { flex: 1 1 100%; }
  .scroll-table { overscroll-behavior-inline: contain; }
  .scroll-hint { display: block; margin-block: 9px 4px; }
  .audit-exceptions { display: grid; gap: 8px; margin-block: 14px; }
  .audit-exceptions h3 { font-size: 16px; }
  .audit-exception {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
  }
  .audit-exception header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; }
  .audit-exception .status-text { font-weight: 650; }
  .audit-exception dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-block: 8px;
    font-variant-numeric: tabular-nums;
  }
  .audit-exception dt { font-size: 13px; color: var(--muted); }
  .audit-exception dd { font-size: 17px; font-weight: 650; }
  .audit-exception summary { padding-block: 12px; }
}

.break-word { overflow-wrap: anywhere; }
