:root {
  --ink: #18232f;
  --muted: #657382;
  --soft: #f5f8f7;
  --panel: #ffffff;
  --line: #dce4e2;
  --soft-line: #edf2f1;
  --green: #1f7a4d;
  --green-2: #4e9a67;
  --teal: #1b7f88;
  --blue: #2f6f9f;
  --gold: #b98225;
  --red: #b84a3a;
  --fill-green: #e8f3ec;
  --fill-blue: #e9f1f8;
  --fill-gold: #fbf1dc;
  --shadow: 0 18px 46px rgba(22, 45, 48, 0.1);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 4%, rgba(31, 122, 77, 0.12), transparent 28%),
    linear-gradient(180deg, #f6faf8 0%, #eef4f3 100%);
}

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

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(249, 252, 251, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 5;
}

.brand-block {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--teal));
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(31, 122, 77, 0.22);
}

.brand-mark svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-block h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
}

.brand-block p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  background: var(--fill-green);
  color: var(--green);
  transform: translateX(2px);
}

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: currentColor;
  background: rgba(31, 122, 77, 0.08);
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-note {
  margin-top: auto;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sidebar-note span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 7px;
}

.sidebar-note strong {
  display: block;
  color: var(--green);
  font-size: 15px;
  margin-bottom: 8px;
}

.sidebar-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 12px;
}

.main-content {
  padding: 28px;
  min-width: 0;
}

.view {
  display: none;
  animation: viewIn 0.28s ease both;
}

.view.active {
  display: grid;
  gap: 20px;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.top-band,
.view-head,
.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.top-band,
.view-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 247, 241, 0.96)),
    #fff;
}

.view-head {
  align-items: center;
}

.eyebrow,
.section-kicker {
  display: inline-block;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.title-group h2,
.view-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.24;
}

.title-group p,
.view-head p {
  margin: 12px 0 0;
  max-width: 880px;
  color: var(--muted);
  line-height: 1.65;
}

.hero-actions,
.form-actions,
.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.secondary-action {
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: 40px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.primary-action {
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 20px rgba(31, 122, 77, 0.2);
}

.secondary-action {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.primary-action:hover,
.secondary-action:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  background: #17643e;
}

.secondary-action:hover {
  border-color: #aebbc6;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 18px;
  min-height: 118px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.metric-card strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.metric-card small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-grid,
.ai-grid,
.trace-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(360px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.panel {
  padding: 20px;
}

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

.section-head h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--fill-blue);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-green {
  color: var(--green);
  background: var(--fill-green);
}

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

.compact-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.full-span {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

textarea {
  resize: vertical;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(31, 122, 77, 0.22);
  border-color: var(--green);
}

.form-actions {
  margin-top: 16px;
}

.project-panel {
  margin-top: 18px;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.import-project-btn {
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.archive-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.chart-row {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.donut-wrap {
  position: relative;
  width: 230px;
  height: 230px;
  margin: 0 auto;
}

.donut {
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg, var(--green) 120deg, var(--teal) 120deg, var(--teal) 200deg, var(--blue) 200deg, var(--blue) 270deg, var(--gold) 270deg, var(--gold) 320deg, var(--red) 320deg);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--soft-line);
}

.donut-center {
  position: absolute;
  inset: 62px;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 1;
}

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

.donut-center strong {
  font-size: 18px;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-item {
  display: grid;
  gap: 7px;
}

.bar-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.bar-top strong {
  color: var(--ink);
  text-align: right;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #edf1f4;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.3s ease;
}

.summary-list {
  display: grid;
  gap: 12px;
}

.summary-list div,
.model-strip div,
.factor-card {
  padding: 13px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcfc;
}

.summary-list span,
.model-strip span,
.factor-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.summary-list strong,
.model-strip strong,
.factor-card strong {
  display: block;
  font-size: 14px;
  line-height: 1.45;
}

.model-strip {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.batch-tools {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.file-drop {
  border: 1px dashed #aec7bd;
  border-radius: 8px;
  padding: 16px;
  background: var(--fill-green);
  cursor: pointer;
}

.file-drop input {
  display: none;
}

.file-drop span {
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
}

.file-drop strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  background: #fff;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  font-size: 13px;
  line-height: 1.4;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: #f8faf9;
  font-weight: 700;
}

.data-table tbody tr:hover {
  background: #fbfcfc;
}

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

.advice-list {
  display: grid;
  gap: 12px;
}

.advice-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcfc;
}

.advice-score {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.advice-body strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.advice-body span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.advice-tag {
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

#promptText {
  min-height: 178px;
}

.ai-output {
  width: 100%;
  min-height: 210px;
  margin-top: 14px;
  background: #fbfcfc;
}

.trace-card {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.qr-box {
  width: 188px;
  height: 188px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  display: grid;
  place-items: center;
}

.qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.trace-info span {
  display: block;
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
}

.trace-info strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.trace-info p {
  color: var(--muted);
  line-height: 1.55;
  margin: 10px 0 14px;
}

dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--soft-line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.qr-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.qr-card {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.qr-card .qr-mini {
  width: 110px;
  height: 110px;
  margin: 0 auto 8px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.qr-card strong,
.qr-card span {
  display: block;
  text-align: center;
  overflow-wrap: anywhere;
}

.qr-card strong {
  font-size: 12px;
}

.qr-card span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.report-panel textarea {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  line-height: 1.7;
  color: var(--ink);
  background: #fbfcfc;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(7, auto);
    overflow-x: auto;
  }

  .sidebar-note {
    display: none;
  }

  .dashboard-grid,
  .ai-grid,
  .trace-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .main-content {
    padding: 14px;
  }

  .top-band,
  .view-head,
  .batch-tools {
    grid-template-columns: 1fr;
  }

  .title-group h2,
  .view-head h2 {
    font-size: 23px;
  }

  .metric-grid,
  .form-grid,
  .compact-form,
  .chart-row,
  .trace-card,
  .factor-grid {
    grid-template-columns: 1fr;
  }

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

  .donut-wrap,
  .donut {
    width: 210px;
    height: 210px;
  }

  .donut::after {
    inset: 36px;
  }

  .donut-center {
    inset: 54px;
  }
}

@media (max-width: 520px) {
  .brand-block {
    width: 100%;
  }

  .nav-list {
    width: 100%;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .advice-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .advice-tag {
    grid-column: 2;
  }
}


.trace-link-box {
  margin-top: 14px;
  display: grid;
  gap: 7px;
}

.trace-open-link,
.qr-card-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.trace-link-box small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.trace-link-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.qr-card-link {
  margin-top: 8px;
  min-height: 30px;
  padding: 7px 10px;
  font-size: 12px;
}
