:root {
  color-scheme: dark;
  --bg: #15171c;
  --sidebar: #101217;
  --surface: #1b1e24;
  --surface-alt: #20242b;
  --surface-raised: #272b33;
  --input: #15181e;
  --text: #f1f3f5;
  --muted: #a3a8b2;
  --subtle: #747b87;
  --line: #343942;
  --line-strong: #4a515e;
  --cyan: #38bdf8;
  --cyan-strong: #7dd3fc;
  --cyan-soft: #153747;
  --green: #35c978;
  --green-strong: #73e2a5;
  --green-soft: #173a28;
  --amber: #f0b44d;
  --amber-soft: #3a2e18;
  --red: #ef6a68;
  --red-soft: #422323;
  --chart-grid: #30343c;
  --chart-axis: #818894;
  --chart-cpu: #38bdf8;
  --chart-memory: #35c978;
  --chart-memory-cache: rgba(129, 136, 148, 0.18);
  --chart-host-rx: #38bdf8;
  --chart-host-tx: #f0b44d;
  --chart-nat-rx: #38bdf8;
  --chart-nat-tx: #35c978;
  --sidebar-width: 232px;
  --z-sidebar: 20;
  --z-modal: 40;
  --z-toast: 50;
  font-family: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f0f2f5;
  --surface-raised: #e8ebef;
  --input: #ffffff;
  --text: #20232a;
  --muted: #5d6470;
  --subtle: #747b87;
  --line: #d8dce2;
  --line-strong: #adb4bf;
  --cyan: #087fae;
  --cyan-strong: #06698f;
  --cyan-soft: #e0f3fa;
  --green: #16834b;
  --green-strong: #12683d;
  --green-soft: #e3f4ea;
  --amber: #94610b;
  --amber-soft: #fff2d5;
  --red: #bd4543;
  --red-soft: #fbe8e7;
  --chart-grid: #e2e5e9;
  --chart-axis: #646b76;
  --chart-cpu: #087fae;
  --chart-memory: #16834b;
  --chart-memory-cache: rgba(100, 107, 118, 0.16);
  --chart-host-rx: #087fae;
  --chart-host-tx: #94610b;
  --chart-nat-rx: #087fae;
  --chart-nat-tx: #16834b;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden],
.view[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
.chart-mount:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: var(--z-toast);
  padding: 8px 12px;
  background: var(--cyan);
  color: #07151b;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-sidebar);
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand {
  display: flex;
  min-width: 0;
  height: 62px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 46px;
  height: 46px;
  border-radius: 4px;
  object-fit: cover;
}

.brand-mark.small {
  width: 28px;
  height: 28px;
}

.brand > span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand strong {
  font-size: 12px;
  line-height: 16px;
}

.brand small {
  color: var(--subtle);
  font-size: 10px;
  line-height: 14px;
}

.resource-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

.nav-label {
  margin: 12px 9px 5px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 650;
  line-height: 16px;
  text-transform: uppercase;
}

.nav-label:first-child {
  margin-top: 0;
}

.node-tab {
  display: grid;
  width: 100%;
  min-height: 36px;
  grid-template-columns: 18px minmax(0, 1fr) 8px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.node-tab:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.node-tab.active {
  background: var(--cyan-soft);
  color: var(--cyan-strong);
  font-weight: 650;
}

.node-tab svg {
  width: 15px;
  height: 15px;
}

.nav-state,
.status-indicator,
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--subtle);
}

.nav-state.running,
.status-indicator.healthy,
.status-indicator.running,
.live-dot {
  background: var(--green);
}

.nav-state.stopped,
.status-indicator.stopped {
  background: var(--red);
}

.nav-state.loading,
.status-indicator.loading {
  background: var(--amber);
}

.sidebar-footer {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.account-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.account-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--cyan-strong);
  font-size: 11px;
  font-weight: 700;
}

.account-meta > div {
  display: grid;
  min-width: 0;
}

.account-meta strong,
.account-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta strong {
  font-size: 11px;
}

.account-meta small {
  color: var(--subtle);
  font-size: 10px;
}

.account-actions {
  display: flex;
  flex: 0 0 auto;
}

.account-actions form {
  margin: 0;
}

.quiet,
.icon-button {
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.quiet:hover,
.icon-button:hover {
  border-color: var(--line);
  background: var(--surface-alt);
  color: var(--text);
}

.icon-only,
.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
}

.icon-button {
  border-color: var(--line);
}

.icon-button.loading svg {
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#app {
  width: calc(100% - var(--sidebar-width));
  max-width: 1440px;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 24px 28px 48px;
}

.page-head,
.section-head,
.panel-head,
.chart-head,
.chart-foot,
.telemetry-heading,
.connection-band,
.title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-head {
  min-height: 52px;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.title-line {
  justify-content: flex-start;
  gap: 10px;
}

.page-head h1 {
  margin: 0;
  font-size: 23px;
  line-height: 30px;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.page-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.updated-at {
  color: var(--subtle);
  font: 10px/16px "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.badge.running {
  border-color: color-mix(in srgb, var(--green) 50%, var(--line));
  background: var(--green-soft);
  color: var(--green-strong);
}

.badge.stopped,
.badge.error {
  border-color: color-mix(in srgb, var(--red) 55%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}

.badge.loading {
  border-color: color-mix(in srgb, var(--amber) 55%, var(--line));
  background: var(--amber-soft);
  color: var(--amber);
}

.host-summary {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(5, minmax(110px, 1fr));
  border: 1px solid var(--line);
  background: var(--surface);
}

.host-summary > div {
  min-width: 0;
  min-height: 82px;
  padding: 13px 15px;
  border-right: 1px solid var(--line);
}

.host-summary > div:last-child {
  border-right: 0;
}

.host-summary span,
.host-summary small,
.snapshot-metric span,
.snapshot-metric small,
.snapshot-facts span,
.snapshot-facts small,
.host-facts span,
.instance-row small,
.connection-band span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 15px;
}

.host-summary strong {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  font: 600 13px/18px "IBM Plex Mono", ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-summary small {
  margin-top: 2px;
}

.host-primary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.host-primary strong {
  margin-top: 2px;
}

.meter,
.mini-meter {
  display: block;
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  background: var(--line);
}

.meter i,
.mini-meter i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cyan);
  transition: width 180ms ease-out;
}

.swap-meter i {
  background: var(--subtle);
}

.meter.warning i,
.mini-meter.warning i,
.swap-meter.warning i {
  background: var(--amber);
}

.meter.critical i,
.mini-meter.critical i,
.swap-meter.critical i {
  background: var(--red);
}

.overview-section,
.telemetry-board,
.host-facts,
.connection-band,
.panel,
.audit {
  border: 1px solid var(--line);
  background: var(--surface);
}

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

.section-head,
.panel-head {
  min-height: 56px;
  padding: 11px 14px;
}

.section-head h2,
.panel-head h2 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

.section-head p,
.panel-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.section-head > span,
.audit-count {
  color: var(--subtle);
  font: 10px/16px "IBM Plex Mono", ui-monospace, monospace;
}

.instance-list {
  border-top: 1px solid var(--line);
}

.instance-row {
  display: grid;
  width: 100%;
  min-height: 64px;
  grid-template-columns: minmax(160px, 1.35fr) minmax(76px, .55fr) repeat(3, minmax(82px, .72fr)) minmax(80px, .65fr) 18px;
  align-items: center;
  gap: 18px;
  padding: 9px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.instance-row:last-child {
  border-bottom: 0;
}

.instance-row:hover {
  background: var(--surface-alt);
}

.instance-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.instance-identity > span,
.instance-resource,
.instance-state,
.instance-traffic {
  min-width: 0;
}

.instance-row strong {
  display: block;
  overflow: hidden;
  font: 600 11px/17px "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-identity > span > strong {
  font-family: inherit;
  font-size: 13px;
}

.instance-system {
  color: var(--cyan-strong);
  font: inherit;
}

.mini-meter {
  width: 100%;
  max-width: 96px;
  margin-top: 5px;
}

.row-chevron {
  color: var(--subtle);
}

.telemetry-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.nat-board {
  grid-template-columns: minmax(220px, .8fr) repeat(2, minmax(260px, 1fr));
  margin-top: 0;
  margin-bottom: 14px;
}

.telemetry-snapshot,
.chart-panel {
  min-width: 0;
  min-height: 254px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.chart-panel {
  display: flex;
  flex-direction: column;
}

.chart-panel:last-child {
  border-right: 0;
}

.telemetry-heading {
  align-items: flex-start;
  margin-bottom: 14px;
}

.telemetry-heading span,
.chart-head span {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.telemetry-heading strong {
  display: block;
  margin-top: 2px;
  color: var(--cyan-strong);
  font: 600 10px/15px "IBM Plex Mono", ui-monospace, monospace;
}

.telemetry-board.stale .live-dot {
  background: var(--amber);
}

.telemetry-board.offline .live-dot {
  background: var(--red);
}

.snapshot-metric {
  margin-top: 12px;
}

.snapshot-metric strong {
  display: block;
  margin-top: 4px;
  font: 600 12px/18px "IBM Plex Mono", ui-monospace, monospace;
}

.memory-metric > span:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.resource-health {
  color: var(--green);
  font: 600 9px/14px "IBM Plex Mono", ui-monospace, monospace;
}

.resource-health.warning { color: var(--amber); }
.resource-health.critical { color: var(--red); }

.memory-meter {
  position: relative;
  overflow: hidden;
}

.memory-meter > i,
.memory-meter > b {
  position: absolute;
  top: 0;
  bottom: 0;
}

.memory-meter > i {
  left: 0;
  z-index: 2;
  background: var(--green);
}

.memory-meter > b {
  z-index: 1;
  background: var(--chart-memory-cache);
}

.snapshot-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 17px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.snapshot-facts strong {
  display: block;
  margin-top: 3px;
  font: 600 11px/17px "IBM Plex Mono", ui-monospace, monospace;
}

.chart-head {
  min-height: 38px;
  align-items: flex-start;
  gap: 12px;
}

.chart-head small {
  display: block;
  margin-top: 2px;
  color: var(--subtle);
  font-size: 10px;
}

.chart-head > strong {
  max-width: 65%;
  overflow: hidden;
  color: var(--cyan-strong);
  font: 600 11px/17px "IBM Plex Mono", ui-monospace, monospace;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-mount {
  position: relative;
  flex: 1 1 auto;
  min-height: 168px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--subtle);
  font-size: 11px;
  pointer-events: none;
}

.chart-mount.ready .chart-empty {
  display: none;
}

.chart-foot {
  min-height: 22px;
  justify-content: flex-start;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
}

.chart-foot span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chart-foot > small {
  margin-left: auto;
  overflow: hidden;
  color: var(--subtle);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-line {
  display: inline-block;
  width: 12px;
  height: 2px;
  background: var(--chart-cpu);
}

.legend-line.memory { background: var(--chart-memory); }
.legend-line.memory-total { background: var(--chart-axis); opacity: .55; }
.legend-line.host-rx { background: var(--chart-host-rx); }
.legend-line.host-tx { background: var(--chart-host-tx); }
.legend-line.nat-rx { background: var(--chart-nat-rx); }
.legend-line.nat-tx { background: var(--chart-nat-tx); }

.uplot {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.uplot .u-legend {
  display: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  max-width: calc(100% - 8px);
  padding: 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface-raised);
  color: var(--text);
  font: 500 10px/15px "IBM Plex Mono", ui-monospace, monospace;
  white-space: nowrap;
  pointer-events: none;
}

.host-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.host-facts > div {
  min-width: 0;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
}

.host-facts > div:last-child {
  border-right: 0;
}

.host-facts strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font: 600 11px/17px "IBM Plex Mono", ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-band {
  min-height: 48px;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-color: color-mix(in srgb, var(--cyan) 38%, var(--line));
  background: var(--cyan-soft);
}

.connection-band > div:first-child {
  min-width: 0;
}

.connection-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.connection-band .icon-button {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin-left: 1px;
  border-color: transparent;
  background: color-mix(in srgb, var(--cyan) 11%, transparent);
}

.connection-band .icon-button svg {
  width: 14px;
  height: 14px;
}

.connection-band .icon-button:hover {
  border-color: color-mix(in srgb, var(--cyan) 45%, var(--line));
  background: color-mix(in srgb, var(--cyan) 19%, transparent);
}

.connection-band code {
  display: block;
  margin-top: 2px;
  color: var(--cyan-strong);
  font: 600 12px/17px "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.inverse {
  border-color: color-mix(in srgb, var(--cyan) 45%, var(--line));
  color: var(--cyan-strong);
}

.terminal-layer {
  position: fixed;
  z-index: var(--z-modal);
  inset: 0;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  background: #0d1014;
  color: #edf2f7;
}

.terminal-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  border-bottom: 1px solid #2d343d;
  background: #15191f;
}

.terminal-identity,
.terminal-identity small,
.terminal-actions {
  display: flex;
  align-items: center;
}

.terminal-identity {
  min-width: 0;
  gap: 9px;
}

.terminal-mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid #28566b;
  background: #153747;
  color: #7dd3fc;
}

.terminal-identity strong,
.terminal-session-meta strong {
  display: block;
  font: 600 12px/17px "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.terminal-identity small,
.terminal-session-meta span {
  color: #8d96a3;
  font-size: 10px;
}

#terminal-state-dot {
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #f0b44d;
}

#terminal-state-dot.connected { background: #35c978; }
#terminal-state-dot.disconnected { background: #ef6a68; }

.terminal-session-meta { text-align: center; }

.terminal-actions {
  justify-content: flex-end;
  gap: 4px;
}

.terminal-actions .icon-button {
  border-color: #343c46;
  color: #aeb7c3;
}

.terminal-mount {
  min-width: 0;
  min-height: 0;
  padding: 10px 12px;
  overflow: hidden;
}

.terminal-mount .xterm,
.terminal-mount .xterm-viewport { height: 100%; }

.terminal-mount .xterm .xterm-selection {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.terminal-mount .xterm .xterm-selection div {
  position: absolute !important;
  background-color: rgba(56, 189, 248, 0.48) !important;
  outline: 1px solid rgba(125, 211, 252, 0.55);
  outline-offset: -1px;
}

.terminal-mount .xterm-helper-textarea,
.terminal-mount .xterm-accessibility {
  font-family: "SF Mono", SFMono-Regular, SFMonoTerminal-Regular, Menlo, Monaco, ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0;
}

.terminal-mount .xterm.focus .xterm-cursor.xterm-cursor-block {
  display: inline-block !important;
  min-width: 0.6em;
  height: 1.22em;
  vertical-align: bottom;
  background-color: #7dd3fc !important;
  color: #0d1014 !important;
  animation: nat-terminal-cursor-blink 1.06s steps(1, end) infinite !important;
}

.terminal-mount .xterm:not(.focus) .xterm-cursor.xterm-cursor-outline {
  display: inline-block !important;
  min-width: 0.6em;
  height: 1.22em;
  vertical-align: bottom;
  background-color: transparent !important;
  box-shadow: inset 0 0 0 1.5px #7dd3fc;
}

@keyframes nat-terminal-cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.12; }
}

.terminal-disconnected {
  position: absolute;
  inset: 56px 0 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  background: rgba(13, 16, 20, 0.93);
  text-align: center;
}

.terminal-disconnected span {
  color: #8d96a3;
  font-size: 12px;
}

.terminal-disconnected button {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

body.terminal-open { overflow: hidden; }

.work-grid {
  display: grid;
  grid-template-columns: minmax(400px, 1.55fr) minmax(270px, .75fr);
  gap: 14px;
}

.panel {
  min-width: 0;
}

.panel-head {
  align-items: flex-start;
  gap: 12px;
}

.segmented {
  display: flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--input);
}

.segmented button {
  height: 26px;
  min-width: 46px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font: 600 10px "IBM Plex Mono", ui-monospace, monospace;
}

.segmented button.active {
  background: var(--cyan-soft);
  color: var(--cyan-strong);
}

.heatmap-scale {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.heatmap-scale span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.heatmap-scale i {
  width: 9px;
  height: 9px;
  border: 1px solid var(--line-strong);
  background: var(--input);
}

.heatmap-scale i.open {
  border-color: var(--cyan);
  background: var(--cyan);
}

.heatmap-scale i.pending {
  border-color: var(--amber);
  background: var(--amber);
}

.port-grid {
  display: grid;
  min-height: 190px;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  align-content: start;
  gap: 5px;
  padding: 14px;
}

.port-button {
  position: relative;
  width: 100%;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--input);
  color: var(--subtle);
  font: 500 10px "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.port-button:hover {
  z-index: 2;
  border-color: var(--cyan);
  background: var(--cyan-soft);
  color: var(--cyan-strong);
}

.port-button.open {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #06141a;
  font-weight: 700;
}

.port-button.open:hover {
  background: var(--cyan-strong);
}

.port-button.pending {
  border-color: var(--amber);
  background: var(--amber);
  color: #211600;
  pointer-events: none;
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 14px;
}

.domain-panel { margin-top: 14px; }

.domain-count {
  color: var(--cyan-strong);
  font: 600 11px/16px "IBM Plex Mono", ui-monospace, monospace;
}

.domain-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, .36fr) auto;
  align-items: end;
  gap: 10px;
  padding: 0 14px 14px;
  border-bottom: 1px solid var(--line);
}

.domain-form label { margin: 0; }

.domain-form input,
.domain-form select { height: 36px; }

select {
  width: 100%;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: 2px solid transparent;
  background: var(--input);
  color: var(--text);
}

.domain-form button { min-width: 116px; }

.domain-form-help,
.domain-form-status {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  font-size: 11px;
  line-height: 16px;
}

.domain-form-help { color: var(--muted); }

.domain-form-status {
  margin-top: -4px;
  color: var(--red-strong);
}

.domain-form-status.success { color: var(--green-strong); }

.domain-table-head,
.domain-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 90px 140px 58px 36px;
  align-items: center;
  gap: 12px;
}

.domain-table-head {
  min-height: 32px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-size: 10px;
  font-weight: 650;
}

.domain-row {
  min-height: 54px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.domain-row:last-child { border-bottom: 0; }

.domain-identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.domain-identity a {
  overflow: hidden;
  color: var(--text);
  font: 600 12px/17px "IBM Plex Mono", ui-monospace, monospace;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-identity a:hover {
  color: var(--cyan-strong);
  text-decoration: underline;
}

.domain-identity small {
  color: var(--green-strong);
  font-size: 10px;
}

.domain-row code {
  color: var(--cyan-strong);
  font: 600 11px "IBM Plex Mono", ui-monospace, monospace;
}

.domain-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.domain-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--subtle);
}

.domain-status.active { color: var(--green-strong); }
.domain-status.active i { background: var(--green); }
.domain-status.paused i { background: var(--amber); }

.switch {
  position: relative;
  display: block;
  width: 32px;
  height: 18px;
  margin: 0;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--input);
  cursor: pointer;
}

.switch span::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform 160ms ease-out, background 160ms ease-out;
}

.switch input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
}

.switch input:checked + span::after {
  background: var(--green);
  transform: translateX(14px);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.domain-delete:hover {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.domain-list-state {
  display: grid;
  min-height: 74px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.domain-list-state.error { color: var(--red); }

.help-layout {
  display: grid;
  gap: 14px;
}

.help-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.help-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.help-section-head > span {
  color: var(--cyan-strong);
  font: 650 12px "IBM Plex Mono", ui-monospace, monospace;
}

.help-section-head h2,
.help-section-head p { margin: 0; }

.help-section-head h2 { font-size: 14px; }

.help-section-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.help-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: help-step;
}

.help-steps li {
  position: relative;
  display: grid;
  min-height: 54px;
  grid-template-columns: minmax(150px, .35fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 9px 16px 9px 50px;
  border-bottom: 1px solid var(--line);
  counter-increment: help-step;
}

.help-steps li::before {
  position: absolute;
  left: 16px;
  color: var(--subtle);
  font: 600 10px "IBM Plex Mono", ui-monospace, monospace;
  content: counter(help-step, decimal-leading-zero);
}

.help-steps li:last-child { border-bottom: 0; }
.help-steps strong { font-size: 12px; }
.help-steps span { color: var(--muted); font-size: 12px; line-height: 18px; }

.help-note {
  display: grid;
  grid-template-columns: minmax(150px, .35fr) minmax(0, 1fr);
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
}

.help-note span { color: var(--text); }

.help-facts { margin: 0; }

.help-facts > div {
  display: grid;
  min-height: 48px;
  grid-template-columns: minmax(150px, .35fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}

.help-facts > div:last-child { border-bottom: 0; }
.help-facts dt { font-size: 12px; font-weight: 650; }
.help-facts dd { margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; }

.action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 14px 14px;
}

.action-row button,
.dialog-actions button,
.primary,
.danger {
  display: flex;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-alt);
}

.primary,
.action-row button.primary,
.action-row button.primary:not(:disabled) {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #07151b;
  font-weight: 650;
}

.primary:hover,
.action-row button.primary:hover:not(:disabled) {
  border-color: var(--cyan-strong);
  background: var(--cyan-strong);
}

.action-row button.primary:disabled,
.primary:disabled {
  border-color: var(--cyan-soft);
  background: var(--cyan-soft);
  color: var(--cyan-strong);
}

.danger {
  border-color: var(--red);
  background: var(--red);
  color: #1c0808;
}

.danger-ghost {
  border-color: color-mix(in srgb, var(--red) 45%, var(--line)) !important;
  color: var(--red);
}

.setting-list {
  border-top: 1px solid var(--line);
}

.setting-list button {
  display: grid;
  width: 100%;
  min-height: 50px;
  grid-template-columns: 20px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.setting-list button:last-child {
  border-bottom: 0;
}

.setting-list button:hover {
  background: var(--surface-alt);
}

.setting-list svg,
.setting-list b {
  color: var(--subtle);
}

.setting-list span strong,
.setting-list span small {
  display: block;
}

.setting-list span strong {
  font-size: 12px;
}

.setting-list span small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.setting-list b {
  font-size: 17px;
}

.setting-list .danger-item strong,
.setting-list .danger-item svg {
  color: var(--red);
}

.audit {
  margin-top: 14px;
  scroll-margin-top: 14px;
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

th,
td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

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

tbody tr:hover {
  background: var(--surface-alt);
}

th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.audit-actor {
  color: var(--text);
  font-weight: 650;
}

.audit-source,
.audit-time {
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.audit-pagination {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}

.audit-pagination > span {
  min-width: 72px;
  color: var(--muted);
  font: 500 10px/16px "IBM Plex Mono", ui-monospace, monospace;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.audit-pagination a {
  color: var(--muted);
  text-decoration: none;
}

.audit-pagination a.previous svg {
  transform: rotate(180deg);
}

.audit-pagination a[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.result {
  display: inline-flex;
  min-width: 48px;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.result i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--subtle);
}

.result.success {
  color: var(--green-strong);
}

.result.success i {
  background: var(--green);
}

.result.failed,
.result.rate-limited {
  color: var(--red);
}

.result.failed i,
.result.rate-limited i {
  background: var(--red);
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.audit-action {
  display: grid;
  gap: 2px;
}

.audit-action small {
  color: var(--subtle);
  font: 9px/13px "IBM Plex Mono", ui-monospace, monospace;
  white-space: nowrap;
}

.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;
}

dialog {
  width: min(470px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

dialog::backdrop {
  background: rgba(8, 10, 13, 0.76);
}

dialog form {
  padding: 18px;
}

.key-dialog {
  width: min(620px, calc(100vw - 24px));
}

.key-dialog .dialog-head > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.key-count {
  color: var(--cyan-strong);
  font: 600 11px/16px "IBM Plex Mono", ui-monospace, monospace;
}

.ssh-key-list {
  min-height: 64px;
  max-height: 250px;
  margin-top: 16px;
  border-block: 1px solid var(--line);
  overflow-y: auto;
}

.ssh-key-row {
  display: grid;
  min-height: 62px;
  grid-template-columns: 32px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.ssh-key-row:last-child {
  border-bottom: 0;
}

.ssh-key-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--cyan-strong);
}

.ssh-key-mark svg {
  width: 14px;
  height: 14px;
}

.ssh-key-identity {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.ssh-key-identity strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ssh-key-identity small {
  overflow: hidden;
  color: var(--muted);
  font: 10px/15px "IBM Plex Mono", ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ssh-key-delete {
  color: var(--muted);
}

.ssh-key-delete:hover {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.key-list-state {
  display: grid;
  min-height: 64px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.key-list-state.error {
  color: var(--red);
}

.key-add-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.34fr) minmax(0, 1fr);
  gap: 12px;
}

.key-add-form textarea {
  min-height: 78px;
}

dialog p {
  margin: 4px 0 16px;
  color: var(--muted);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-head h2 {
  margin: 0;
  font-size: 17px;
}

.dialog-head button {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}

label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: 2px solid transparent;
  background: var(--input);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--cyan) 20%, transparent);
}

textarea {
  resize: vertical;
  font: 12px/1.5 "IBM Plex Mono", ui-monospace, monospace;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 20px;
}

.dialog-actions button {
  padding: 0 15px;
}

:root[data-theme="dark"] :is(#save-key, #save-password, #do-reinstall):not(:disabled) {
  min-width: 96px;
  border-color: #bae6fd;
  background: #7dd3fc;
  color: #06151b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

:root[data-theme="dark"] :is(#save-key, #save-password, #do-reinstall):not(:disabled):hover {
  border-color: #e0f2fe;
  background: #bae6fd;
}

:root[data-theme="dark"] :is(#save-key, #save-password, #do-reinstall):not(:disabled):active {
  border-color: #7dd3fc;
  background: #38bdf8;
}

:root[data-theme="dark"] :is(#save-key, #save-password, #do-reinstall):not(:disabled):focus-visible {
  outline-color: #e0f2fe;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .terminal-mount .xterm.focus .xterm-cursor.xterm-cursor-block {
    animation: none !important;
    opacity: 1 !important;
  }
}

.secret-output {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 11px;
  border: 1px solid var(--green);
  background: var(--green-soft);
}

.secret-output code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--green-strong);
  font: 600 14px/20px "IBM Plex Mono", ui-monospace, monospace;
  user-select: all;
}

.instance-setup-state {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-top: 1px solid color-mix(in srgb, var(--amber) 55%, var(--line));
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 55%, var(--line));
  background: var(--amber-soft);
}

.setup-state-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--amber) 60%, var(--line));
  border-radius: 6px;
  color: var(--amber);
}

.setup-state-mark svg { width: 15px; height: 15px; }

.instance-setup-state div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.instance-setup-state strong { font-size: 13px; }
.instance-setup-state small { color: var(--muted); font-size: 11px; }

.instance-unavailable :is(.connection-band, .telemetry-board, .ports-panel, .domain-panel) {
  opacity: 0.46;
}

.system-dialog { width: min(500px, calc(100vw - 24px)); }

.system-dialog .dialog-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.system-options {
  display: grid;
  gap: 7px;
  margin: 14px 0 16px;
}

.system-option {
  min-height: 64px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input);
  cursor: pointer;
}

.system-option:hover { border-color: var(--line-strong); }

.system-option:has(input:checked) {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}

.system-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--cyan);
}

.system-option span { min-width: 0; display: grid; gap: 3px; }
.system-option strong { font-size: 13px; }
.system-option small { color: var(--muted); font-size: 11px; line-height: 16px; }

.field-help {
  display: block;
  margin: -5px 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 16px;
}

.transfer-progress {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text);
}

#transfer-confirm-label {
  color: var(--amber);
  font: 600 12px/18px "IBM Plex Mono", ui-monospace, monospace;
}

.transfer-progress div {
  display: grid;
  gap: 3px;
}

.transfer-progress small {
  color: var(--muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.handoff-summary {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--input);
}

.handoff-summary div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  min-height: 36px;
  border-bottom: 1px solid var(--line);
}

.handoff-summary div:last-child {
  border-bottom: 0;
}

.handoff-summary dt,
.handoff-summary dd {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 7px 10px;
}

.handoff-summary dt {
  color: var(--muted);
  font-size: 11px;
}

.handoff-summary dd {
  min-width: 0;
  overflow-wrap: anywhere;
  border-left: 1px solid var(--line);
  font: 12px/18px "IBM Plex Mono", ui-monospace, monospace;
}

.handoff-summary .waiting {
  color: var(--amber);
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.8s; }
}

@media (max-width: 520px) {
  .instance-setup-state {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .instance-setup-state > .badge {
    grid-column: 2;
    justify-self: start;
  }
}

.danger-text {
  color: var(--red);
}

.alert {
  padding: 9px 10px;
  border: 1px solid;
  border-radius: 4px;
  font-size: 12px;
}

.alert.error {
  margin-bottom: 12px;
  border-color: color-mix(in srgb, var(--red) 50%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}

.alert.warning {
  margin: 14px 0;
  border-color: color-mix(in srgb, var(--amber) 48%, var(--line));
  background: var(--amber-soft);
  color: var(--amber);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: var(--z-toast);
  max-width: min(380px, calc(100vw - 36px));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 10px 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.toast.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.toast.error {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.toast-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: -3px -2px 0 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: currentColor;
  font-size: 18px;
  line-height: 18px;
  opacity: .72;
}

.toast-close:hover,
.toast-close:focus-visible {
  border-color: currentColor;
  opacity: 1;
}

.product-signature {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--subtle);
  font: 500 10px/14px "IBM Plex Mono", ui-monospace, monospace;
}

.signature-prompt {
  color: var(--cyan-strong);
}

.product-signature strong {
  color: var(--muted);
  font-weight: 650;
}

.product-signature i {
  width: 5px;
  height: 10px;
  background: var(--cyan);
  box-shadow: 0 0 8px color-mix(in srgb, var(--cyan) 45%, transparent);
  opacity: .82;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.login-shell {
  width: min(420px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 4px;
  color: var(--text);
}

.login-brand h1 {
  margin: 1px 0 3px;
  font-size: 22px;
}

.login-brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-brand .eyebrow {
  color: var(--cyan-strong);
  font: 11px "IBM Plex Mono", ui-monospace, monospace;
}

.login-form {
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.form-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.form-heading h2 {
  margin: 0;
  font-size: 20px;
}

.form-heading span {
  color: var(--muted);
  font-size: 11px;
}

.wide {
  width: 100%;
  margin-top: 20px;
}

.login-form input {
  height: 40px;
}

.login-signature {
  min-height: 20px;
  margin-top: -2px;
  padding-top: 0;
  border-top: 0;
}

@media (max-width: 1050px) {
  .host-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .host-summary > div:nth-child(3) {
    border-right: 0;
  }

  .host-summary > div:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .instance-row {
    grid-template-columns: minmax(155px, 1.3fr) minmax(72px, .55fr) repeat(3, minmax(78px, .7fr)) 18px;
  }

  .instance-traffic {
    display: none;
  }

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

  .telemetry-snapshot {
    grid-column: 1 / -1;
    display: grid;
    min-height: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .telemetry-heading {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .snapshot-metric,
  .snapshot-facts {
    margin-top: 0;
  }

  .snapshot-facts {
    padding-top: 0;
    border-top: 0;
  }
}

@media (max-width: 840px) {
  .sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    height: 54px;
  }

  .resource-nav {
    display: flex;
    gap: 4px;
    padding: 7px 10px;
    overflow-x: auto;
  }

  .nav-label {
    display: none;
  }

  .node-tab {
    width: auto;
    min-width: max-content;
    grid-template-columns: 16px auto 8px;
  }

  .sidebar-footer {
    position: absolute;
    top: 0;
    right: 8px;
    min-height: 54px;
    padding: 8px;
    border-top: 0;
  }

  .account-meta {
    display: none;
  }

  #app {
    width: 100%;
    min-height: 0;
    margin-left: 0;
    padding: 18px 14px 36px;
  }

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

  .telemetry-board {
    grid-template-columns: 1fr;
  }

  .host-board .chart-panel,
  .nat-board .chart-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .host-board .chart-panel:last-child,
  .nat-board .chart-panel:last-child {
    border-bottom: 0;
  }

  .telemetry-snapshot {
    display: block;
    grid-column: auto;
  }

  .telemetry-heading {
    margin-bottom: 14px;
  }

  .snapshot-metric {
    margin-top: 12px;
  }

  .snapshot-facts {
    margin-top: 17px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

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

  .host-facts > div:nth-child(2) {
    border-right: 0;
  }

  .host-facts > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .domain-form {
    grid-template-columns: 1fr;
  }

  .domain-form button {
    width: 100%;
  }

  .domain-table-head {
    display: none;
  }

  .domain-row {
    grid-template-columns: minmax(0, 1fr) 110px 36px 36px;
    gap: 8px;
  }

  .domain-identity {
    grid-column: 1 / -1;
  }

  .help-steps li,
  .help-note,
  .help-facts > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .key-add-form {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .brand > span {
    display: none;
  }

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

  .host-summary > div,
  .host-summary > div:nth-child(3) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .host-summary > div:nth-child(even) {
    border-right: 0;
  }

  .host-summary > div:last-child {
    border-bottom: 0;
  }

  .host-summary > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .instance-row {
    grid-template-columns: minmax(125px, 1fr) minmax(62px, .55fr) minmax(62px, .55fr) 16px;
    gap: 10px;
  }

  .instance-state,
  .disk-resource,
  .instance-traffic {
    display: none;
  }

  .page-head {
    gap: 10px;
  }

  .page-tools {
    align-items: flex-end;
    flex-direction: column-reverse;
    gap: 4px;
  }

  .updated-at {
    font-size: 9px;
  }

  .port-grid {
    grid-template-columns: repeat(5, minmax(44px, 1fr));
    gap: 3px;
    padding: 10px;
  }

  .port-button {
    width: 100%;
    height: 32px;
    font-size: 9px;
  }

  .chart-head > strong {
    max-width: 58%;
    font-size: 10px;
  }

  .chart-foot {
    flex-wrap: wrap;
  }

  .chart-foot > small {
    flex-basis: 100%;
    margin-left: 0;
  }

  .connection-band code {
    overflow-wrap: anywhere;
    font-size: 10px;
  }

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

  .audit-pagination {
    justify-content: center;
  }
}

@media (max-width: 390px) {
	.terminal-toolbar {
		grid-template-columns: minmax(110px, 1fr) auto;
		gap: 8px;
	}

	.terminal-session-meta { display: none; }

	.terminal-mark { display: none; }

	.terminal-mount { padding: 8px 6px; }

  .instance-row {
    grid-template-columns: minmax(120px, 1fr) minmax(56px, .5fr) minmax(56px, .5fr) 16px;
  }

  .instance-state,
  .disk-resource,
  .instance-traffic {
    display: none;
  }

  .host-summary > div {
    min-height: 76px;
    padding: 11px;
  }

  .page-head h1 {
    font-size: 20px;
  }

  .panel-head,
  .section-head {
    padding: 10px 11px;
  }

  .telemetry-snapshot,
  .chart-panel {
    padding: 12px 11px;
  }

  .action-row {
    padding: 0 11px 11px;
  }

  .login-form {
    padding: 24px 20px;
  }
}

@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;
  }
}
