:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #eef4ef;
  --ink: #1d2522;
  --muted: #68736d;
  --line: #dce4dd;
  --accent: #0f7b63;
  --accent-strong: #0a5d4b;
  --accent-soft: #dff2eb;
  --warning: #9a5b00;
  --danger: #b42318;
  --blue: #2367a2;
  --shadow: 0 18px 45px rgba(34, 47, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  background: #10241e;
  color: #f7fbf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #31b38f;
  color: #06150f;
  font-weight: 800;
}

.brand span,
.account-card small {
  display: block;
  color: #9db7ad;
  font-size: 12px;
  margin-top: 3px;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: #cfe0d8;
  text-align: left;
}

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

.account-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.sidebar .eyebrow {
  color: #9db7ad;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-button,
.ghost-button,
.icon-button,
.chip-button {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 14px;
}

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

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

.ghost-button,
.chip-button {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  place-items: center;
  padding: 0;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 18px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.two-col {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.card,
.table-wrap,
.module-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card {
  padding: 16px;
}

.stat-value {
  margin: 8px 0 3px;
  font-size: 26px;
  font-weight: 800;
}

.stat-note {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 12px;
  background: transparent;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-size: 12px;
  white-space: nowrap;
}

.status.warning {
  background: #fff1d6;
  color: var(--warning);
}

.status.danger {
  background: #ffe3df;
  color: var(--danger);
}

.status.blue {
  background: #e2effa;
  color: var(--blue);
}

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

.module-panel {
  padding: 16px;
}

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

.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.mini-row:last-child {
  border-bottom: 0;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e4e9e5;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

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

.field {
  display: grid;
  gap: 6px;
}

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

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

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

.field textarea {
  min-height: 88px;
  resize: vertical;
}

dialog {
  width: min(680px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(8, 15, 12, 0.45);
}

.dialog-header,
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog-fields {
  padding: 16px;
}

.calc-result {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.calc-result .card {
  box-shadow: none;
}

.api-output {
  min-height: 120px;
  max-height: 340px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf8;
  color: #26302b;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.setup-guide {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.setup-guide div {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: start;
}

.setup-guide p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.step-badge {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef4ef;
  color: #25342e;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.env-template {
  overflow: auto;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: #26302b;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: block;
    padding: 12px;
  }

  .brand,
  .account-card {
    display: none;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    grid-template-columns: 22px max-content;
    min-width: max-content;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 0;
  }

  .stats-grid,
  .two-col,
  .form-grid,
  .dialog-fields,
  .calc-result {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 16px;
  }

  .table-wrap {
    overflow-x: auto;
  }

  table {
    min-width: 720px;
  }
}
