:root {
  --page: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #151c2c;
  --muted: #6b7280;
  --line: #d8e0ea;
  --line-strong: #c5d0dd;
  --accent: #0f766e;
  --accent-ink: #0b4f4a;
  --blue: #2563eb;
  --danger: #b42318;
  --warn: #a15c07;
  --good: #15803d;
  --violet: #6d28d9;
  --shadow: 0 16px 42px rgba(21, 28, 44, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #e8eef3 0, rgba(232, 238, 243, 0) 280px),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.1), transparent 320px),
    var(--page);
}

button, input, select, textarea { font: inherit; }

.app-header {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  font-weight: 900;
  letter-spacing: 0;
}

.brand h1, .login-panel h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.sync-dot {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
}

.sync-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
}

.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 24px 28px;
  display: grid;
  grid-template-columns: minmax(440px, 520px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.submit-panel, .workspace, .login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.submit-panel {
  position: sticky;
  top: 12px;
  padding: 18px;
}

.workspace {
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 800;
}

.mini-badge {
  color: var(--accent-ink);
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.case-form {
  display: grid;
  gap: 13px;
}

.form-section {
  border: 1px solid #e4eaf1;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 13px;
  display: grid;
  gap: 12px;
}

.section-title {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.55;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checks label {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 7px 9px;
  font-weight: 650;
}

.checks input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.upload-box {
  min-height: 94px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed #a9b8c9;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: var(--muted);
}

.upload-box input { display: none; }
.upload-main { color: var(--ink); font-weight: 850; }
.upload-sub { font-size: 12px; font-weight: 500; }

.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-preview span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 9px;
  color: #475569;
  font-size: 12px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover { background: var(--accent-ink); }

.button.ghost {
  background: rgba(255, 255, 255, 0.78);
  color: #27364f;
  border-color: var(--line-strong);
}

.button.ghost:hover { background: #fff; border-color: #95a4b8; }

.button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.message {
  color: var(--muted);
  font-size: 13px;
}

.message.ok { color: var(--good); }
.message.err { color: var(--danger); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 13px;
  display: grid;
  gap: 4px;
}

.metric span {
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
  color: #172033;
}

.metric small {
  color: var(--muted);
  font-weight: 700;
}

.metric.danger span { color: var(--danger); }
.metric.warn span { color: var(--warn); }
.metric.good span { color: var(--good); }

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

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 34px;
  padding: 6px 11px;
  color: #475569;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.tabs button.active {
  color: #fff;
  background: #27364f;
  border-color: #27364f;
}

.search {
  max-width: 260px;
  min-width: 180px;
}

.cases {
  display: grid;
  gap: 12px;
}

.case {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 11px;
}

.case-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.case-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.case-title strong {
  font-size: 18px;
  letter-spacing: 0;
}

.case-title span {
  color: var(--muted);
  font-weight: 800;
}

.case-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 12px;
  color: #155e75;
  background: #ecfeff;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
  font-weight: 750;
}

.pill.false_positive { color: var(--danger); background: #fff1f2; border-color: #fecdd3; }
.pill.false_negative { color: var(--warn); background: #fffbeb; border-color: #fde68a; }
.pill.good_case { color: var(--good); background: #f0fdf4; border-color: #bbf7d0; }
.pill.bug { color: var(--violet); background: #f5f3ff; border-color: #ddd6fe; }

.comment {
  white-space: pre-wrap;
  line-height: 1.6;
  color: #27364f;
  border-left: 3px solid #bdd7d2;
  padding: 2px 0 2px 10px;
  font-size: 13px;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thumbs a {
  width: 132px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  display: block;
  background: #f8fafc;
}

.thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.login-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(6px);
}

.login-layer[hidden] { display: none; }

.login-panel {
  width: min(390px, 100%);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.login-panel form {
  display: grid;
  gap: 10px;
}

.login-panel button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-weight: 850;
  cursor: pointer;
}

@media (max-width: 1120px) {
  .layout { grid-template-columns: 1fr; }
  .submit-panel { position: static; }
}

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 14px 8px;
  }
  .layout { padding: 8px 12px 20px; }
  .field-grid, .checks, .metrics { grid-template-columns: 1fr; }
  .case-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .search { max-width: none; }
  .case-head { flex-direction: column; }
}
