/* PitCheck — mobile-first, dirty-hands UI.
   Design goals: huge tap targets, one-tap ratings, minimal typing,
   thumb-reachable actions, readable in a bright workshop. */

:root {
  --bg:        #eef2f6;
  --card:      #ffffff;
  --ink:       #0b1f33;
  --ink-soft:  #5b6b7b;
  --line:      #d7dee6;
  --brand:     #0b1f33;
  --brand-2:   #1763b6;
  --accent:    #ff7a00;   /* high-vis action colour */
  --good:      #1ca35a;
  --good-bg:   #e3f6ec;
  --warn:      #e08a00;
  --warn-bg:   #fdf0d9;
  --bad:       #d23b3b;
  --bad-bg:    #fbe4e4;
  --na:        #8794a1;
  --na-bg:     #eceff2;
  --radius:    16px;
  --tap:       58px;       /* minimum interactive height */
  --shadow:    0 2px 10px rgba(11,31,51,.08);
  --safe-bot:  env(safe-area-inset-bottom, 0px);
}

/* Dark mode — overrides the surface/ink palette only.
   Brand and accent stay so the user's chosen colours still show through. */
body.dark {
  --bg:        #0e141b;
  --card:      #1a2330;
  --ink:       #e8eef4;
  --ink-soft:  #95a3b3;
  --line:      #2a3543;
  --good-bg:   #163228;
  --warn-bg:   #322614;
  --bad-bg:    #341818;
  --na-bg:     #2a3543;
  --shadow:    0 2px 12px rgba(0,0,0,.45);
}
body.dark .chip { background: #131a23; }
body.dark .chip.on.good { background: var(--good-bg); }
body.dark .chip.on.warn { background: var(--warn-bg); }
body.dark .chip.on.bad  { background: var(--bad-bg);  }
body.dark .chip.on.na   { background: var(--na-bg);   }
body.dark .platebox input { background: #1f2a38; color: #ffd400; }
body.dark .field input[readonly] { background: #131a23; }
body.dark .iconbtn { background: rgba(255,255,255,.10); }
body.dark .secnav button { background: #1a2330; }
body.dark .num input,
body.dark .notes,
body.dark .field input,
body.dark .field textarea { background: #1a2330; color: var(--ink); }
body.dark .damage-svg { background: #1a2330; }

/* Inputs don't inherit text colour by default — force them to */
input, textarea, select { color: inherit; }
.field input, .field textarea, .num input, .notes,
.platebox input, .bigval .val { color: var(--ink); }

/* Dark mode for the on-screen report (print rules below force back to light) */
body.dark .report { background: var(--bg); color: var(--ink); }
body.dark .rep-vehicle,
body.dark .rep-party > div,
body.dark .rep-summary,
body.dark .rep-dview { background: #1a2330; }
body.dark .rep-vmeta, body.dark .rep-vmeta.sub,
body.dark .rep-disclaim, body.dark .rep-foot,
body.dark .rep-id, body.dark .rep-contact { color: var(--ink-soft); }
body.dark .rep-findings { background: #2a1f0d; }
body.dark .rep-findings.rep-allgood { background: #14302a; }
body.dark .sticker { background: var(--card); border-color: var(--ink-soft); color: var(--ink); }
body.dark .sticker-head, body.dark .sticker-foot { color: var(--ink-soft); }
body.dark .rep-header { border-bottom-color: var(--ink-soft); }
body.dark .rep-sec h3 { color: var(--ink); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 18px; }

/* ---------- App frame ---------- */
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(96px + var(--safe-bot)); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--brand); color: #fff;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow);
}
.topbar .brand { font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.topbar .brand small { font-weight: 500; opacity: .7; font-size: 13px; display: block; }
.topbar .spacer { flex: 1; }
.iconbtn {
  background: rgba(255,255,255,.14); color: #fff; border: 0;
  width: 46px; height: 46px; border-radius: 12px; font-size: 22px;
  display: grid; place-items: center;
}
.iconbtn:active { background: rgba(255,255,255,.28); }
/* Wider variant for labelled back button so "‹ Home" fits comfortably */
.iconbtn.home-btn { width: auto; padding: 0 14px; font-size: 15px; font-weight: 800; }

/* ---------- Generic cards ---------- */
.wrap { padding: 16px; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  width: 100%; min-height: var(--tap); border: 0; border-radius: 14px;
  font-size: 19px; font-weight: 700; padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { filter: brightness(.92); }
.btn.dark { background: var(--brand); color: #fff; }
.btn.ghost { background: #fff; color: var(--brand); border: 2px solid var(--line); }
.btn.sm { min-height: 46px; font-size: 16px; width: auto; padding: 0 16px; }
.btn:disabled { opacity: .5; }

/* ---------- Home / list ---------- */
.hero { padding: 22px 16px 6px; }
.hero h1 { margin: 0 0 4px; font-size: 26px; }
.list-item {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
}
.del-insp {
  border: 0; background: transparent; color: var(--ink-soft);
  width: 36px; height: 36px; border-radius: 999px; font-size: 18px; font-weight: 800;
  flex-shrink: 0; cursor: pointer;
}
.del-insp:active { background: var(--bad-bg); color: var(--bad); }
.list-item .plate-chip {
  background: var(--ink); color: #ffd400; font-weight: 800; letter-spacing: 1px;
  border-radius: 8px; padding: 8px 10px; min-width: 86px; text-align: center;
  border: 2px solid #000; font-size: 18px;
}
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta b { display: block; font-size: 18px; }
.list-item .meta span { color: var(--ink-soft); font-size: 14px; }
.badge { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge.draft { background: var(--warn-bg); color: var(--warn); }
.badge.done  { background: var(--good-bg); color: var(--good); }
.empty { text-align: center; color: var(--ink-soft); padding: 50px 20px; }
.empty .big { font-size: 56px; }

/* ---------- Section nav (chips) ---------- */
/* Wrap to multiple rows so every section is reachable without scrolling. */
.secnav {
  position: sticky; top: 72px; z-index: 20; background: var(--bg);
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 10px;
}
.secnav button {
  white-space: nowrap; border: 0; background: #dfe4ea; color: var(--ink-soft);
  border-radius: 999px; padding: 8px 13px; font-weight: 700; font-size: 14px;
}
body.dark .secnav button { background: #1a2330; }
.secnav button.active { background: var(--brand); color: #fff; }
.secnav button .dot { color: var(--good); }

/* ---------- Section header ---------- */
.sec-head { display: flex; align-items: center; gap: 10px; margin: 4px 2px 12px; }
.sec-head h2 { margin: 0; font-size: 22px; }
.sec-head .ico { font-size: 26px; }
.sec-head .spacer { flex: 1; }

/* ---------- Check rows (the heart of it) ---------- */
.check { padding: 14px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check .label { font-weight: 700; margin-bottom: 10px; font-size: 18px; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip {
  min-height: var(--tap); border-radius: 12px; border: 2px solid var(--line);
  background: #fff; color: var(--ink-soft); font-weight: 800; font-size: 16px;
}
.chip:active { transform: scale(.97); }
.chip.on.good { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.chip.on.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.chip.on.bad  { background: var(--bad-bg);  border-color: var(--bad);  color: var(--bad);  }
.chip.on.na   { background: var(--na-bg);   border-color: var(--na);   color: var(--na);   }

.row-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.notes { width: 100%; margin-top: 10px; border: 2px solid var(--line); border-radius: 12px;
         padding: 12px; min-height: 52px; resize: vertical; }

/* numeric stepper for tyre tread etc */
.num { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.num button { width: var(--tap); height: var(--tap); border-radius: 12px; border: 2px solid var(--line);
              background: #fff; font-size: 28px; font-weight: 800; color: var(--brand); }
.num input { flex: 1; text-align: center; min-height: var(--tap); border: 2px solid var(--line);
             border-radius: 12px; font-size: 24px; font-weight: 800; }
.num .unit { color: var(--ink-soft); font-weight: 700; min-width: 34px; }

/* ---------- Field inputs ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; min-height: var(--tap); border: 2px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.field textarea { min-height: 96px; }
.field input[readonly] { background: #f4f7fa; color: var(--ink); }
.field .from-api { font-size: 12px; color: var(--brand-2); font-weight: 700; }

/* ---------- Plate / chassis lookup block ---------- */
.idtoggle { display: flex; gap: 0; margin-bottom: 12px; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.idtoggle .seg { flex: 1; min-height: 48px; border: 0; background: #fff; color: var(--ink-soft); font-weight: 800; font-size: 16px; }
.idtoggle .seg.on { background: var(--brand); color: #fff; }
.platebox { display: flex; gap: 10px; }
.platebox input {
  flex: 1; text-transform: uppercase; letter-spacing: 3px; font-weight: 800;
  font-size: 26px; text-align: center; min-height: 66px; border: 3px solid var(--ink);
  border-radius: 14px; background: #fffbe6;
}
.lookup-status { margin-top: 10px; font-weight: 700; min-height: 22px; }
.lookup-status.err { color: var(--bad); }
.lookup-status.ok  { color: var(--good); }

/* ---------- Photos ---------- */
.photogrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photogrid .thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #000; }
.photogrid .thumb img { width: 100%; height: 100%; object-fit: cover; }
.photogrid .thumb .del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6);
                         color: #fff; border: 0; width: 30px; height: 30px; border-radius: 999px; font-size: 16px; }
.addphoto { aspect-ratio: 1; border: 2px dashed var(--brand-2); border-radius: 12px; background: #f4f9ff;
            color: var(--brand-2); font-weight: 800; font-size: 30px; display: grid; place-items: center; }

/* ---------- Signature ---------- */
.sigpad { width: 100%; height: 200px; border: 2px solid var(--line); border-radius: 12px; background: #fff; touch-action: none; }

/* ---------- Bottom bar ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + var(--safe-bot));
  display: flex; gap: 10px; max-width: 720px; margin: 0 auto;
}
.bottombar .btn { flex: 1; }

/* progress bar under topbar */
.progress { height: 6px; background: var(--line); }
.progress > div { height: 100%; background: var(--good); transition: width .25s; }

/* fab on home */
.fab {
  position: fixed; right: 18px; bottom: calc(20px + var(--safe-bot)); z-index: 40;
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  height: 64px; padding: 0 24px; font-size: 19px; font-weight: 800;
  box-shadow: 0 6px 18px rgba(255,122,0,.4); display: flex; align-items: center; gap: 10px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-bot)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 700; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* Offline status banner — only visible when navigator.onLine === false */
#offline-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 70;
  background: var(--warn); color: #fff; text-align: center;
  font-weight: 700; font-size: 13px; padding: 8px 14px;
  transform: translateY(-100%); transition: transform .2s ease;
}
#offline-bar.show { transform: translateY(0); }
#offline-bar.show ~ #app .topbar { padding-top: calc(14px + env(safe-area-inset-top) + 34px); }

/* ---------- Spinner (dial picker) ---------- */
.bigval {
  width: 100%; background: #fff; border: 2px solid var(--line); border-radius: 14px;
  padding: 14px 18px; display: flex; align-items: baseline; justify-content: space-between;
  font-family: inherit;
}
.bigval .val { font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: .5px; }
.bigval .hint { font-size: 13px; color: var(--brand-2); font-weight: 700; }

.modal {
  position: fixed; inset: 0; background: rgba(11,31,51,.55); z-index: 80;
  display: grid; place-items: end center; padding: 0 12px 18px;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 520px; background: #fff; border-radius: 20px 20px 16px 16px;
  padding: 18px 18px calc(14px + var(--safe-bot)); position: relative;
  box-shadow: 0 -10px 40px rgba(0,0,0,.25);
}
.modal-title { font-weight: 800; font-size: 16px; color: var(--ink-soft); text-align: center; }
.spin-readout { text-align: center; font-size: 38px; font-weight: 900; letter-spacing: 1px; margin: 6px 0 4px; }
.spin-row {
  position: relative; display: flex; gap: 6px; justify-content: center; align-items: center;
  height: 192px; /* 3 visible rows */
  background: linear-gradient(180deg, #fff 0%, rgba(255,255,255,0) 25%, rgba(255,255,255,0) 75%, #fff 100%);
}
.spin-col {
  flex: 0 0 58px; height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  border-radius: 10px; background: #f4f7fa;
}
.spin-col::-webkit-scrollbar { display: none; }
.spin-pad { height: 64px; } /* lets first/last digit centre under the highlight band */
.spin-digit {
  height: 64px; font-size: 32px; font-weight: 800; color: var(--ink);
  display: grid; place-items: center; scroll-snap-align: center; scroll-snap-stop: always;
}
.spin-suffix {
  font-size: 32px; font-weight: 800; color: var(--ink-soft);
  align-self: center; padding-left: 4px; letter-spacing: 1px;
}
/* centre highlight band over the visible middle row */
.spin-center {
  position: absolute; left: 12px; right: 12px; top: 50%; transform: translateY(-50%);
  height: 64px; border-top: 2px solid var(--brand-2); border-bottom: 2px solid var(--brand-2);
  pointer-events: none;
}
.modal-actions { display: flex; gap: 10px; margin-top: 12px; }
.modal-actions .btn { flex: 1; }

/* Keyboard-entry mode for the spinner */
.spin-keys { height: 192px; display: grid; place-items: center; gap: 10px; }
.spin-keys input {
  width: 100%; max-width: 320px; min-height: 80px; text-align: center;
  font-size: 44px; font-weight: 800; letter-spacing: 2px; padding: 0 16px;
  border: 2px solid var(--line); border-radius: 14px; background: #fffbe6;
}
.spin-keys-hint { font-size: 12px; color: var(--ink-soft); }

/* ---------- Damage diagram ---------- */
.damage .label { margin-bottom: 4px; }
.dview-tabs {
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 8px 0; scrollbar-width: none;
}
.dview-tabs::-webkit-scrollbar { display: none; }
.dview-tabs button {
  white-space: nowrap; border: 2px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px;
}
.dview-tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.damage-svg {
  /* Break out of the card's 16px padding so the diagram can use more of the
     viewport width — taps are bigger, marks are easier to land precisely. */
  display: block; width: calc(100% + 32px); margin: 0 -16px;
  max-height: 75vh;                       /* much more vertical room when needed */
  background: #f7fafd;
  border-radius: 0;                       /* edge-to-edge */
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 4px;
  touch-action: manipulation;
}
.damage-svg .dmark { pointer-events: all; }
/* iOS Safari needs touch-action: none AND no overscroll for finger drag to stay
   inside the SVG instead of being interpreted as page scroll. */
.damage-svg { touch-action: none !important; overscroll-behavior: contain; user-select: none; -webkit-user-select: none; }
.damage-svg * { touch-action: none !important; }

/* Drawing toolbar */
.dtools { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.dtool {
  border: 2px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 14px; min-height: 42px;
}
.dtool.on     { background: var(--brand); color: #fff; border-color: var(--brand); }
.dtool.danger { color: var(--bad); border-color: var(--bad-bg); }
body.dark .dtool { background: #1a2330; color: var(--ink); }

/* Invert the diagram artwork in dark mode so the black lines become legible */
body.dark .damage-svg image { filter: invert(1) hue-rotate(180deg); }

/* Choice chips picker (e.g. body shape) */
.choice-chips { gap: 6px; }
.choice-chips .chip { font-size: 14px; min-height: 44px; padding: 0 6px; }

/* Battery: skip render work on cards that scroll off-screen */
.card, .rep-sec { content-visibility: auto; contain-intrinsic-size: auto 400px; }

.damage-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.damage-item {
  display: flex; align-items: center; gap: 10px;
  background: #f7fafd; border-radius: 10px; padding: 8px 12px; font-size: 14px;
}
.dnum {
  width: 24px; height: 24px; border-radius: 999px; color: #fff;
  font-weight: 800; font-size: 13px; display: grid; place-items: center; flex-shrink: 0;
}
.dtype { font-weight: 700; }
.dnote { color: var(--ink-soft); font-size: 13px; }

/* damage type picker chips in modal */
.dmg-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 10px; }
.dmg-chips button {
  min-height: 52px; border: 2px solid var(--line); background: #fff;
  border-radius: 12px; font-weight: 800; font-size: 14px; color: var(--ink);
}
.dmg-chips button.on { background: var(--c); border-color: var(--c); color: #fff; }

/* report variant: same SVG, side-by-side compact list */
.rep-damage { grid-column: 1 / -1; margin-top: 6px; display: grid;
              grid-template-columns: 1fr; gap: 14px; }
.rep-dview { background: #f9fbfd; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.rep-dview-label { font-weight: 700; font-size: 13px; color: var(--brand); margin-bottom: 6px; }
.rep-dview .damage-svg { max-height: 320px; }

/* ---------- Settings (company branding) ---------- */
.logo-row { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.logo-thumb {
  width: 88px; height: 88px; border-radius: 12px; background: #f4f7fa; border: 2px dashed var(--line);
  display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
}
.logo-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.logo-thumb span { color: var(--ink-soft); font-size: 12px; }
.colour-row { display: flex; gap: 10px; align-items: center; }
.colour-row input[type="color"] {
  width: 56px; height: 48px; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; padding: 4px;
}

/* ---------- Report (review + print) ---------- */
.report {
  max-width: 760px; margin: 0 auto; padding: 18px 18px calc(110px + var(--safe-bot));
  color: var(--ink); background: #fff;
}
.rep-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 18px;
  border-bottom: 3px solid var(--brand); padding-bottom: 12px; margin-bottom: 14px;
}
.rep-brand { display: flex; gap: 14px; align-items: center; min-width: 0; }
.rep-logo  { max-width: 220px; max-height: 110px; object-fit: contain; }
.rep-company { font-size: 20px; font-weight: 800; }
.rep-contact { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.rep-meta  { text-align: right; min-width: 160px; }
.rep-title { font-weight: 800; font-size: 16px; color: var(--brand); }
.rep-id    { font-family: monospace; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.rep-vehicle {
  display: flex; gap: 14px; align-items: center; padding: 12px;
  background: #f7fafd; border-radius: 12px; margin-bottom: 12px;
}
.rep-vinfo { flex: 1; min-width: 0; }
.rep-vqr   { flex: 0 0 140px; display: grid; place-items: center; }
.rep-vqr svg { width: 140px; height: 140px; }
.rep-plate {
  background: #ffd400; border: 3px solid #000; border-radius: 8px;
  padding: 10px 14px; font-weight: 900; font-size: 22px; letter-spacing: 2px;
}
.rep-vtitle { font-weight: 800; font-size: 18px; }
.rep-vmeta  { font-size: 13px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.rep-vmeta.sub { font-size: 12px; display: block; margin-top: 6px; }

.rep-party {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; font-size: 13px;
}
.rep-party > div { padding: 10px 12px; background: #f7fafd; border-radius: 10px; }

.rep-sec { margin-top: 16px; page-break-inside: avoid; break-inside: avoid; }
.rep-sec h3 {
  font-size: 15px; margin: 0 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line); color: var(--brand);
}
.rep-row {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 6px 0;
  border-bottom: 1px dashed #e6ebf0; align-items: baseline;
}
.rep-label { font-size: 14px; color: var(--ink); }
.rep-val   { font-size: 14px; font-weight: 700; text-align: right; }
.rep-note  { grid-column: 1 / -1; font-size: 12px; color: var(--ink-soft); font-style: italic; }
.rep-photos { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.rep-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }

.rep-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.rep-pill.good { background: var(--good-bg); color: var(--good); }
.rep-pill.warn { background: var(--warn-bg); color: var(--warn); }
.rep-pill.bad  { background: var(--bad-bg);  color: var(--bad);  }
.rep-pill.na   { background: var(--na-bg);   color: var(--na);   }

.rep-summary { background: #f7fafd; padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 0; }

.rep-sign { display: flex; gap: 18px; align-items: flex-end; margin-top: 22px; }
.rep-sign img { max-width: 220px; max-height: 90px; border-bottom: 1px solid var(--ink); }

.rep-disclaim { font-size: 10px; color: var(--ink-soft); line-height: 1.4; margin-top: 22px; }
.rep-foot { font-size: 10px; color: var(--ink-soft); text-align: center; margin-top: 14px; }

/* ---------- Findings summary ---------- */
.rep-findings { background: #fff8ee; border: 1px solid var(--warn); border-radius: 12px;
                padding: 12px 14px; margin-top: 14px; }
.rep-findings h3 { color: var(--warn); border-bottom: 0; margin: 0 0 8px; }
.rep-findings.rep-allgood { background: var(--good-bg); border-color: var(--good); }
.rep-findings.rep-allgood h3 { color: var(--good); }
.rep-finding { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px;
               padding: 8px 0; border-bottom: 1px dashed rgba(0,0,0,.08); align-items: center; }
.rep-finding:last-child { border-bottom: 0; }
.rep-finding.bad  { border-left: 4px solid var(--bad);  padding-left: 10px; }
.rep-finding.warn { border-left: 4px solid var(--warn); padding-left: 10px; }
.rep-fitem  { font-size: 14px; }
.rep-fnote  { grid-column: 1 / -1; font-size: 13px; color: var(--ink-soft); font-style: italic;
              padding-left: 2px; }

/* ---------- Windscreen sticker ---------- */
.sticker {
  max-width: 360px; margin: 28px auto 14px; padding: 14px 18px 16px;
  border: 2px dashed #1a1a1a; border-radius: 12px; text-align: center;
  background: #fff; page-break-inside: avoid; break-inside: avoid;
}
.sticker-head {
  display: flex; justify-content: space-between;
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px;
  color: var(--ink-soft); text-transform: uppercase; margin-bottom: 8px;
}
.sticker-qr { display: grid; place-items: center; margin: 4px 0 10px; }
.sticker-qr svg { width: 180px; height: 180px; max-width: 100%; }
.sticker-plate {
  display: inline-block; background: #ffd400; border: 3px solid #000;
  border-radius: 8px; padding: 8px 18px; font-weight: 900;
  font-size: 30px; letter-spacing: 4px; margin-top: 4px;
}
.sticker-title { margin-top: 8px; font-weight: 700; font-size: 14px; }
.sticker-foot { margin-top: 6px; font-size: 11px; color: var(--ink-soft); }

/* Print: A4-friendly, app chrome hidden */
@page { size: A4; margin: 12mm; }
@media print {
  .topbar, .secnav, .bottombar, .fab, .row-actions, .modal, .no-print { display: none !important; }
  body, .report { background: #fff !important; }
  #app { padding: 0; max-width: none; }
  .report { padding: 0; max-width: none; }
  .rep-sec { break-inside: avoid; }
  .rep-photos img { aspect-ratio: 4/3; max-height: 4cm; }
  a { color: inherit; text-decoration: none; }
  /* Sticker-only print: hide everything else in the report */
  body.print-sticker .report > *:not(.sticker) { display: none !important; }
  body.print-sticker .sticker { margin: 0 auto; }
  /* Force the printed page to light theme even if the user is viewing in dark */
  body.dark, body.dark .report { background: #fff !important; color: #0b1f33 !important; }
  body.dark .rep-vehicle, body.dark .rep-party > div, body.dark .rep-summary,
  body.dark .rep-dview { background: #f7fafd !important; }
  body.dark .rep-findings { background: #fff8ee !important; }
  body.dark .rep-findings.rep-allgood { background: #e3f6ec !important; }
  body.dark .sticker { background: #fff !important; border-color: #1a1a1a !important; color: #0b1f33 !important; }
}
