:root {
  color-scheme: dark;
  --bg: #071019;
  --surface: #0c1722;
  --surface-2: #111f2c;
  --surface-3: #172836;
  --line: #263b4b;
  --line-soft: #1b2d3b;
  --text: #e8f0f5;
  --muted: #91a6b5;
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --blue: #60a5fa;
  --danger: #fb7185;
  --warning: #fbbf24;
  --success: #4ade80;
  --radius: 10px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-width: 1080px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 84% -10%, rgba(45, 212, 191, 0.09), transparent 32rem),
    var(--bg);
  font-size: 14px;
}

button, input, textarea, select { font: inherit; }
button, select, input[type="checkbox"] { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid rgba(45, 212, 191, 0.65);
  outline-offset: 1px;
}

.topbar {
  min-height: 72px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(8, 18, 27, 0.94);
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 300px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(45, 212, 191, 0.45);
  border-radius: 9px;
  color: var(--accent);
  background: linear-gradient(145deg, rgba(45, 212, 191, 0.13), rgba(96, 165, 250, 0.07));
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
}
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: 0.2px; }
.brand-subtitle { margin-top: 3px; color: var(--muted); font-size: 12px; }

.status-cluster { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.status-chip {
  height: 32px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(17, 31, 44, 0.72);
  color: var(--muted);
  font-size: 12px;
}
.status-chip strong { color: #b9c8d2; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #526675; box-shadow: 0 0 0 3px rgba(82, 102, 117, 0.12); }
.status-dot.on { background: var(--success); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.14); }
.status-dot.busy { background: var(--warning); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.14); }
.build-badge, .top-busy {
  padding: 5px 8px;
  border-radius: 5px;
  color: #8da2b0;
  background: #0a141e;
  border: 1px solid var(--line-soft);
  font: 11px/1.2 Consolas, monospace;
}
.top-busy { color: var(--warning); }
.hidden { display: none !important; }

.projectbar {
  min-height: 58px;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #0a141e;
  border-bottom: 1px solid var(--line-soft);
}
.project-identity { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.project-path {
  width: 520px;
  min-height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: text;
}
.project-path, .project-identity strong {
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 12px/1.4 Consolas, "Microsoft YaHei", monospace;
  color: #c8d5dd;
}
.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.project-actions, .heading-actions, .card-actions, .log-tools, .inline-options {
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-divider { width: 1px; height: 24px; margin: 0 3px; background: var(--line); }

.btn {
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid #314959;
  border-radius: 7px;
  color: #dce7ed;
  background: #142330;
  transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.btn:hover:not(:disabled) { border-color: #4c687a; background: #1a2e3d; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary {
  border-color: var(--accent-strong);
  color: #032521;
  background: var(--accent);
  font-weight: 700;
}
.btn.primary:hover:not(:disabled) { background: #5eead4; border-color: #5eead4; }
.btn.danger { border-color: rgba(251, 113, 133, 0.42); color: #fecdd3; background: rgba(251, 113, 133, 0.09); }
.btn.danger:hover:not(:disabled) { border-color: var(--danger); background: rgba(251, 113, 133, 0.16); }
.btn.small { min-height: 29px; padding: 5px 10px; font-size: 12px; }
.btn:disabled { cursor: not-allowed; opacity: 0.42; }

.compact-select, input, textarea, select {
  color: var(--text);
  border: 1px solid #2a4050;
  border-radius: 7px;
  background: #09141e;
}
.compact-select { height: 34px; padding: 0 28px 0 9px; }
input, textarea { width: 100%; padding: 9px 10px; }
input { min-height: 36px; }
input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  height: 14px;
  padding: 0;
  accent-color: var(--accent-strong);
}
textarea { resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #536b7c; }
input:focus, textarea:focus, select:focus { border-color: rgba(45, 212, 191, 0.7); }

.tabs {
  min-height: 62px;
  padding: 0 24px;
  display: flex;
  gap: 2px;
  background: #0a141e;
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative;
  min-width: 190px;
  padding: 10px 18px 11px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  color: #91a6b5;
  border: 0;
  background: transparent;
}
.tab::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 2px;
  background: transparent;
}
.tab:hover { color: #d6e3ea; background: rgba(255, 255, 255, 0.02); }
.tab.active { color: var(--text); }
.tab.active::after { background: var(--accent); }
.tab span { font-weight: 700; }
.tab small { color: #6f8798; font-size: 11px; }
.tab.active small { color: #8da6b5; }

.workspace {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  scrollbar-color: #314a5b #09131c;
}
.panel { display: none; max-width: 1540px; margin: 0 auto; }
.panel.active { display: block; }
.panel-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.panel-heading h1 { margin: 5px 0 4px; font-size: 24px; line-height: 1.2; letter-spacing: -.3px; }
.panel-heading p, .card-header p { margin: 0; color: var(--muted); line-height: 1.5; }

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(17, 31, 44, 0.98), rgba(12, 23, 34, 0.98));
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 0; }
.card-header {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.card-header h2 { margin: 0 0 5px; font-size: 16px; }
.card-header p { font-size: 12px; }
.preview-card, .variables-card { margin-top: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; color: #b7c6cf; font-size: 12px; }
.field > span { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.field em { color: #667d8d; font-style: normal; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.full { grid-column: 1 / -1; }

.check-row, .switch-row { display: flex; align-items: center; gap: 9px; color: #c4d1d9; }
.select-all { margin-bottom: 10px; font-size: 12px; }
.selection-list, .object-list {
  min-height: 156px;
  max-height: 245px;
  margin-bottom: 14px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #09141e;
}
.empty-box { padding: 18px; display: grid; place-items: center; color: #617889; font-size: 12px; }
.selection-list label {
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #142633;
}
.selection-list label:last-child { border-bottom: 0; }
.switch-row {
  margin-top: 16px;
  padding: 12px;
  align-items: flex-start;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8, 20, 29, 0.55);
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  flex: 0 0 34px;
  width: 34px;
  height: 18px;
  position: relative;
  border-radius: 9px;
  background: #314655;
}
.switch::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: white;
  transition: transform .15s;
}
.switch-row input:checked + .switch { background: var(--accent-strong); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row strong, .switch-row small { display: block; }
.switch-row small { margin-top: 3px; color: var(--muted); }

.result-box {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.5;
}
.result-box.neutral { color: #8fa6b5; border-color: var(--line-soft); background: rgba(7, 16, 25, 0.5); }
.result-box.success { color: #bbf7d0; border-color: rgba(74, 222, 128, .28); background: rgba(74, 222, 128, .07); }
.result-box.error { color: #fecdd3; border-color: rgba(251, 113, 133, .3); background: rgba(251, 113, 133, .08); }

.table-wrap { overflow: auto; border: 1px solid var(--line-soft); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  padding: 10px 12px;
  text-align: left;
  color: #8fa6b5;
  background: #0a1620;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  white-space: nowrap;
}
td { padding: 10px 12px; color: #cad6dd; border-bottom: 1px solid #182a37; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(45, 212, 191, 0.025); }
.empty-cell { padding: 28px; text-align: center; color: #607889; }

.editor-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; min-height: 500px; }
.object-browser { display: flex; flex-direction: column; }
.search-input { min-width: 220px; }
.filter-row { padding: 12px 2px; display: flex; gap: 15px; color: #9eb0bb; font-size: 12px; }
.filter-row label, .compact-check { display: flex; align-items: center; gap: 6px; }
.object-list { flex: 1; margin: 0; }
.object-item {
  padding: 10px 12px;
  border-bottom: 1px solid #172a37;
  cursor: pointer;
}
.object-item:hover, .object-item.active { background: var(--accent-soft); }
.object-item strong, .object-item small { display: block; }
.object-item small { margin-top: 3px; color: #718999; }
.object-item .kind-badge { float: right; margin-left: 8px; }
.object-group {
  padding: 8px 12px;
  color: #6f8798;
  background: #0a1620;
  border-bottom: 1px solid #172a37;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}
.structure-details { margin-top: 12px; color: #91a6b5; font-size: 12px; }
.structure-details summary { cursor: pointer; }
.structure-details pre {
  max-height: 210px;
  overflow: auto;
  white-space: pre-wrap;
  color: #a8bbc6;
  font: 11px/1.5 Consolas, monospace;
}

.code-editor { min-width: 0; display: flex; flex-direction: column; }
.editor-toolbar { display: flex; align-items: flex-end; gap: 9px; }
.path-field { flex: 1; }
.kind-badge, .pid-badge, .count-badge, .connection-badge {
  padding: 5px 8px;
  border: 1px solid #294253;
  border-radius: 5px;
  color: #8fa7b6;
  background: #0a1620;
  font-size: 11px;
  white-space: nowrap;
}
.code-grid { flex: 1; min-height: 360px; margin-top: 15px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.code-field textarea {
  flex: 1;
  min-height: 340px;
  resize: none;
  color: #d7e6ec;
  font: 13px/1.62 "Cascadia Code", Consolas, monospace;
  tab-size: 4;
}
.editor-footer {
  margin-top: 14px;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line-soft);
}
.inline-options { color: #9db0bc; font-size: 12px; }
.inline-options label { display: flex; gap: 6px; align-items: center; }
.inline-result { max-width: 350px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #718999; font-size: 12px; }

.endpoint-summary {
  max-width: 480px;
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0a151f;
}
.endpoint-summary span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.endpoint-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c7d7df; font: 12px/1.4 Consolas, monospace; }
.service-kicker { display: block; margin-bottom: 5px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.service-card { display: flex; flex-direction: column; }
.service-card .form-grid { flex: 1; }
.compact-switch { margin-top: 14px; padding: 10px 12px; }
.card-actions { margin-top: 18px; justify-content: flex-end; }
.variables-header { align-items: center; }
.title-line { display: flex; align-items: center; gap: 10px; }
.title-line h2 { margin-bottom: 0; }
.count-badge { color: #99f6e4; border-color: rgba(45, 212, 191, .28); background: rgba(45, 212, 191, .07); }
.variable-tools { display: flex; align-items: center; gap: 8px; }
.online-table-wrap { margin-top: 12px; max-height: 440px; }
.online-table { table-layout: fixed; }
.online-table th:nth-child(1) { width: 19%; }
.online-table th:nth-child(2) { width: 10%; }
.online-table th:nth-child(3) { width: 25%; }
.online-table th:nth-child(4) { width: auto; }
.online-table th:nth-child(5) { width: 78px; }
.variable-name strong, .variable-name small { display: block; }
.variable-name small { margin-top: 3px; color: #718999; }
.type-pill { color: #93c5fd; font: 11px Consolas, monospace; }
.node-id { color: #7f96a5; font: 11px/1.4 Consolas, monospace; word-break: break-all; }
.value-editor { min-height: 32px; padding: 6px 8px; font: 12px Consolas, monospace; }
.action-column { text-align: right; }
.online-table td:last-child { text-align: right; }
.pagination { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; color: #718999; font-size: 12px; }

.log-resizer {
  flex: 0 0 5px;
  cursor: ns-resize;
  background: #0a141e;
  border-top: 1px solid var(--line-soft);
}
.log-resizer:hover { background: var(--accent-strong); }
.logbar {
  flex: 0 0 190px;
  min-height: 96px;
  max-height: 46vh;
  display: flex;
  flex-direction: column;
  background: #060d13;
  border-top: 1px solid #172936;
}
.logbar.collapsed { flex-basis: 42px !important; min-height: 42px; }
.logbar.collapsed .log-box { display: none; }
.log-header {
  min-height: 42px;
  padding: 6px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #13242f;
}
.log-title { display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 700; }
.connection-badge { padding: 3px 6px; color: #fcd34d; }
.connection-badge.on { color: #86efac; border-color: rgba(74, 222, 128, .3); }
.log-filter { width: 180px; min-height: 29px; padding: 5px 8px; }
.log-tools .compact-select { height: 29px; }
.compact-check { color: #718999; font-size: 11px; }
.text-button { padding: 5px 7px; border: 0; color: #8da3b1; background: transparent; font-size: 12px; }
.text-button:hover { color: var(--text); }
.log-box {
  flex: 1;
  min-height: 0;
  padding: 8px 18px 14px;
  overflow: auto;
  color: #98abb6;
  font: 11px/1.55 "Cascadia Code", Consolas, monospace;
}
.log-line { display: grid; grid-template-columns: 74px 60px minmax(0, 1fr); gap: 8px; padding: 2px 0; }
.log-line .time { color: #496373; }
.log-line .level { color: #60a5fa; text-transform: uppercase; }
.log-line.success .level { color: var(--success); }
.log-line.error .level { color: var(--danger); }

@media (max-width: 1220px) {
  .brand-subtitle, .status-chip span:not(.status-dot), .status-chip strong { display: none; }
  .project-identity strong { max-width: 300px; }
  .variable-tools .search-input { width: 220px; }
}
