/* 60-Second Fire Check — local demo UI.
   Plain CSS, no build step. Two breakpoints: 900px (results collapse) and 460px (phone). */

* { box-sizing: border-box; }

:root {
  --bg: #f4f4f1;
  --panel: #ffffff;
  --ink: #15171c;
  --muted: #5b6270;
  --line: #e3e2dc;
  --line-strong: #cdccc4;
  --red: #b3261e;
  --red-soft: #fbeae7;
  --green: #177a4c;
  --green-soft: #e6f3eb;
  --amber: #92540a;
  --amber-soft: #fbf0dc;
  --slate: #4d5a6d;
  --slate-soft: #eceff4;
  --ink-soft: #f0f0ec;
  --radius: 14px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- chrome */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 249, 0.88);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  text-decoration: none;
}

.brand .mark { width: 22px; height: 22px; color: var(--red); flex: none; }

.local-tag {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 11px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #2b303a; }
.btn.primary:disabled { opacity: 0.35; cursor: default; }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn.ghost:hover { background: var(--ink-soft); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #edc9c4;
  background: var(--red-soft);
  color: #7c1d18;
  font-size: 14px;
}

/* ---------------------------------------------------------------- upload */

.hero { max-width: 780px; margin-bottom: 32px; }

.hero h1 {
  font-size: clamp(26px, 3.6vw, 42px);
  line-height: 1.14;
  font-weight: 680;
  letter-spacing: -0.03em;
}

.lede {
  margin-top: 16px;
  max-width: 640px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.upload-box { margin-bottom: 36px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 232px;
  padding: 32px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #8d9199;
  background: var(--panel);
}

.dz-icon { width: 30px; height: 30px; color: var(--muted); }
.dz-title { font-size: 16px; font-weight: 600; }
.dz-sub { font-size: 13px; color: var(--muted); }

.upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}

.file-chosen {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passcode-row { justify-content: flex-start; gap: 10px; margin-top: 10px; }
.passcode-label { font-size: 13px; color: var(--muted); }
.passcode-input {
  flex: 0 1 200px;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.12em;
}
.passcode-input:focus { outline: 2px solid #8d9199; outline-offset: 1px; }

.public-note {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.notice {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e6d3b0;
  background: var(--amber-soft);
  color: #6d4106;
  font-size: 14px;
}

.samples-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.samples-head h2 { font-size: 14px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.samples-head .rule { flex: 1; height: 1px; background: var(--line); }

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.sample-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sample-info { display: flex; flex-direction: column; gap: 3px; }
.sample-name { font-weight: 600; }
.sample-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sample-summary { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.sample-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- processing */

.proc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.proc-head h2 { font-size: 22px; font-weight: 660; }
.proc-head p { margin-top: 4px; }

.timer {
  font-family: var(--mono);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.stages {
  list-style: none;
  margin: 0 0 24px;
  padding: 6px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stage {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 18px;
}

.stage + .stage { border-top: 1px solid var(--line); }

.stage-icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.stage.running .stage-icon {
  border-color: transparent;
  border-top-color: var(--ink);
  border-right-color: var(--ink);
  animation: spin 0.8s linear infinite;
}

.stage.done .stage-icon { background: var(--green); border-color: var(--green); }
.stage.failed .stage-icon { background: var(--red); border-color: var(--red); }
.stage.skipped .stage-icon { border-style: dashed; }

@keyframes spin { to { transform: rotate(360deg); } }

.stage-body { min-width: 0; }
.stage-title { font-weight: 600; }
.stage.done .stage-title { color: var(--ink); }
.stage.pending .stage-title { color: var(--muted); }
.stage-detail {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.stage-detail:empty { display: none; }

.feed {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.feed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.feed-head h3 { font-size: 14px; font-weight: 650; }

.feed-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 360px;
  overflow-y: auto;
}

.feed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 18px;
  font-size: 13.5px;
}

.feed-row .time {
  flex: none;
  width: 58px;
  color: #9aa0aa;
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.feed-row .text { min-width: 0; overflow-wrap: anywhere; }
.feed-row code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--ink-soft);
  border-radius: 5px;
  padding: 1px 5px;
}
.feed-row .arrow { color: var(--muted); }
.feed-row.error .text { color: var(--red); }

/* which of the two independent checks an event came from */
.check-chip {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--ink-soft);
  border-radius: 4px;
  padding: 1px 5px;
}

.feed-row .thumb {
  flex: none;
  width: 54px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--ink-soft);
}

.feed-empty { padding: 16px 18px; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- results */

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.stats { display: flex; flex-wrap: wrap; gap: 10px; }

.stat {
  min-width: 118px;
  padding: 10px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stat b {
  display: block;
  font-size: 27px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat span {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat.issue b { color: var(--red); }
.stat.check b { color: var(--amber); }
.stat.ok b { color: var(--green); }
.stat.missing b { color: var(--slate); }

.result-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.player-col { overflow: hidden; }

#overlay-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0d0f13;
}

.player-cap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.player-cap svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

.summary-box { padding: 16px; border-top: 1px solid var(--line); }
.summary-box h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 8px; }
.summary-box p { font-size: 14px; line-height: 1.6; }

.checklist-col { overflow: hidden; }

.checklist-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.checklist-head h3 { font-size: 15px; font-weight: 650; }

.checklist { list-style: none; margin: 0; padding: 0; max-height: 620px; overflow-y: auto; }

.item { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }

.item-top { display: flex; align-items: flex-start; gap: 10px; }
.item-main { min-width: 0; flex: 1; }
.item-name { font-weight: 570; font-size: 14px; }

/* the two independent checks did not agree — the item went to a person */
.disagree {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 4px;
  padding: 2px 6px;
  vertical-align: 1px;
}

.item-note {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.item-ev {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.time-chip {
  font: inherit;
  font-size: 12px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  padding: 3px 8px 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--ink-soft);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.time-chip:hover { background: #e6e6e0; }
.time-chip svg { width: 11px; height: 11px; }

.badge {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 1px;
  white-space: nowrap;
}

.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.issue { background: var(--red-soft); color: var(--red); }
.badge.check { background: var(--amber-soft); color: var(--amber); }
.badge.missing { background: var(--slate-soft); color: var(--slate); }
.badge.verify { background: var(--ink-soft); color: #6a6f79; }

.src { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.src summary { cursor: pointer; color: var(--muted); }
.src p { margin-top: 6px; line-height: 1.55; }
.src .unverified { color: var(--amber); }

/* ---------------------------------------------------------------- tabs */

.tabs { margin-top: 20px; overflow: hidden; }

.tabbar {
  display: flex;
  gap: 2px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 13px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

.tabpanel { padding: 16px; }

.email-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.email-body {
  margin: 0;
  padding: 16px;
  border-radius: 10px;
  background: #fbfbf9;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 420px;
  overflow-y: auto;
}

.trace-list, .site-list { list-style: none; margin: 0; padding: 0; }

.trace-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}

.trace-row:last-child { border-bottom: 0; }

.trace-step {
  flex: none;
  width: 52px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #9aa0aa;
}

.trace-row code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--ink-soft);
  border-radius: 5px;
  padding: 1px 5px;
}

.trace-row .thumbs { display: flex; gap: 6px; margin-left: auto; }
.trace-row img {
  width: 68px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.trace-note { color: var(--muted); font-size: 12.5px; }

.site-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
}

.site-item:last-child { border-bottom: 0; }
.site-item .item-name { font-size: 14px; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  main { padding: 24px 18px 48px; }
  .result-grid { grid-template-columns: 1fr; }
  .checklist { max-height: none; }
  .hero h1 { font-size: 27px; }
  .lede { font-size: 15px; }
}

@media (max-width: 460px) {
  body { font-size: 14.5px; }
  .topbar { padding: 11px 14px; }
  .brand .name { font-size: 14px; }
  .local-tag { display: none; }
  main { padding: 18px 14px 40px; }
  .hero { margin-bottom: 22px; }
  .hero h1 { font-size: 23px; line-height: 1.2; }
  .dropzone { min-height: 176px; padding: 24px 16px; }
  .upload-row { flex-direction: column; align-items: stretch; }
  .upload-row .btn { width: 100%; }
  .file-chosen { margin-bottom: 2px; }
  .sample-grid { grid-template-columns: 1fr; }
  .proc-head { flex-direction: column-reverse; align-items: flex-start; gap: 6px; }
  .timer { font-size: 17px; }
  .stage { padding: 11px 14px; gap: 11px; }
  .feed-row { padding: 6px 14px; }
  .feed-row .time { width: 48px; }
  .feed-row .thumb { width: 44px; height: 33px; }
  .stat { flex: 1 1 calc(50% - 10px); min-width: 0; padding: 9px 12px; }
  .stat b { font-size: 23px; }
  .result-actions { width: 100%; justify-content: space-between; }
  .item { padding: 12px 14px; }
  .checklist-head { padding: 14px; }
  .tabpanel { padding: 12px; }
  .tab { padding: 12px 9px; font-size: 13px; }
  .email-body { font-size: 11.5px; padding: 12px; }
  .foot { flex-direction: column; gap: 4px; padding: 14px; }
}