:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #dde3ec;
  --accent: #1a6ce0;
  --success: #1f9d55;
  --error: #d64545;
  --orange: #f28c28;
  --shadow: 0 12px 32px rgba(20, 31, 50, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(246, 247, 249, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 20px;
}

.test-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--orange);
  color: white;
  font-size: 12px;
  line-height: 1;
}

.nav { display: flex; align-items: center; gap: 14px; }
.user-email { color: var(--muted); font-size: 14px; }

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy, .card, .hero-panel {
  background: var(--card);
  border: 1px solid rgba(221, 227, 236, 0.8);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 46px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 42px; line-height: 1.1; letter-spacing: 0; margin-bottom: 16px; }
h2 { font-size: 22px; margin-bottom: 16px; }
h3 { font-size: 17px; margin-bottom: 8px; }

.hero-copy p {
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
  margin-bottom: 26px;
}

.hero-panel {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 16px;
  border-radius: 10px;
  background: #f8fbff;
  border: 1px solid #e2ebf8;
}

.metric strong { font-size: 28px; }
.metric span, .muted { color: var(--muted); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.button:hover { text-decoration: none; filter: brightness(0.96); }
.button.small { min-height: 34px; padding: 7px 12px; font-size: 14px; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.card { padding: 22px; margin-bottom: 18px; }
.card.wide { margin-top: 6px; }
.step span { display: block; font-size: 28px; margin-bottom: 12px; }
.step p { color: var(--muted); margin-bottom: 0; }

.check-list { padding-left: 20px; margin-bottom: 0; }
.check-list li { margin: 8px 0; }

.disclaimer-box {
  border-color: #f2d29a;
  background: #fffaf2;
}

.auth-card { max-width: 440px; margin: 48px auto; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 0 0 18px;
}

.section-head p { color: var(--muted); margin-bottom: 0; }

.form { display: grid; gap: 16px; }
.form.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: #27364f;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  background: white;
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; }

.form-actions { display: flex; justify-content: flex-end; }

.alert {
  padding: 12px 14px;
  border-radius: 9px;
  margin-bottom: 16px;
  font-weight: 700;
}
.alert.error { background: #fff1f1; color: var(--error); border: 1px solid #ffd0d0; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.table-wrap.small { max-height: 320px; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  background: #edf3fb;
  z-index: 1;
  font-size: 13px;
  color: #3c4b64;
}

tbody tr:nth-child(even) td { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: #e8edf5;
  color: #41506a;
}

.status-done, .status-confident { background: #e9f7ef; color: var(--success); }
.status-error, .status-none { background: #fff1f1; color: var(--error); }
.status-running, .status-summary, .status-confirmed, .status-disputed { background: #eef5ff; color: var(--accent); }
.status-vor_parsing, .status-vor_review, .status-med { background: #fff5e8; color: #b65f00; }
.status-high { background: #e9f7ef; color: var(--success); }
.status-low { background: #fff1f1; color: var(--error); }

.stat { display: grid; gap: 5px; margin-bottom: 0; }
.stat strong { font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }

.candidate { max-width: 560px; }
.candidate span, .radio-line em { color: var(--muted); font-style: normal; }
.radio-line {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 9px;
  font-weight: 500;
}
.radio-line input { width: auto; min-height: auto; margin-top: 4px; }

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
  font-weight: 600;
}

.radio-card input { width: auto; min-height: auto; margin-top: 5px; }
.radio-card small { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }

.source-cell { min-width: 280px; color: var(--muted); font-size: 13px; }
.manual-list { padding-left: 20px; margin-top: 0; }
.manual-list li { margin: 8px 0; }
.manual-list span { display: block; color: var(--muted); font-size: 13px; }

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  font-weight: 600;
}
.check-line input { width: auto; min-height: auto; margin-top: 5px; }

.file-list { margin-bottom: 0; padding-left: 20px; }
.file-list li { margin: 8px 0; }

.error-text {
  white-space: pre-wrap;
  color: var(--error);
  background: #fff7f7;
  padding: 14px;
  border-radius: 9px;
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .topbar, .section-head { align-items: flex-start; flex-direction: column; }
  .nav { flex-wrap: wrap; }
  .hero, .grid.two, .grid.three, .grid.four, .grid.six, .form.two-col, .mode-switch { grid-template-columns: 1fr; }
  .hero-copy { padding: 28px; }
  h1 { font-size: 32px; }
  .page { width: min(100% - 20px, 1180px); margin-top: 18px; }
  .footer { width: min(100% - 20px, 1180px); }
  table { min-width: 680px; }
}
