:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --line: #d7dee4;
  --text: #15202b;
  --muted: #5d6b7a;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e6f4f1;
  --warn: #b45309;
  --risk: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 32px;
  background: #123c3a;
  color: white;
  border-bottom: 4px solid #0f766e;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 700;
}

.topbar p {
  margin-top: 6px;
  color: #d7f1ec;
  font-size: 14px;
}

.status-pill {
  min-width: 84px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  text-align: center;
  font-size: 13px;
}

.home-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
}

.hero-panel,
.task-card,
.safety-panel,
.data-query-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.hero-panel {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}

.hero-panel h2 {
  font-size: 21px;
}

.hero-panel p {
  max-width: 720px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.task-card {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.task-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.task-head h2 {
  font-size: 18px;
  line-height: 1.4;
}

.task-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.upload-box {
  display: grid;
  place-items: center;
  min-height: 150px;
  margin: 18px 0 14px;
  border: 2px dashed #b7c5d8;
  border-radius: 8px;
  background: #fbfcfe;
  cursor: pointer;
  text-align: center;
  padding: 20px;
}

.upload-box:hover {
  border-color: var(--accent);
  background: #f2fbf9;
}

.upload-box strong {
  display: block;
  max-width: 100%;
  color: var(--text);
  font-size: 17px;
  overflow-wrap: anywhere;
}

.upload-box span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.compact-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.plan-count-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfb;
  color: var(--muted);
  font-size: 13px;
}

.plan-count-box strong {
  color: var(--accent-strong);
  font-size: 16px;
}

input {
  width: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  background: white;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
  transition: background 160ms ease, box-shadow 160ms ease;
}

button:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

button.secondary {
  background: #eef5f4;
  color: var(--accent-strong);
  border: 1px solid #bad5d1;
}

button.secondary:hover {
  background: #dff0ed;
}

.mobile-capture-panel,
.candidate-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}

.candidate-panel {
  background: #fffaf0;
  border-color: #f1c27d;
}

.candidate-panel strong {
  display: block;
  font-size: 14px;
}

.candidate-panel p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.capture-actions,
.capture-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.capture-actions button {
  flex: 1 1 120px;
}

.capture-status span {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  font-size: 13px;
}

.result-list {
  display: grid;
  gap: 10px;
  margin-top: auto;
  max-height: 260px;
  overflow: auto;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

.result-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.output-folder {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfb;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.result-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.result-card h3 {
  font-size: 15px;
  margin-bottom: 7px;
}

.result-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6f5;
  color: var(--accent-strong);
  font-size: 12px;
}

.data-query-panel {
  grid-column: 1 / -1;
}

.query-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.query-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.query-field input {
  width: 100%;
  min-height: 44px;
  font-size: 15px;
}

.query-results {
  margin-top: 14px;
}

.query-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  color: var(--muted);
  font-size: 13px;
}

.query-summary strong {
  color: var(--text);
}

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

.data-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.data-block h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.data-item {
  padding: 10px 0;
  border-top: 1px solid #eef2f5;
}

.data-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.data-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.5;
}

.data-item p,
.muted-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.tag.warn {
  background: #fff7ed;
  color: var(--warn);
}

.tag.risk {
  background: #fef2f2;
  color: var(--risk);
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}

.safety-panel {
  grid-column: 1 / -1;
  background: #fffaf0;
  border-color: #f1c27d;
}

.safety-panel h2 {
  font-size: 17px;
  margin-bottom: 8px;
}

.safety-panel ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 24px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 20px;
  }

  .home-layout {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .hero-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-card {
    min-height: auto;
  }

  .task-actions,
  .result-toolbar,
  .query-row {
    align-items: stretch;
    flex-direction: column;
  }

  .query-row {
    display: flex;
  }

  .data-grid {
    grid-template-columns: 1fr;
  }

  .capture-actions {
    flex-direction: column;
  }

  .capture-actions button {
    width: 100%;
  }
}
