:root {
  --bg: #f4efe7;
  --bg-soft: #ebe1d3;
  --surface: rgba(255, 251, 246, 0.82);
  --surface-strong: #fffdfa;
  --surface-deep: #f7f1e7;
  --ink: #172027;
  --muted: #5f6c74;
  --line: rgba(23, 32, 39, 0.1);
  --accent: #0f7b82;
  --accent-deep: #0a5960;
  --accent-soft: rgba(15, 123, 130, 0.1);
  --amber: #c27a2a;
  --success: #1b7b49;
  --success-soft: rgba(27, 123, 73, 0.12);
  --danger: #b24335;
  --danger-soft: rgba(178, 67, 53, 0.12);
  --warning: #8c661f;
  --warning-soft: rgba(140, 102, 31, 0.12);
  --shadow-lg: 0 24px 60px rgba(23, 32, 39, 0.08);
  --shadow-md: 0 16px 36px rgba(23, 32, 39, 0.06);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font-sans: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at top left, rgba(15, 123, 130, 0.16), transparent 26%),
    radial-gradient(circle at bottom right, rgba(194, 122, 42, 0.15), transparent 22%),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
}

button,
input {
  font: inherit;
}

code,
pre {
  font-family: var(--font-mono);
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.control-rail,
.workspace-hero,
.status-board,
.server-card,
.login-card {
  backdrop-filter: blur(16px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow-lg);
}

.control-rail {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: var(--radius-xl);
}

.rail-brand h1,
.workspace-hero h2,
.section-head h2,
.server-card-head h2,
.tool-head h3,
.login-card h2 {
  margin: 0;
}

.eyebrow,
.section-kicker,
.panel-label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.rail-copy,
.workspace-copy,
.tool-head p,
.login-copy,
.health-card p,
.session-user,
.panel-meta,
.nav-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.rail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.button.secondary {
  color: var(--ink);
  background: rgba(23, 32, 39, 0.08);
}

.button.warning {
  color: #fff;
  background: linear-gradient(135deg, #ad7620, var(--amber));
}

.button.danger {
  color: #fff;
  background: linear-gradient(135deg, var(--danger), #7a241d);
}

.button.ghost {
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(23, 32, 39, 0.08);
}

.rail-panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.rail-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.server-nav {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.server-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--ink);
  background: var(--surface-deep);
}

.server-nav-item:hover {
  border-color: rgba(15, 123, 130, 0.2);
  box-shadow: var(--shadow-md);
}

.server-nav-item.is-global {
  background: linear-gradient(135deg, rgba(178, 67, 53, 0.08), rgba(194, 122, 42, 0.12));
}

.server-nav-main {
  display: grid;
  gap: 4px;
  text-align: left;
}

.server-nav-name {
  font-weight: 800;
}

.server-nav-desc {
  font-size: 13px;
  color: var(--muted);
}

.server-nav-badge {
  display: inline-flex;
  align-items: center;
  min-width: 42px;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 123, 130, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  display: grid;
  gap: 24px;
}

.workspace-hero,
.status-board,
.server-card {
  border-radius: var(--radius-xl);
}

.workspace-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  min-width: min(420px, 100%);
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.stat-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.stat-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.section-head,
.server-card-head,
.health-card-top,
.tool-head-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.status-board {
  padding: 24px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.health-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.health-card.online {
  border-color: rgba(27, 123, 73, 0.16);
}

.health-card.offline {
  border-color: rgba(178, 67, 53, 0.16);
}

.status-pill,
.feature-badge,
.server-kicker {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.online {
  color: var(--success);
  background: var(--success-soft);
}

.status-pill.offline {
  color: var(--danger);
  background: var(--danger-soft);
}

.server-kicker {
  color: var(--amber);
  background: rgba(194, 122, 42, 0.12);
}

.feature-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.feature-badge {
  color: var(--accent);
  background: var(--accent-soft);
}

.operations-stage {
  display: grid;
  gap: 18px;
}

.server-panels {
  display: grid;
  gap: 22px;
}

.server-card {
  padding: 24px;
  scroll-margin-top: 24px;
}

.server-card.global-card {
  background:
    linear-gradient(135deg, rgba(178, 67, 53, 0.06), rgba(194, 122, 42, 0.08)),
    var(--surface);
  border-color: rgba(178, 67, 53, 0.18);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.tool-card {
  display: grid;
  align-content: start;
  min-width: 0;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.tool-head {
  min-height: 110px;
}

.tool-head h3 {
  font-size: 20px;
}

.tool-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.tool-form label {
  display: grid;
  gap: 8px;
}

.tool-form span {
  font-size: 13px;
  font-weight: 700;
}

.tool-form input[type="number"],
.tool-form input[type="text"],
.tool-form input[type="password"],
.tool-form textarea,
.tool-form select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.tool-form textarea {
  min-height: 108px;
  padding: 14px;
  resize: vertical;
}

.tool-form input:focus {
  outline: none;
  border-color: rgba(15, 123, 130, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 123, 130, 0.08);
}

.tool-form textarea:focus {
  outline: none;
  border-color: rgba(15, 123, 130, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 123, 130, 0.08);
}

.tool-form select:focus {
  outline: none;
  border-color: rgba(15, 123, 130, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 123, 130, 0.08);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-row,
.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(23, 32, 39, 0.05);
  border: 1px solid transparent;
}

.result-box {
  display: none;
  min-width: 0;
  max-width: 100%;
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  line-height: 1.75;
  overflow: hidden;
}

.result-box.is-visible {
  display: block;
}

.result-box.success {
  background: rgba(27, 123, 73, 0.08);
  border: 1px solid rgba(27, 123, 73, 0.14);
}

.result-box.error {
  background: rgba(178, 67, 53, 0.08);
  border: 1px solid rgba(178, 67, 53, 0.14);
}

.result-box.loading {
  background: rgba(15, 123, 130, 0.08);
  border: 1px solid rgba(15, 123, 130, 0.14);
}

.result-title {
  margin: 0 0 8px;
  font-weight: 800;
}

.section-spacer {
  margin-top: 14px;
}

.result-box p,
.result-box pre {
  margin: 0;
}

.result-box p,
.result-box li,
.result-box td,
.result-box th,
.result-box code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-box pre {
  overflow: auto;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-box code {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.result-box .inline-code-block {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(23, 32, 39, 0.05);
  white-space: pre-wrap;
}

.result-meta {
  display: grid;
  gap: 10px;
}

.result-meta-item {
  display: grid;
  gap: 4px;
}

.result-meta-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

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

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  min-width: 0;
}

th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
}

.datetime-cell {
  min-width: 172px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 32, 39, 0.34);
}

.login-overlay.hidden,
.inline-message.hidden {
  display: none;
}

.login-card {
  width: min(460px, 100%);
  padding: 30px;
  border-radius: var(--radius-xl);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.inline-message.error {
  color: var(--danger);
}

.empty-state {
  margin: 8px 0 0;
  color: var(--muted);
}

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

  .control-rail {
    position: static;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 1500px);
    padding-top: 16px;
  }

  .workspace-hero,
  .section-head,
  .server-card-head,
  .health-card-top,
  .rail-panel-head {
    flex-direction: column;
  }

  .overview-stats {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .rail-actions {
    grid-template-columns: 1fr;
  }

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

/* Operations console refresh: denser, calmer, and easier to scan during repeated admin work. */
:root {
  --bg: #eef2f5;
  --bg-soft: #e4e9ee;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-deep: #f5f7f9;
  --ink: #172027;
  --muted: #63707b;
  --line: #d9e1e8;
  --accent: #0b7285;
  --accent-deep: #075763;
  --accent-soft: #e6f4f6;
  --amber: #a16207;
  --success: #137447;
  --success-soft: #e7f6ee;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warning: #8a5a00;
  --warning-soft: #fff4d8;
  --shadow-lg: 0 10px 28px rgba(23, 32, 39, 0.08);
  --shadow-md: 0 8px 18px rgba(23, 32, 39, 0.07);
  --radius-xl: 10px;
  --radius-lg: 8px;
  --radius-md: 8px;
  --radius-sm: 6px;
}

body {
  background:
    linear-gradient(90deg, rgba(23, 32, 39, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  background-size: 24px 24px, auto;
}

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

.app-shell {
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  width: min(1600px, calc(100% - 24px));
  padding: 16px 0 28px;
}

.control-rail,
.workspace-hero,
.status-board,
.server-card,
.login-card {
  backdrop-filter: none;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.control-rail {
  top: 16px;
  gap: 14px;
  padding: 18px;
}

.rail-brand h1 {
  font-size: 24px;
  line-height: 1.2;
}

.rail-copy,
.workspace-copy,
.tool-head p,
.login-copy,
.health-card p,
.session-user,
.panel-meta,
.nav-empty {
  line-height: 1.55;
}

.eyebrow,
.section-kicker,
.panel-label {
  margin-bottom: 8px;
  color: #50606b;
  letter-spacing: 0.08em;
}

.button {
  min-height: 38px;
  border-radius: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  box-shadow: none;
}

.button:hover {
  transform: none;
  box-shadow: var(--shadow-md);
}

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

.button.warning {
  background: var(--warning);
}

.button.danger {
  background: var(--danger);
}

.button.secondary,
.button.ghost {
  background: var(--surface-deep);
  border-color: var(--line);
}

.rail-panel {
  padding: 14px;
}

.server-nav {
  gap: 8px;
}

.server-nav-item {
  min-height: 56px;
  padding: 11px 12px;
  border-color: var(--line);
  border-radius: 8px;
  background: #fff;
}

.server-nav-item:hover {
  border-color: rgba(11, 114, 133, 0.45);
}

.server-nav-item.is-global {
  background: #fff7ed;
  border-color: #fed7aa;
}

.server-nav-badge,
.status-pill,
.feature-badge,
.server-kicker {
  border-radius: 6px;
  padding: 4px 8px;
}

.workspace {
  gap: 18px;
}

.workspace-hero {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 520px);
  gap: 18px;
  padding: 18px;
}

.workspace-hero h2,
.section-head h2,
.server-card-head h2,
.login-card h2 {
  font-size: 24px;
  line-height: 1.25;
}

.overview-stats {
  min-width: 0;
}

.stat-card {
  padding: 14px;
}

.stat-label,
.stat-hint {
  font-size: 12px;
}

.stat-value {
  font-size: 28px;
}

.status-board,
.server-card {
  padding: 18px;
}

.health-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.health-card {
  padding: 14px;
  border-radius: 8px;
}

.health-card-top h3 {
  margin: 0;
  font-size: 16px;
}

.feature-badges {
  justify-content: flex-start;
}

.tool-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.tool-card {
  padding: 14px;
  border-radius: 8px;
  box-shadow: none;
}

.tool-head {
  min-height: auto;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.tool-head-top {
  align-items: center;
}

.tool-head h3 {
  font-size: 17px;
  line-height: 1.3;
}

.tool-form {
  gap: 11px;
  margin-top: 12px;
}

.tool-form span {
  color: #2e3a42;
  font-size: 12px;
}

.tool-form input[type="number"],
.tool-form input[type="text"],
.tool-form input[type="password"],
.tool-form textarea,
.tool-form select,
.login-form input {
  min-height: 40px;
  border-radius: 7px;
  border-color: #cdd7df;
  background: #fbfcfd;
}

.tool-form input[type="number"],
.tool-form input[type="text"],
.tool-form input[type="password"],
.tool-form select,
.login-form input {
  padding: 0 12px;
}

.tool-form textarea {
  min-height: 92px;
  padding: 10px 12px;
}

.tool-form input:focus,
.tool-form textarea:focus,
.tool-form select:focus,
.login-form input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 114, 133, 0.12);
}

.button-row {
  gap: 8px;
}

.button-row .button {
  flex: 1 1 180px;
}

.pill-option {
  min-height: 36px;
  border-radius: 7px;
  background: var(--surface-deep);
  border-color: var(--line);
}

.result-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  line-height: 1.55;
}

.result-box pre,
.result-box .inline-code-block {
  border: 1px solid #dfe6ec;
  background: #f7fafc;
}

.result-meta {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.result-meta-item {
  min-width: 0;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

th,
td {
  padding: 10px 9px;
}

.login-overlay {
  background: rgba(15, 23, 31, 0.45);
}

.login-card {
  border-radius: 10px;
}

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

  .control-rail {
    position: static;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 16px, 1600px);
    padding-top: 10px;
  }

  .workspace-hero {
    grid-template-columns: 1fr;
  }

  .rail-actions,
  .overview-stats {
    grid-template-columns: 1fr;
  }

  .section-head,
  .server-card-head,
  .health-card-top,
  .tool-head-top,
  .rail-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

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