:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #687385;
  --line: #dce3ec;
  --blue: #1769aa;
  --blue-strong: #0f4c81;
  --green: #0f766e;
  --red: #b42318;
  --amber: #a15c07;
  --shadow: 0 12px 28px rgba(20, 35, 56, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: #0d1b2a;
  color: #fff;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #2a9d8f;
  font-weight: 800;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav-item {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ai-card {
  position: absolute;
  right: 22px;
  bottom: 24px;
  left: 22px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.ai-label {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.ai-model {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
}

.ai-state {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.main {
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
}

.topbar p,
.panel-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.env-pill,
.step-badge {
  flex: none;
  border-radius: 999px;
  background: #e8f2fb;
  color: var(--blue-strong);
  font-size: 12px;
  font-weight: 700;
}

.env-pill {
  padding: 10px 14px;
}

.step-badge {
  padding: 7px 10px;
}

.section {
  margin-bottom: 22px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(320px, 0.85fr);
  gap: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.upload-form {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.drop-zone {
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px dashed #9bb5ce;
  border-radius: 8px;
  background: #f8fbfe;
  cursor: pointer;
}

.drop-zone:hover {
  border-color: var(--blue);
}

.drop-zone.drag-over {
  border-color: var(--green);
  background: #eef7f5;
}

.drop-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  font-weight: 700;
}

.drop-desc {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.drop-hint {
  color: #8390a2;
  font-size: 12px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
}

.primary-btn {
  background: var(--blue);
  color: #fff;
}

.primary-btn:hover:not(:disabled) {
  background: var(--blue-strong);
}

.secondary-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-btn {
  border: 1px solid #f1b8b2;
  background: #fff;
  color: var(--red);
}

.danger-btn:hover:not(:disabled) {
  background: #fde8e7;
}

.btn-icon {
  font-size: 16px;
  line-height: 1;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 24px;
}

.target-picker {
  display: grid;
  gap: 8px;
  margin: 0 24px 16px;
}

.target-picker label {
  color: var(--muted);
  font-size: 13px;
}

.target-picker select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.status-line {
  margin: 0 24px 24px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #eef7f5;
  color: var(--green);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1040px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #3a4656;
  font-size: 12px;
  text-transform: uppercase;
}

.empty,
.empty-block {
  color: var(--muted);
  text-align: center;
}

.empty-block {
  padding: 28px;
}

.status-ok,
.status-error,
.status-warn {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-ok {
  background: #e7f6f2;
  color: var(--green);
}

.status-error {
  background: #fde8e7;
  color: var(--red);
}

.status-warn {
  background: #fff3db;
  color: var(--amber);
}

.validation-list,
.history-list,
.ai-output {
  padding: 20px 24px 24px;
}

.validation-item,
.history-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.validation-item + .validation-item,
.history-item + .history-item {
  margin-top: 12px;
}

.validation-title,
.history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-weight: 700;
}

.issue-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #3a4656;
}

.ai-output {
  min-height: 92px;
  color: #314154;
  line-height: 1.65;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: none;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #17202a;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.toast.show {
  display: block;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .ai-card {
    position: static;
    margin-top: 24px;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .panel-head {
    display: grid;
  }

  .grid-2,
  .metrics {
    grid-template-columns: 1fr;
  }
}
