:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dee7;
  --text: #1f2933;
  --muted: #617080;
  --blue: #1f6feb;
  --blue-dark: #1554b3;
  --green: #2f855a;
  --amber: #b7791f;
  --red: #c53030;
  --ink: #263238;
  --shadow: 0 8px 24px rgba(30, 42, 62, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

button,
.topbar-actions a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

button:hover,
.topbar-actions a:hover {
  border-color: var(--blue);
  color: var(--blue);
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

button.primary:hover {
  background: var(--blue-dark);
  color: #fff;
}

button.full {
  width: 100%;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 310px minmax(560px, 1fr) 390px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.sidebar,
.main-stage,
.detail-pane {
  min-width: 0;
}

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

.panel {
  padding: 14px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.3;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-heading h2 {
  margin: 0;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: #334155;
  font-size: 13px;
}

input[type="file"] {
  display: none;
}

input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.file-drop {
  border: 1px dashed #aab4c2;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
  cursor: pointer;
}

.file-drop span {
  display: block;
  font-weight: 700;
}

.file-drop small,
.hint,
.empty {
  color: var(--muted);
  font-size: 12px;
}

.hint {
  margin: 4px 0 0;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 14px;
}

.stats-strip div {
  padding: 12px 14px;
  background: #fff;
}

.stats-strip span,
.check-item span,
.manifest-item span,
.object-item span,
.graph-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stats-strip strong,
.check-item strong,
.manifest-item strong,
.object-item strong,
.graph-item strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
}

.stats-strip strong {
  font-size: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #e8f1ff;
  color: var(--blue-dark);
  font-size: 12px;
  white-space: nowrap;
}

.badge.ready {
  background: #e6f4ea;
  color: var(--green);
}

.badge.warn {
  background: #fff3cd;
  color: var(--amber);
}

.badge.bad {
  background: #fee2e2;
  color: var(--red);
}

.check-list,
.manifest-list,
.object-summary,
.graph-summary {
  display: grid;
  gap: 8px;
}

.check-item,
.manifest-item,
.object-item,
.graph-item {
  padding: 9px 10px;
  border: 1px solid #edf0f5;
  border-left: 4px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.check-item.pass,
.object-item.pass {
  border-left-color: var(--green);
}

.check-item.warn,
.manifest-item.warn,
.graph-item.warn {
  border-left-color: var(--amber);
}

.check-item.block,
.manifest-item.block,
.graph-item.block {
  border-left-color: var(--red);
}

.manifest-item,
.graph-item {
  border-left-color: var(--blue);
}

.html-preview {
  min-height: 300px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.html-preview h1,
.html-preview h2,
.html-preview h3 {
  margin: 0 0 8px;
}

.html-preview p,
.html-preview li {
  color: #334155;
  font-size: 13px;
  line-height: 1.6;
}

.html-preview .preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.html-preview .preview-card {
  padding: 10px;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  background: #fff;
}

.report-panel pre {
  margin: 0;
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fbfcfe;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 300px 1fr;
  }

  .detail-pane {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .detail-pane .panel {
    margin-bottom: 0;
  }
}

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .workspace,
  .detail-pane {
    grid-template-columns: 1fr;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
