:root {
  color-scheme: light;
  --ink: #171512;
  --muted: #6f6961;
  --paper: #fff;
  --line: #dedbd6;
  --red: #C41230;
  --red-dark: #8c0d24;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-size: 16px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px clamp(18px, 5vw, 64px); border-bottom: 1px solid var(--line); background: #fff; }
.topbar h1 { margin: 4px 0 0; font-size: clamp(25px, 4vw, 38px); letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--red); font-size: 12px; font-weight: 850; letter-spacing: .14em; }
.quiet-link { color: var(--ink); font-weight: 750; text-decoration: none; white-space: nowrap; }
.page { width: min(1180px, calc(100% - 28px)); margin: 28px auto 64px; }
.notice { display: flex; gap: 14px; padding: 15px 18px; border: 1px solid var(--red); border-radius: 14px; color: var(--red-dark); background: #fff; line-height: 1.55; }
.notice strong { flex: 0 0 auto; }
.status { min-height: 24px; color: var(--muted); line-height: 1.55; }
.status.error, .field-error { color: var(--red-dark); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.metric-grid > div { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.metric-grid span { display: block; color: var(--muted); font-size: 13px; }
.metric-grid strong { display: block; margin-top: 6px; font-family: Georgia, serif; font-size: 32px; }
.columns { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.panel { padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.panel + .panel { margin-top: 16px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 4px 0 0; font-size: clamp(23px, 3vw, 32px); letter-spacing: -.035em; }
.muted { color: var(--muted); }
.secondary { border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; color: var(--ink); background: #fff; font-weight: 750; }
.stack, .review-list { display: grid; gap: 10px; }
.task, .review-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.task.selected { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.task-top, .review-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.task-title, .review-title { margin: 0; font-weight: 800; }
.task-meta, .review-meta { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.task button { margin-top: 11px; border: 0; border-radius: 8px; padding: 8px 11px; color: #fff; background: var(--red); font-weight: 750; }
.task-evidence { display: flex; align-items: center; gap: 9px; margin-top: 12px; }
.task-evidence a { display: block; flex: 0 0 96px; }
.task-evidence img { display: block; width: 96px; height: 72px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; }
.task-id { margin-top: 8px; color: var(--muted); font-size: 12px; }
.task-id summary { cursor: pointer; width: fit-content; text-decoration: underline; text-underline-offset: 3px; }
.task-id code { display: block; margin-top: 5px; overflow-wrap: anywhere; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.task-reason { margin: 12px 0 0; color: var(--red-dark); line-height: 1.5; }
.pill { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; }
.pill.pending, .pill.submitted { color: var(--red); border-color: var(--red); }
.pill.passed { color: var(--ink); border-color: var(--ink); }
.pill.failed { color: var(--red); border-color: var(--red); }
.filter-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.filter-label select, select, input[type=file] { border: 1px solid #bdbab5; border-radius: 8px; padding: 8px; background: #fff; color: var(--ink); }
form { display: grid; gap: 8px; }
form label { font-weight: 750; font-size: 14px; }
#inspection-select { width: 100%; }
input[type=file] { width: 100%; padding: 10px; }
.preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; min-height: 12px; }
.preview figure { position: relative; margin: 0; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview figcaption { position: absolute; right: 3px; bottom: 3px; left: 3px; overflow: hidden; padding: 2px 4px; color: #fff; background: #171512; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.field-error { min-height: 22px; margin: 0; font-size: 13px; }
.review-card .evidence { display: flex; gap: 8px; margin: 12px 0; overflow: auto; }
.evidence a { display: block; flex: 0 0 78px; }
.evidence img { display: block; width: 78px; height: 64px; border: 1px solid var(--line); border-radius: 7px; object-fit: cover; }
.review-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: end; margin-top: 12px; }
.review-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.review-form select, .review-form textarea { width: 100%; border: 1px solid #bdbab5; border-radius: 8px; padding: 8px; background: #fff; color: var(--ink); font: inherit; }
.review-form textarea { min-height: 42px; resize: vertical; }
.review-form button { border: 0; border-radius: 8px; padding: 9px 12px; color: #fff; background: var(--red); font-weight: 750; }
.review-form button:disabled, #upload-submit:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 18px; }
  .page { margin-top: 18px; }
  .notice { display: block; }
  .notice strong { display: block; margin-bottom: 5px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .columns { grid-template-columns: 1fr; }
  .review-form { grid-template-columns: 1fr; }
  .review-form button { width: 100%; }
}
@media (max-width: 420px) {
  .page { width: calc(100% - 20px); }
  .topbar { gap: 12px; }
  .topbar h1 { font-size: 25px; }
  .quiet-link { font-size: 13px; }
  .panel { padding: 16px; }
  .preview { grid-template-columns: repeat(2, 1fr); }
}

/* Private originals are loaded only after an explicit view action. */
.photo-access { display: grid; gap: 8px; min-width: 0; }
.task-evidence .photo-access a, .evidence .photo-access a { flex: initial; overflow-wrap: anywhere; }
.photo-access button { justify-self: start; }
.task-evidence > .task-meta { white-space: nowrap; }
