/* ─────────────────────────────────────────────────────────────────────
   The Inspections page and the inspection workspace (inspections-board.ts).
   Desk (1440): one row per inspection, columns line up. Tablet (820/1024):
   the row wraps into two lines. Phone (≤760): a card per inspection, no
   sideways scrolling. Colours come from the theme tokens in index.html.
   ───────────────────────────────────────────────────────────────────── */

.ib-page > header .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ib-stamp { white-space: nowrap; }
.ib-segs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0 10px; }
.ib-segs .insp-seg { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border-radius: 14px; border: 2px solid; font: inherit; font-weight: 700; cursor: pointer; opacity: .78; }
.ib-segs .insp-seg strong { font-size: 1.7rem; line-height: 1; }
.ib-segs .insp-seg.on { opacity: 1; box-shadow: 0 0 0 3px var(--brand) inset; }
.ib-segs .insp-seg.t-bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
.ib-searchrow { margin-bottom: 10px; }
.ib-search { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
.ib-hint { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.ib-hint.warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-line); }

.ib-list { display: flex; flex-direction: column; gap: 8px; }
.ib-head, .ib-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.5fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(110px, .8fr) minmax(190px, 1.6fr) minmax(90px, .7fr);
  gap: 6px 14px;
  align-items: start;
}
.ib-head { padding: 0 14px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ib-head span:last-child { display: none; }
.ib-row { padding: 10px 14px; border: 1px solid var(--line); border-left-width: 6px; border-radius: 12px; background: var(--panel); color: var(--text); min-width: 0; }
.ib-row.s-info { border-left-color: var(--info-line); }
.ib-row.s-warn { border-left-color: var(--warn-line); }
.ib-row.s-bad { border-left-color: var(--bad-line); }
.ib-row.s-ok { border-left-color: var(--ok-line); }
.ib-c { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ib-c strong { overflow-wrap: anywhere; }
.ib-cust { align-self: flex-start; text-align: left; font-size: .95rem; }
.ib-typepill { align-self: flex-start; padding: 2px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 800; font-size: .9rem; }
.ib-status .pill { align-self: flex-start; }
.ib-miss { color: var(--muted); }
.ib-miss.sig { color: var(--bad-fg, #fca5a5); font-weight: 700; }
.bad-text { color: var(--bad-line, #f87171); }
.ib-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
.ib-actions .tiny-btn, .ib-unsigned .tiny-btn { min-height: 40px; padding: 0 14px; border-radius: 10px; font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.ib-actions .tiny-btn.primary, .ib-unsigned .tiny-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand, #fff); }
.ib-actions .tiny-btn.ghost, .ib-unsigned .tiny-btn.ghost { background: transparent; }
.ib-unsigned { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-fg); }
.ib-unsigned-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ib-menu { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; padding: 12px; border: 2px solid var(--brand); border-radius: 12px; background: var(--panel); color: var(--text); max-width: 420px; }
.ib-menu .row { display: flex; flex-wrap: wrap; gap: 8px; }
.ib-menu button { min-height: 44px; }
.ib-actions .ib-menu { flex-basis: 100%; }
.ib-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 12px 0; }
.ib-more { margin-top: 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.ib-more > summary { cursor: pointer; font-weight: 700; min-height: 40px; display: flex; align-items: center; }

/* Tablet (820 / 1024): vehicle + status on the first line, the rest under it. */
@media (max-width: 1180px) and (min-width: 761px) {
  .ib-head { display: none; }
  .ib-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); }
  .ib-when { grid-column: 3; }
}

/* ── The inspection workspace (over the page) ── */
.iw-overlay { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.iw-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
.iw-bar button { min-height: 44px; padding: 0 16px; border-radius: 10px; font: inherit; font-weight: 700; }
.iw-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); max-width: 1280px; width: 100%; margin: 0 auto; box-sizing: border-box; }
/* The overlay sits outside the app's page, so its buttons get the app's look here. */
.iw-overlay button:not(.cf-tab):not(.linkish), .ib-menu button { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.iw-overlay button.primary:not(.cf-tab):not(.linkish), .ib-menu button.primary, .iw-overlay .cf-btn.primary:not(.cf-tab):not(.linkish) { background: var(--brand); border-color: var(--brand); color: var(--on-brand, #fff); }
.iw-overlay button.ghost:not(.cf-tab):not(.linkish) { background: transparent; }
.iw-overlay button:disabled, .ib-menu button:disabled { opacity: .5; cursor: not-allowed; }
.iw-overlay h2, .iw-overlay h3 { text-transform: none; letter-spacing: 0; color: var(--text); }
.iw-overlay textarea { width: 100%; box-sizing: border-box; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; padding: 8px; }
.iw-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.iw-head p { margin: 0; }
.iw-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.iw-title h2 { margin: 0; font-size: 1.35rem; }
.iw-actions, .iw-docbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.iw-actions button { min-height: 44px; }
.iw-date { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 600; }
.iw-date input { min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 0 8px; font: inherit; }
.iw-tabs { position: sticky; top: -12px; z-index: 2; border-radius: 10px; margin-bottom: 10px; }
.iw-body { display: flex; flex-direction: column; gap: 8px; }
.iw-doc { background: var(--panel); }
.iw-doc .cf-btn { min-height: 38px; font-size: 14px; }
.iw-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.iw-photos figure { margin: 0; }
.iw-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; cursor: zoom-in; }

/* Messages: picking damage photos */
.attach-photos-pick .row { display: flex; gap: 8px; margin-top: 6px; }
.attach-photo.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }

/* Staff › person: inspection numbers */
.staff-stats { margin: 8px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.staff-stats h3 { margin: 0 0 8px; }
.ss-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ss-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.ss-card strong { font-size: 1.6rem; }
.ss-list { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.ss-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 40px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer; }

/* Phone: a card per inspection, nothing wider than the screen. */
@media (max-width: 760px) {
  .ib-page > header { flex-wrap: wrap; }
  .ib-page > header h1 { flex: 1 1 100%; overflow-wrap: normal; margin: 0; }
  .ib-segs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ib-segs .insp-seg { min-height: 56px; }
  .ib-head { display: none; }
  .ib-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px 12px; }
  .ib-veh, .ib-status { grid-column: 1 / -1; }
  .ib-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ib-actions .tiny-btn { min-height: 44px; width: 100%; }
  .ib-unsigned-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .ib-unsigned .tiny-btn { min-height: 44px; width: 100%; }
  .ib-menu { max-width: 100%; }
  .ib-foot { flex-direction: column; align-items: stretch; }
  .iw-scroll { padding: 10px 12px calc(24px + env(safe-area-inset-bottom)); }
  /* Room for the floating alert bell at the top right. */
  .iw-bar { padding-right: 68px; }
  .iw-title h2 { font-size: 1.15rem; }
  .iw-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .iw-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ss-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ss-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ss-row > span:nth-child(3) { grid-column: 1 / -1; }
}
