:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee9;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #12805c;
  --green-soft: #e8f7ef;
  --amber: #a15c00;
  --amber-soft: #fff4df;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

a {
  color: var(--blue);
  text-decoration: none;
}

button,
.base-link,
.report-actions a {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button.danger {
  border-color: #d92d20;
  color: #b42318;
  background: #fff1f0;
}

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

button.primary {
  width: 100%;
  min-height: 46px;
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  font-weight: 700;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  letter-spacing: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  max-width: 720px;
  font-size: 16px;
}

.api-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.upload-panel {
  display: grid;
  gap: 14px;
}

.dropzone {
  position: relative;
  border: 1.5px dashed #9fb0ca;
  border-radius: 8px;
  min-height: 230px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: #fbfdff;
}

.dropzone.dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.dropzone input {
  display: none;
}

.upload-icon {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 34px;
  margin: 0 auto 12px;
}

.dropzone h2 {
  margin-bottom: 4px;
}

.dropzone p {
  color: var(--muted);
}

.file-list {
  display: grid;
  gap: 8px;
}

.empty,
.file-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f9fafb;
}

.file-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.file-name {
  font-weight: 700;
}

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

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

label {
  display: grid;
  gap: 5px;
}

label span {
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: white;
}

.status-panel h2 {
  margin-bottom: 14px;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 10px;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  min-height: 34px;
}

.steps span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.steps li.done {
  color: var(--green);
}

.steps li.done span {
  background: var(--green);
  border-color: var(--green);
}

.steps li.done span::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg);
}

.steps li.active {
  color: var(--blue);
  font-weight: 700;
}

.steps li.active span {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.report {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
  opacity: 0.45;
  pointer-events: none;
}

.policy-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
  background: white;
}

.policy-card h3 {
  margin-bottom: 8px;
}

.policy-card p {
  margin-bottom: 8px;
  color: var(--muted);
}

.policy-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.policy-card li + li {
  margin-top: 4px;
}

.report.ready {
  opacity: 1;
  pointer-events: auto;
}

.report h3 {
  margin-bottom: 12px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.report-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.report-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.report-grid strong {
  display: block;
  font-size: 24px;
  margin-top: 2px;
}

.analysis-preview {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.analysis-preview h4 {
  margin: 0;
  font-size: 14px;
}

.candidate-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: white;
}

.candidate-row strong,
.candidate-row span {
  display: block;
}

.candidate-row span {
  color: var(--muted);
  font-size: 12px;
}

.note {
  margin: 12px 0;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 8px;
  padding: 10px;
}

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

.report-actions a:first-child {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

@media (max-width: 900px) {
  .header,
  .layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .context,
  .report-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}
