/* Borem Fire field-tool mockup.
 * Brand colors live in :root so reskinning to Borem's real palette is a one-place change. */
:root {
  --brand: #cc1f2d;          /* Borem truck red */
  --brand-dark: #9e1722;
  --brand-tint: #ffe9ea;
  --ink: #161616;            /* near-black, matches the BOREM wordmark */
  --ink-soft: #5c666b;
  --line: #e4e8ea;
  --bg: #f4f6f7;
  --card: #ffffff;
  --ok: #1a7f4b;
  --warn: #c0211f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 6px 16px rgba(0,0,0,.05);
  --tap: 56px;               /* min tap target — field gloves */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 920px; margin: 0 auto; min-height: 100%; background: var(--bg); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--brand);
  color: #fff;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand__logo { height: 40px; width: auto; flex: none; }
.brand__meta { display: flex; flex-direction: column; min-width: 0; }
.brand__name { font-weight: 800; font-size: 19px; letter-spacing: .2px; }
.brand__addr { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar__right { display: flex; align-items: center; gap: 14px; flex: none; }
.topbar__report {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.45); color: #fff;
  border-radius: 99px; padding: 8px 16px; font-weight: 700; font-size: 14px; cursor: pointer;
  min-height: 40px; white-space: nowrap;
}
.topbar__reset {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); color: #fff;
  width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: none;
  line-height: 1;
}
.progress { text-align: right; flex: none; min-width: 160px; }
.progress__count { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.progress__count span { font-weight: 800; }
.progress__bar { height: 8px; background: rgba(255,255,255,.3); border-radius: 99px; overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: #fff; border-radius: 99px; transition: width .4s ease; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; padding: 16px 20px 8px; }
.tab {
  flex: 1; min-height: 46px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 99px; font-size: 15px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .15s ease;
}
.tab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab__badge {
  background: var(--brand-tint); color: var(--brand-dark);
  border-radius: 99px; padding: 1px 9px; font-size: 13px; font-weight: 800;
}
.tab.is-active .tab__badge { background: rgba(255,255,255,.22); color: #fff; }

/* ---------- unit list ---------- */
.unit-list { list-style: none; margin: 0; padding: 8px 16px 120px; }
.unit {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  min-height: var(--tap);
  transition: transform .12s ease, box-shadow .12s ease, opacity .3s ease;
}
.unit:active { transform: scale(.99); }
.unit--done { opacity: .6; }
.unit__main { flex: 1; min-width: 0; }
.unit__loc { font-weight: 700; font-size: 17px; margin-bottom: 2px; }
.unit__spec { font-size: 14px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.unit__serial { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.unit__serial--missing { color: var(--brand); font-style: italic; font-weight: 600; }
.unit__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.chip {
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  background: #eef1f2; color: var(--ink-soft);
}
.chip--overdue { background: var(--brand-tint); color: var(--brand-dark); }
.chip--added { background: #fff4d6; color: #8a6300; }

.unit__action { flex: none; }
.unit__go { color: var(--brand); font-weight: 700; font-size: 15px; }
.unit__check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ok); color: #fff; font-weight: 800;
}

/* ---------- empty / all-done ---------- */
.empty { text-align: center; padding: 64px 24px; }
.empty__icon {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 38px;
  display: flex; align-items: center; justify-content: center;
}
.empty__title { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.empty__sub { color: var(--ink-soft); margin: 0; }
.empty__cta { max-width: 340px; margin: 24px auto 0; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px;
  background: var(--brand); color: #fff; border: none;
  padding: 0 28px; height: 56px; border-radius: 99px;
  font-size: 17px; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 20px rgba(192,33,31,.4); z-index: 20;
}
.fab:active { transform: translateX(-50%) scale(.97); }

/* ---------- views ---------- */
.view { display: none; }
.view.is-active { display: block; }

/* ---------- inspection detail ---------- */
.detail { padding: 8px 20px 140px; }
.detail__back {
  background: none; border: none; color: var(--brand); font-weight: 700; font-size: 16px;
  padding: 14px 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.detail__loc { font-size: 26px; font-weight: 800; margin: 4px 0 2px; }
.detail__sub { color: var(--ink-soft); font-size: 15px; margin-bottom: 18px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card__label { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 0 12px; }

.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.spec { min-width: 0; }
.spec__k { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.spec__v { font-size: 16px; font-weight: 700; }
.spec__v.is-overdue { color: var(--brand); }

/* serial capture row */
.serial-row { display: flex; gap: 10px; align-items: center; }
.serial-row input {
  flex: 1; min-height: var(--tap); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 14px; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.btn-scan {
  flex: none; min-height: var(--tap); padding: 0 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--brand); background: var(--brand-tint); color: var(--brand-dark);
  font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 7px;
}

/* pass/fail big toggle */
.passfail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pf {
  min-height: 64px; border-radius: 12px; border: 2px solid var(--line); background: var(--card);
  font-size: 18px; font-weight: 800; cursor: pointer; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.pf--pass.is-on { border-color: var(--ok); background: #e8f6ee; color: var(--ok); }
.pf--fail.is-on { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-dark); }

/* service action chips */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.act {
  min-height: 48px; padding: 0 16px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 700; font-size: 15px;
}
.act.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }

.notes {
  width: 100%; min-height: 90px; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font: inherit; resize: vertical;
}
.text-field {
  width: 100%; min-height: var(--tap); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 14px; font-size: 17px; font-weight: 600;
}

/* just-added unit flash */
@keyframes flashIn {
  0% { background: var(--brand-tint); box-shadow: 0 0 0 3px var(--brand); }
  100% { background: var(--card); box-shadow: var(--shadow); }
}
.unit--flash { animation: flashIn 1.6s ease; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-row span { font-weight: 700; }
.switch { position: relative; width: 56px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; inset: 0; background: #cfd5d8; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch__track::before { content: ""; position: absolute; height: 26px; width: 26px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::before { transform: translateX(24px); }

.detail__save {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: linear-gradient(transparent, var(--bg) 30%); padding: 16px 20px 20px;
}
#app .detail__save { max-width: 920px; margin: 0 auto; }
.btn-primary {
  width: 100%; min-height: 60px; border: none; border-radius: 14px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 19px; font-weight: 800;
  box-shadow: 0 6px 20px rgba(204,31,45,.35);
}
.btn-primary:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }

/* ---------- welcome ---------- */
.welcome {
  position: fixed; inset: 0; z-index: 200;
  background: linear-gradient(160deg, var(--brand), var(--brand-dark));
  display: flex; align-items: center; justify-content: center; padding: 24px;
  transition: opacity .35s ease;
}
.welcome.is-gone { opacity: 0; pointer-events: none; }
.welcome__card {
  background: var(--card); border-radius: 22px; padding: 36px 28px; max-width: 440px; width: 100%;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.welcome__logo { height: 56px; width: auto; margin-bottom: 22px; filter: brightness(0) saturate(100%); }
.welcome__lead { font-size: 21px; font-weight: 700; line-height: 1.35; margin: 0 0 10px; }
.welcome__by { font-size: 14px; font-weight: 700; color: var(--brand); letter-spacing: .2px; margin: 0 0 18px; }
.welcome__hint { font-size: 16px; color: var(--ink-soft); margin: 0 0 26px; }
.welcome__start { max-width: 280px; margin: 0 auto; }

/* ---------- list hint ---------- */
.hint {
  display: flex; align-items: flex-start; gap: 12px; margin: 16px 20px 0;
  background: #fff8e6; border: 1px solid #f1dca0; color: #6b5300;
  border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4;
}
.hint__close { flex: none; border: none; background: transparent; color: #6b5300;
  font-size: 15px; cursor: pointer; padding: 2px 4px; }

/* ---------- scan overlay ---------- */
.scan-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10,10,12,.6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.scan-overlay[hidden] { display: none; } /* must beat the .scan-overlay display:flex above */
.scan-sheet {
  background: var(--card); width: 100%; max-width: 520px;
  border-radius: 20px 20px 0 0; padding: 22px 22px 28px; position: relative;
  box-shadow: 0 -8px 40px rgba(0,0,0,.3);
}
@media (min-width: 540px) { .scan-overlay { align-items: center; } .scan-sheet { border-radius: 20px; } }
.scan-close {
  position: absolute; right: 16px; top: 16px; border: none; background: #eef1f2;
  width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; color: var(--ink-soft);
}
.scan-title { font-size: 20px; font-weight: 800; margin: 2px 0 16px; }
.scan-stage {
  position: relative; aspect-ratio: 4/3; background: #111; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: none; }
.scan-stage.is-live video { display: block; }
.scan-reticle {
  position: absolute; width: 72%; height: 42%; border: 3px solid rgba(255,255,255,.9);
  border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.15);
}
.scan-reticle::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: var(--brand); box-shadow: 0 0 8px var(--brand); opacity: 0;
}
.scan-stage.is-scanning .scan-reticle::after { animation: scanline 0.7s ease-in-out; opacity: 1; }
@keyframes scanline { 0% { top: 4%; } 100% { top: 96%; } }
.scan-hint {
  position: absolute; bottom: 10px; left: 12px; right: 12px; text-align: center;
  color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.scan-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-ghost {
  width: 100%; min-height: 52px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 16px; font-weight: 700;
}
.scan-note { text-align: center; color: var(--ink-soft); font-size: 14px; margin: 12px 0 0; min-height: 18px; }

/* ---------- report ---------- */
.report-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.btn-print {
  background: var(--brand); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-weight: 800; font-size: 15px; cursor: pointer; min-height: 44px;
}
.report {
  background: #fff; margin: 0 20px 40px; padding: 28px; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.report-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  border-bottom: 3px solid var(--brand); padding-bottom: 18px; margin-bottom: 20px; }
.report-head__brand { display: flex; align-items: center; gap: 16px; }
.report-logo { height: 52px; width: auto; /* white logo: tint dark for print on white */
  filter: brightness(0) saturate(100%); }
.report-title { font-size: 20px; font-weight: 800; line-height: 1.15; color: var(--ink); }
.report-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; align-content: start; }
.report-meta div { display: flex; flex-direction: column; }
.report-meta span { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.report-meta strong { font-size: 15px; }

.report-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.sum { flex: 1; min-width: 92px; background: #f6f8f9; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; text-align: center; }
.sum__n { font-size: 26px; font-weight: 800; line-height: 1; }
.sum__l { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.sum--ok .sum__n { color: var(--ok); }
.sum--bad .sum__n { color: var(--brand); }
.sum--warn .sum__n { color: #b8860b; }

.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th { text-align: left; background: var(--ink); color: #fff; padding: 8px 9px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.report-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.report-table tr:nth-child(even) td { background: #fafbfb; }
.report-table .r-mono { font-variant-numeric: tabular-nums; }
.report-table .is-overdue { color: var(--brand); font-weight: 700; }
.r-row--pending td { color: var(--ink-soft); }
.r-tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 800; }
.r-tag--pass { background: #e8f6ee; color: var(--ok); }
.r-tag--fail { background: var(--brand-tint); color: var(--brand-dark); }
.r-tag--none { background: #eef1f2; color: var(--ink-soft); }
.r-added { color: #8a6300; font-size: 11px; font-weight: 700; }
.r-return { color: #b8860b; font-size: 11px; font-weight: 700; }
.r-notes { max-width: 180px; }
.report-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-soft); text-align: center; }

.report-cta {
  margin-top: 26px; background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 28px 24px; text-align: center;
}
.cta-lead { font-size: 20px; font-weight: 800; line-height: 1.35; margin: 0 auto 16px; max-width: 460px; }
.cta-contact { font-size: 14px; color: #d6dadd; line-height: 1.6; margin-bottom: 20px; }
.cta-contact strong { color: #fff; }
.cta-btn { display: inline-block; width: auto; min-width: 220px; text-decoration: none;
  line-height: 60px; padding: 0 32px; }

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  .topbar, .report-bar, .fab, .tabs { display: none !important; }
  .view { display: none !important; }
  .view[data-view="report"] { display: block !important; }
  .welcome, .hint, .report-cta { display: none !important; } /* CTA is a pitch, not part of the client deliverable */
  #app { max-width: none; }
  .report { box-shadow: none; border: none; margin: 0; padding: 0; }
  .report-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- phone fallback ---------- */
@media (max-width: 540px) {
  body { font-size: 16px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .brand__addr { font-size: 12px; }
  .topbar__right { width: 100%; gap: 10px; }
  .progress { min-width: 0; flex: 1; text-align: left; }
  .progress__count { display: flex; justify-content: space-between; }
  .report-meta { grid-template-columns: 1fr; }
  .report-table { font-size: 11px; }
  .report-table th, .report-table td { padding: 6px 5px; }
  .report { padding: 16px; margin: 0 10px 30px; }
}
