/* Johnstone Supply brand (JS_Brand_Guidelines.pdf, updated 06/10/26):
   colors from "Brand Colors" (p.10), Franklin family type (p.9; Libre Franklin is an approved alternative,
   Arial/Helvetica the backup), the official primary logo on white with clear space of half the logo height
   (p.7). The logo file is used as supplied: no recoloring, effects or busy backgrounds (p.5). */

@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/libre-franklin-400.woff2) format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/libre-franklin-600.woff2) format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/libre-franklin-800.woff2) format("woff2"); }

:root {
  /* primary brand colors */
  --js-blue: #004990;
  --js-red: #EF3E42;
  /* secondary brand colors */
  --js-gray: #67696B;
  --js-dark-blue: #113464;
  --js-light-teal: #72AAB3;
  --js-dark-teal: #016373;

  --bg: #F3F5F7;
  --card: #FFFFFF;
  --text: #1E2328;
  --muted: var(--js-gray);
  --line: #DADFE4;
  --red-tint: #FDEDED;
  --teal-tint: #E7F2F3;
  --blue-tint: #E6EEF6;
  --logo-h: 40px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 "Libre Franklin", "Franklin Gothic", Arial, Helvetica, sans-serif; }

/* Header: official logo on white, clear space = 1/2 logo height on every side */
.top { display: flex; justify-content: space-between; align-items: center; gap: calc(var(--logo-h) / 2); background: var(--card);
  padding: calc(var(--logo-h) / 2) max(16px, calc(var(--logo-h) / 2)); }
.brand { display: block; line-height: 0; }
.brand img { height: var(--logo-h); width: auto; }
.me { color: var(--muted); font-size: 13px; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Title band, after the guide's page headers: JS Blue, white uppercase heading */
.band { background: var(--js-blue); color: #fff; }
.band div { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; justify-content: space-between; align-items: baseline; }
.band .title { font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: 18px; }
.band a { color: #fff; font-weight: 600; font-size: 14px; }

main { max-width: 980px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 8px 0; color: var(--js-dark-blue); font-weight: 800; }
h2 { font-size: 16px; margin: 0 0 8px; color: var(--js-dark-blue); font-weight: 800; }
.hint { color: var(--muted); margin-top: 0; }
.panel, .card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin: 12px 0; }
textarea { width: 100%; min-height: 110px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--text); font: inherit; resize: vertical; }
input[type=text], input[type=date] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--text); font: inherit; }
textarea:focus, input:focus, button:focus-visible { outline: 2px solid var(--js-blue); outline-offset: 1px; }
button { font: inherit; font-weight: 600; border-radius: 4px; border: 1px solid var(--js-blue); background: #fff; color: var(--js-blue); padding: 7px 14px; cursor: pointer; }
button:hover { background: var(--blue-tint); }
button.primary { background: var(--js-blue); border-color: var(--js-blue); color: #fff; }
button.primary:hover { background: var(--js-dark-blue); border-color: var(--js-dark-blue); }
button:disabled { opacity: .5; cursor: default; }
button.link { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 0; font-weight: 400; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; font-size: 13px; background: var(--bg); }
.chip img { width: 44px; height: 44px; object-fit: cover; border-radius: 3px; }
.chip button { padding: 0 6px; border: 0; }

.banner { border-radius: 6px; padding: 12px 14px; margin: 12px 0; border: 1px solid var(--line); border-left: 5px solid var(--js-blue); background: var(--card); }
.banner.working { border-left-color: var(--js-blue); background: var(--blue-tint); }
.banner.error { border-left-color: var(--js-red); background: var(--red-tint); }
.banner.done { border-left-color: var(--js-dark-teal); background: var(--teal-tint); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--js-blue); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.summary { font-size: 16px; }
.header-line { color: var(--muted); margin: 6px 0 0; }
.decide { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--js-red); border-radius: 6px; padding: 10px 14px; margin: 12px 0; }
.decide h2 { font-size: 15px; color: var(--js-red); }
.decide ol.asks { margin: 4px 0 0; padding-left: 20px; }
.decide ol.asks li { margin: 8px 0; }
.decide ul.notes { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
input.answer { width: 100%; max-width: 520px; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; background: #fff; color: var(--text); }
/* A question on its bid line: the line gets a JS Red edge, the question sits in the row just below it */
tr.has-q td:first-child { box-shadow: inset 4px 0 0 var(--js-red); }
tr.qrow td { background: var(--red-tint) !important; padding: 8px 10px; }
.qline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.qmark { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; background: var(--js-red); color: #fff; font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.qtext { flex: 1 1 240px; font-weight: 600; }
.qline input.answer { flex: 1 1 220px; margin-top: 0; }
/* Optional lines: off the bid until ticked */
.card.optional th { background: var(--js-gray); }
.card.optional td.tick { width: 44px; text-align: center; }
.card.optional input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--js-blue); cursor: pointer; }
.card.optional label { cursor: pointer; }
.qty-box { width: 64px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; text-align: right; }
.card.optional tbody tr:has(input.add-line:checked) td { background: var(--blue-tint); }
/* Unfinished orders list */
.orders-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.orders-head h2 { margin: 0; }
.filters { display: inline-flex; }
.filters button { border-radius: 0; }
.filters button:first-child { border-radius: 4px 0 0 4px; }
.filters button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.filters button.on { background: var(--js-blue); color: #fff; }
.filters button + button { border-left: 0; }
#ordersList table td a { color: var(--js-blue); font-weight: 600; text-decoration: none; }
#ordersList table td a:hover { text-decoration: underline; }
.status { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.status.waiting_on_employee { background: var(--red-tint); color: #b0272b; }
.status.processing, .status.submitting { background: var(--blue-tint); color: var(--js-blue); }
.status.error { background: var(--js-red); color: #fff; }
.status.closed { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.stale { color: #b0272b; font-weight: 600; }
/* Someone else's order */
.banner.owner { border-left-color: var(--js-dark-teal); background: var(--teal-tint); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Send bar: pinned to the bottom once an answer is typed, so nobody scrolls to send */
.sendbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--js-dark-blue); color: #fff; box-shadow: 0 -2px 8px rgba(0,0,0,.15); z-index: 10; }
.sendbar div { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sendbar button.primary { background: #fff; color: var(--js-blue); border-color: #fff; }
.sendbar button.primary:hover { background: var(--blue-tint); }
body.with-sendbar main { padding-bottom: 80px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #fff; background: var(--js-dark-blue); font-weight: 600; }
tbody tr:nth-child(even) { background: var(--bg); }
td.qty { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.note { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; color: var(--muted); }
.change { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding: 8px 0; }
.change:first-of-type { border-top: 0; }
.saved { color: var(--js-dark-teal); font-size: 13px; font-weight: 600; }
#history summary { cursor: pointer; font-weight: 800; color: var(--js-dark-blue); }
#transcript { padding-left: 20px; margin: 8px 0 0; }
#transcript li { margin: 6px 0; white-space: pre-wrap; }
#transcript .who { font-weight: 600; }
.footer-actions { text-align: right; }
label.check { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.result { margin-top: 10px; }
@media (max-width: 600px) {
  :root { --logo-h: 32px; }
  main { padding: 12px 16px; }
  .me { display: none; }   /* keeps the logo's clear space free on phones */
  #review .card:not(.optional) th:nth-child(3), #review .card:not(.optional) td:nth-child(3),
  #review .card:not(.optional) th:nth-child(4), #review .card:not(.optional) td:nth-child(4),
  #review .card.optional th:nth-child(3), #review .card.optional td:nth-child(3) { display: none; }
  #ordersList th:nth-child(3), #ordersList td:nth-child(3) { display: none; }
}

/* Printing / Save as PDF: keep the brand colors (browsers drop backgrounds by default) and leave out the controls */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #fff; }
  .sendbar, #replyPanel, #submitPanel, #changes button, .footer-actions, .band a, input.answer, input.add-line, #history { display: none !important; }
  main { padding: 0 16px; max-width: none; }
  .card, .panel, .decide, tr { break-inside: avoid; }
  thead { display: table-header-group; }
}
.warn { color: var(--js-red); font-weight: 600; margin: 8px 0; }
label.stack { display: block; margin: 8px 0; }
textarea.bid-notes { display: block; width: 100%; min-height: 56px; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; box-sizing: border-box; }
input.line-qty { width: 60px; }

/* photos the order came in with */
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 140px; text-decoration: none; color: inherit; }
.thumb img { width: 140px; height: 140px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); }
.thumb .doc { width: 140px; height: 140px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 4px; font-weight: 600; background: var(--bg); }
.thumb .small { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .thumb, .thumb img, .thumb .doc, .thumb .small { width: 100px; max-width: 100px; } .thumb img, .thumb .doc { height: 100px; } }
