:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #dfe3ec;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #3b82f6;
  --primary-strong: #1d4ed8;
  --shadow: 0 10px 24px rgba(31, 41, 55, 0.12);
  --radius: 12px;
  --space: 16px;
  --line: 1.6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 0 60px 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", system-ui, -apple-system, sans-serif;
  line-height: var(--line);
}

h1, h2 {
  margin: 0 0 8px 0;
}

p {
  margin: 0;
}

.page-header {
  padding: 28px 24px 12px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.subtitle {
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.doc-link:hover {
  color: var(--primary-strong);
}

.layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  padding: 0 24px 24px 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input, textarea {
  width: 100%;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-row {
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  transition: all 0.15s ease;
}

.primary {
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.ghost:hover {
  border-color: var(--primary);
  color: var(--text);
}

.ghost.error {
  background: #ff8b8b;
  color: #0f1428;
  border-color: #ff8b8b;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(255, 139, 139, 0.25);
}

.ghost.error:hover {
  background: #ff9f9f;
  border-color: #ff9f9f;
  color: #0b1021;
}

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

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow: auto;
}

.result-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.small {
  padding: 6px 10px;
  font-size: 12px;
}

.result-item header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: #0f1428;
  background: #7fe0c2;
}

.badge.error {
  background: #ff8b8b;
}

.footer {
  margin: 12px 24px 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.mode-switch {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  font-weight: 600;
}

.mode-switch input {
  width: auto;
  margin-right: 6px;
}

.hidden {
  display: none;
}

.modal.hidden {
  display: none !important;
}

.analysis {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #f3f6fb;
}

.analysis-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 13px;
}

.analysis-table th,
.analysis-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
}

.analysis-table th {
  background: #e5e7eb;
  color: #111827;
  text-align: left;
}

.analysis-table td {
  background: #ffffff;
}

.analysis-table tr:nth-child(odd) td {
  background: #f7f9fc;
}

.analysis-table tr.flagged-row td {
  background: #fff4f4 !important;
}

.raw-text {
  margin-top: 8px;
  padding: 10px;
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  font-size: 12px;
  color: #111827;
}

.analysis-table tr {
  position: relative;
}

.flag-btn {
  position: relative;
  transform: none;
  padding: 4px 8px;
  background: linear-gradient(90deg, #ffb347, #ff7746);
  border-color: #ff7746;
  color: #0b1021;
  font-weight: 700;
  display: inline-flex;
  box-shadow: 0 0 0 2px rgba(255, 139, 70, 0.25);
}

.flag-btn.error {
  background: linear-gradient(90deg, #ff8b8b, #ff4f4f);
  border-color: #ff4f4f;
}

/* 不再变更行背景，保留默认 */

.analysis-error {
  color: #ff8b8b;
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 98vw;
  max-width: 1400px;
  max-height: 96vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}

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

.modal-body {
  padding: 14px 16px;
  overflow: auto;
  background: #f5f7fb;
}

