/* ── Reset & base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; background: #f5f5f5; color: #333; }

/* ── Nav ─────────────────────────────────────────── */
.main-nav {
  background: #1a1a2e; padding: 0 24px; display: flex;
  align-items: center; height: 60px; gap: 8px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-weight: 700; font-size: 16px;
  text-decoration: none; margin-right: 24px;
}
.nav-logo-icon {
  width: 32px; height: 32px; background: #fff; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  color: rgba(255,255,255,0.7); text-decoration: none;
  padding: 6px 14px; border-radius: 6px; font-size: 14px; font-weight: 500;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: #fff; background: rgba(255,255,255,0.15); }
.nav-logout {
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.2); padding: 6px 14px;
  border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none;
}
.nav-logout:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ── Page layout ─────────────────────────────────── */
.page-wrap { padding: 24px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 700; color: #111; margin: 0; }

/* ── Cards & tables ──────────────────────────────── */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; }
.card-body { padding: 20px 24px; }
.table-card { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 600;
  color: #888; letter-spacing: 0.06em; text-transform: uppercase;
  border-bottom: 1px solid #f0f0f0;
}
td { padding: 13px 16px; font-size: 14px; color: #333; border-bottom: 1px solid #f9f9f9; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.mono { font-family: monospace; font-size: 13px; font-weight: 600; }
.table-empty { text-align: center; color: #aaa; padding: 40px; }

/* ── Buttons ─────────────────────────────────────── */
.btn { border: none; padding: 7px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-block; transition: opacity 0.15s; }
.btn-primary { background: #1a1a2e; color: #fff; }
.btn-primary:hover { opacity: 0.85; color: #fff; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-success { background: #15803d; color: #fff; }
.btn-success:hover { opacity: 0.85; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 6px; }

/* ── Status badges ───────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
}
.badge-received, .badge-to_be_labelled { background: #dbeafe; color: #1d4ed8; }
.badge-audited, .badge-annotated, .badge-trained, .badge-test_completed { background: #dcfce7; color: #15803d; }
.badge-annotation_in_progress, .badge-ready_for_training, .badge-training_in_progress { background: #fed7aa; color: #c2410c; }
.badge-production { background: #166534; color: #fff; }
.badge-reevaluate { background: #fee2e2; color: #dc2626; }
.badge-aws { background: #fef3c7; color: #92400e; }
.badge-image_url { background: #dbeafe; color: #1d4ed8; }
.badge-pass { background: #dcfce7; color: #15803d; }
.badge-fail { background: #fee2e2; color: #dc2626; }
.badge-skip { background: #f3f4f6; color: #6b7280; }
.badge-error { background: #fee2e2; color: #b91c1c; }
.badge-running { background: #fef9c3; color: #854d0e; }
.badge-pending { background: #f3f4f6; color: #6b7280; }

/* ── Stats grid ──────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.stat-label { font-size: 12px; color: #888; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 32px; font-weight: 700; color: #111; margin-top: 4px; }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 16px; width: 800px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-sm { width: 480px; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 18px; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #666; line-height: 1; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; gap: 8px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.image-item { border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: #f3f4f6; }
.image-item img { width: 100%; height: 100%; object-fit: cover; }

/* ── Progress bar ────────────────────────────────── */
.progress-wrap { background: #f0f0f0; border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar { background: #1a1a2e; height: 100%; transition: width 0.3s; border-radius: 999px; }

/* ── Forms ───────────────────────────────────────── */
.form-label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1.5px solid #e5e7eb;
  border-radius: 7px; font-size: 14px; outline: none; transition: border 0.15s;
}
.form-control:focus { border-color: #1a1a2e; }
.form-control[readonly] { background: #f9fafb; color: #555; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Settings sub-nav ────────────────────────────── */
.settings-subnav {
  display: flex; gap: 0; border-bottom: 2px solid #e5e7eb; margin-bottom: 0;
}
.settings-subnav a {
  padding: 10px 20px; font-size: 14px; font-weight: 500; color: #6b7280;
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s;
}
.settings-subnav a:hover { color: #111827; }
.settings-subnav a.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

/* ── Section title ───────────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 700; color: #888; letter-spacing: 0.08em;
  text-transform: uppercase; margin: 0 0 12px 0; padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}
.field-row { display: grid; grid-template-columns: 160px 1fr; align-items: center; margin-bottom: 10px; gap: 8px; }
.field-label { font-size: 13px; color: #666; font-weight: 500; }
.field-value { font-size: 14px; color: #111; }

/* ── Image selector ──────────────────────────────── */
.selector-wrap { max-width: 700px; margin: 0 auto; }
.selector-img-card { background: #fff; border-radius: 16px; padding: 24px; box-shadow: 0 1px 8px rgba(0,0,0,0.08); text-align: center; margin-bottom: 20px; }
.selector-img-card img { max-width: 100%; max-height: 400px; border-radius: 8px; object-fit: contain; }
.selector-filename { color: #888; font-size: 13px; margin-top: 8px; }
.selector-actions { display: flex; gap: 12px; justify-content: center; }
.done-card { background: #fff; border-radius: 16px; padding: 40px; text-align: center; box-shadow: 0 1px 8px rgba(0,0,0,0.08); }

/* ── Validation layout ───────────────────────────── */
.validation-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.tc-group-title { font-size: 12px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 0.06em; margin: 16px 0 6px 0; }
.tc-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f9f9f9; }
.tc-meta { flex: 1; }
.tc-name { font-size: 13px; color: #333; }
.tc-id { font-family: monospace; font-size: 12px; color: #888; }
.result-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.result-card { background: #fff; border-radius: 10px; padding: 16px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.result-card .val { font-size: 28px; font-weight: 700; }
.result-card .lbl { font-size: 12px; color: #888; margin-top: 4px; }

/* ── Alerts ──────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-danger { background: #fee2e2; color: #b91c1c; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-info { background: #dbeafe; color: #1d4ed8; }

/* ── Login page ──────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f5f5f5; }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; box-shadow: 0 4px 24px rgba(0,0,0,0.10); width: 100%; max-width: 380px; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.login-logo-icon { width: 40px; height: 40px; background: #1a1a2e; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; }
.login-logo-text { font-size: 20px; font-weight: 700; color: #1a1a2e; }
