:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --ink: #292b30;
  --muted: #7a7d85;
  --paper: #f7f7f9;
  --sidebar: #f0f1f2;
  --surface: rgba(255, 255, 255, 0.90);
  --line: rgba(0, 0, 0, 0.08);
  --note-bg: rgba(0, 0, 0, 0.035);
  --neutral-bg: rgba(0, 0, 0, 0.055);
  --neutral-ink: #676b73;
  --good-bg: #e7f6ee;
  --good-ink: #147047;
  --warn-bg: #fef4e4;
  --warn-ink: #995d05;
  --bad-bg: #fdecee;
  --bad-ink: #b4232c;
  --managed-bg: #eaf2fd;
  --managed-ink: #1b5ec2;
  --button-line: rgba(0, 0, 0, 0.12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 13px; line-height: 1.5; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 28px; font-weight: 600; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 600; }
strong, h3 { font-weight: 600; }
code, .mono { font-family: var(--mono); }
.muted { color: var(--muted); font-size: 12px; }
:focus-visible { outline: 2px solid var(--managed-ink); outline-offset: 3px; }
#page-title:focus { outline: none; }

button, input, select { font: inherit; color: var(--ink); }
button, input, select {
  min-height: 32px;
  border: 1px solid var(--button-line);
  border-radius: 7px;
  background: #fff;
}
button { cursor: pointer; padding: 5px 10px; white-space: nowrap; }
button:hover { background: #f4f5f7; }
button:disabled { cursor: wait; opacity: .55; }
input, select { min-width: 0; padding: 5px 9px; }
input::placeholder { color: var(--muted); }
.primary { background: var(--ink); color: #fff; font-weight: 600; }
.primary:hover { background: #3b3d43; }
.quiet-button { border-color: transparent; background: transparent; color: var(--neutral-ink); font-size: 12px; }
.quiet-button:hover { color: var(--ink); background: var(--note-bg); }

.icon-sprite { position: absolute; pointer-events: none; }
.icon {
  display: block;
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.surface { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.pill.good { background: var(--good-bg); color: var(--good-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill.managed { background: var(--managed-bg); color: var(--managed-ink); }
.connection { padding: 5px 10px; }
.connection::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--paper), #fff);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}
.brand { display: flex; align-items: center; gap: 10px; padding-inline: 10px; }
.brand .icon { width: 24px; height: 24px; }
.brand strong { display: block; font-size: 15px; line-height: 1.3; }
.brand-caption { display: block; margin-top: 3px; color: var(--muted); font: 600 9px/1.3 var(--mono); letter-spacing: .14em; }
.navigation { display: grid; gap: 5px; }
.navigation button {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
}
.navigation button .icon { color: var(--neutral-ink); }
.navigation button:hover { background: var(--note-bg); }
.navigation button[aria-current] { border-color: var(--line); background: #fff; font-weight: 600; box-shadow: 0 1px 2px #00000008; }
.navigation button[aria-current] .icon { color: var(--ink); }
.sidebar-footer { margin-top: auto; }
.node-summary { display: flex; align-items: flex-start; gap: 8px; padding: 0 10px 12px; }
.node-summary .icon { width: 16px; height: 16px; margin-top: 1px; color: var(--neutral-ink); }
.node-summary strong { display: block; margin-bottom: 3px; font-size: 12px; overflow-wrap: anywhere; }
.node-summary p { color: var(--muted); font-size: 11px; line-height: 1.55; }
.sidebar-actions { display: flex; flex-wrap: wrap; gap: 2px; padding-top: 6px; border-top: 1px solid var(--line); }

.canvas { width: 100%; max-width: 1120px; padding: 30px 36px 48px; margin-inline: auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-header p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.hub-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f3f4f6;
  color: var(--neutral-ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.hub-note .icon { width: 16px; height: 16px; }
.notice { margin-top: 8px; background: var(--warn-bg); color: var(--warn-ink); }
.canvas > section { margin-top: 22px; }
.section-block + .section-block, .kpis + .section-block { margin-top: 24px; }
.section-heading { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.section-heading h2 { display: flex; align-items: center; gap: 8px; }
.section-heading .quiet-button { min-height: 28px; padding: 3px 7px; }
.empty { padding: 15px 18px; color: var(--muted); font-size: 12px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpis > div { display: grid; align-content: start; gap: 7px; min-height: 108px; padding: 14px 16px; }
.kpis dt { color: var(--muted); font-size: 12px; }
.kpi-value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.17; overflow-wrap: anywhere; }
.kpi-note { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.summary-list { display: grid; gap: 8px; }
.summary-row {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  padding: 14px 20px;
  text-align: left;
  white-space: normal;
}
.summary-row:hover { border-color: var(--button-line); background: #fff; box-shadow: 0 2px 5px #00000006; }
.icon-tile { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--note-bg); color: #555960; }
.summary-content, .summary-meta { display: grid; gap: 3px; overflow-wrap: anywhere; }
.summary-content strong { font-size: 14px; }
.summary-meta { justify-items: end; text-align: right; }
.summary-meta .muted { font-size: 11px; font-variant-numeric: tabular-nums; }
.chevron { width: 14px; height: 14px; color: var(--muted); }

.segments { display: inline-flex; gap: 3px; max-width: 100%; margin-bottom: 14px; padding: 3px; border-radius: 9px; background: #e9ebee; }
.segments button { min-height: 28px; padding: 3px 10px; border-color: transparent; background: transparent; font-size: 12px; }
.segments button:hover { background: var(--note-bg); }
.segments button[aria-pressed="true"] { border-color: var(--line); background: #fff; box-shadow: 0 1px 2px #0000000a; font-weight: 600; }
.segments button span { color: var(--neutral-ink); font-size: 11px; }
.routing-list { display: grid; gap: 8px; margin-bottom: 12px; }
.routing-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 11px 15px; }
.routing-card-info { display: grid; gap: 2px; min-width: 0; }
.routing-card-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.routing-card .segments { margin-bottom: 0; }
.priority-cell { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.dialog-actions-right { display: flex; align-items: center; gap: 6px; }
.dialog-actions button { min-height: 32px; }
.service-table { overflow: hidden; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); }
th { background: var(--note-bg); color: var(--neutral-ink); font-size: 11px; font-weight: 600; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 15px; }
th:last-child, td:last-child { padding-right: 15px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9f9fa; }
.service-id, .service-node { overflow-wrap: anywhere; }
.service-id { font-weight: 600; }
.process-state { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.capacity { min-width: 66px; white-space: nowrap; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 4px; margin-top: 4px; border: 0; border-radius: 999px; background: #e9ebee; color: var(--muted); }
progress::-webkit-progress-bar { border-radius: 999px; background: #e9ebee; }
progress::-webkit-progress-value { border-radius: 999px; background: var(--muted); }
progress::-moz-progress-bar { border-radius: 999px; background: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 4px; min-width: 108px; }
.actions button { min-height: 26px; padding: 3px 6px; font-size: 11px; }
.cell-label { display: none; }

.logs-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; margin-bottom: 10px; }
.log-source { display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; font-size: 12px; }
.log-source-caption { color: var(--neutral-ink); white-space: nowrap; }
.dropdown { position: relative; min-width: 0; width: 240px; max-width: 280px; }
.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 5px 9px;
  border-color: var(--button-line);
  font-weight: 400;
  text-align: left;
}
.dropdown-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-trigger .chevron-down { width: 14px; height: 14px; color: var(--neutral-ink); transition: transform .15s ease; }
.dropdown-trigger[aria-expanded="true"] .chevron-down { transform: rotate(180deg); }
.dropdown-trigger:disabled { cursor: not-allowed; opacity: .6; background: #fff; }
.dropdown-menu {
  position: absolute;
  z-index: 30;
  inset: calc(100% + 5px) 0 auto;
  max-height: min(260px, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(41, 43, 48, 0.12);
}
.dropdown-menu:focus { outline: none; }
.dropdown-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.dropdown-option:hover, .dropdown-option.active { background: #f3f4f6; }
.dropdown-menu:focus-visible .dropdown-option.active { outline: 2px solid var(--managed-ink); outline-offset: -2px; }
.dropdown-option .dropdown-check { width: 14px; height: 14px; color: var(--neutral-ink); visibility: hidden; }
.dropdown-option[aria-selected="true"] { font-weight: 600; }
.dropdown-option[aria-selected="true"] .dropdown-check { visibility: visible; }
.dropdown-option .pill { padding: 2px 6px; }
.logs-tools input { flex: 1 1 130px; }
.log-actions { display: flex; gap: 6px; }
.log-lines {
  height: clamp(360px, 60vh, 640px);
  overflow: auto;
  padding: 12px 15px;
  border-radius: 12px;
  background: #212428;
  color: #eaedf2;
  font: 12px/1.55 var(--mono);
}
.log-line { display: grid; grid-template-columns: 8ch calc(6ch + 8px) minmax(0, 1fr); align-items: start; gap: 0 10px; margin-block: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-time { color: #888e96; }
.log-stream { padding-inline: 4px; border-radius: 4px; background: #ffffff0d; color: #78c6ff; text-align: center; }
.log-line[data-stream="stderr"] .log-stream { color: #ff8c95; }
.log-line[data-stream="system"] .log-stream { color: #ffd17d; }

.request-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(175px, 100%), 1fr)); align-items: end; gap: 10px; padding: 14px; margin-bottom: 12px; }
.request-filters label, .request-filters .filter-field { display: grid; gap: 4px; min-width: 0; color: var(--neutral-ink); font-size: 12px; }
.request-filters .dropdown { width: 100%; max-width: none; }

.datetime-picker { position: relative; min-width: 0; }
.datetime-control {
  display: flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--button-line);
  border-radius: 7px;
  background: #fff;
}
.datetime-control:focus-within { outline: 2px solid var(--managed-ink); outline-offset: 2px; }
.datetime-trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}
.datetime-trigger:hover { background: transparent; }
.datetime-trigger:focus-visible { outline: none; }
.datetime-trigger .icon { width: 14px; height: 14px; color: var(--neutral-ink); }
.datetime-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.datetime-value.is-placeholder { color: var(--muted); }
.datetime-clear {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  min-height: 24px;
  margin-right: 4px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}
.datetime-clear:hover { background: var(--note-bg); color: var(--ink); }
.datetime-clear .icon { width: 12px; height: 12px; }
.datetime-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  width: 268px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(41, 43, 48, 0.14);
}
.datetime-popover.align-right { left: auto; right: 0; }
.datetime-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.datetime-month { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.datetime-nav {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--neutral-ink);
}
.datetime-nav:hover { background: var(--note-bg); color: var(--ink); }
.datetime-nav .icon { width: 14px; height: 14px; }
.datetime-nav[data-dir="prev"] .icon { transform: rotate(180deg); }
.datetime-weekdays, .datetime-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.datetime-weekdays { margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 600; }
.datetime-weekdays span { line-height: 24px; }
.datetime-day {
  min-height: 30px;
  height: 30px;
  padding: 0;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.datetime-day:hover { background: #f3f4f6; }
.datetime-day.is-outside { color: var(--muted); opacity: .55; }
.datetime-day.is-today { border-color: var(--button-line); font-weight: 600; }
.datetime-day.is-selected { background: var(--ink); color: #fff; font-weight: 600; }
.datetime-day.is-selected:hover { background: #3b3d43; }
.datetime-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.datetime-time-label { color: var(--neutral-ink); }
.datetime-time-inputs { display: flex; align-items: center; gap: 4px; }
.datetime-time-input {
  width: 38px;
  min-height: 28px;
  padding: 3px 4px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.datetime-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.datetime-footer button { min-height: 28px; padding: 3px 10px; font-size: 12px; }
.datetime-footer-actions { display: flex; align-items: center; gap: 4px; }
.request-actions, .request-toolbar { display: flex; align-items: center; gap: 8px; }
.request-toolbar { justify-content: space-between; padding: 10px 14px; }
.request-table { overflow-x: auto; border-block: 1px solid var(--line); }
.request-table table { min-width: 740px; }
.request-table .pill { white-space: nowrap; }
.request-path { display: block; overflow: hidden; max-width: 28ch; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.request-number { white-space: nowrap; font-variant-numeric: tabular-nums; }
.request-detail { width: min(560px, calc(100% - 32px)); max-height: 85vh; overflow: auto; padding: 4px 16px 16px; color: var(--ink); box-shadow: 0 16px 45px #292b3022; }
.request-detail::backdrop { background: #292b3038; }
.request-detail .request-toolbar { padding-inline: 0; }
.request-detail dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 15px; padding-block: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.request-detail dt { color: var(--muted); }
.request-detail dd { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.request-detail section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.request-detail ol { margin: 6px 0 0; padding-left: 24px; }

.nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(255px, 100%), 1fr)); gap: 12px; }
.node { padding: 15px 17px; }
.node-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.node-head h3 { font-size: 14px; overflow-wrap: anywhere; }
.node-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; margin-top: 7px; }
.node-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.node-metrics dt { color: var(--muted); font-size: 11px; }
.node-metrics dd { font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.route-panel { padding: 13px 17px; overflow-wrap: anywhere; }
.route-panel > p { color: var(--muted); }
.route-panel code { color: var(--ink); font-size: 12px; }
.routes { margin: 10px 0 0; padding: 0; list-style: none; }
.routes li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.routes li:last-child { padding-bottom: 0; }
.routes .pill { margin-left: auto; }

.login { width: min(380px, calc(100% - 32px)); padding: 22px; background: #fff; color: var(--ink); box-shadow: 0 16px 45px #292b3022; }
.login::backdrop { background: #292b3038; }
.login h2 { font-size: 18px; }
.login form, .login label { display: grid; gap: 5px; }
.login form { gap: 13px; }
.login label { color: var(--neutral-ink); font-size: 12px; }
.login input, .login button { min-height: 36px; }
.error { color: var(--bad-ink); font-size: 12px; }

@media (max-width: 1060px) {
  .service-table table, .service-table tbody { display: block; }
  .service-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .service-table tbody tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px 12px; padding: 12px 15px; }
  .service-table tbody tr + tr { border-top: 1px solid var(--line); }
  .service-table tbody td { min-width: 0; padding: 0; border: 0; }
  .service-id { grid-column: span 2; }
  .service-actions { grid-column: 1 / -1; }
  .cell-label { display: block; margin-bottom: 2px; color: var(--muted); font-family: inherit; font-size: 11px; }
}

@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .navigation { grid-area: 2 / 1 / auto / -1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
  .navigation button { height: 34px; gap: 6px; padding-inline: 8px; font-size: 12px; }
  .navigation button:focus-visible { outline-offset: -3px; }
  .navigation button .icon { width: 15px; height: 15px; }
  .sidebar-footer { margin: 0; }
  .node-summary { display: none; }
  .sidebar-actions { padding: 0; border: 0; }
  .canvas { padding: 22px 16px 36px; }
}

@media (max-width: 560px) {
  .page-header { align-items: flex-start; gap: 8px; }
  h1 { font-size: 25px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpis > div { min-height: 99px; padding: 12px; }
  .summary-row { gap: 8px; padding: 12px; }
  .summary-meta .muted { max-width: 80px; }
  .service-table tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segments button { padding-inline: 6px; }
  .log-source { flex: 1 1 100%; }
  .dropdown { width: 100%; max-width: none; }
  .log-lines { padding-inline: 8px; font-size: 11px; }
  .log-line { column-gap: 6px; }
}
