:root {
  color-scheme: light;
  --ink: #17231f;
  --muted: #66736e;
  --line: #dce3df;
  --surface: #ffffff;
  --canvas: #f3f6f4;
  --green: #176b4d;
  --green-soft: #e8f4ee;
  --red: #a43d3d;
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
.page-header, main { width: min(1500px, calc(100% - 40px)); margin-inline: auto; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 42px 0 24px; }
.eyebrow, .panel-label { margin: 0 0 7px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(28px, 4vw, 46px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 20px; }
.subtitle { margin-bottom: 0; color: var(--muted); }
.status { flex: 0 0 auto; padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.status-idle { color: var(--muted); background: #e7ece9; }
.status-success { color: var(--green); background: var(--green-soft); }
.status-error { color: var(--red); background: #faeaea; }

.drop-zone { min-height: 150px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 7px; padding: 20px; color: var(--muted); background: var(--surface); border: 1.5px dashed #9aaba3; border-radius: 18px; transition: .2s ease; }
.drop-zone:hover, .drop-zone.dragging { color: var(--green); border-color: var(--green); background: var(--green-soft); transform: translateY(-1px); }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.drop-zone strong { color: var(--ink); }
.drop-icon { width: 29px; height: 29px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 50%; font-size: 22px; line-height: 1; }
.upload-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 7px; }
.upload-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: 0 20px; color: var(--ink); background: white; border: 1px solid #aebbb5; border-radius: 12px; font-weight: 800; cursor: pointer; transition: .18s ease; }
.upload-button:hover { color: var(--green); border-color: var(--green); }
.camera-button { color: white; background: var(--green); border-color: var(--green); }
.camera-button:hover { color: white; background: #115a40; }
.format-note { font-size: 12px; }
.drop-zone.busy { opacity: .58; pointer-events: none; }
.alert { margin-top: 16px; padding: 14px 18px; color: var(--red); background: #fff0f0; border: 1px solid #f1cccc; border-radius: 12px; }
.alert[hidden] { display: none; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin: 18px 0 40px; }
.panel { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 32px rgba(28, 46, 39, .06); }
.panel-heading { min-height: 82px; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.filename { max-width: 45%; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.image-stage { position: relative; min-height: 610px; display: grid; place-items: center; padding: 18px; background: #e9eeeb; }
.image-stage img { display: block; max-width: 100%; max-height: 76vh; object-fit: contain; border-radius: 6px; box-shadow: 0 9px 28px rgba(0, 0, 0, .13); }
.empty-state { color: #8a9791; font-weight: 700; }
.processing { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; color: white; background: rgba(20, 36, 30, .72); backdrop-filter: blur(4px); }
.processing[hidden] { display: none; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.metrics div { min-width: 0; padding: 16px; background: #fbfcfb; }
.metrics span, .metrics strong { display: block; }
.metrics span { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.metrics strong { overflow: hidden; font-size: 18px; text-overflow: ellipsis; }
.ground-truth-summary { margin: 18px 20px 0; padding: 18px; background: #f7f9f8; border: 1px solid var(--line); border-radius: 12px; }
.ground-truth-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ground-truth-metrics div { padding: 10px 0; }
.ground-truth-metrics span, .ground-truth-metrics strong { display: block; }
.ground-truth-metrics span { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; padding: 18px 20px 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); background: #f7f9f8; font-size: 12px; letter-spacing: .04em; }
.numeric-column { width: 110px; text-align: right; white-space: nowrap; }
td:not(.numeric-column) { overflow-wrap: anywhere; word-break: keep-all; }
.empty-row td { height: 130px; color: var(--muted); text-align: center; }
.notice { margin: 10px 20px 20px; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .image-stage { min-height: 420px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .ground-truth-metrics { grid-template-columns: 1fr; }
  .camera-button { min-width: 180px; }
}
@media (max-width: 560px) {
  .page-header, main { width: min(100% - 24px, 1500px); }
  .page-header { align-items: start; padding-top: 28px; }
  .subtitle { font-size: 13px; }
  .drop-zone { padding: 20px 14px; text-align: center; }
  .upload-actions { width: 100%; flex-direction: column; }
  .upload-button { width: 100%; min-height: 50px; }
  .image-stage { min-height: 340px; padding: 10px; }
  .panel-heading { padding: 16px; }
  .metrics div { padding: 13px 12px; }
  .metrics strong { font-size: 16px; }
  .table-wrap { padding: 12px 8px 6px; overflow-x: hidden; }
  table { table-layout: fixed; font-size: 13px; }
  th, td { padding: 11px 7px; }
  .numeric-column { width: 82px; }
}
