/* ============================================================================
   « Mon plancher » — the technician's screen on a phone (views/tech.js) and
   the camera barcode scanner (ui/scan.js). Phone first (390 px), fine on a
   tablet or a desk screen: one column of big cards and big buttons, nothing
   narrower than a thumb. Every colour comes from tokens.css, so the dark
   theme follows.
   ========================================================================== */

.tech { display: flex; flex-direction: column; gap: var(--s-4); max-width: 760px; margin: 0 auto; min-width: 0; }
.tech-back { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); align-self: flex-start; }
.tech-back:hover { color: var(--accent); text-decoration: none; }

/* ---- Section titles ------------------------------------------------------ */
.tech-h {
  display: flex; align-items: center; gap: var(--s-2); margin: var(--s-2) 0 0;
  font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; color: var(--ink);
}
.tech-h svg { color: var(--accent); flex: none; }
.tech-h b { font-weight: 600; font-size: var(--fs-sm); color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.tech-h__act { margin-left: auto; }
.tech-empty { margin: 0; padding: var(--s-4); border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--ink-3); font-size: var(--fs-sm); }

/* ---- Big buttons ---------------------------------------------------------- */
.tech-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 52px; padding: 0 var(--s-4); border-radius: var(--r-lg);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 650; font-size: var(--fs-base); cursor: pointer; flex: 1 1 auto; min-width: 0;
  box-shadow: var(--shadow-xs); transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tech-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-btn:active { transform: translateY(1px); }
.tech-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.tech-btn--wide { min-height: 64px; font-size: var(--fs-xl); }
.tech-btn--go { background: var(--success); border-color: transparent; color: #fff; }
.tech-btn--go:hover { background: color-mix(in srgb, var(--success) 86%, #000); }
.tech-btn--accent { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.tech-btn--accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.tech-btn--ok { background: var(--success-soft); border-color: transparent; color: var(--success-ink); }
.tech-btn--stop { background: var(--danger-soft); border-color: transparent; color: var(--danger-ink); }
.tech-btn--stop:hover { background: var(--danger); color: #fff; }

/* ---- Me, on the clock ----------------------------------------------------- */
.tech-me {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: var(--s-4); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: var(--s-3);
}
.tech-me__who { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.tech-me__name { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.tech-me__name b { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-me__state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-3); }
.tech-me__state i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.tech-me__state[data-tone="job"] i { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.tech-me__state[data-tone="idle"] i { background: var(--info); }
.tech-me__state[data-tone="break"] i { background: var(--warning); }
.tech-me__shift { text-align: right; display: grid; line-height: 1.1; }
.tech-me__shift span { font-size: var(--fs-2xl); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tech-me__shift small { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.tech-me__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.tech-me__actions .tech-btn { flex: 1 1 calc(50% - var(--s-2)); }
.tech-me__actions .tech-btn--wide { flex-basis: 100%; }
.tech-me--compact { padding: var(--s-3) var(--s-4); }
.tech-me--compact .tech-me__name b { font-size: var(--fs-base); }
.tech-me--compact .tech-me__shift span { font-size: var(--fs-xl); }

.tech-now {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label label" "title timer" "task since";
  gap: 2px var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-lg);
  background: var(--success-soft); color: var(--success-ink); text-decoration: none; align-items: center;
}
.tech-now:hover { text-decoration: none; filter: brightness(.98); }
.tech-now--break { background: var(--warning-soft); color: var(--warning-ink); grid-template-areas: "label timer"; }
.tech-now__label { grid-area: label; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; opacity: .8; }
.tech-now__title { grid-area: title; font-weight: 700; font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-now__task { grid-area: task; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-now__timer { grid-area: timer; font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; text-align: right; }
.tech-now__since { grid-area: since; font-size: var(--fs-xs); text-align: right; opacity: .8; }
.tech-now--break .tech-now__timer { grid-row: 1 / span 1; }

/* ---- Work-order cards ------------------------------------------------------- */
.tech-list { display: flex; flex-direction: column; gap: var(--s-3); }
.tech-more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: var(--s-2); font-weight: 650; color: var(--ink-3); padding: var(--s-2) 0; user-select: none; }
.tech-more > summary::-webkit-details-marker { display: none; }
.tech-more > summary b { font-weight: 600; font-size: var(--fs-sm); color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.tech-more > summary svg { transition: transform var(--t-med) var(--ease); }
.tech-more[open] > summary svg { transform: rotate(180deg); }
.tech-more .tech-list { margin-top: var(--s-2); }

.tech-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); min-width: 0;
  box-shadow: var(--shadow-xs);
}
.tech-card.is-mine { border-color: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.tech-card.is-compact { padding: var(--s-2) var(--s-3); gap: 4px; }
.tech-card__head { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; color: inherit; text-decoration: none; min-width: 0; }
.tech-card__head:hover { text-decoration: none; }
.tech-card__head > svg:last-child { margin-left: auto; color: var(--faint); flex: none; }
.tech-card__num { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-md); color: var(--accent); }
.tech-card__vehicle { font-size: var(--fs-md); color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 140px; }
.tech-card__vehicle b { color: var(--ink); font-weight: 700; letter-spacing: .02em; }
.tech-card__chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.tech-card__meta { display: flex; flex-wrap: wrap; gap: 4px var(--s-3); font-size: var(--fs-sm); color: var(--ink-3); }
.tech-card__meta > * { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.tech-card__meta a { color: var(--accent); }
.tech-card__due.is-late { color: var(--danger); font-weight: 600; }
.tech-card__title { font-weight: 600; font-size: var(--fs-md); color: var(--ink); }
.tech-card__sub { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); }
.tech-card__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-1); }
.tech-card__actions .tech-btn { flex: 1 1 calc(50% - var(--s-2)); min-height: 46px; font-size: var(--fs-md); }
.tech-card__actions .tech-btn:not(.tech-btn--go):not(.tech-btn--accent) span,
.tech-me__actions .tech-btn:not(.tech-btn--accent):not(.tech-btn--wide) span { white-space: normal; line-height: 1.15; text-align: left; }
.tech-card__actions--wo { margin-top: 0; }

/* Tasks inside a card */
.tech-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tech-task { display: flex; align-items: center; gap: var(--s-2); padding: 6px var(--s-2); border-radius: var(--r-md); background: var(--surface-2); min-width: 0; }
.tech-task.is-on { background: var(--success-soft); }
.tech-task.is-done .tech-task__title { color: var(--ink-3); text-decoration: line-through; }
.tech-task__mark {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 700;
}
.tech-task__mark i { font-style: normal; }
.tech-task.is-done .tech-task__mark, .tech-job.is-done .tech-task__mark { background: var(--success); color: #fff; }
.tech-task.is-on .tech-task__mark, .tech-job.is-mine .tech-task__mark { background: var(--accent); color: var(--accent-ink); }
.tech-task__title { flex: 1 1 auto; min-width: 0; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-task .btn { flex: none; }

/* ---- One work order ---------------------------------------------------------- */
.tech-wohead {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-2); box-shadow: var(--shadow-sm);
}
.tech-wohead__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }
.tech-wohead__vehicle { font-size: var(--fs-xl); line-height: var(--lh-tight); }
.tech-wohead__vehicle b { font-weight: 800; letter-spacing: .02em; }
.tech-wohead__vehicle span { color: var(--ink-2); font-size: var(--fs-base); }
.tech-wohead__title { font-weight: 650; font-size: var(--fs-md); }
.tech-wohead__desc { margin: 0; color: var(--ink-2); font-size: var(--fs-md); white-space: pre-wrap; }
.tech-odo { margin-top: var(--s-1); }
.tech-odo__row { display: flex; align-items: center; gap: var(--s-2); }
.tech-odo__row .input { flex: 1 1 auto; min-width: 0; max-width: 220px; font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.tech-odo__unit { color: var(--muted); font-weight: 600; font-size: var(--fs-sm); }
.tech-over .btn { margin-top: var(--s-1); }

.tech-job { gap: var(--s-2); }
.tech-job.is-mine { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tech-job__head { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.tech-job__title { font-weight: 650; font-size: var(--fs-base); flex: 1 1 auto; min-width: 0; }
.tech-job__hours { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.tech-job__line { font-size: var(--fs-md); color: var(--ink-2); white-space: pre-wrap; }
.tech-job__line b { display: block; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tech-job__now { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--accent); }
.tech-job__now [data-timer] { font-variant-numeric: tabular-nums; }
.tech-job__story > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); user-select: none; }
.tech-job__story > summary::-webkit-details-marker { display: none; }
.tech-job__story[open] > summary { margin-bottom: var(--s-2); }
.tech-job__actions { display: flex; gap: var(--s-2); }
.tech-job__actions .tech-btn { min-height: 46px; font-size: var(--fs-md); }

/* Parts */
.tech-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tech-line { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--border-subtle); min-width: 0; }
.tech-line:last-child { border-bottom: 0; }
.tech-line__no { flex: 0 0 auto; max-width: 34%; font-weight: 700; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-line__desc { flex: 1 1 auto; min-width: 0; font-size: var(--fs-md); display: grid; }
.tech-line__desc small { font-size: var(--fs-xs); }
.tech-line__qty { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.tech-pull { background: var(--surface-inset); }
.tech-search { display: flex; gap: var(--s-2); }
.tech-search .input { flex: 1 1 auto; min-width: 0; }
.tech-hits { display: flex; flex-direction: column; gap: 4px; margin-top: var(--s-2); max-height: min(38vh, 320px); overflow: auto; }
.tech-hit {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "no stock" "desc stock"; gap: 0 var(--s-2);
  padding: var(--s-2) var(--s-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
  text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.tech-hit:hover, .tech-hit:focus-visible { border-color: var(--accent); outline: none; background: var(--accent-soft); }
.tech-hit.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft-2); }
.tech-hit__no { grid-area: no; font-weight: 700; font-size: var(--fs-sm); }
.tech-hit__desc { grid-area: desc; font-size: var(--fs-sm); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-hit__stock { grid-area: stock; align-self: center; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; white-space: nowrap; }
.tech-nohit { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-3); font-size: var(--fs-sm); }
.tech-partpick { margin-top: var(--s-3); padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-inset); display: flex; flex-direction: column; gap: var(--s-3); }
.tech-partpick__what { font-size: var(--fs-md); }
.tech-partpick__what b { font-family: var(--font-mono); }
.tech-qty { display: grid; gap: 4px; }
.tech-qty__row { display: flex; align-items: center; gap: var(--s-2); }
.tech-qty__row .input { width: 96px; text-align: center; font-size: var(--fs-lg); font-weight: 700; }
.tech-qty__row .btn { width: 44px; height: 44px; }

/* Photos */
.tech-preview { display: flex; gap: var(--s-2); overflow: auto; margin-bottom: var(--s-3); }
.tech-preview img { height: 120px; border-radius: var(--r-md); object-fit: cover; flex: none; border: 1px solid var(--border); }
.tech-notes p { margin: 0; white-space: pre-wrap; font-size: var(--fs-md); color: var(--ink-2); }
.tech-inspection .card { box-shadow: var(--shadow-xs); }

/* ---- The camera scanner ------------------------------------------------------- */
.scanbox { position: relative; border-radius: var(--r-md); overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanbox__video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanbox__frame {
  position: absolute; inset: 18% 12%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); transition: border-color var(--t-fast) var(--ease);
}
.scanbox.is-hit .scanbox__frame { border-color: var(--success); }
.scanbox__status {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; text-align: center;
  font-size: var(--fs-sm); font-weight: 600; color: #fff; background: rgba(0, 0, 0, .55);
}
.scanbox__type { display: flex; gap: var(--s-2); }
.scanbox__type .input { flex: 1 1 auto; min-width: 0; }

/* ---- Wide screens: two columns of cards --------------------------------------- */
@media (min-width: 900px) {
  .tech { max-width: 1100px; }
  .tech-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .tech-me__actions .tech-btn { flex: 1 1 auto; }
  .tech-me__actions .tech-btn--wide { flex-basis: auto; }
}
@media (max-width: 480px) {
  .tech-card__actions .tech-btn--go, .tech-card__actions .tech-btn--accent, .tech-me__actions .tech-btn--accent, .tech-me__actions .tech-btn--wide { flex-basis: 100%; }
.tech-me--compact { padding: var(--s-3) var(--s-4); }
.tech-me--compact .tech-me__name b { font-size: var(--fs-base); }
.tech-me--compact .tech-me__shift span { font-size: var(--fs-xl); }
  .tech-card__actions .tech-btn:not(.tech-btn--go):not(.tech-btn--accent), .tech-me__actions .tech-btn:not(.tech-btn--accent):not(.tech-btn--wide) { flex-basis: calc(50% - var(--s-2)); }
  .tech-job__actions { flex-direction: column; }
}
.tech-btn--warn { background: var(--warning-soft); border-color: transparent; color: var(--warning-ink); }
