:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f4f8fd;
  --ink: #1e2a3a;
  --muted: #6b7c93;
  --line: #dfe8f2;
  --line-strong: #c6d5e6;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #e7f0ff;
  --good: #0f9d68;
  --good-soft: #e4f6ee;
  --warn: #d97706;
  --warn-soft: #fdf2e0;
  --bad: #dc2626;
  --bad-soft: #fdeaea;
  --console: #101828;
  --console-ink: #e4ecf7;
  --sans: "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(37, 99, 235, 0.05), 0 10px 28px rgba(37, 99, 235, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Chrome / Edge / Safari：细滚动条，5px */
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #b9cbe4;
  border: 1px solid transparent;
  border-radius: 3px;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #8aa9d2; background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* Firefox：标准属性，仅 Firefox 生效（避免覆盖上面的 webkit 自定义样式） */
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-color: #b9cbe4 transparent; scrollbar-width: thin; }
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(37, 99, 235, 0.06) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button, input { font: inherit; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 228px;
  padding: 16px 10px 22px 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: solid 1px #efefef;  }

.brand-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  object-fit: contain;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 4px;
}

.brand-name {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.brand-sub { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 15px;}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease;
  border-bottom: dotted 1px var(--line);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: currentColor;
  opacity: 0.85;
}

.nav-icon svg { width: 100%; height: 100%; display: block; }

.nav-item:hover { background: var(--surface-2); color: var(--ink); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }

.status-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: 0 0 auto; }
.dot.ok { background: var(--good); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }

.runs-dir {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
  overflow-wrap: anywhere;
}

.side-note { margin-top: 8px; font-size: 11px; color: var(--muted); }

.main { margin-left: 228px; padding: 12px 12px 24px 12px; max-width: 1680px; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.topbar-desc {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions { display: flex; align-items: center; gap: 10px; }

.clock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 2px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.btn:hover { opacity: 1; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-primary { width: 100%; }
.btn-block { width: 100%; margin-top: 4px; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}

.link-btn:hover { color: var(--accent); }

.toast {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 50;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.error { border-color: var(--bad); color: var(--bad); }

.hidden { display: none !important; }

.section { margin-bottom: 12px; scroll-margin-top: 20px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.updated { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover { transform: translateY(-2px); border-color: var(--accent); }

.stat-label { color: var(--muted); font-size: 12px; }

.stat-value {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stat-value.accent { color: var(--accent); }

.stat-sub { margin-top: 6px; font-size: 11px; color: var(--muted); }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.quick-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.14);
}

.quick-icon {
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.quick-card strong { font-size: 15px; color: var(--ink); }
.quick-card > span:last-child { color: var(--muted); font-size: 12px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 { margin: 0; font-family: var(--display); font-size: 16px; font-weight: 600; }

.hint { color: var(--muted); font-size: 11px; }
.hint code { font-family: var(--mono); font-size: 10px; }

.count-pill {
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.model-info-panel { margin-bottom: 16px; }
.model-info-body { padding: 16px 18px; }
.model-info-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.model-info-label { color: var(--muted); font-size: 12px; }
.model-info-value { font-family: var(--mono); font-size: 16px; }
.model-info-badge { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.model-info-note { margin-top: 8px; color: var(--muted); font-size: 12px; }

.manage-grid {
  display: grid;
  /* grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr); */
  gap: 16px;
  align-items: start;
}

.form-panel { padding-bottom: 18px; }

.form-panel .field, .form-panel .field-grid, .form-panel .checkbox-row { margin-left: 18px; margin-right: 18px; }

.field { margin-top: 14px; }

.field label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid-3 { grid-template-columns: repeat(3, 1fr); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.checkbox-row input { accent-color: var(--accent); }
.form-panel > .btn { width: calc(100% - 36px); margin: 16px 18px 0; }

.jobs-panel { min-height: 420px; display: flex; flex-direction: column; }

.job-list { padding: 8px; max-height: 340px; overflow-y: auto; }

.job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  padding: 11px 10px;
  border-radius: 4px;
  border-bottom: 1px solid var(--line);
}

.job-row:last-child { border-bottom: none; }
.job-row:hover { background: var(--surface-2); }

.job-name { font-weight: 600; font-size: 13px; }
.job-id { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-left: 6px; }

.job-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-actions { display: flex; align-items: center; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.badge.completed, .badge.ok { background: var(--good-soft); border-color: transparent; color: var(--good); }
.badge.running { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.badge.failed, .badge.stopped { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.badge.no_results { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

.log-box { margin: 0 8px 8px; border-radius: 4px; overflow: hidden; background: var(--console); }

.log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  color: var(--console-ink);
  font-family: var(--mono);
  font-size: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.log-head .link-btn { color: rgba(228,236,247,0.7); }

.log-box pre {
  margin: 0;
  padding: 12px;
  max-height: 220px;
  overflow: auto;
  color: var(--console-ink);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(520px, 1.28fr);
  gap: 16px;
  align-items: start;
}

.run-list { padding: 8px; max-height: 520px; overflow-y: auto; }

.run-row {
  padding: 11px 10px;
  border-radius: 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s ease;
}

.run-row:last-child { border-bottom: none; }
.run-row:hover { background: var(--surface-2); }
.run-row.selected { background: var(--accent-soft); }

.run-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.run-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.run-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.run-map { color: var(--accent); font-weight: 600; }

.detail-panel { min-height: 520px; }

.detail-empty {
  min-height: 480px;
  display: grid;
  place-items: center;
}

.empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: 12px; }

.detail-content { padding: 18px; }

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-head h3 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 600; }
.detail-head p { margin: 3px 0 0; color: var(--muted); font-family: var(--mono); font-size: 10px; overflow-wrap: anywhere; }

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.mini-stat { padding: 11px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); }
.mini-stat span { display: block; color: var(--muted); font-size: 10px; }
.mini-stat strong { display: block; margin-top: 4px; font-family: var(--mono); font-size: 17px; font-weight: 600; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chart-card { border: 1px solid var(--line); border-radius: 4px; padding: 12px; background: #fff; }
.chart-card h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.chart-card canvas { width: 100%; height: 210px; display: block; }

.history-wrap { margin-top: 16px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }

.history-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 10.5px; }
.history-table th, .history-table td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.history-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 500; }
.history-table th:first-child, .history-table td:first-child { text-align: left; }
.history-table tr:last-child td { border-bottom: none; }

.dataset-panel { padding: 20px; }

.dataset-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }

.dataset-cell { padding: 14px 16px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); }
.dataset-cell span { display: block; color: var(--muted); font-size: 11px; }
.dataset-cell strong { display: block; margin-top: 5px; font-family: var(--mono); font-size: 20px; font-weight: 600; }

.progress-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-bottom: 6px; }

.progress-track { height: 10px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: flex; }
.progress-seg { height: 100%; }
.progress-seg.trained { background: var(--good); }
.progress-seg.untrained { background: var(--warn); }
.progress-seg.missing { background: var(--bad); }

.dataset-path { margin-top: 12px; font-family: var(--mono); font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dataset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .sidebar { position: static; width: auto; height: auto; flex-direction: row; align-items: center; gap: 20px; padding: 14px 20px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { margin-bottom: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin-top: 0; margin-left: auto; padding-top: 0; border-top: none; text-align: right; }
  .side-note { display: none; }
  .main { margin-left: 0; padding: 24px 20px 60px; }
  .manage-grid, .results-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .stat-grid, .dataset-grid, .mini-stats, .chart-grid, .field-grid, .field-grid-3 { grid-template-columns: 1fr 1fr; }
  .main { padding: 20px 14px 50px; }
  .sidebar { flex-wrap: wrap; }
  .sidebar-foot { margin-left: 0; text-align: left; }
  .upload-body { grid-template-columns: 1fr; }
  .data-grid { grid-template-columns: 1fr; }
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.upload-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 18px 0;
}

.single-image-options {
  display: flex;
  gap: 10px;
  margin: 12px 18px 0;
}

.mini-select, .mini-input {
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
}

.mini-select { width: 88px; }
.mini-input { flex: 1; min-width: 0; }
.mini-select:focus, .mini-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dropzone {
  display: block;
  padding: 24px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.dropzone-title { display: block; font-weight: 600; font-size: 13px; }
.dropzone-sub { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }

.upload-note {
  margin: 12px 18px 18px;
  color: var(--muted);
  font-size: 11px;
}

.mini-search {
  width: 190px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
}

.mini-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.files-wrap, .records-wrap { max-height: 360px; overflow: auto; }

.file-table, .records-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}

.file-table th, .file-table td,
.records-table th, .records-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.file-table th, .records-table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 500;
}

.file-table tr:last-child td, .records-table tr:last-child td { border-bottom: none; }
.file-table td:first-child { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.records-table tbody tr { cursor: pointer; }
.records-table tbody tr:hover { background: var(--surface-2); }
.records-panel { margin-bottom: 16px; }

.kind-pill {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  background: var(--surface-2);
  color: var(--muted);
}

.kind-pill.image { background: var(--accent-soft); color: var(--accent); }
.kind-pill.label { background: var(--good-soft); color: var(--good); }
.kind-pill.config { background: var(--warn-soft); color: var(--warn); }

.annotate-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.annotate-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.annotate-filters .mini-search { width: 200px; }
.submit-training-btn { margin-left: auto; width: auto; flex: 0 0 auto; white-space: nowrap; }

.annotate-image-list { max-height: 80vh; overflow-y: auto; padding: 8px; }

.annotate-image-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.annotate-thumb {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
}

.annotate-image-info { flex: 1; min-width: 0; }
.annotate-image-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.annotate-image-original { display: block; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.annotate-image-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { color: var(--bad); box-shadow: 0 6px 16px rgba(220,38,38,0.18); }

.annotate-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
}

.annotate-pagination .btn:disabled { opacity: 0.4; cursor: not-allowed; }

.preview-modal-dialog { width: min(820px, 94vw); }
.preview-modal-body { padding: 16px; text-align: center; }
.preview-modal-body img { max-width: 100%; max-height: 70vh; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; }
.preview-meta { margin-top: 12px; color: var(--muted); font-size: 12px; }

.annotate-image-row {
  padding: 9px 10px;
  border-radius: 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.annotate-image-row:last-child { border-bottom: none; }
.annotate-image-row:hover { background: var(--surface-2); }
.annotate-image-row.selected { background: var(--accent-soft); color: var(--accent); }

.annotate-image-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.new-class-input { width: 160px; flex: 0 0 160px; }

.btn-small { padding: 6px 10px; font-size: 12px; }

.canvas-wrap {
  margin: 14px;
  min-height: 280px;
  max-height: 620px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
}

#annotation-canvas {
  max-width: none;
  height: auto;
  display: block;
  cursor: crosshair;
  background: #fff;
  box-shadow: 0 2px 10px rgba(30, 42, 58, 0.12);
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 2px;
}

.zoom-label, .annotation-status {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  min-width: 38px;
  text-align: center;
}

.annotation-status { min-width: 72px; text-align: left; }
.save-label { margin-left: auto; }

.annotation-output {
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.annotation-output-head {
  padding: 7px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.annotation-output pre {
  margin: 0;
  padding: 10px;
  min-height: 64px;
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.submit-body { padding: 14px 18px 18px; }
.submit-body .field { margin-top: 12px; }
.submit-body .field:first-child { margin-top: 0; }
.mini-select.wide { width: 100%; }

.submit-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16, 24, 40, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.28);
  max-height: 92vh;
  overflow: auto;
}

.annotation-modal-dialog { width: min(1180px, 96vw); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-subtitle { margin-left: 6px; color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 400; }

.modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover { color: var(--ink); }

.confirm-dialog { width: min(520px, 92vw); }
.confirm-body { padding: 18px; }
.confirm-message { margin: 0 0 14px; white-space: pre-wrap; color: var(--muted); font-size: 12px; line-height: 1.7; }
.confirm-body .field { margin-top: 12px; }
.confirm-body .field:first-of-type { margin-top: 0; }
.confirm-body .btn-block { margin-top: 14px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 18px 18px; }
.confirm-actions .btn { min-width: 96px; }

.detail-modal-dialog { width: min(1000px, 96vw); }
.detail-modal-body { padding: 16px 18px 20px; }
.detail-path { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 11px; }

.metric-explain {
  margin: 14px 0;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.metric-explain h4 { margin: 0 0 8px; font-size: 13px; }
.metric-explain ul { margin: 0; padding-left: 18px; }
.metric-explain li { margin: 5px 0; color: var(--ink); font-size: 12px; line-height: 1.6; }
.metric-explain strong { color: var(--accent-dark); }

.logout-btn { margin-top: 14px; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: var(--bg);
  background-image: none;
}

.login-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 12% 20%, rgba(37, 99, 235, 0.14), transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(14, 165, 233, 0.12), transparent 42%);
  pointer-events: none;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 72px rgba(16, 24, 40, 0.18);
  overflow: hidden;
}

.login-brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 34px 36px;
  color: #fff;
  background: linear-gradient(150deg, #1d4ed8 0%, #2563eb 55%, #0ea5e9 100%);
}

.login-brand-panel::after {
  content: '';
  position: absolute;
  right: -90px;
  bottom: -110px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 44px rgba(255,255,255,0.06), 0 0 0 88px rgba(255,255,255,0.04);
  pointer-events: none;
}

.login-brand-top { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; }

.login-logo-frame {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}

.login-logo-frame img { width: 40px; height: 40px; object-fit: contain; display: block; }

.login-brand-name { font-size: 16px; font-weight: 700; line-height: 1.35; }
.login-brand-sub { margin-top: 3px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; opacity: 0.8; }

.login-brand-body { position: relative; z-index: 1; margin-top: 64px; }
.login-brand-body h2 { margin: 0; font-size: 30px; line-height: 1.35; font-weight: 700; }
.login-brand-body p { margin: 16px 0 0; font-size: 13px; line-height: 1.8; opacity: 0.88; max-width: 320px; }

.login-feature-list { list-style: none; margin: 26px 0 0; padding: 0; }
.login-feature-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 12px;
  opacity: 0.95;
}
.login-feature-list span {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.18);
}

.login-brand-foot { position: relative; z-index: 1; margin-top: auto; padding-top: 30px; font-size: 11px; opacity: 0.75; }

.login-form-panel { display: flex; align-items: center; justify-content: center; padding: 40px 42px; }
.login-form-wrap { width: 100%; }
.login-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; color: var(--accent); }
.login-form-panel h1 { margin: 8px 0 0; font-size: 26px; font-weight: 700; }
.login-desc { margin: 7px 0 28px; color: var(--muted); font-size: 13px; }
.login-form .field { margin-bottom: 16px; }
.login-form .field input { width: 100%; height: 40px; }

.login-password-wrap { position: relative; }
.login-password-wrap input { padding-right: 56px; }
.login-toggle-password {
  position: absolute;
  right: 4px;
  top: 4px;
  height: 32px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
}
.login-toggle-password:hover { background: var(--accent-soft); }

.login-submit { height: 42px; margin-top: 8px; font-size: 14px; }
.login-submit:disabled { opacity: 0.7; cursor: not-allowed; }

.login-error {
  margin-bottom: 14px;
  padding: 9px 12px;
  background: var(--bad-soft);
  border: 1px solid var(--bad);
  border-radius: 4px;
  color: var(--bad);
  font-size: 12px;
}
.login-hint { margin-top: 22px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.login-hint code { font-family: var(--mono); color: var(--accent); }

.hero-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 30px 34px;
  border-radius: 4px;
  background: linear-gradient(115deg, #1d4ed8 0%, #2563eb 55%, #0ea5e9 100%);
  color: #fff;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.22);
}

.hero-content { position: relative; z-index: 1; max-width: 620px; }
.hero-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; opacity: 0.8; }
.hero-content h2 { margin: 8px 0 10px; font-size: 25px; font-weight: 700; }
.hero-content p { margin: 0; font-size: 13px; line-height: 1.7; opacity: 0.9; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; }
.hero-actions .btn-primary { width: auto; background: #fff; color: var(--accent-dark); border-color: #fff; }
.hero-actions .btn-primary:hover { background: #f0f5ff; }
.hero-actions .btn { border-color: rgba(255,255,255,0.6); color: #fff; }

.hero-decor { position: relative; width: 160px; height: 160px; flex: 0 0 160px; display: grid; place-items: center; }
.hero-decor > span { position: relative; z-index: 2; font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: 0.08em; }
.hero-ring { position: absolute; inset: 0; border: 1px solid rgba(255,255,255,0.35); border-radius: 50%; }
.hero-ring-2 { inset: 22px; border-color: rgba(255,255,255,0.22); }

.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.status-grid { padding: 8px 14px 14px; }
.status-item {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 1.4fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.status-item:last-child { border-bottom: none; }
.status-item-label { color: var(--muted); }
.status-item-value { font-family: var(--mono); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-recent { padding: 8px 14px 14px; }
.overview-recent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.overview-recent-row:last-child { border-bottom: none; }
.overview-recent-row strong { display: block; font-family: var(--mono); font-size: 12px; }
.overview-recent-meta { color: var(--muted); font-size: 11px; }
.overview-recent-score { color: var(--muted); white-space: nowrap; }
.overview-recent-score b { color: var(--accent); font-family: var(--mono); }

@media (max-width: 860px) {
  .annotate-grid { grid-template-columns: 1fr; }
  .modal-overlay { padding: 10px; }
  .overview-grid { grid-template-columns: 1fr; }
  .hero-card { padding: 22px; }
  .hero-decor { display: none; }
  .login-page { padding: 16px; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-brand-panel { padding: 24px; }
  .login-brand-body { margin-top: 28px; }
  .login-brand-body h2 { font-size: 23px; }
  .login-brand-foot { padding-top: 20px; }
  .login-form-panel { padding: 28px 24px 32px; }
}

.verify-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(480px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.verify-config-body { padding: 14px 18px 18px; }
.verify-config-body > .field { margin-top: 12px; }
.verify-config-body > .field:first-child { margin-top: 0; }
.verify-config-body .field-grid { margin-top: 12px; }
.verify-config-body .field-grid .field { margin-top: 0; }
.verify-config-body .mini-select.wide { width: 100%; }

.verify-dropzone { padding: 16px 12px; }

.verify-placeholder {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.verify-placeholder-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 28px;
}

.verify-placeholder p { margin: 0; }

.verify-result-body { padding: 14px; }

.verify-image-wrap {
  min-height: 280px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.verify-image {
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  border-radius: 4px;
}

.verify-image-zoom-modal { width: min(1200px, 96vw); }
.verify-image-zoom-body { padding: 12px; text-align: center; }
.verify-image-zoom-body img { max-width: 100%; max-height: 84vh; object-fit: contain; border-radius: 4px; }

.verify-detections { margin-top: 14px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }

.verify-detection-list { max-height: 300px; overflow-y: auto; }

.verify-detect-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.verify-detect-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.verify-detect-chip {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.verify-detect-statline { color: var(--muted); font-size: 10px; font-family: var(--mono); }

.verify-detection-row {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
}

.verify-detect-main {
  display: grid;
  grid-template-columns: 32px minmax(80px, 1fr) 56px minmax(60px, 1fr);
  gap: 8px;
  align-items: center;
}

.verify-detect-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.verify-detect-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.verify-detect-bar i { display: block; height: 100%; background: var(--accent); }

.verify-detection-row:last-child { border-bottom: none; }
.verify-detection-index { color: var(--muted); }
.verify-detection-label { font-weight: 600; }
.verify-detection-score { color: var(--accent); }
.verify-detect-classid {
  margin-left: 6px;
  font-weight: 400;
  font-size: 9px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
}

@media (max-width: 1080px) {
  .verify-grid { grid-template-columns: 1fr; }
}
