:root {
  --ink: #0d1116;
  --surface: #12171e;
  --surface-raised: #191f27;
  --surface-bright: #202832;
  --line: #303945;
  --line-bright: #44505d;
  --paper: #edf0ed;
  --muted: #87929d;
  --faint: #5d6873;
  --acid: #d7fb78;
  --cyan: #74d7cf;
  --blue: #8bb9ff;
  --amber: #f6c979;
  --red: #fb958b;
  --shadow: rgba(0, 0, 0, 0.32);
  --radius: 3px;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Bahnschrift, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--paper);
  background-color: var(--ink);
  background-image: repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 64px);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
  background: radial-gradient(circle at 85% 7%, rgba(215, 251, 120, 0.08), transparent 27rem), radial-gradient(circle at 8% 85%, rgba(116, 215, 207, 0.045), transparent 25rem);
}

body,
button,
input {
  font-family: var(--sans);
}

button,
input {
  font-size: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.5;
}

button,
input {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.6rem 0.8rem;
  color: var(--ink);
  background: var(--acid);
  font-weight: 700;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 4.2vw;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  border-bottom: 1px solid var(--line);
}

.brand-block,
.topbar-meta,
.connection-state,
.node-chip,
.hero-pulse-label,
.section-heading,
.legend,
.legend span,
.process-toolbar,
.network-pair,
.login-aside-footer,
.login-footnote {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 0.85rem;
}

.brand-mark {
  display: grid;
  width: 2.05rem;
  height: 2.05rem;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.18em;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--acid);
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.3;
  text-transform: uppercase;
}

.brand-block h1 {
  margin: 0;
  color: var(--paper);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.topbar-meta {
  gap: 0.65rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.connection-state {
  gap: 0.4rem;
  white-space: nowrap;
}

.connection-state.is-live {
  color: var(--acid);
}

.connection-state.is-error {
  color: var(--red);
}

.status-dot,
.live-dot {
  display: inline-block;
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--faint);
}

.connection-state.is-live .status-dot,
.live-dot {
  background: var(--acid);
  box-shadow: 0 0 0 0.2rem rgba(215, 251, 120, 0.08);
}

.connection-state.is-live .status-dot {
  animation: pulse 2.4s ease-out infinite;
}

.connection-state.is-error .status-dot {
  background: var(--red);
}

.status-dot-muted {
  background: var(--faint);
}

.node-chip {
  min-height: 1.75rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.button {
  min-height: 2.2rem;
  padding: 0.45rem 0.82rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 650;
  line-height: 1;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

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

.button-ghost {
  border-color: var(--line-bright);
  color: var(--paper);
  background: transparent;
}

.button-ghost:hover {
  border-color: var(--acid);
  color: var(--acid);
}

.button-primary {
  color: var(--ink);
  background: var(--acid);
}

.button-primary:hover {
  background: #e3ff9a;
}

.button-small {
  min-height: 1.9rem;
  padding: 0.34rem 0.62rem;
  font-size: 0.74rem;
}

.main-content {
  padding: 2.8rem 0 4.5rem;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  min-height: 285px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1.25rem 2.5rem var(--shadow);
}

.hero-panel::after {
  position: absolute;
  right: -5%;
  bottom: -45%;
  width: 62%;
  height: 110%;
  content: "";
  border: 1px solid rgba(215, 251, 120, 0.12);
  border-radius: 50%;
  transform: rotate(-17deg);
  pointer-events: none;
}

.hero-copy,
.hero-pulse {
  position: relative;
  z-index: 1;
  padding: 2.5rem;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.hero-copy h2,
.login-aside-copy h2 {
  margin: 0;
  color: var(--paper);
  font-size: clamp(2.2rem, 4.9vw, 5.6rem);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.hero-copy h2 em,
.login-aside-copy h2 em {
  color: var(--acid);
  font-style: normal;
}

.hero-intro {
  max-width: 34rem;
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-pulse {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  background: rgba(255, 255, 255, 0.018);
}

.hero-pulse-label {
  gap: 0.48rem;
  margin-bottom: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-pulse-number {
  color: var(--acid);
  font-family: var(--mono);
  font-size: clamp(3.6rem, 7.5vw, 7.5rem);
  font-weight: 400;
  letter-spacing: -0.1em;
  line-height: 0.95;
}

.hero-pulse-caption {
  margin: 0.55rem 0 0.95rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.hero-sparkline {
  display: block;
  width: 100%;
  height: 4.2rem;
}

.section-block {
  margin-top: 3.75rem;
}

.section-heading {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.section-heading-tight {
  margin-bottom: 0.85rem;
}

.section-heading h2,
.operator-note h2,
.login-card-header h2 {
  margin: 0;
  color: var(--paper);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.section-note {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric-card {
  min-height: 11.1rem;
  padding: 1.05rem 1.15rem 1.15rem;
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-bright);
  background: var(--surface-raised);
}

.metric-card-accent {
  border-top-color: var(--acid);
}

.metric-card-wide {
  grid-column: span 2;
}

.metric-card-topline {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.67rem;
  letter-spacing: 0.12em;
}

.metric-index {
  color: var(--faint);
}

.metric-value {
  display: block;
  margin-top: 1rem;
  color: var(--paper);
  font-family: var(--mono);
  font-size: clamp(1.9rem, 3.5vw, 3.15rem);
  font-weight: 400;
  letter-spacing: -0.09em;
  line-height: 1;
}

.metric-value-compact {
  letter-spacing: -0.12em;
}

.metric-label {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.67rem;
}

.metric-meter {
  display: block;
  width: 100%;
  height: 0.28rem;
  margin-top: 1.25rem;
  border: 0;
  background: var(--line);
}

.metric-meter::-webkit-meter-bar {
  background: var(--line);
}

.metric-meter::-webkit-meter-optimum-value {
  background: var(--acid);
}

.metric-meter::-moz-meter-bar {
  background: var(--acid);
}

.load-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin-top: 1.3rem;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.load-strip span {
  padding-top: 0.35rem;
  border-top: 1px solid var(--line-bright);
}

.network-pair {
  gap: 2rem;
  margin-top: 1rem;
}

.network-pair > div {
  min-width: 7rem;
}

.network-label {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.67rem;
}

.network-pair strong {
  display: block;
  margin-top: 0.32rem;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 400;
}

.legend {
  flex-wrap: wrap;
  gap: 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.legend span {
  gap: 0.35rem;
}

.legend-swatch {
  display: inline-block;
  width: 0.8rem;
  height: 0.2rem;
  background: var(--faint);
}

.legend-cpu {
  background: var(--acid);
}

.legend-memory {
  background: var(--cyan);
}

.legend-load {
  background: var(--blue);
}

.chart-panel {
  position: relative;
  min-height: 250px;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 250px;
}

.chart-empty {
  position: absolute;
  top: 50%;
  right: 1rem;
  left: 1rem;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-align: center;
  transform: translateY(-50%);
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(240px, 0.7fr);
  gap: 1.25rem;
  align-items: start;
  margin-top: 3.75rem;
}

.dashboard-columns .section-block {
  margin-top: 0;
}

.panel-section {
  min-width: 0;
  padding: 1.35rem;
  border: 1px solid var(--line);
  background: rgba(18, 23, 30, 0.74);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-table th {
  padding: 0.58rem 0.65rem;
  border-bottom: 1px solid var(--line-bright);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid rgba(68, 80, 93, 0.48);
  color: var(--paper);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: rgba(215, 251, 120, 0.035);
}

.table-action-head,
.service-actions {
  text-align: right !important;
}

.service-name {
  display: block;
  font-weight: 650;
}

.service-kind {
  display: block;
  margin-top: 0.15rem;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.63rem;
}

.service-detail {
  max-width: 16rem;
  color: var(--muted) !important;
  font-size: 0.72rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.23rem 0.45rem;
  border: 1px solid var(--line-bright);
  font-family: var(--mono);
  font-size: 0.65rem;
  white-space: nowrap;
}

.status::before {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}

.status-running,
.status-active {
  border-color: rgba(215, 251, 120, 0.32);
  color: var(--acid);
}

.status-running::before,
.status-active::before {
  background: var(--acid);
}

.status-starting,
.status-stopping,
.status-unknown {
  border-color: rgba(246, 201, 121, 0.32);
  color: var(--amber);
}

.status-starting::before,
.status-stopping::before,
.status-unknown::before {
  background: var(--amber);
}

.status-failed,
.status-error,
.status-inactive,
.status-stopped {
  border-color: rgba(251, 149, 139, 0.32);
  color: var(--red);
}

.status-failed::before,
.status-error::before,
.status-inactive::before,
.status-stopped::before {
  background: var(--red);
}

.service-actions {
  white-space: nowrap;
}

.service-action {
  padding: 0.25rem 0.38rem;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.service-action:hover {
  color: var(--acid);
}

.service-action[data-action="stop"],
.service-action[data-action="restart"] {
  color: var(--amber);
}

.service-action[data-action="stop"]:hover,
.service-action[data-action="restart"]:hover {
  color: var(--red);
}

.empty-cell {
  padding: 2rem 0.65rem !important;
  color: var(--muted) !important;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-align: center;
}

.operator-note {
  position: relative;
  min-height: 18rem;
  padding: 1.65rem;
  border: 1px solid var(--line);
  background: var(--acid);
  color: var(--ink);
}

.operator-note .eyebrow {
  color: rgba(13, 17, 22, 0.62);
}

.operator-note h2 {
  max-width: 14rem;
  color: var(--ink);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.operator-note > p:not(.eyebrow):not(.note-meta) {
  max-width: 18rem;
  margin: 1.15rem 0 0;
  color: rgba(13, 17, 22, 0.74);
}

.note-rule {
  width: 100%;
  height: 1px;
  margin: 2.2rem 0 0.75rem;
  background: rgba(13, 17, 22, 0.24);
}

.note-meta {
  margin: 0;
  color: rgba(13, 17, 22, 0.62);
  font-family: var(--mono);
  font-size: 0.67rem;
  line-height: 1.7;
}

.process-heading {
  align-items: flex-end;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: min(100%, 17rem);
  border-bottom: 1px solid var(--line-bright);
}

.search-icon {
  color: var(--acid);
  font-family: var(--mono);
  font-weight: 700;
  transform: rotate(-45deg);
}

.search-field input {
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0;
  border: 0;
  outline: 0;
  color: var(--paper);
  background: transparent;
  font-size: 0.76rem;
}

.search-field input::placeholder {
  color: var(--faint);
}

.process-toolbar {
  justify-content: space-between;
  gap: 1rem;
  margin: -0.25rem 0 0.6rem;
}

.sort-hint {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.sort-button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
}

.sort-button:hover,
.sort-button[aria-sort="true"] {
  color: var(--acid);
}

.numeric,
.numeric .sort-button {
  text-align: right !important;
}

.process-table td:nth-child(1),
.process-table td:nth-child(4),
.process-table td:nth-child(5),
.process-table td:nth-child(6) {
  font-family: var(--mono);
}

.process-table td:nth-child(1),
.process-table td:nth-child(5),
.process-table td:nth-child(6) {
  color: var(--cyan);
}

.process-state {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.69rem;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 1.5rem;
  bottom: 1.5rem;
  max-width: min(30rem, calc(100vw - 3rem));
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line-bright);
  color: var(--paper);
  background: var(--surface-bright);
  box-shadow: 0 0.75rem 2rem var(--shadow);
  font-size: 0.76rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  border-color: rgba(251, 149, 139, 0.5);
  color: var(--red);
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.08em;
}

/* Login */
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  min-height: 100vh;
}

.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 6vw, 5.5rem);
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.login-aside-copy {
  max-width: 40rem;
  margin: auto 0;
}

.login-aside-copy h2 {
  font-size: clamp(2.6rem, 6vw, 6.8rem);
}

.login-aside-copy > p:last-child {
  max-width: 26rem;
  margin: 1.6rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.login-aside-footer {
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 32rem);
  padding: clamp(2rem, 7vw, 5.5rem);
  margin: 0 auto;
}

.login-card-header p:last-child {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.form-alert {
  margin-top: 1.6rem;
  padding: 0.75rem 0.85rem;
  border-left: 2px solid var(--red);
  color: var(--red);
  background: rgba(251, 149, 139, 0.08);
  font-size: 0.78rem;
}

.login-form {
  display: grid;
  gap: 1.1rem;
  margin-top: 2.15rem;
}

.field-group {
  display: grid;
  gap: 0.42rem;
}

.field-group label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.69rem;
}

.field-hint {
  color: var(--faint);
  font-family: var(--sans);
}

.field-group input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  outline: 0;
  color: var(--paper);
  background: var(--surface-raised);
}

.field-group input:hover {
  border-color: var(--muted);
}

.field-group input:focus {
  border-color: var(--acid);
  box-shadow: 0 0 0 1px var(--acid);
}

.button-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 3.2rem;
  margin-top: 0.55rem;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
}

.login-footnote {
  gap: 0.45rem;
  margin: 1.65rem 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.64rem;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(215, 251, 120, 0.18); }
  50% { box-shadow: 0 0 0 0.28rem rgba(215, 251, 120, 0); }
}

@media (max-width: 1050px) {
  .app-shell {
    padding-right: 2.5vw;
    padding-left: 2.5vw;
  }

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

  .metric-card-wide {
    grid-column: span 1;
  }

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

  .operator-note {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
    padding: 1.1rem 0;
  }

  .topbar-meta {
    width: 100%;
    justify-content: space-between;
  }

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

  .hero-copy {
    min-height: 15rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-copy,
  .hero-pulse {
    padding: 1.5rem;
  }

  .hero-pulse {
    min-height: 14rem;
  }

  .section-block {
    margin-top: 2.8rem;
  }

  .section-heading,
  .process-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .process-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .panel-section {
    padding: 1rem;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-shell {
    display: block;
  }

  .login-aside {
    min-height: 42vh;
    padding: 1.5rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .login-aside-copy {
    margin: 3rem 0 2rem;
  }

  .login-aside-copy h2 {
    font-size: clamp(2.35rem, 12vw, 4.3rem);
  }

  .login-card {
    width: 100%;
    padding: 2.2rem 1.5rem 3rem;
  }
}

@media (max-width: 460px) {
  .topbar-meta {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar-meta form {
    margin-left: auto;
  }

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

  .metric-card-wide {
    grid-column: auto;
  }

  .network-pair {
    gap: 1rem;
  }

  .network-pair > div {
    min-width: 0;
  }

  .network-pair strong {
    font-size: 1rem;
  }

  .services-table {
    min-width: 36rem;
  }

  .process-table {
    min-width: 40rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
