:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --text: #1d2733;
  --muted: #667484;
  --line: #d9e0e7;
  --accent: #146c8f;
  --accent-dark: #0d526e;
  --good: #1f7a4d;
  --warn: #a36311;
  --shadow: 0 16px 40px rgba(20, 36, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

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

.sidebar {
  min-height: 100vh;
  background: #17212c;
  color: #f3f7fa;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #e0f2f1;
  color: #12343c;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand h1 {
  font-size: 16px;
  line-height: 1.2;
  margin: 0;
}

.brand p,
.toolbar p,
.panel-heading span,
.hint,
.empty {
  color: var(--muted);
}

.brand p {
  margin: 4px 0 0;
  color: rgba(243, 247, 250, 0.68);
  font-size: 12px;
}

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

.nav-item {
  color: rgba(243, 247, 250, 0.82);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.side-panel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 14px;
}

.side-panel h2 {
  font-size: 14px;
  margin: 0 0 8px;
}

.side-panel p {
  margin: 0;
  color: rgba(243, 247, 250, 0.72);
  font-size: 13px;
  line-height: 1.7;
}

.side-panel code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  color: #d8f3dc;
  font-size: 12px;
}

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

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

.toolbar h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.toolbar p {
  margin: 0;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.status-pill.good {
  color: var(--good);
}

.status-pill.warn {
  color: var(--warn);
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.column {
  display: grid;
  gap: 18px;
}

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

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

.panel-heading h3 {
  margin: 0;
  font-size: 17px;
}

.panel-heading span {
  font-size: 12px;
  text-align: right;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 108, 143, 0.14);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 13px;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9fb;
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  border-color: var(--accent);
}

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

button.primary:hover {
  background: var(--accent-dark);
}

button.wide {
  width: 100%;
}

.hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
}

pre {
  margin: 0;
  min-height: 150px;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #101820;
  color: #eef7ff;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.55;
  font-size: 13px;
}

.output-panel:nth-of-type(3) pre {
  background: #10201b;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--panel-soft);
  color: inherit;
  text-decoration: none;
}

.history-item:hover {
  border-color: var(--accent);
}

.history-item div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.history-item b {
  color: var(--text);
}

.history-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.detail-main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

body.detail-page {
  display: block;
  padding: 0;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.detail-actions a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

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

.detail-grid .wide-panel {
  grid-column: 1 / -1;
}

.detail-context {
  min-height: 180px;
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--line);
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .layout {
    grid-template-columns: 1fr;
  }

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

  .toolbar {
    flex-direction: column;
  }
}

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

  .button-row,
  .panel-heading {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    display: grid;
  }

  .panel-heading span {
    text-align: left;
  }
}
