:root {
  --ink: #1d2330;
  --muted: #5d6676;
  --paper: #faf8f4;
  --card: #ffffff;
  --line: #e4e0d6;
  --accent: #d98b1f;
  --accent-ink: #ffffff;
  --ok: #2e7d4f;
  --bad: #b3261e;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef0f4; --muted: #a7afbd; --paper: #171b23; --card: #20262f; --line: #323a46;
  }
}
:root[data-theme="dark"] {
  --ink: #eef0f4; --muted: #a7afbd; --paper: #171b23; --card: #20262f; --line: #323a46;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
a { color: inherit; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--muted); }
nav a:hover { color: var(--ink); }
main { max-width: 1600px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; margin: 0.4rem 0 0.6rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.6rem; }
h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 60ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--accent); font-weight: 700; margin: 0; }
.hero { padding: 40px 0 28px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 12px 0 24px; }
.card, .panel, .stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card p, .panel p { margin: 0.2rem 0 0; color: var(--muted); }
.card.muted { border-style: dashed; }
.panel.narrow { max-width: 440px; margin: 24px auto; }
.callout { border-color: var(--accent); }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 9px; padding: 10px 16px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.05); }
.btn.small { padding: 7px 12px; font-size: .92rem; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.linkbtn:hover { color: var(--ink); }
.inline { display: inline; margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.gap { margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=url] {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { color: var(--muted); font-weight: 400; font-size: .88rem; }
.muted-text { color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--card); }
.flash.success { border-color: var(--ok); color: var(--ok); }
.flash.error { border-color: var(--bad); color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { display: flex; flex-direction: column; margin: 0; }
.stat .num { font-size: 2rem; font-weight: 800; }
.stat span:last-child { color: var(--muted); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border-bottom: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: .85rem; }
.pill.verified { color: var(--ok); border-color: var(--ok); }
.pill.error { color: var(--bad); border-color: var(--bad); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 16px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: .92rem; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); }
.footer { max-width: 1040px; margin: 0 auto; padding: 20px 16px 36px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
@media (max-width: 600px) {
  table.orders th:nth-child(4), table.orders td:nth-child(4) { display: none; }
  .details { grid-template-columns: 1fr; }
}

.diag { margin-top: 14px; }
.diag code { font-size: .9rem; }

.kpi-row { display: grid; gap: 12px; margin: 12px 0 18px; }
.kpi-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-row.five { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; min-width: 0; }
.kpi .num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.kpi .num.money { font-size: 1.35rem; overflow-wrap: anywhere; }
.kpi .label { color: var(--muted); font-size: .9rem; }
.kpi.hero-kpi { border-color: var(--accent); }
.period { margin-top: 8px; }
.period h2 { margin-bottom: 4px; }
@media (max-width: 600px) { .kpi-row.two { grid-template-columns: 1fr; } }

.lines { display: flex; flex-direction: column; }
.line { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.thumb { position: relative; width: 84px; height: 84px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb-fallback { font-size: .75rem; color: var(--muted); text-align: center; padding: 4px; }
.thumb img + .thumb-fallback { display: none; }
.thumb:not(:has(img)) .thumb-fallback { display: block; }
.line-title { font-weight: 650; overflow-wrap: anywhere; }
.qty { display: inline-block; background: var(--ink); color: var(--paper); border-radius: 6px; padding: 0 7px; font-size: .9rem; margin-right: 4px; }
.line-meta { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.remarks { margin-top: 8px; font-size: .92rem; background: var(--paper); border-left: 3px solid var(--accent); padding: 6px 10px; border-radius: 6px; overflow-wrap: anywhere; }
.line-price { text-align: right; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; }
.line-price .each { font-weight: 650; }
@media (max-width: 600px) {
  .line { grid-template-columns: 64px minmax(0, 1fr); }
  .thumb { width: 64px; height: 64px; }
  .line-price { grid-column: 2; text-align: left; align-items: flex-start; flex-direction: row; gap: 6px; }
}

.table-wrap { overflow-x: auto; }
table.items { min-width: 600px; }
table.items td, table.items th { vertical-align: middle; }
table.items .num { text-align: right; white-space: nowrap; }
table.items .strong { font-weight: 650; }
table.items .pic { width: 70px; }
table.items .thumb { width: 58px; height: 58px; }
table.items .remarks-cell { min-width: 160px; overflow-wrap: anywhere; font-size: .92rem; }
a.sort { color: inherit; text-decoration: none; font-weight: 650; white-space: nowrap; }
a.sort:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.label-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; background: var(--ink); color: var(--paper); font-weight: 800; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.legend li { display: flex; gap: 10px; align-items: center; }
.radio-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.radio-group legend { font-weight: 600; margin-bottom: 6px; }
table.picker { min-width: 680px; }

.color-slot { display: flex; gap: 12px; align-items: center; }
.color-slot select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); flex: 1; min-width: 0; }
.color-slot .label-badge { min-width: 40px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 8px 0 18px; }
.tab { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.label-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; margin-top: 10px; }
.slot-box { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 96px; padding: 10px 6px; border: 2px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--card); }
.slot-box.on { border-color: var(--accent); }
.slot-box .label-badge { min-width: 72px; font-size: .95rem; }
.slot-name { font-size: .8rem; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.slot-add { width: 96px; min-height: 96px; border: 2px dashed var(--line); border-radius: 12px; background: transparent; color: var(--muted); font-size: 2rem; cursor: pointer; }
.slot-add:hover { color: var(--ink); border-color: var(--ink); }
.color-picker { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.hex { font-family: ui-monospace, Menlo, monospace; color: var(--muted); }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.swatch-choice { position: relative; cursor: pointer; }
.swatch-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch { display: block; height: 44px; border-radius: 10px; border: 1px solid rgba(0,0,0,.15); }
.swatch-choice input:checked + .swatch { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatch-choice input:focus-visible + .swatch { outline: 3px solid var(--accent); outline-offset: 2px; }

.slot-box { width: 72px; height: 72px; border-radius: 12px; display: flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 800; font-size: 1.6rem; border: 0; }
.slot-box.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.slot-num { line-height: 1; }
.label-strip { align-items: center; }
.picker-wrap { position: relative; }
.color-picker { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.color-picker[hidden] { display: none; }
.color-picker.floating { position: absolute; z-index: 20; width: min(520px, 100%); margin-top: 0; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.picker-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.picker-head h3 { margin: 0; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.swatch-btn { background: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; color: var(--ink); }
.swatch-num { min-height: 1.3em; font-weight: 800; }
.swatch-btn .swatch { display: block; width: 100%; height: 40px; border-radius: 10px; border: 1px solid rgba(0,0,0,.15); }
.swatch-btn.current .swatch { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatch-btn:focus-visible .swatch { outline: 3px solid var(--accent); outline-offset: 2px; }

.kpi-actions { display: flex; gap: 8px; margin-top: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); background: var(--paper); text-decoration: none; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

tr.pick-row { cursor: pointer; user-select: none; }
tr.pick-row:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
tr.pick-row.picked { background: rgba(46, 125, 79, .14); }
tr.pick-row.picked td { color: var(--muted); }
tr.pick-row.picked .line-title { text-decoration: line-through; }
.cond-new { color: #2e7d32; font-weight: 700; }
.cond-used { color: #c62828; font-weight: 700; }

.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.legend-grid li { min-width: 0; }
.legend-text { min-width: 0; overflow-wrap: anywhere; }
.order-price { margin-left: auto; font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) { .legend-grid { grid-template-columns: 1fr; } }
.pick-overview { position: sticky; top: 0; z-index: 30; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; box-shadow: 0 4px 12px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 6px; }
.ov-main { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ov-orders { display: flex; flex-wrap: wrap; gap: 4px 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ov-errors { font-weight: 700; color: #e8590c; }
.action-bar { margin: 14px 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
tr.pick-row { cursor: pointer; user-select: none; }
tr.pick-row:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
tr.pick-row.picked { background: rgba(46, 125, 79, .14); }
tr.pick-row.errored { background: rgba(232, 89, 12, .18); }
tr.pick-row.picked .line-title, tr.pick-row.errored .line-title { text-decoration: line-through; }
td.first { white-space: nowrap; }
.mark { display: inline-block; width: 18px; text-align: center; font-weight: 900; font-size: 1.1rem; line-height: 1; margin-right: 6px; vertical-align: middle; }
.mark-ok { color: var(--ok); }
.mark-err { color: #e8590c; }
td.qty { white-space: nowrap; }
.qx { font-size: .8rem; color: var(--muted); margin-right: 2px; }
.qn { font-size: 1.4rem; font-weight: 800; }
.err-note { color: #d9480f; font-size: .88rem; font-weight: 600; }
.cond-new { color: #2e7d32; font-weight: 700; }
.cond-used { color: #c62828; font-weight: 700; }
.ctx-menu { position: fixed; z-index: 60; min-width: 200px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.2); padding: 4px; }
.ctx-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 7px; font: inherit; color: var(--ink); cursor: pointer; }
.ctx-menu button:hover { background: rgba(127,127,127,.15); }
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(440px, 100%); }
.modal-card h2 { margin-top: 0; }
.modal-card .field { display: block; margin: 12px 0; font-weight: 600; }
.modal-card select, .modal-card input { display: block; width: 100%; margin-top: 6px; padding: 9px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.form-error { color: var(--bad); font-weight: 600; }
[hidden] { display: none !important; }

.ov-order { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 10px; }
.ov-label { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 8px; border: 2px solid var(--ink); font-weight: 900; font-size: 1.05rem; background: inherit; color: inherit; }
.pick-overview.paused #ov-timer::after { content: " paused"; font-size: .8rem; font-weight: 700; color: var(--muted); }

.pick-overview { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 12px 18px; }
.pick-overview > *:not(.ov-orders) { flex-shrink: 0; }
.pick-overview .ov-orders { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; }
.ov-main { flex-wrap: nowrap; white-space: nowrap; }
table.picker td { vertical-align: middle; }
@media (max-width: 640px) {
  .pick-overview { flex-direction: column; align-items: stretch; }
  .pick-overview .ov-orders { flex-wrap: wrap; overflow: visible; }
}

.kpi-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .kpi-row.three { grid-template-columns: 1fr; } }
.msg-field { display: block; font-weight: 600; margin: 10px 0; }
.msg-field textarea, .msg-field select, .msg-field input { display: block; width: 100%; margin-top: 6px; padding: 9px; font: inherit; font-weight: 400; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.message-form .panel { margin-bottom: 14px; }
.error-order { margin-bottom: 20px; }
.eo-head { margin-bottom: 8px; }
.eo-marker { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px; border: 2px solid var(--ink); font-weight: 900; box-sizing: border-box; }
.eo-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 6px 0 12px; }
.edit-notation summary { cursor: pointer; color: var(--muted); }
.edit-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.edit-fields input, .edit-fields select { padding: 6px 8px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.handling { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 6px; }
.flag-line strong { color: var(--ink); }
.small-note { font-size: .85rem; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; background: var(--line); }
.status-pill.continue, .status-pill.completed { background: rgba(46, 125, 79, .2); }
.status-pill.pending { background: rgba(232, 89, 12, .22); }
.hold-lines { color: var(--muted); padding-left: 18px; }

.status-line { color: var(--muted); font-size: .88rem; }
td.resolution { min-width: 230px; }
.res-select { display: block; width: 100%; margin: 4px 0; padding: 6px 8px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.res-fields { display: grid; gap: 6px; margin: 4px 0; }
.res-fields input { width: 100%; padding: 6px 8px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.res-text { font-weight: 600; margin-top: 4px; }

.inv-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; align-items: center; }
.inv-filters input, .inv-filters select { padding: 8px 10px; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.inv-filters input[type=search] { flex: 1 1 220px; }

.breakdown-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.breakdown-wide { grid-column: 1 / -1; }
.breakdown-grid h3 { margin: 0 0 8px; }
table.breakdown { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.breakdown th, table.breakdown td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.breakdown .num { text-align: right; }
@media (max-width: 640px) { .breakdown-grid { grid-template-columns: 1fr; } }

/* Table quantity cells: centered vertically. Kept separate from .qty (the order-detail pill, which is inline-block). */
td.qtycell { vertical-align: middle; white-space: nowrap; }
.qn { display: inline-block; line-height: 1; }

/* Inventory dropdown in the top navigation */
.nav-drop { position: relative; }
.nav-drop > summary { cursor: pointer; list-style: none; color: inherit; }
.nav-drop > summary::-webkit-details-marker { display: none; }
.nav-drop > summary::after { content: " ▾"; font-size: .8em; }
.nav-menu { position: absolute; top: 100%; left: 0; z-index: 40; min-width: 170px; margin-top: 8px; padding: 6px; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.nav-menu a { padding: 8px 10px; white-space: nowrap; border-radius: 6px; }
.nav-menu a:hover { background: var(--paper); }

/* Pricing rules */
.rule-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.rule-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.rule-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-top: 12px; }
.rule-form label { min-width: 150px; }

/* Uploads */
.status-line { margin: 8px 0 16px; }

/* Uploads: action buttons and pop-up windows */
.upload-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 20px; }
dialog.upload-dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); padding: 22px; width: min(460px, 92vw); max-height: 88vh; }
dialog.upload-dialog::backdrop { background: rgba(0,0,0,.45); }
dialog.upload-dialog h2 { margin-top: 0; }

/* Batch page: camera icon button */
label.icon-cam { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink); color: var(--paper); cursor: pointer; }

.match-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.match-btn { text-align: left; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); cursor: pointer; font: inherit; }
.match-btn.picked { border-color: var(--accent); background: rgba(46, 125, 79, .12); }
label.icon-cam span { margin-left: 8px; font-weight: 700; }
label.icon-cam { width: auto; padding: 0 14px; height: 44px; }

/* The camera input covers its button invisibly so phones open the camera, not the photo library */
label.icon-cam { position: relative; overflow: hidden; }
label.icon-cam input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }

/* Camera button in the Add item window (desktop webcams and phones) */
.cam-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink); color: var(--paper); font: inherit; font-weight: 700; cursor: pointer; align-self: flex-start; }

/* Order errors: handled orders collapse to one row */
details.error-order > summary.condensed { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
details.error-order > summary.condensed::-webkit-details-marker { display: none; }
details.error-order > summary.condensed .res-title { font-weight: 700; }
details.error-order > summary.condensed .cond-status { margin-left: auto; }
details.error-order[open] > summary.condensed { margin-bottom: 8px; }

/* Camera matches: part picture beside the name */
.match-btn { display: flex; align-items: center; gap: 12px; }
.match-img { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 8px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.match-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.match-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
