:root {
  color-scheme: light;
  --paper: #efe9d8;
  --surface: #f7f3e8;
  --ink: #212121;
  --muted: #635e53;
  --rule: #d6ceb8;
  --highlight: #e5dec9;
  --green: #265e46;
  --clay: #96472e;
  --display: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --mono: "Source Code Pro", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.55 Inter, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
.page { max-width: 1280px; margin: auto; padding: 24px 32px 48px; }
.mast, .heading, .toolbar, .actions, .dialog-head, .lane-head, .draft-row, .history-row { display: flex; align-items: center; gap: 12px; }
.mast, .heading, .dialog-head, .lane-head, .draft-row, .history-row { justify-content: space-between; }
.mast { padding-bottom: 15px; border-bottom: 1px solid var(--rule); font-size: 13px; }
.mast span, #profile, .sub, .empty, .next, .muted { color: var(--muted); }
.divider { margin: 0 6px; }
a { color: inherit; text-underline-offset: 4px; }
.heading { align-items: baseline; flex-wrap: wrap; margin: 26px 0 18px; }
h1,h2,h3 { font-family: var(--display); line-height: 1.22; margin: 0; }
h1 { font-size: clamp(32px, 5vw, 44px); font-weight: 400; letter-spacing: -1px; }
h2 { font-size: 25px; font-weight: 450; letter-spacing: -.4px; }
h3 { font-size: 16px; font-weight: 600; }
.toolbar { flex-wrap: wrap; border-block: 1px solid var(--rule); padding: 16px 0; align-items: end; }
.actions { flex-wrap: wrap; margin-left: auto; }
label { display: grid; gap: 4px; font-weight: 600; }
input,select,textarea,button { font: inherit; color: inherit; }
input,select,textarea { background: var(--surface); border: 1px solid #999280; border-radius: 2px; min-width: 0; min-height: 42px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; }
.search { width: min(320px,100%); }
button { background: var(--surface); border: 1px solid #928b79; border-radius: 2px; min-height: 42px; padding: 8px 14px; cursor: pointer; }
button:hover { background: var(--highlight); }
button.primary { color: var(--surface); background: var(--ink); border-color: var(--ink); }
button.primary:hover { background: #413f38; }
button:disabled { cursor: wait; opacity: .62; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
::selection { background: var(--highlight); }
section { margin-top: 28px; min-width: 0; }
#board { display: grid; gap: 20px; grid-template-columns: repeat(4,minmax(0,1fr)); margin-top: 16px; }
.lane { min-width: 0; border-top: 3px solid var(--lane-color,var(--ink)); }
.lane[data-stage="ready"] { --lane-color: #716343; }
.lane[data-stage="partial"] { --lane-color: var(--clay); }
.lane[data-stage="complete"] { --lane-color: var(--green); }
.lane-head { padding: 10px 0; }
.count, .invoice, .quantity, .receipt { font-family: var(--mono); }
.count { color: var(--muted); }
.order-card { display: grid; gap: 4px; width: 100%; text-align: left; overflow-wrap: anywhere; border-color: var(--rule); padding: 14px; margin-bottom: 8px; }
.invoice { font-size: 12px; color: var(--muted); }
.customer { font-size: 17px; font-weight: 600; }
.card-line { font-size: 13px; }
.next { border-top: 1px solid var(--rule); padding-top: 7px; margin-top: 4px; font-size: 12px; }
.empty { padding: 10px 0; margin: 0; }
.bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.bottom section { border-top: 1px solid var(--rule); padding-top: 18px; }
.sub { margin: 4px 0 14px; }
.draft-row { width: 100%; text-align: left; margin: 0 0 6px; padding: 10px 14px; border-color: var(--rule); overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; }
td,th { padding: 8px 6px; border-bottom: 1px solid var(--rule); text-align: right; }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
td:first-child,th:first-child { text-align: left; overflow-wrap: anywhere; }
td:not(:first-child) { font-family: var(--mono); }
.stage-picker { display: none; }
dialog { width: min(550px,calc(100% - 24px)); max-height: 90dvh; overflow-y: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--muted); padding: 24px; }
dialog::backdrop { background: rgb(32 30 23 / 48%); }
.dialog-head { align-items: start; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
#panel-title { overflow-wrap: anywhere; }
#panel-body { overflow-wrap: anywhere; }
#panel-body h3 { margin: 18px 0 7px; }
#panel-body form, .field-list { display: grid; gap: 14px; }
#panel-body form { margin: 16px 0 0; }
.form-line { display: grid; grid-template-columns: minmax(0,1fr) minmax(80px,.4fr) auto; align-items: end; gap: 8px; }
.history-row { border-top: 1px solid var(--rule); padding: 10px 0; flex-wrap: wrap; }
.history-row p { margin: 0; }
.detail-actions { margin-top: 16px; }
.back-detail, .review-history { margin-top: 14px; }
.review-history summary { cursor: pointer; }
#feedback:empty, #notice:empty { display: none; }
.error, .review { color: var(--clay); font-weight: 600; }
#no-match { padding: 12px 0; font-weight: 600; }
@media (max-width: 820px) {
  #board, .bottom { grid-template-columns: 1fr; }
  .bottom { gap: 0; }
  .stage-picker { display: grid; margin-top: 12px; max-width: 360px; }
  .lane:not(.selected) { display: none; }
}
@media (max-width: 540px) {
  .page { padding: 16px; }
  .mast { gap: 6px; flex-wrap: wrap; }
  .heading { margin: 20px 0 14px; gap: 4px; }
  .search { width: 100%; }
  .actions { margin-left: 0; }
  dialog { padding: 16px; }
  .form-line { grid-template-columns: minmax(0,1fr) 88px; }
  .form-line button { grid-column: 1 / -1; justify-self: start; }
}
