:root {
  --canvas: #eef1f4;
  --surface: #ffffff;
  --surface-muted: #f6f8fa;
  --sidebar-bg: #1a1f26;
  --sidebar-bg-2: #14181e;
  --sidebar-text: #d7dde5;
  --sidebar-muted: #8b95a3;
  --sidebar-active: #24303c;
  --line: #d8dee6;
  --line-strong: #c3ccd6;
  --text: #1b2430;
  --text-strong: #111820;
  --muted: #5f6b7a;
  --accent: #0f8f9f;
  --accent-hover: #0b7a88;
  --accent-soft: rgba(15, 143, 159, 0.12);
  --ok: #1f8a4c;
  --ok-soft: rgba(31, 138, 76, 0.12);
  --warn: #b5810a;
  --warn-soft: rgba(181, 129, 10, 0.12);
  --danger: #c23b3b;
  --danger-soft: rgba(194, 59, 59, 0.12);
  --radius: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 32, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 56px;
  --sidebar-w: 232px;
  --sidebar-compact: 72px;
  --metric-value-h: 2rem;
  --map-h: 300px;
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-feature-settings: "tnum" 1;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--canvas);
  color: var(--text);
  overflow-x: hidden;
}

body {
  line-height: 1.45;
  letter-spacing: 0;
  font-size: 14px;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

a { color: var(--accent); }

.eyebrow {
  letter-spacing: 0;
  text-transform: none;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.muted { color: var(--muted); }

/* Login — focused operational sign-in (no marketing split hero) */
.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--canvas);
  padding: 1.25rem;
}

.login-shell {
  width: min(100%, 440px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  min-width: 0;
}
.login-brand strong {
  display: block;
  font-size: 15px;
  color: var(--text-strong);
}
.login-brand small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.login-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 0.85rem;
  min-height: 24px;
}
.login-status-sep { opacity: 0.55; }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  background: var(--muted);
}
.status-dot.is-ok { background: var(--ok); }

.login-card-header h1 {
  margin: 0 0 0.25rem;
  font-size: 18px;
  font-weight: 650;
  color: var(--text-strong);
  line-height: 1.3;
}
.login-card-header p {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 13px;
}

.brand-lockup, .sidebar-brand, .account-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-symbol {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border: 0;
  font-weight: 700;
  flex: 0 0 auto;
}

.brand-symbol.compact {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.brand-lockup strong, .sidebar-brand strong {
  display: block;
  font-size: 15px;
  color: inherit;
}
.brand-lockup small, .sidebar-brand small, .account-card small {
  color: var(--sidebar-muted);
  font-size: 11px;
  display: block;
}

.online-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #3ecf7a;
  font-size: 12px;
  font-weight: 600;
}
.online-kicker i, .phase-card i, .control-health i, .scope-band i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex: 0 0 auto;
}

.login-card, .modal-card, .settings-card, .audit-card, .mobile-node-card {
  width: min(100%, 440px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}

.login-card {
  width: 100%;
}

.field-label {
  display: grid;
  gap: 0.35rem;
  margin: 0.75rem 0;
  font-size: 13px;
  color: var(--muted);
}
.field-label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.field-label input,
.field-label select,
.field-label textarea,
.toolbar input,
.toolbar select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  min-height: 40px;
}
.field-label input:focus,
.field-label select:focus,
.field-label textarea:focus,
.toolbar input:focus,
.toolbar select:focus {
  outline: 2px solid rgba(15, 143, 159, 0.28);
  border-color: var(--accent);
}

.primary-button, .ghost-button, .icon-button, .link-button {
  min-height: 40px;
  min-width: 40px;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  letter-spacing: 0;
}
.primary-button {
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}
.primary-button:hover { background: var(--accent-hover); }
.ghost-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}
.ghost-button.danger { color: var(--danger); border-color: rgba(194, 59, 59, 0.35); }
.ghost-button.small, .primary-button.small {
  min-height: 32px;
  min-width: 0;
  padding: 0.25rem 0.6rem;
  font-size: 12px;
}
.icon-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  width: 40px;
  padding: 0;
}
.link-button {
  color: var(--accent);
  text-decoration: underline;
  padding: 0.15rem 0.3rem;
  min-width: 0;
  min-height: 0;
}
.login-submit { width: 100%; margin-top: 0.4rem; }
.form-error { color: var(--danger); min-height: 1.2em; font-size: 13px; }
.login-footnote {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 12px;
}
.login-footnote strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}
.login-footnote p { margin: 0; line-height: 1.4; }
.file-warning {
  border: 1px solid rgba(181, 129, 10, 0.35);
  background: var(--warn-soft);
  border-radius: 8px;
  padding: 0.85rem;
  margin-bottom: 0.85rem;
}
.file-warning code { display: block; margin: 0.45rem 0; color: var(--text); }

/* App shell */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  background: var(--canvas);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #2a323c;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 1rem 0.75rem calc(0.85rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow: auto;
  min-width: 0;
}

.sidebar-brand strong { color: #f2f5f8; }
.sidebar-brand small { color: var(--sidebar-muted); }

.nav-group-label {
  margin: 0.55rem 0.55rem 0.25rem;
  font-size: 11px;
  font-weight: 650;
  color: var(--sidebar-muted);
  text-transform: none;
  letter-spacing: 0;
}

.main-nav {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.nav-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  color: var(--sidebar-muted);
  text-align: left;
  min-width: 0;
}
.nav-item .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: #f4f7fa;
}
.nav-item:hover:not(.nav-deferred):not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  color: #e8edf3;
}
.nav-item em {
  font-style: normal;
  font-size: 11px;
  color: var(--sidebar-muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  min-width: 1.4rem;
  text-align: center;
}
.nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  opacity: 0.9;
}
.nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-deferred,
.nav-item.nav-deferred {
  opacity: 0.55;
  cursor: not-allowed;
  color: var(--sidebar-muted);
}
.nav-deferred:hover {
  background: transparent;
  color: var(--sidebar-muted);
}
.nav-deferred .nav-badge {
  font-size: 10px;
  border: 1px solid #3a4450;
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  color: var(--sidebar-muted);
  white-space: nowrap;
}

.phase-card {
  margin-top: auto;
  border: 1px solid #2a323c;
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--sidebar-bg-2);
  min-width: 0;
  max-width: 100%;
}
.phase-card div {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #6ec8d4;
  font-size: 12px;
  margin-bottom: 0.3rem;
  min-width: 0;
}
.phase-card strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #eef2f6;
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.phase-card p {
  margin: 0;
  color: var(--sidebar-muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
#phaseCardLabel {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.account-card {
  border-top: 1px solid #2a323c;
  padding-top: 0.75rem;
  color: var(--sidebar-text);
  flex: 0 0 auto;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  /* Keep fully in viewport at 1024x768 / 1440x900 */
  position: sticky;
  bottom: 0;
  background: var(--sidebar-bg);
  z-index: 2;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #2a3440;
  border: 1px solid #3a4450;
  color: #eef2f6;
  flex: 0 0 auto;
}
.account-card > .account-meta,
.account-card > div:not(.user-avatar) { flex: 1; min-width: 0; }
.account-card strong, .account-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-card strong { color: #f2f5f8; font-size: 13px; }
#logoutButton {
  color: var(--sidebar-muted);
  border: 1px solid #3a4450;
  border-radius: 8px;
  /* Auto width so icon +「退出」stay one horizontal line; never 36px-forced wrap */
  width: auto;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 0.55rem;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  letter-spacing: 0;
  overflow: visible;
}
#logoutButton .logout-icon,
#logoutButton .logout-text {
  display: inline;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  line-height: 1;
  flex: 0 0 auto;
}

.workspace {
  min-width: 0;
  padding: 1rem 1.25rem 1.5rem;
  background: var(--canvas);
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
  min-width: 0;
}
.page-header > div:first-child { min-width: 0; flex: 1; }
.page-header h1 {
  margin: 0.1rem 0;
  font-size: 22px;
  font-weight: 650;
  color: var(--text-strong);
  line-height: 1.25;
}
#pageDescription {
  color: var(--muted);
  font-size: 13px;
  display: block;
  overflow-wrap: anywhere;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  flex: 0 1 auto;
  justify-content: flex-end;
  min-width: 0;
}
/* Command labels never stack vertically (one glyph per line). */
.header-actions .icon-button,
.header-actions .primary-button,
.header-actions .ghost-button {
  white-space: nowrap;
  writing-mode: horizontal-tb;
  letter-spacing: 0;
  flex: 0 0 auto;
}
.header-actions .primary-button span,
.header-actions .primary-button b {
  white-space: nowrap;
  writing-mode: horizontal-tb;
}
.control-health {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  background: var(--surface);
  color: var(--ok);
  min-height: 40px;
  min-width: 0;
}
.control-health strong, .control-health small { display: block; color: var(--text); }
.control-health small {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.control-health strong { font-size: 12px; }

/* Overview layout */
.scope-band {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 0.75rem;
  min-width: 0;
}
.scope-band.is-strict { border-color: rgba(15, 143, 159, 0.35); }
.scope-band.is-open { border-color: rgba(181, 129, 10, 0.35); }
.scope-band .scope-band-body { min-width: 0; flex: 1; }
.scope-band strong {
  display: block;
  font-size: 12px;
  color: var(--text-strong);
  margin-bottom: 0.15rem;
}
.scope-band p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.scope-band i.scope-dot-ok { color: var(--ok); }
.scope-band i.scope-dot-warn { color: var(--warn); }

.metric-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.metric-band .metric-cell {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0.7rem 0.9rem;
  min-width: 0;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.metric-band .metric-cell:last-child { border-right: 0; }
.metric-band .metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  min-width: 0;
}
.metric-band span.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 0.4rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
  border: 1px solid transparent;
  white-space: nowrap;
  flex: 0 0 auto;
}
.metric-pill.is-ok { color: var(--ok); background: var(--ok-soft); }
.metric-pill.is-warn { color: var(--warn); background: var(--warn-soft); }
.metric-pill.is-danger { color: var(--danger); background: var(--danger-soft); }
.metric-pill.is-neutral { color: var(--muted); background: var(--surface-muted); border-color: var(--line); }
.metric-band .metric-value {
  min-height: var(--metric-value-h);
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}
.metric-band strong {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  font-feature-settings: "tnum" 1;
}
.metric-band .metric-unit {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.metric-band p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.overview-main {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.85fr);
  gap: 0.75rem;
  min-width: 0;
  align-items: start;
}

.ops-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}
.ops-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.ops-panel > header h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text-strong);
  font-weight: 650;
}
.ops-panel > header .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  font-size: 11px;
  color: var(--muted);
}
.ops-panel > header .legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.ops-panel > header .legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.legend-online { background: var(--ok); }
.legend-pending { background: var(--warn); }
.legend-abnormal { background: var(--danger); }

.map-body {
  position: relative;
  min-height: var(--map-h);
  height: var(--map-h);
  background: #f0f3f6;
  border-bottom: 1px solid var(--line);
}
.node-map {
  width: 100%;
  height: 100%;
  min-height: var(--map-h);
  overflow: hidden;
  background: #e9eef3;
}
.node-map-svg { width: 100%; height: 100%; display: block; }
.map-ocean { fill: #dfe6ed; }
.map-land { fill: #c5d0db; stroke: #b2becb; stroke-width: 1; }
.map-pin-dot { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.map-pin.status-online .map-pin-dot { fill: var(--ok); }
.map-pin.status-pending_registration .map-pin-dot,
.map-pin.status-pending_approval .map-pin-dot,
.map-pin.status-initializing .map-pin-dot { fill: var(--warn); }
.map-pin.status-offline .map-pin-dot,
.map-pin.status-degraded .map-pin-dot,
.map-pin.status-quarantined .map-pin-dot,
.map-pin.status-disabled .map-pin-dot { fill: var(--danger); }
.map-pin-label {
  fill: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  pointer-events: none;
}
.map-empty[hidden] { display: none !important; }
.map-empty-inner {
  max-width: 22rem;
  pointer-events: auto;
}
.map-empty-inner strong {
  display: block;
  font-size: 15px;
  color: var(--text-strong);
  margin-bottom: 0.35rem;
}
.map-empty-inner p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.map-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-muted);
  min-width: 0;
}
.map-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-ops {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: var(--map-h);
}
.side-ops .ops-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.side-section {
  padding: 0.7rem 0.85rem;
  min-width: 0;
}
.side-section + .side-section {
  border-top: 1px solid var(--line);
}
.side-section h4 {
  margin: 0 0 0.55rem;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0;
}
.connection-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  max-height: 180px;
  overflow: auto;
}
.connection-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  min-height: 32px;
  padding: 0.25rem 0.2rem;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.connection-list li:last-child { border-bottom: 0; }
.connection-list .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.connection-list .dot.is-online { background: var(--ok); }
.connection-list .dot.is-pending { background: var(--warn); }
.connection-list .dot.is-abnormal { background: var(--danger); }
.connection-list .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-strong);
  font-weight: 600;
}
.connection-list .meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 11px;
}
.connection-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 0.5rem 0;
  margin: 0;
}

.formal-ops-panel {
  margin-top: 0.75rem;
}
.formal-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.formal-status-grid > section {
  padding: 0.75rem 0.85rem;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}
.formal-status-grid > section:nth-child(odd) { border-right: 1px solid var(--line); }
.formal-status-grid h4,
.formal-incidents-block h4 {
  margin: 0 0 0.55rem;
  font-size: 12px;
  color: var(--muted);
}
.formal-status-list,
.formal-incident-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.formal-status-list li,
.formal-incident-list li {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  min-width: 0;
}
.formal-status-list strong,
.formal-incident-list strong {
  display: block;
  color: var(--text-strong);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.formal-status-list small,
.formal-incident-list small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.formal-incident-list li.is-critical { border-left: 3px solid var(--danger); }
.formal-incident-list li.is-warning { border-left: 3px solid var(--warn); }
.formal-incidents-block { padding: 0.75rem 0.85rem; }
.formal-status-footer {
  padding: 0.45rem 0.85rem;
  color: var(--muted);
  background: var(--surface-muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}
@media (max-width: 760px) {
  .formal-status-grid { grid-template-columns: 1fr; }
  .formal-status-grid > section:nth-child(odd) { border-right: 0; }
}

.reg-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.reg-flow li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
}
.reg-flow .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}
.reg-flow strong {
  display: block;
  font-size: 12px;
  color: var(--text-strong);
}
.reg-flow small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.toolbar input[type="search"] { flex: 1 1 200px; max-width: 320px; }
.toolbar select { flex: 0 1 160px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  max-width: 100%;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}
.data-table th, .data-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  background: var(--surface-muted);
}
.col-check { width: 40px; }
.row-actions { width: 1%; white-space: nowrap; }
.node-action-select {
  width: auto;
  min-width: 76px;
  padding-right: 1.65rem;
  cursor: pointer;
}
.node-identity strong,
.node-identity small { display: block; }
.node-identity small { margin-top: 0.18rem; color: var(--muted); font-size: 10px; }
.col-rollout { min-width: 185px; }
.node-rollout { display: grid; gap: 0.24rem; align-items: start; }
.rollout-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.rollout-detail {
  display: block;
  max-width: 260px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.rollout-dns_active { color: var(--ok); border-color: rgba(31, 138, 76, 0.3); background: var(--ok-soft); }
.rollout-waiting_publish,
.rollout-waiting_apply,
.rollout-probing,
.rollout-dns_syncing,
.rollout-dns_retained { color: var(--warn); border-color: rgba(181, 129, 10, 0.3); background: var(--warn-soft); }
.rollout-failed,
.rollout-offline { color: var(--danger); border-color: rgba(194, 59, 59, 0.3); background: var(--danger-soft); }
.col-traffic { min-width: 210px; }
.traffic-usage { display: grid; gap: 0.28rem; min-width: 180px; }
.traffic-usage-summary { display: flex; align-items: baseline; gap: 0.18rem; white-space: nowrap; }
.traffic-usage-summary strong { color: var(--text-strong); font-size: 12px; }
.traffic-usage-summary span,
.traffic-usage-detail { color: var(--muted); font-size: 10px; }
.traffic-progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
}
.traffic-progress-fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}
.traffic-progress-fill.is-warning { background: var(--warn); }
.traffic-progress-fill.is-over { background: var(--danger); }
.method-fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem; }
.method-fieldset legend { padding: 0 0.25rem; color: var(--text-strong); font-weight: 600; }
.method-fieldset small { display: block; margin-top: 0.5rem; color: var(--muted); line-height: 1.45; }
.method-grid { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; }
.method-grid label { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 12px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  white-space: nowrap;
}
.status-pill.status-online { color: var(--ok); border-color: rgba(31, 138, 76, 0.3); background: var(--ok-soft); }
.status-pill.status-pending_registration,
.status-pill.status-pending_approval,
.status-pill.status-initializing { color: var(--warn); border-color: rgba(181, 129, 10, 0.3); background: var(--warn-soft); }
.status-pill.status-offline,
.status-pill.status-degraded,
.status-pill.status-quarantined,
.status-pill.status-disabled { color: var(--danger); border-color: rgba(194, 59, 59, 0.3); background: var(--danger-soft); }

.mobile-node-list { display: none; gap: 0.55rem; }
.mobile-node-card {
  width: 100%;
  display: grid;
  gap: 0.4rem;
  box-shadow: none;
  border-radius: 8px;
}
.mobile-node-card strong { font-size: 14px; }
.mobile-node-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.mobile-node-card-head strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-node-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.3rem;
}
.mobile-node-rollout {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.mobile-node-label { color: var(--muted); font-size: 11px; line-height: 24px; }
.node-rollout-compact { min-width: 0; }
.node-rollout-compact .rollout-detail { max-width: none; }
.header-logout { display: none; }
.admins-table { min-width: 600px; }

.panel-state { margin: 0.4rem 0 0.75rem; color: var(--muted); }
.panel-state > p { display: none; margin: 0; }
.panel-state[data-state="loading"] .state-loading,
.panel-state[data-state="error"] .state-error,
.panel-state[data-state="ready-empty"] .state-empty,
.panel-state[data-state="forbidden"] .state-forbidden { display: block; }
.panel-state[data-state="ready-data"],
.panel-state[data-state="stale-data"] { display: none; }

/* Overview keeps layout visible for empty; hide generic empty copy when content shown */
#overviewView .panel-state[data-state="ready-empty"] { display: none; }
#overviewView .panel-state[data-state="loading"],
#overviewView .panel-state[data-state="error"] { display: block; }

.audit-list { display: grid; gap: 0.65rem; }
.audit-card { width: 100%; box-shadow: none; border-radius: 8px; }
.audit-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}
.audit-meta { margin: 0; color: var(--muted); font-size: 13px; }
.operation-result {
  flex: 0 0 auto;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}
.operation-result.is-success { color: var(--ok); background: var(--ok-soft); }
.operation-result.is-danger { color: var(--danger); background: var(--danger-soft); }
.operation-result.is-neutral { color: var(--muted); background: var(--surface-muted); }
.operation-log-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
  margin: 0;
}
.operation-log-facts div {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 0.45rem;
  min-width: 0;
}
.operation-log-facts dt { color: var(--muted); }
.operation-log-facts dd { margin: 0; overflow-wrap: anywhere; }
.operation-log-note {
  margin: 0.65rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}
.audit-diff, .code-block {
  margin: 0.5rem 0 0;
  padding: 0.65rem;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  min-width: 0;
}
.settings-primary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
  min-width: 0;
}
.settings-grid .settings-card {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: auto;
}
.settings-card-heading,
.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}
.settings-card-heading h3,
.settings-section-heading h2 {
  margin: 0.16rem 0 0;
}
.settings-card-kicker,
.settings-section-kicker {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.settings-card-badge {
  flex: 0 0 auto;
  padding: 0.24rem 0.48rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 650;
}
.settings-section {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}
.settings-section-heading {
  padding: 0 0.15rem;
}
.settings-section-heading p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.settings-advanced {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.settings-advanced > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  list-style: none;
}
.settings-advanced > summary::-webkit-details-marker { display: none; }
.settings-advanced > summary span:first-child {
  display: grid;
  gap: 0.2rem;
}
.settings-advanced > summary small {
  color: var(--muted);
  font-weight: 400;
}
.settings-details-action {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 650;
}
.settings-advanced[open] .settings-details-action::before { content: '收起'; }
.settings-advanced[open] .settings-details-action { font-size: 0; }
.settings-advanced[open] .settings-details-action::before { font-size: 0.82rem; }
.settings-advanced-content {
  padding: 0 1.2rem 1.2rem;
  border-top: 1px solid var(--line);
}
.kv-list { display: grid; gap: 0.45rem; margin: 0 0 0.85rem; }
.kv-list div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.45rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
  min-width: 0;
}
.kv-list dt { color: var(--muted); }
.kv-list dd {
  margin: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(720px, calc(100vw - 1.5rem));
}
.modal::backdrop { background: rgba(17, 24, 32, 0.45); }
.modal-card { width: min(720px, 100%); border-radius: 8px; }
.modal-card header { margin-bottom: 0.4rem; }
.modal-card h2 { margin: 0; font-size: 18px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 0.65rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.65rem;
}
.token-warning {
  color: var(--warn);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 1rem;
  /* Above content; below mobile sidebar/More (sidebar z-index 110) so logout is never covered */
  bottom: calc(1rem + var(--safe-bottom) + var(--toast-nav-clearance, 0px));
  z-index: 90;
  max-width: min(400px, calc(100vw - 2rem));
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(17, 24, 32, 0.12);
  color: var(--text);
  pointer-events: none;
  white-space: normal;
  writing-mode: horizontal-tb;
}
@media (max-width: 700px) {
  /* Single-row five-cell bottom nav (icon + label + safe-area). */
  :root {
    --nav-h: 3.65rem;
    --toast-nav-clearance: calc(var(--nav-h) + 0.65rem);
  }
  .toast {
    left: 0.75rem;
    right: 0.75rem;
    max-width: none;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 0.65rem);
  }
}
.toast-success { border-color: rgba(31, 138, 76, 0.4); }
.toast-warning { border-color: rgba(181, 129, 10, 0.45); }
.toast-error { border-color: rgba(194, 59, 59, 0.5); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ≥1100: full overview columns */
@media (min-width: 1100px) {
  .overview-main { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr); }
  .mobile-node-list { display: none !important; }
}

/* 1024–1099 still two columns but tighter */
@media (min-width: 1024px) and (max-width: 1099px) {
  .overview-main { grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.9fr); }
  --map-h: 280px;
}

@media (min-width: 1024px) {
  .sidebar { position: sticky; }
  .mobile-node-list { display: none !important; }
  .nodes-table { min-width: 680px; }
}

/* 701–1023: compact sidebar rail with full short labels (no mid-glyph clip) */
@media (max-width: 1023px) and (min-width: 701px) {
  .app-shell { grid-template-columns: 88px 1fr; }
  .sidebar {
    padding-inline: 0.4rem;
    padding-bottom: calc(0.65rem + var(--safe-bottom));
    overflow-x: hidden;
    overflow-y: auto;
  }
  .sidebar-brand div:last-child,
  .nav-item em,
  .nav-group-label,
  .nav-group-governance,
  .phase-card p,
  .phase-settings-link,
  .account-card > .account-meta,
  .account-card > div:not(.user-avatar),
  .logout-text { display: none; }
  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.15rem;
    padding: 0.45rem 0.2rem;
  }
  .nav-item .nav-label {
    display: block;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.15;
    max-width: 100%;
    text-align: center;
    writing-mode: horizontal-tb;
  }
  .account-card {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding-top: 0.55rem;
  }
  /* Compact rail: icon-only logout (text already hidden via .logout-text) */
  #logoutButton {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 36px;
    padding: 0;
  }
  .metric-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-band .metric-cell:nth-child(2n) { border-right: 0; }
  .metric-band .metric-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .overview-main { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .operation-log-facts { grid-template-columns: 1fr; }
  --map-h: 260px;
}

/* ≤700: bottom nav — exactly one five-column row */
@media (max-width: 700px) {
  .login-view { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .app-shell {
    grid-template-columns: 1fr;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 0.5rem);
  }
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: calc(var(--nav-h) + var(--safe-bottom));
    max-height: calc(var(--nav-h) + var(--safe-bottom));
    width: 100%;
    /* Above toast (90): fixed More menu is trapped in this stacking context */
    z-index: 110;
    border-right: 0;
    border-top: 1px solid #2a323c;
    padding: 0.15rem 0.15rem calc(0.15rem + var(--safe-bottom));
    flex-direction: row;
    align-items: stretch;
    overflow: visible;
    gap: 0;
  }
  .sidebar-brand,
  .nav-group-label,
  .nav-group-governance,
  .nav-deferred,
  .phase-card,
  .account-card { display: none !important; }
  .main-nav {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-flow: column;
    grid-auto-rows: 1fr;
    gap: 0;
    overflow: hidden;
    flex-wrap: nowrap;
    align-items: stretch;
  }
  /* Only five cells: 总览、节点、站点、设置、更多 (publish/logs stay in More). */
  .main-nav > .nav-primary:not([hidden]),
  .main-nav .nav-more-wrap {
    min-width: 0;
    max-width: none;
    width: auto;
  }
  .main-nav .nav-more-wrap {
    display: flex;
    align-items: stretch;
    min-width: 0;
  }
  .main-nav .nav-more-wrap > #navMoreBtn {
    width: 100%;
  }
  .main-nav > .nav-item,
  .main-nav .nav-more-wrap > .nav-item {
    min-height: 0;
    height: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: center;
    gap: 0.08rem;
    padding: 0.2rem 0.1rem;
    font-size: 11px;
    white-space: nowrap;
    writing-mode: horizontal-tb;
  }
  .nav-item em { display: none; }
  .nav-label {
    overflow: hidden;
    text-overflow: clip;
    max-width: 100%;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    line-height: 1.1;
    font-size: 0.72rem;
  }
  .page-header { flex-direction: column; }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  /* Logout never in the cramped top action row on mobile — use More menu. */
  .header-logout { display: none !important; }
  .metric-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-band .metric-cell:nth-child(2n) { border-right: 0; }
  .metric-band .metric-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .overview-main { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  #nodesTableWrap.table-wrap { display: none; }
  .mobile-node-list { display: grid; }
  #adminsTableWrap.table-wrap {
    display: block !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #adminsTableWrap .admins-table { min-width: 520px; }
  .kv-list div { grid-template-columns: 1fr; }
  --map-h: 240px;
  .workspace {
    padding: 0.85rem 0.85rem calc(1.25rem + var(--nav-h) * 0);
    padding-bottom: 1.25rem;
  }
}

@media (max-width: 390px) {
  .workspace { padding-inline: 0.7rem; }
  .header-logout { display: none !important; }
  .metric-band .metric-cell { min-height: 84px; padding: 0.6rem 0.65rem; }
  .header-actions .primary-button {
    white-space: nowrap;
    writing-mode: horizontal-tb;
  }
}

@media (min-width: 701px) {
  .nav-mobile-only { display: none !important; }
}
@media (max-width: 700px) {
  .nav-desktop-only { display: none !important; }
}


/* Round-2 helpers */
.phase-card-brief { margin: 0 0 0.35rem !important; }
.phase-settings-link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.15rem;
  font-size: 12px;
  color: #6ec8d4;
  text-decoration: none;
}
.phase-settings-link:hover { text-decoration: underline; }
.phase-settings-link:focus-visible {
  outline: 2px solid rgba(15, 143, 159, 0.85);
  outline-offset: 2px;
  border-radius: 4px;
}
.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Temporary textarea for clipboard fallback: off-screen, invisible, non-interactive.
   Kept as a fixed class so app.js never writes dynamic inline styles. */
.clipboard-fallback-control {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  border: 0;
  outline: none;
  overflow: hidden;
  resize: none;
  z-index: -1;
}
.logout-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  min-height: 36px;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  color: var(--sidebar-muted);
  border: 1px solid #2a323c;
  font-size: 12px;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}
.logout-btn:hover { color: #f2f5f8; background: rgba(255,255,255,0.04); }
.logout-btn:focus-visible {
  outline: 2px solid rgba(15, 143, 159, 0.85);
  outline-offset: 2px;
}
.form-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem 0.25rem;
  margin: 0 0 0.65rem;
  min-width: 0;
}
.form-section legend {
  padding: 0 0.35rem;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-strong);
}
.input-with-unit {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.input-with-unit input { flex: 1 1 auto; min-width: 0; }
.input-with-unit .unit {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.modal-card-wide { width: min(760px, 100%); }
.token-meta { margin: 0.5rem 0 0.75rem; }
.deferred-list {
  margin: 0.35rem 0 0.65rem;
  padding-left: 1.1rem;
  color: var(--text);
}
.deferred-list li { margin: 0.2rem 0; }
.settings-deferred-intro {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 13px;
}
.nav-item:focus-visible,
.icon-button:focus-visible,
.primary-button:focus-visible,
.ghost-button:focus-visible {
  outline: 2px solid rgba(15, 143, 159, 0.85);
  outline-offset: 2px;
}
.map-land-image { pointer-events: none; }
