/* JW LED brand colours (Products and Marketing/Resources/Logo/#Brand Guide, July 2025):
   slate #627984, light grey #B6BEC4, orange #F48220, navy #0F344B (secondary); font Open Sans. Andrew, Nov 10. */
:root {
  --brand-slate: #627984;
  --brand-grey: #B6BEC4;
  --brand-orange: #F48220;
  --brand-navy: #0F344B;
  --bg: #eceff1;
  --panel: #ffffff;
  --text: #0F344B;
  --muted: #566b75;
  --line: #d3d9dd;
  --accent: #0F344B;
  --action: #F48220;
  --on-action: #0F344B;
  --late: #b3261e;
  --warn-bg: #fdeed3;
  --warn-text: #6d3b00;
  --ready: #1f7a45;
  --on-accent: #ffffff;
  --head-bg: #0F344B;
  --k-assembly: #627984;
  --k-smt: #7b3fb5;
  --k-shipping: #1f7a45;
  --k-transfer: #F48220;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1f2d;
    --panel: #12293a;
    --text: #e8eef2;
    --muted: #B6BEC4;
    --line: #29445a;
    --accent: #F48220;
    --late: #ff8a80;
    --warn-bg: #4a3209;
    --warn-text: #ffd9a3;
    --ready: #52b87e;
    --on-accent: #0F344B;
    --head-bg: #07161f;
    --k-assembly: #9fb4bf;
    --k-smt: #c39bf0;
    --k-shipping: #52b87e;
    --k-transfer: #F48220;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 'Open Sans', system-ui, 'Segoe UI', Roboto, sans-serif; }
/* Full screen: room for a tablet's notch and the Full screen button */
.full-btn { margin-right: 10px; padding: 5px 12px; border: 1px solid var(--brand-grey); border-radius: 999px; background: none; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.full-btn:hover { background: rgb(255 255 255 / .1); }
button, input, select { font: inherit; color: inherit; }

.copy-banner { background: var(--warn-bg); color: var(--warn-text); text-align: center; padding: 4px 16px; font-size: 13px; }

header { display: flex; align-items: center; gap: 16px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--head-bg); color: #fff; border-bottom: 3px solid var(--brand-orange); }
header h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: .02em; }
header h1 span { color: var(--brand-grey); font-weight: 400; letter-spacing: .12em; }
header .who { margin-left: auto; display: flex; align-items: center; gap: 4px; color: var(--brand-grey); font-size: 13px; }
header .link { color: #fff; text-decoration: underline; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }

nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--brand-grey); font-weight: 600; font-size: 15px; }
nav .tab-count { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--brand-orange); color: var(--brand-navy); font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
nav button:not(.on) .tab-count { background: rgb(255 255 255 / .14); color: #fff; }
nav button:hover { color: #fff; }
nav button.on { color: #fff; border-bottom-color: var(--brand-orange); }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.tools input, .tools select { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.tools input { flex: 1 1 220px; min-width: 0; }
.tools .count { color: var(--muted); font-size: 13px; }

.list { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.head, .row { display: grid; grid-template-columns: var(--cols); gap: 12px; padding: 8px 12px; align-items: baseline; }
.orders { --cols: 80px 1fr 150px 100px 100px 200px; }
.mos { --cols: 80px 1fr 100px 90px 90px 100px; }
.head { color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.row { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.row:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
/* Open orders and MOs (Andrew, Nov 10): taller rows, every other row shaded, customer and status stand out */
.list .row { padding: 12px; font-size: 15px; align-items: center; }
.list .head { padding: 10px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.list .row:nth-of-type(even) { background: color-mix(in srgb, var(--line) 30%, transparent); }
.list .row:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.list .row[aria-expanded='true'] { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 4px 0 var(--accent); }
.list .cust { font-weight: 600; }
.pill { justify-self: start; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); white-space: nowrap; }
.pill.going { background: color-mix(in srgb, var(--ready) 16%, transparent); color: var(--ready); }
.pill.wait { background: var(--warn-bg); color: var(--warn-text); }
.row:last-child { border-bottom: 0; }
.num { font-weight: 600; }
.money { text-align: right; font-variant-numeric: tabular-nums; }
.late { color: var(--late); font-weight: 600; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail { padding: 8px 12px 12px; border-bottom: 1px solid var(--line); background: var(--bg); font-size: 14px; }
.detail .note { color: var(--muted); margin: 0 0 8px; white-space: pre-wrap; }
.detail table { width: 100%; border-collapse: collapse; }
.detail th { text-align: left; color: var(--muted); font-weight: 400; font-size: 12px; }
.detail td, .detail th { padding: 3px 12px 3px 0; vertical-align: top; }
.detail .qty { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.message { padding: 24px; text-align: center; color: var(--muted); }
.message.error { color: var(--late); }

.signin { max-width: 340px; margin: 12vh auto 0; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.signin h1 { margin: 0 0 16px; font-size: 20px; }
.signin label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.signin input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.signin button { width: 100%; padding: 9px; background: var(--action); color: var(--on-action); font-weight: 700; border: 0; border-radius: 6px; cursor: pointer; }
.signin .error { color: var(--late); font-size: 13px; margin: 0 0 12px; }

main.wide { max-width: none; }
.primary { background: var(--action); color: var(--on-action); font-weight: 700; border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; max-width: calc(100% - 32px); z-index: 5; }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; align-items: start; padding-bottom: 8px; }
.column { display: grid; gap: 8px; min-width: 0; }
.column h2 { margin: 0; font-size: 16px; }
.column h2 small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.my-list { display: grid; gap: 8px; max-width: 640px; margin: 0 auto; }

/* Job cards (Andrew, Nov 10: easier to read and tell apart): a colour stripe and tag per kind of job */
.card { --kind: var(--muted); background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--kind); border-radius: 10px; min-width: 0; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.card.kind-assembly { --kind: var(--k-assembly); }
.card.kind-smt { --kind: var(--k-smt); }
.card.kind-shipping { --kind: var(--k-shipping); }
.card.kind-transfer { --kind: var(--k-transfer); }
.card.is-rush { border-color: var(--late); border-left-color: var(--late); }
.card-open { display: grid; gap: 6px; width: 100%; padding: 12px 14px; background: none; border: 0; text-align: left; cursor: pointer; }
.card-open:hover { background: color-mix(in srgb, var(--kind) 6%, transparent); }
.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; }
.card .num { font-size: 15px; }
.kind-tag { margin-left: auto; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; color: var(--kind); background: color-mix(in srgb, var(--kind) 14%, transparent); }
.card .name { font-size: 19px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.card .customer { font-size: 14px; font-weight: 600; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.facts > span { padding: 3px 8px; border-radius: 6px; background: var(--bg); color: var(--muted); }
.facts b { color: var(--text); }
.card-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.card-flags:empty { display: none; }
.card-tools { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 14px; background: color-mix(in srgb, var(--bg) 50%, var(--panel)); border-radius: 0 0 10px 0; }
.card-tools select { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.place { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--kind); color: var(--panel); font-size: 13px; }
.column { background: color-mix(in srgb, var(--line) 35%, transparent); border-radius: 12px; padding: 10px; align-content: start; gap: 10px; }
.column h2 { font-size: 18px; padding: 0 2px 6px; border-bottom: 1px solid var(--line); }
.column .empty { padding: 8px 2px; }
.sub { color: var(--muted); font-size: 13px; margin: 0; }
.flag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 0 6px; border-radius: 4px; }
.flag.rush { background: var(--late); color: var(--panel); }
.flag.hold { background: var(--warn-bg); color: var(--warn-text); }
.flag.started { border: 1px solid var(--accent); color: var(--accent); }

.job { max-width: 720px; margin: 0 auto; display: grid; gap: 8px; }
.job h2 { margin: 0; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.job .num { font-weight: 600; }
.act { min-height: 52px; padding: 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-size: 17px; font-weight: 600; cursor: pointer; }
.act.main { background: var(--action); border-color: var(--action); color: var(--on-action); }
.act:disabled { opacity: .45; cursor: not-allowed; }
.act.back { justify-self: start; min-height: 44px; font-size: 15px; }
.finish { width: 100%; min-height: 68px; font-size: 22px; }
.row-buttons { display: flex; gap: 8px; }
.row-buttons .act { flex: 1; }
.step { border-top: 2px solid var(--line); padding-top: 8px; display: grid; gap: 6px; }
.step h3 { margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 15px; color: var(--muted); }
.step h3 b { color: var(--text); }

.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.pick { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 56px; padding: 6px 10px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.line:has(.line-buttons:empty) .pick, .line > .pick:only-child { grid-column: 1 / -1; }
.pick small { display: block; color: var(--muted); font-size: 13px; line-height: 1.25; }
.pick .box { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 2px solid var(--muted); border-radius: 6px; font-weight: 700; }
.pick[aria-pressed='true'] { border-color: var(--ready); }
.pick[aria-pressed='true'] .box { background: var(--ready); border-color: var(--ready); color: var(--panel); }
.big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.line-buttons { display: grid; gap: 6px; }
.small-act { min-width: 60px; min-height: 40px; background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); cursor: pointer; }
.small-act.warn { color: var(--late); }
.part-note { grid-column: 1 / -1; background: var(--warn-bg); color: var(--warn-text); padding: 6px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.part-note small { display: block; }

.note-form, .watt-form { grid-column: 1 / -1; display: grid; gap: 8px; }
.note-form label, .watt-form label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.note-form input, .note-form textarea, .watt-form input { width: 100%; min-height: 48px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-size: 18px; }
.watt-form input { font-size: 32px; font-weight: 700; text-align: center; min-height: 66px; }

.clock-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.clabel { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.clock { font-size: 46px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.counts div { background: var(--panel); border-radius: 8px; padding: 8px 6px; text-align: center; }
.counts span { display: block; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.counts b { font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; }
.meter { height: 12px; background: var(--panel); border-radius: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ready); }
.ask { margin: 4px 0; font-size: 24px; font-weight: 600; line-height: 1.15; }
.yes-no { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.yes-no .act { min-height: 84px; font-size: 24px; }
.slide { position: relative; display: flex; align-items: center; justify-content: center; min-height: 84px; background: var(--panel); border: 1px solid var(--accent); border-radius: 8px; overflow: hidden; user-select: none; -webkit-user-select: none; }
.slide span { padding: 0 8px 0 88px; font-size: 20px; font-weight: 600; line-height: 1.05; text-align: center; }
.knob { position: absolute; left: 0; top: 0; bottom: 0; width: 80px; display: grid; place-items: center; background: var(--action); color: var(--on-action); font-size: 32px; cursor: grab; touch-action: none; border-radius: 7px; }
.fishbowl-box { background: var(--panel); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; display: grid; gap: 6px; }
.fishbowl-box h2 { margin: 0; font-size: 16px; }
.request { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.request.problem b { color: var(--late); }
.request b { font-weight: 600; font-size: 13px; color: var(--muted); }
.job-msg { padding: 8px 12px; border-radius: 8px; background: var(--panel); font-weight: 600; }
.job-msg.off { background: var(--warn-bg); color: var(--warn-text); }

@media (max-width: 760px) {
  .board { grid-auto-flow: row; grid-auto-columns: auto; }
  .head { display: none; }
  .row { grid-template-columns: 1fr auto; gap: 2px 12px; }
  .row .wide { grid-column: 1 / -1; }
  .row .blank { display: none; }
  .row .money { text-align: left; }
  header { flex-wrap: wrap; gap: 8px 16px; padding-bottom: 0; }
}
/* phones and tablets: logo and name on top, the tabs on their own full-width row (Andrew, Nov 10) */
@media (max-width: 900px) {
  header { flex-wrap: wrap; row-gap: 6px; padding-bottom: 0; }
  header nav { order: 3; flex: 1 0 100%; margin: 0 -16px; padding: 0 10px; }
  nav button { padding: 10px 12px; }
}
@media (max-width: 480px) {
  nav button { padding: 10px 8px; font-size: 14px; gap: 4px; }
}
/* buttons keep brand orange with navy text in both themes */

/* Times (Andrew, Nov 10): owner only */
.times { --cols: 150px 1fr 60px 90px 130px 110px 120px 120px; }
.times-note { margin: -4px 0 10px; }
.big-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.big-time small { font-weight: 400; color: var(--muted); }
.time-detail { max-width: 900px; margin: 0 auto; display: grid; gap: 8px; }
.time-detail h2 { margin: 0; font-size: 24px; }
.time-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 6px 0; }
.time-facts div { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--brand-orange); border-radius: 8px; padding: 10px 12px; }
.time-facts span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.time-facts b { display: block; font-size: 24px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.section { margin: 12px 0 0; font-size: 16px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.times-table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 8px; overflow: hidden; font-variant-numeric: tabular-nums; }
.times-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.times-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.times-table tr.setup td { background: color-mix(in srgb, var(--brand-slate) 12%, transparent); font-weight: 600; }
.times-table tr.off td { background: var(--warn-bg); color: var(--warn-text); }
.times-table small { color: var(--muted); }
.time-notes { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.time-notes small { color: var(--muted); }
.time-facts small { display: block; color: var(--muted); font-size: 12px; }

/* Sales orders as cards, tagged with who picks them up (Andrew, Nov 10) */
.order-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.order-card .detail { border-top: 1px solid var(--line); border-bottom: 0; }
.pill.pickup { background: color-mix(in srgb, var(--brand-orange) 18%, transparent); color: var(--text); }
.pill.truck { background: color-mix(in srgb, var(--brand-slate) 18%, transparent); color: var(--text); }
.pill.pickup::before { content: '🙋 '; }
.pill.truck::before { content: '🚚 '; }
.card-top .pill { margin-left: auto; }
.pickup-btn { width: 100%; min-height: 56px; font-size: 18px; }
.card-tools .pickup-btn { margin: 2px 0; }

/* Andrew, Nov 10: MO / SO / TO / SMT tabs, mine first, then everyone else */
.list-head { max-width: 640px; margin: 4px auto 8px; font-size: 1.05rem; color: var(--text); display: flex; gap: 8px; align-items: baseline; }
.list-head small { font-weight: 400; color: var(--muted); }
.others-toggle { display: block; max-width: 640px; width: 100%; margin: 24px auto 12px; }
.list-head.others { margin-top: 28px; padding-top: 14px; border-top: 2px solid var(--brand-grey); }
.others-group { max-width: 640px; margin: 0 auto 14px; }
.others-group h3 { font-size: .95rem; margin: 6px 0; color: var(--muted); }
.others-group .card { opacity: .85; }

/* batch picking on the SO tab (Andrew, Nov 10) */
.batch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; max-width: 640px; margin: 0 auto 10px; }
.batch-bar .act { flex: 1 1 240px; }
.batch-pick { display: grid; gap: 4px; }
.batch-check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); padding: 2px 4px; cursor: pointer; }
.batch-check input { width: 22px; height: 22px; accent-color: var(--action); }
.batch-from { display: block; color: var(--muted); }
.batch-order { display: grid; gap: 6px; padding: 10px 0; border-top: 1px dashed var(--line); }
.batch-order h3 { margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 15px; }

/* office Done tab: JW LED / Peter / Both (Andrew, Nov 10) */
.done-shops { display: flex; gap: 6px; max-width: 640px; margin: 0 auto 10px; }
.done-shops button { flex: 1; padding: 10px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font-weight: 600; font-size: 15px; cursor: pointer; }
.done-shops button.on { background: var(--action); border-color: var(--action); color: var(--on-action); }

/* SO tab groups: Courier, Skids, Hand Bomb, Other (Andrew, Nov 10) */
.so-group { max-width: 640px; margin: 0 auto 18px; }
.so-group-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--action); }
.so-group-head small { color: var(--muted); font-weight: 500; }
.so-groups { flex-wrap: wrap; }
.so-groups button { flex: 1 1 130px; }
.so-group-note { max-width: 640px; margin: -4px auto 10px; }
