:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #eef3f8;
  --text: #18212f;
  --muted: #647084;
  --line: #d9e1eb;
  --accent: #1c7c72;
  --accent-2: #265fd7;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(31, 45, 61, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  background: #14202f;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #2fd0b5;
  color: #10202b;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #b8c5d6;
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  background: transparent;
  color: #c8d3e1;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #203146;
  color: #fff;
}

.status-panel {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2fd0b5;
}

.status-panel strong,
.status-panel span {
  display: block;
}

.status-panel span {
  color: #b8c5d6;
  font-size: 13px;
}

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

.topbar,
.section-head,
.editor-head,
.tools-head,
.form-actions,
.actions,
.field-row {
  display: flex;
  align-items: center;
}

.topbar,
.section-head {
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
}

.section-head p,
.editor-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(420px, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.secrets-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(360px, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.server-list {
  display: grid;
  gap: 12px;
  align-content: start;
}

.server-card,
.editor,
.code-panel,
.steps article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(31, 45, 61, 0.04);
}

.server-card {
  padding: 14px;
  text-align: left;
}

.server-card.active {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.server-card h3 {
  margin-bottom: 6px;
}

.server-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--panel-2);
  color: #3d4a5c;
  font-size: 12px;
}

.editor {
  padding: 18px;
}

.editor-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

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

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

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28, 124, 114, 0.14);
}

.field-row {
  gap: 12px;
}

.field-row label {
  flex: 1;
}

.tools-block {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 16px;
}

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

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

.secret-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
}

.secret-item strong,
.secret-item span {
  display: block;
}

.secret-item span {
  margin-top: 4px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.tools-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(180px, 1fr) 38px;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.tool-row label {
  margin-bottom: 0;
}

.icon-btn,
.primary-btn,
.secondary-btn,
.danger-btn,
.segmented button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
}

.icon-btn {
  width: 38px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
}

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

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

.danger-btn {
  background: #fff5f3;
  color: var(--danger);
  border-color: #ffd5cf;
}

.remove-tool {
  margin-top: 22px;
  width: 38px;
  padding: 0;
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.actions,
.form-actions {
  gap: 10px;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  min-height: 30px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--panel-2);
  color: var(--text);
}

.code-panel {
  margin-top: 18px;
  overflow: hidden;
}

pre {
  margin: 0;
  padding: 18px;
  max-height: 62vh;
  overflow: auto;
  background: #101923;
  color: #d6e4f0;
  font-size: 13px;
  line-height: 1.55;
}

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

.steps article {
  padding: 18px;
}

.steps span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #dff7f2;
  color: var(--accent);
  font-weight: 800;
}

.steps p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(20px);
  opacity: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #14202f;
  color: #fff;
  transition: 0.18s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    min-height: auto;
  }

  .content-grid,
  .secrets-layout,
  .steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .section-head,
  .editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .field-row,
  .tool-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .remove-tool {
    margin-top: 0;
  }
}
