:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #102033;
  --muted: #637083;
  --line: #dbe4ef;
  --blue: #2457d6;
  --blue-2: #0c3a91;
  --green: #087f5b;
  --amber: #b56b00;
  --red: #c92a2a;
  --shadow: 0 18px 45px rgba(16, 32, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(36, 87, 214, 0.16), transparent 34rem),
    linear-gradient(135deg, #f9fbff 0%, var(--bg) 100%);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1240px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: #42516a;
  font-size: 18px;
  line-height: 1.7;
}

.runtime-notice {
  display: inline-flex;
  max-width: 820px;
  margin: 16px 0 0;
  padding: 10px 13px;
  border-radius: 14px;
  color: #5a3d00;
  background: rgba(255, 193, 7, 0.16);
  font-size: 14px;
  line-height: 1.55;
}

.runtime-notice.ok {
  color: #075a42;
  background: rgba(8, 127, 91, 0.12);
}

.hero-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.hero-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(8, 127, 91, 0.12);
}

.mode-tabs {
  display: flex;
  gap: 10px;
  padding: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.tab {
  flex: 1;
  border: 0;
  border-radius: 13px;
  padding: 13px 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  box-shadow: 0 10px 24px rgba(36, 87, 214, 0.28);
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 18px;
  align-items: stretch;
}

.input-panel,
.score-panel,
.result-toolbar,
.results {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 22px;
}

.panel-title,
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-title h2,
.result-toolbar h2,
.score-panel h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

.panel-title p,
.result-toolbar p {
  margin: 0;
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 310px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  resize: vertical;
  color: var(--ink);
  background: #fbfdff;
  line-height: 1.65;
}

textarea:focus,
input:focus {
  border-color: rgba(36, 87, 214, 0.58);
  box-shadow: 0 0 0 4px rgba(36, 87, 214, 0.12);
}

.input-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.primary-btn,
.ghost-btn,
.file-btn {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
}

.primary-btn {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
}

.ghost-btn,
.file-btn {
  color: var(--blue-2);
  border-color: var(--line);
  background: #fff;
}

.file-btn input {
  display: none;
}

.quick-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.upload-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.upload-status strong {
  color: var(--blue-2);
}

.import-progress {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7faff;
}

.import-progress[hidden] {
  display: none;
}

.import-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.import-progress-track {
  height: 9px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8f6;
}

.import-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
  transition: width 180ms ease;
}

.import-progress.processing .import-progress-fill {
  width: 100%;
  background: repeating-linear-gradient(
    135deg,
    var(--blue) 0 10px,
    var(--blue-2) 10px 20px
  );
  background-size: 32px 32px;
  animation: import-progress-stripes 900ms linear infinite;
}

.import-progress.success {
  border-color: rgba(8, 127, 91, 0.25);
  background: rgba(8, 127, 91, 0.06);
}

.import-progress.success .import-progress-fill {
  width: 100%;
  background: var(--green);
}

.import-progress.error {
  border-color: rgba(201, 42, 42, 0.25);
  background: rgba(201, 42, 42, 0.06);
}

.import-progress.error .import-progress-fill {
  width: 100%;
  background: var(--red);
}

.file-btn.busy {
  pointer-events: none;
  opacity: 0.6;
}

@keyframes import-progress-stripes {
  to {
    background-position: 32px 0;
  }
}

.quick-fields label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quick-fields input {
  width: 100%;
  margin-top: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
}

.score-panel {
  padding: 22px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 170px;
  height: 170px;
  margin: 18px auto;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 55%, transparent 56%),
    conic-gradient(var(--blue) 0deg, #e4ebf5 0deg);
}

.score-ring span {
  display: block;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.score-ring small {
  margin-top: -18px;
  color: var(--muted);
  font-weight: 800;
}

.signals {
  display: grid;
  gap: 8px;
}

.signal {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6f8fb;
  color: var(--muted);
  font-size: 13px;
}

.signal strong {
  color: var(--ink);
}

.note {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  color: #4d5b70;
  background: #eef4ff;
  line-height: 1.55;
}

.llm-output {
  line-height: 1.7;
}

.llm-output h1,
.llm-output h2,
.llm-output h3 {
  margin-top: 18px;
  margin-bottom: 10px;
}

.llm-output pre {
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  background: #0f172a;
  color: #e5eefc;
}

.llm-output blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--blue);
  background: #f4f7fc;
  color: var(--muted);
}

.llm-output code {
  padding: 0.12em 0.35em;
  border-radius: 5px;
  background: #eef2f8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.llm-output pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.report-table-wrap {
  max-width: 100%;
  margin: 14px 0;
  overflow-x: auto;
}

.llm-output table {
  width: 100%;
  border-collapse: collapse;
}

.llm-output th,
.llm-output td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.llm-output th {
  background: #f3f6fb;
}

@media (prefers-reduced-motion: reduce) {
  .import-progress-fill {
    transition: none;
  }

  .import-progress.processing .import-progress-fill {
    animation: none;
  }
}

.result-toolbar {
  margin-top: 18px;
  padding: 18px 22px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.results {
  min-height: 280px;
  margin-top: 18px;
  padding: 22px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 230px;
  text-align: center;
  color: var(--muted);
}

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

.result-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: #fff;
}

.result-card.full {
  grid-column: 1 / -1;
}

.result-card h3 {
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 900;
}

.badge.good {
  color: var(--green);
  background: rgba(8, 127, 91, 0.1);
}

.badge.warn {
  color: var(--amber);
  background: rgba(181, 107, 0, 0.1);
}

.badge.risk {
  color: var(--red);
  background: rgba(201, 42, 42, 0.1);
}

ul,
ol {
  padding-left: 1.3em;
}

li {
  margin: 7px 0;
  line-height: 1.55;
}

.metric-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
}

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

.metric-table th {
  color: #44536a;
  background: #f3f6fb;
}

.metric-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 900px) {
  .hero,
  .workspace,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .quick-fields {
    grid-template-columns: 1fr;
  }

  .mode-tabs,
  .panel-title,
  .result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions,
  .input-actions {
    flex-direction: column;
  }
}

@media print {
  body {
    background: #fff;
  }

  .mode-tabs,
  .input-panel,
  .score-panel,
  .import-progress,
  .toolbar-actions {
    display: none;
  }

  .shell {
    width: auto;
    padding: 0;
  }

  .results,
  .result-toolbar {
    box-shadow: none;
  }
}
