/* Yard Desk: a working tool for the counter and the warehouse. Dark side rail in the shop's colours,
   light work area, tables first. Printed paperwork is plain black on white. */
:root {
  --blue: #034c8c;
  --blue-deep: #023a6c;
  --blue-soft: #e6eff8;
  --amber: #1e7bff;
  --amber-deep: #1667db;
  --amber-ink: #ffffff;
  --red: #bf3617;
  --page: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --line: #d9e0ea;
  --ink: #111827;
  --muted: #4b5768;
  --good: #0d7a4a;
  --good-soft: #e2f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1d8;
  --night: #07111f;
  --radius: 12px;
  --font: "Inter", "Segoe UI", system-ui, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 14.5px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--night); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: #fff; text-decoration: none; padding: 0 8px; }
.yardname { color: rgba(255, 255, 255, .6); font-size: 13px; padding: 4px 8px 14px; }
#nav { display: grid; gap: 2px; }
#nav button { font: 600 14.5px/1 var(--font); text-align: left; background: none; border: 0; color: rgba(255, 255, 255, .72); padding: 12px 12px; border-radius: 9px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
#nav button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
#nav button.on { background: var(--amber); color: var(--amber-ink); }
#nav b { font-size: 12px; background: rgba(255, 255, 255, .16); border-radius: 99px; padding: 3px 8px; }
#nav button.on b { background: rgba(35, 23, 0, .16); }
.sidelink { margin-top: auto; color: rgba(255, 255, 255, .6); text-decoration: none; font-size: 13px; padding: 8px; }
.sidelink:hover { color: #fff; }
.saved { color: rgba(255, 255, 255, .45); font-size: 12px; padding: 0 8px; min-height: 18px; }

main { padding: 28px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { font-weight: 800; font-size: 30px; letter-spacing: -.025em; color: var(--blue-deep); }
.headtools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lead { color: var(--muted); max-width: 80ch; margin-bottom: 18px; }
.count, .hint { color: var(--muted); font-size: 13px; }

.btn { font: 600 14px/1 var(--font); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 10px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 700; }
.btn.primary:hover { background: var(--amber-deep); border-color: var(--amber-deep); color: var(--amber-ink); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.small { padding: 7px 10px; font-size: 13px; }
.btn.danger { color: var(--red); }

.notice { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat small, th, .field > span, h3 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat b { display: block; font-weight: 800; font-size: 28px; letter-spacing: -.02em; color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.card h2 { font-weight: 800; font-size: 17px; color: var(--blue-deep); margin-bottom: 10px; }
.card h2 small { font-weight: 500; font-size: 13px; color: var(--muted); margin-left: 8px; }
.empty { color: var(--muted); padding: 8px 0; }
.empty.big { background: var(--surface); border: 1px dashed #b9c5d4; border-radius: var(--radius); padding: 46px 20px; text-align: center; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] { flex: 1; min-width: 240px; max-width: 460px; }
.toolbar .count { margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { font: 600 13px/1 var(--font); border: 0; background: none; color: var(--muted); padding: 10px 13px; cursor: pointer; text-transform: capitalize; }
.seg button.on { background: var(--blue); color: #fff; }
.bulk { background: var(--blue-deep); color: #fff; border-radius: var(--radius); padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bulk b { margin-right: 6px; }
.bulk .btn.ghost { color: #fff; }

input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0; height: 40px; }
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
input[type="checkbox"] { width: 17px; height: 17px; padding: 0; accent-color: var(--blue); }
.mono { font-family: var(--mono); }

.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); color: var(--blue); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-action] { cursor: pointer; }
tbody tr:hover { background: #f7f9fc; }
tr.picked { background: var(--blue-soft); }
td small { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rowtools { white-space: nowrap; text-align: right; }
.rowtools .btn + .btn { margin-left: 4px; }
.place { font-family: var(--mono); font-weight: 700; background: var(--surface-2); border-radius: 6px; padding: 3px 7px; white-space: nowrap; }
.warn { color: var(--red); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 4px 10px; background: var(--surface-2); color: var(--muted); text-transform: capitalize; white-space: nowrap; }
.chip button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: inherit; padding: 0; }
.s-instock, .s-paid, .s-delivered { background: var(--good-soft); color: var(--good); }
.s-reserved, .s-new, .s-picked, .s-packed { background: var(--warn-soft); color: var(--warn); }
.s-sold, .s-shipped { background: var(--blue-soft); color: var(--blue-deep); }
.s-cancelled, .s-returned, .s-scrapped { background: #fbe9e4; color: var(--red); }
td select { height: 34px; padding: 4px 8px; font-weight: 700; font-size: 13px; text-transform: capitalize; width: auto; }

.spots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.spot { font: inherit; text-align: left; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; padding: 12px; cursor: pointer; display: grid; gap: 2px; color: var(--ink); }
.spot:hover { border-color: var(--blue); background: var(--blue-soft); }
.spot b { font-family: var(--mono); font-size: 16px; color: var(--blue-deep); }
.spot span { font-weight: 600; font-size: 13px; }
.spot small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* forms and dialogs */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 18px; }
.formgrid.three { grid-template-columns: repeat(3, 1fr); }
.formgrid.four { grid-template-columns: repeat(4, 1fr); }
.wide, .wide2 { grid-column: span 2; }
.wide3 { grid-column: span 3; }
.wide4 { grid-column: span 4; }
.inline { display: flex; gap: 8px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }
.form h2 { margin-top: 6px; }
.formtools { margin-top: 18px; }
.dialog { border: 0; border-radius: 16px; padding: 0; width: min(900px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 24px 70px rgba(3, 30, 60, .35); color: var(--ink); }
.dialog::backdrop { background: rgba(2, 30, 60, .55); }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dhead, .dfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; background: var(--surface); }
.dhead { border-bottom: 1px solid var(--line); }
.dhead h2 { font-weight: 800; font-size: 20px; color: var(--blue-deep); }
.dfoot { border-top: 1px solid var(--line); flex-wrap: wrap; }
.dfoot div { display: flex; gap: 8px; flex-wrap: wrap; }
.dbody { padding: 18px 22px; overflow: auto; }
.dbody h3 { margin: 4px 0 10px; color: var(--blue); }
.items { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tiny { width: 64px; height: 34px; text-align: right; }
.tiny.wide { width: 96px; }
.totals { background: var(--blue-soft); border-radius: 10px; padding: 12px 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--blue-deep); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 100; }

/* ---------- paperwork (only shown when printing) ---------- */
.print { display: none; }
@media print {
  .app, .dialog, .toast { display: none !important; }
  body { background: #fff; }
  .print { display: block; color: #000; font: 12pt/1.4 Arial, sans-serif; }
  @page { margin: 14mm; }
  .doc { page-break-after: always; }
  .letterhead { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2pt solid #000; padding-bottom: 10pt; margin-bottom: 14pt; }
  .letterhead h1 { font-size: 20pt; margin: 0 0 4pt; }
  .letterhead p { margin: 0; }
  .letterhead .right { text-align: right; }
  .docmeta { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14pt; }
  .docmeta h2 { font-size: 24pt; margin: 0; letter-spacing: .04em; text-transform: uppercase; }
  .docmeta table { width: auto; }
  .docmeta td { padding: 2pt 0 2pt 14pt; border: 0; }
  .parties { display: flex; gap: 40pt; margin-bottom: 14pt; }
  .parties h3 { font-size: 9pt; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 4pt; color: #444; }
  .parties p { margin: 0 0 4pt; }
  .lines { width: 100%; border-collapse: collapse; margin-bottom: 12pt; }
  .lines th { text-align: left; font-size: 9pt; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1.5pt solid #000; padding: 5pt 6pt; background: none; color: #000; }
  .lines td { border-bottom: .5pt solid #999; padding: 7pt 6pt; vertical-align: top; }
  .lines .num, .sums td:last-child { text-align: right; }
  .lines .box { font-size: 16pt; text-align: center; }
  .pick .where { font: bold 14pt monospace; white-space: nowrap; }
  .sums { margin-left: auto; width: 240pt; border-collapse: collapse; }
  .sums td { padding: 4pt 6pt; border: 0; }
  .sums .grand td { border-top: 1.5pt solid #000; font-weight: bold; font-size: 14pt; }
  .terms { margin-top: 18pt; font-size: 10pt; color: #222; }
  .terms p { margin: 0 0 5pt; }
  /* labels print one to a page, sized for a 4 x 6 inch label printer */
  body[data-print="labels"] { }
  .label { page-break-after: always; border: 1.5pt solid #000; padding: 12pt; }
  .label.tag { width: 4in; min-height: 2.6in; }
  .tagtop, .tagfoot { display: flex; justify-content: space-between; gap: 10pt; font-size: 10pt; }
  .tagtop span:last-child { font: bold 14pt monospace; }
  .label.tag h1 { font-size: 46pt; line-height: 1; margin: 6pt 0 2pt; letter-spacing: .02em; }
  .label.tag h2 { font-size: 16pt; margin: 0 0 2pt; }
  .label.tag p { margin: 0; font-size: 11pt; }
  .tagfoot { border-top: 1pt solid #000; margin-top: 8pt; padding-top: 6pt; align-items: baseline; }
  .tagfoot b { font-size: 16pt; }
  .label.ship { width: 4in; min-height: 5.6in; display: flex; flex-direction: column; }
  .label.ship .from { font-size: 9pt; border-bottom: 1pt solid #000; padding-bottom: 6pt; margin: 0 0 14pt; }
  .label.ship small { font-size: 9pt; letter-spacing: .1em; text-transform: uppercase; }
  .label.ship h1 { font-size: 22pt; margin: 2pt 0 6pt; }
  .label.ship .to p { font-size: 14pt; margin: 0 0 4pt; }
  .label.ship .to .postal { font: bold 30pt monospace; letter-spacing: .06em; margin: 8pt 0; }
  .label.ship .ref { margin-top: auto; border-top: 1pt solid #000; padding-top: 6pt; font-size: 10pt; }
}

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  #nav { grid-auto-flow: column; }
  .sidelink { margin: 0 0 0 auto; }
  .stats, .twocol { grid-template-columns: 1fr 1fr; }
  .formgrid.three, .formgrid.four { grid-template-columns: 1fr 1fr; }
  .wide3, .wide4 { grid-column: span 2; }
  main { padding: 18px 16px 50px; }
}

/* ================= Yard Desk 2: intake, photos, vehicles, work board, demand, reports ================= */
.sidetop { display: flex; align-items: center; justify-content: space-between; }
.menu { display: none; font-size: 22px; background: none; border: 0; color: #fff; cursor: pointer; padding: 6px 10px; }
.findbox { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; margin-bottom: 8px; }
.findbox::placeholder { color: rgba(255, 255, 255, .5); }
.side { overflow-y: auto; }
#nav button { padding: 10px 12px; }
#nav .addnav { color: var(--amber); }
#nav .addnav.on { color: var(--amber-ink); }

.stat[data-view] { cursor: pointer; }
.stat[data-view]:hover { border-color: var(--blue); }
.notice.hot { background: var(--blue-soft); color: var(--blue-deep); }
.hintcell { color: var(--muted); font-size: 13px; }
.good { color: var(--good); font-weight: 600; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--blue); cursor: pointer; text-decoration: underline; }
.thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; display: block; background: var(--surface-2); }
.thumb.none { display: grid; place-items: center; color: #9aa7b8; border: 1px dashed #b9c5d4; font-weight: 700; cursor: pointer; }
td[data-action] { cursor: pointer; }
.toolbar select { width: auto; }
.tablewrap.short { max-height: 420px; overflow-y: auto; }
.tier { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 800; color: #fff; background: #8b98aa; margin-right: 4px; }
.tier.t1 { background: var(--red); }
.tier.t2 { background: var(--blue); }

/* four ways to add stock */
.ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.way { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.way h2 { margin: 0; font-size: 20px; }
.way p { color: var(--muted); }
.waytag { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--amber-ink); background: #dbeaff; border-radius: 99px; padding: 4px 10px; }
.wayrow { display: flex; gap: 8px; flex-wrap: wrap; }
.inline .btn { height: 40px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; min-height: 26px; }
.chips .chip { text-transform: none; background: var(--good-soft); color: var(--good); }
.chips .chip small { opacity: .7; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.chips .chip.missing { background: #fbe9e4; color: var(--red); }
[data-action=dictate].live { background: var(--red); border-color: var(--red); color: #fff; }
.decoded { background: var(--blue-soft); color: var(--blue-deep); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }

/* photos on a part */
.photostrip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.photostrip figure { margin: 0; width: 132px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.photostrip figure.first { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.photostrip img { width: 100%; height: 100px; object-fit: cover; display: block; }
.photostrip figcaption { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; font-size: 12px; font-weight: 600; }
.photostrip figcaption button { border: 0; background: none; color: var(--blue); font: inherit; cursor: pointer; padding: 2px 4px; }
.photostrip figcaption button:last-child { color: var(--red); font-size: 16px; line-height: 1; }
.addphoto { width: 132px; min-height: 128px; border: 2px dashed #b9c5d4; border-radius: 10px; background: none; color: var(--muted); font: 600 13px/1.3 var(--font); cursor: pointer; display: grid; place-content: center; gap: 2px; text-align: center; }
.addphoto b { font-size: 24px; color: var(--blue); }
.addphoto small { font-weight: 400; font-size: 11px; }
.addphoto:hover { border-color: var(--blue); color: var(--blue); }
.aiz { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.dialog.wide { width: min(1080px, calc(100vw - 24px)); }
.dbody .hint { margin: -8px 0 16px; }
.dbody .aiz .hint { margin: 0; }
.pull td { vertical-align: middle; }
.pull select { height: 34px; width: 64px; }
.addline { margin-bottom: 16px; max-width: 460px; }
tr.none td { color: var(--muted); }
.prepbox { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.prepbox ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.prepbox label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
#auditList tr.ok { background: var(--good-soft); }
#auditList tr.stray { background: var(--warn-soft); }

/* work board */
.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; }
.column { background: var(--surface-2); border-radius: var(--radius); padding: 12px; min-height: 200px; }
.column h2 { font-weight: 800; font-size: 15px; color: var(--blue-deep); margin-bottom: 10px; display: flex; justify-content: space-between; }
.column h2 small { background: var(--surface); border-radius: 99px; padding: 2px 9px; font-size: 12px; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; display: grid; gap: 8px; }
.ticket header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ticket header b { color: var(--blue); cursor: pointer; text-decoration: underline; font-size: 16px; }
.ticket ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ticket li small { display: block; color: var(--muted); }
.ticket footer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ticket footer select { width: auto; height: 32px; padding: 2px 8px; font-size: 13px; }
.ticket .via { color: var(--muted); font-size: 12px; margin-right: auto; }
.ticket .log { color: var(--muted); font-size: 11px; }

/* reports */
.bars { display: flex; gap: 12px; align-items: flex-end; height: 190px; padding-top: 10px; }
.bar { flex: 1; display: grid; grid-template-rows: 1fr auto auto; height: 100%; text-align: center; gap: 4px; }
.bar span { align-self: end; background: var(--blue); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar small { color: var(--muted); font-weight: 600; }
.bar b { font-size: 12px; min-height: 16px; font-variant-numeric: tabular-nums; }
.aging { display: grid; gap: 10px; margin-bottom: 12px; }
.agerow { display: grid; grid-template-columns: 110px 1fr 90px 70px 100px; gap: 10px; align-items: center; }
.agebar { background: var(--surface-2); border-radius: 6px; height: 14px; overflow: hidden; }
.agebar i { display: block; height: 100%; background: var(--amber); }
.agerow b { text-align: right; font-variant-numeric: tabular-nums; }
.agerow small { color: var(--muted); }

@media (max-width: 1000px) {
  .ways { grid-template-columns: 1fr; }
  .menu { display: block; }
  .side { display: block; padding: 10px 14px; position: sticky; top: 0; z-index: 20; height: auto; overflow: visible; }
  .side .yardname, .side .sidelink, .side .saved { display: none; }
  .side #nav { display: none; grid-auto-flow: row; padding-top: 8px; }
  .side .findbox { margin: 8px 0 0; }
  body.navopen .side #nav { display: grid; }
  .board { grid-template-columns: repeat(4, 260px); }
  .agerow { grid-template-columns: 90px 1fr 80px; }
  .agerow small, .agerow span:last-child, .agerow .btn { display: none; }
}
@media (max-width: 640px) {
  .stats, .twocol { grid-template-columns: 1fr; }
  .formgrid, .formgrid.three, .formgrid.four { grid-template-columns: 1fr; }
  .wide, .wide2, .wide3, .wide4 { grid-column: auto; }
  .head h1 { font-size: 24px; }
  .dhead, .dfoot, .dbody { padding-left: 14px; padding-right: 14px; }
}

@media print {
  .barcode { display: block; margin: 4pt 0; }
  .docmeta > div > p { margin: 2pt 0 0; font-size: 10pt; }
  .label.tag .small { font-size: 9pt; }
  .label.tag .barcode { margin: 6pt 0 0; width: 100%; height: 38pt; }
  .shipfoot { margin-top: auto; border-top: 1pt solid #000; padding-top: 6pt; }
  .label.ship .ref { margin-top: 4pt; border: 0; padding: 0; }
  .signs { display: flex; gap: 20pt; margin-top: 36pt; }
  .signs div { flex: 1; border-top: 1pt solid #000; padding-top: 4pt; font-size: 9pt; }
  .prep { margin-bottom: 14pt; page-break-inside: avoid; }
  .prep h3 { font-size: 12pt; margin: 0 0 4pt; text-transform: none; letter-spacing: 0; color: #000; }
  .prep p { margin: 0 0 6pt; font-size: 10pt; }
  .prep ul { margin: 0; padding: 0; list-style: none; }
  .prep li { padding: 3pt 0; border-bottom: .5pt solid #bbb; }
  .prep .box { font-size: 13pt; margin-right: 6pt; }
  .lines .sign { width: 110pt; border-bottom: 1pt solid #000; }
  .labelpage .label { margin: 0 auto; }
  .doc:last-child, .label:last-child { page-break-after: auto; }
}
@page labels { size: 4in 6in; margin: 3mm; }
@media print { body[data-print="labels"] .label { page: labels; border: 0; } }

#nav b:empty { display: none; }

/* the door of a hosted copy */
body.door #nav, body.door .findbox, body.door .menu { display: none !important; }
body.door main { display: grid; place-items: start center; padding-top: 8vh; }
/* With the sign-in service: the whole screen, the pitch on the left and the sign-in box on the right */
body.door.wide .side { display: none; }
body.door.wide .app { display: block; }
body.door.wide main { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); place-items: stretch; min-height: 100vh; padding: 0; max-width: none; }
.doorpitch { display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 56px clamp(28px, 6vw, 88px); color: #e8ebf0; background: radial-gradient(1200px 600px at 10% -10%, rgba(30, 123, 255, .16), transparent 60%), radial-gradient(900px 600px at 110% 110%, rgba(3, 76, 140, .5), transparent 60%), #07111f; }
.doorpitch .brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 20px; text-decoration: none; }
.doorpitch .brand b { padding: 1px 7px 2px; border-radius: 7px; background: var(--amber); color: #ffffff; font-size: 12px; letter-spacing: .04em; }
.doorpitch h1 { font-size: clamp(32px, 4vw, 52px); font-weight: 800; letter-spacing: -.03em; line-height: 1.04; color: #fff; }
.doorpitch h1 em { font-style: normal; color: var(--amber); }
.doorpitch .lead { margin: 0; max-width: 520px; font-size: 17px; line-height: 1.6; color: #b9c0cc; }
.doorpitch ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; max-width: 520px; }
.doorpitch li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; font-size: 15px; line-height: 1.5; color: #cfd5de; }
.doorpitch li::before { content: "\2713"; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(30, 123, 255, .16); color: var(--amber); font-weight: 800; font-size: 14px; }
.doorpitch li b { color: #fff; }
.doorpitch .fine { font-size: 13px; color: #7f8896; }
.doorpitch .fine a { color: #b9c0cc; }
.doorside { display: grid; place-items: center; padding: 40px 24px; background: var(--page, #f2f5f9); }
.doorside .doorcard { width: min(440px, 100%); box-shadow: 0 4px 10px rgba(3, 30, 60, .06), 0 24px 60px rgba(3, 30, 60, .12); border-radius: 18px; }
.doorside #clerkBox { display: grid; justify-items: center; min-height: 120px; }
@media (max-width: 900px) {
  body.door.wide main { grid-template-columns: 1fr; }
  .doorpitch { padding: 36px 24px; gap: 16px; }
  .doorpitch ul { display: none; }
}
.doorcard { width: min(440px, 100%); display: grid; gap: 14px; padding: 28px; }
.doorcard h1 { font-weight: 800; font-size: 26px; letter-spacing: -.02em; color: var(--blue-deep); }
.doorcard .lead { margin: 0; }
.doorcard .btn { justify-content: center; height: 44px; }
.doorcard .warn:empty { display: none; }
#whoami { word-break: break-all; }
#whoami .linkish { color: #fff; }

/* phones: one column, nothing wider than the screen */
.twocol > *, .stats > *, .ways > * { min-width: 0; }
@media (max-width: 1000px) {
  .app { display: block; min-height: 0; }
  .card { overflow-x: auto; }
  .hintcell { display: none; }
  .toolbar input[type="search"] { max-width: none; min-width: 0; flex: 1 1 100%; }
  .dialog { width: calc(100vw - 12px); max-height: calc(100vh - 12px); }
  .dialog form { max-height: calc(100vh - 12px); }
  .dfoot .btn { flex: 1 1 auto; justify-content: center; }
  .photostrip figure, .addphoto { width: calc(50% - 5px); }
}

tr.dim td { opacity: .55; }

/* ================= the inventory on a phone: one card per part instead of a wide table ================= */
@media (max-width: 640px) {
  .stockwrap { border: 0; background: none; overflow: visible; }
  table.stock, table.stock tbody { display: block; width: 100%; }
  table.stock thead { display: none; }
  table.stock tr {
    display: grid;
    grid-template-columns: 26px 52px 1fr 1fr auto;
    grid-template-areas:
      "pick photo fits fits price"
      "pick photo part part status"
      "pick photo number number tools"
      ". stock grade place qty";
    gap: 3px 10px;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
  table.stock td { display: block; border: 0; padding: 0; min-width: 0; }
  table.stock td:nth-child(1) { grid-area: pick; align-self: start; padding-top: 4px; }
  table.stock td:nth-child(2) { grid-area: photo; align-self: start; }
  table.stock td:nth-child(3) { grid-area: stock; font-size: 13px; color: var(--muted); }
  table.stock td:nth-child(3)::before { content: "#"; }
  table.stock td:nth-child(4) { grid-area: fits; font-weight: 700; }
  table.stock td:nth-child(5) { grid-area: part; }
  table.stock td:nth-child(5) br { display: none; }
  table.stock td:nth-child(5) small { margin-left: 6px; }
  table.stock td:nth-child(6) { grid-area: number; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  table.stock td:nth-child(7) { grid-area: grade; font-size: 13px; color: var(--muted); }
  table.stock td:nth-child(7):not(:empty)::before { content: "Grade "; }
  table.stock td:nth-child(8) { grid-area: place; font-size: 13px; }
  table.stock td:nth-child(9) { grid-area: qty; font-size: 13px; color: var(--muted); text-align: right; }
  table.stock td:nth-child(9)::before { content: "Qty "; }
  table.stock td:nth-child(10) { grid-area: price; text-align: right; font-size: 17px; }
  table.stock td:nth-child(11) { display: none; }
  table.stock td:nth-child(12) { grid-area: status; text-align: right; }
  table.stock td:nth-child(13) { grid-area: tools; text-align: right; }
}

/* ================= the bid helper on the vehicle form ================= */
.bidbox { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.bidbox h3 { margin: 0 0 10px; }
.bidrow { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; color: var(--muted); }
.bidrow input { margin: 0 4px; }
.bidsum { margin: 12px 0 0; font-size: 14.5px; line-height: 1.6; }
.bidtop { font-size: 17px; color: var(--blue-deep); white-space: nowrap; }
.bidsum .warn { color: var(--red, #bf3617); font-weight: 600; }

/* ================= orders on a phone: one card per order ================= */
@media (max-width: 640px) {
  .orderwrap { border: 0; background: none; overflow: visible; }
  table.orderlist, table.orderlist tbody { display: block; width: 100%; }
  table.orderlist thead { display: none; }
  table.orderlist tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "number customer total"
      "date customer due"
      "parts parts parts"
      "carrier tracking tracking"
      "status tools tools";
    gap: 4px 12px;
    align-items: start;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
  table.orderlist td { display: block; border: 0; padding: 0; min-width: 0; }
  table.orderlist td:nth-child(1) { grid-area: number; font-size: 16px; }
  table.orderlist td:nth-child(2) { grid-area: date; font-size: 13px; color: var(--muted); }
  table.orderlist td:nth-child(3) { grid-area: customer; font-weight: 600; }
  table.orderlist td:nth-child(4) { grid-area: parts; font-size: 14px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0; }
  table.orderlist td:nth-child(5) { grid-area: carrier; font-size: 13px; color: var(--muted); }
  table.orderlist td:nth-child(6) { grid-area: tracking; font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; }
  table.orderlist td:nth-child(7) { grid-area: total; text-align: right; font-size: 16px; }
  table.orderlist td:nth-child(8) { grid-area: due; text-align: right; font-size: 13px; }
  table.orderlist td:nth-child(8):not(:empty)::before { content: "due "; color: var(--muted); font-weight: 400; }
  table.orderlist td:nth-child(9) { grid-area: status; align-self: center; }
  table.orderlist td:nth-child(10) { grid-area: tools; text-align: right; }
}

/* ================= other lists on a phone: each row a block, its buttons on a line of their own ================= */
@media (max-width: 640px) {
  table.stack, table.stack tbody { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: block; border: 0; padding: 0; min-width: 0; }
  table.stack td:empty { display: none; }
  /* the cell that says what the row is about takes a line to itself */
  table.stack td:nth-child(2), table.stack td:nth-child(3) { flex: 1 1 40%; }
  table.stack td:last-child { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
  .tablewrap.short { max-height: none; }
}

/* figures in a stacked row say what they are */
@media (max-width: 640px) {
  table.stack td[class~="num"]::before, table.vehiclelist td:nth-child(4)::before, table.vehiclelist td:nth-child(5)::before, table.customerlist td:nth-child(8)::before { color: var(--muted); font-weight: 400; font-size: 12px; margin-right: 4px; }
  table.vehiclelist td:nth-child(4)::before { content: "row"; }
  table.vehiclelist td:nth-child(5)::before { content: "in"; }
  table.vehiclelist td:nth-child(6)::before { content: "cost"; }
  table.vehiclelist td:nth-child(7)::before { content: "parts"; }
  table.vehiclelist td:nth-child(8)::before { content: "sold"; }
  table.vehiclelist td:nth-child(9)::before { content: "left"; }
  table.customerlist td:nth-child(4)::before { content: "orders"; }
  table.customerlist td:nth-child(5)::before { content: "quotes"; }
  table.customerlist td:nth-child(6)::before { content: "bought"; }
  table.customerlist td:nth-child(7)::before { content: "owes"; }
  table.customerlist td:nth-child(8)::before { content: "last"; }
}

/* two links at the foot of the side bar sit together */
.sidelink + .sidelink { margin-top: 0; }

/* eBay: where a part stands there, the card in Yard settings, and the listing dialog */
.chip.ebay { margin-top: 5px; background: var(--blue-soft); color: var(--blue-deep); text-decoration: none; }
a.chip.ebay:hover { text-decoration: underline; }
.chip.ebay.sold { background: var(--good-soft); color: var(--good); }
.chip.ebay.warnchip { background: #fbe9e4; color: var(--red); cursor: help; }
#ebayCard p { margin: 0 0 12px; max-width: 78ch; }
#ebayCard .formtools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ebaypaste { margin-top: 14px; }
.ebaypaste summary { cursor: pointer; font-weight: 600; color: var(--blue-deep); }
.ebaypaste .inline { margin-top: 8px; }
.ebaybox { margin-bottom: 6px; }
.ebaystate { min-width: 220px; }
.ebayneed { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line, #dfe5ec); }
.ebayneed h3 small { font-weight: 500; opacity: .75; }
.notice > span { flex: 1 1 320px; }
.chip.ebay { text-transform: none; }
#ebayListForm .tablewrap { margin: 12px 0 14px; }
#ebayListForm .btn[disabled] { opacity: .5; cursor: default; }
