/* addi-server management — sci-fi minimalist console (btop palette, no chrome) */
:root {
  --bg-0: #000000;
  --bg-1: #05070a;
  --bg-2: #0a0d12;
  --bg-3: #10151c;
  --line: #2a323c;
  --line-soft: #1a2028;
  --text: #d0d6dc;
  --text-dim: #7a8490;
  --text-mute: #4a5460;
  --used: #e05a4a;
  --free: #3ecf8e;
  --avail: #e0b84a;
  --cached: #4aa8d8;
  --cyan: #4ecdc4;
  --mag: #c678dd;
  --warn: #e0b84a;
  --danger: #e05a4a;
  --info: #4aa8d8;
  --accent: #3ecf8e;
  --radius: 2px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

/* —— Colour tokens (btop meaning) —— */
.c-used { color: var(--used); }
.c-free { color: var(--free); }
.c-avail { color: var(--avail); }
.c-cached { color: var(--cached); }
.c-down { color: var(--cyan); }
.c-up { color: var(--mag); }
.mono-dim { color: var(--text-mute); font-family: var(--mono); }
.heat-ok { color: var(--free); }
.heat-warn { color: var(--avail); }
.heat-crit { color: var(--used); }

/* —— Spinners / loading —— */
.spin {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-top-color: var(--free);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
.spin.sm { width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel-loading {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.65rem;
  border: 1px solid var(--line-soft);
  background: var(--bg-1);
  color: var(--text-dim);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.panel-loading.inset { margin: 0 0 0.65rem; }

.btn-busy {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-top-color: #e8fff4;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  vertical-align: middle;
}
.btn.is-busy .btn-label { display: none; }

/* —— Login —— */
.login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.75rem;
  background: var(--bg-0);
}

.login-panel {
  width: min(100%, 380px);
  padding: 1.65rem 1.5rem 1.5rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.login-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}

.brand-mark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--free);
}

.brand-sub {
  color: var(--text-mute);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.field input,
.select,
.input-inline {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  outline: none;
}

.field input:focus,
.select:focus,
.input-inline:focus {
  border-color: #3a8f68;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

/* —— Buttons —— */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font-weight: 500;
}

.btn:hover:not(:disabled) {
  background: #161c24;
  border-color: #3a4654;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: #153528;
  border-color: #2a8f62;
  color: #d8ffe8;
}

.btn-primary:hover:not(:disabled) {
  background: #1a4230;
  border-color: var(--free);
}

.btn-danger {
  border-color: #6b2f28;
  color: #f0b0a8;
  background: #1a0e0c;
}

.btn-danger:hover:not(:disabled) {
  background: #2a1410;
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
}

.btn-block {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.2rem;
}

.btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
}

/* —— App shell —— */
.app-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-0);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-brand .brand-mark {
  font-size: 0.92rem;
  white-space: nowrap;
}

.hostname {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

.nav-tabs {
  display: flex;
  gap: 0.15rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  color: var(--free);
  border-bottom-color: var(--free);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.conn-pill {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--line);
  color: var(--text-mute);
}

.conn-pill.live {
  color: var(--free);
  border-color: #1f6b4a;
}

.conn-pill.poll {
  color: var(--info);
  border-color: #2a5a78;
}

.conn-pill.err {
  color: var(--danger);
  border-color: #6b2f28;
}

.main {
  flex: 1;
  padding: 0.7rem;
  width: 100%;
  max-width: none;
  margin: 0;
}

.panel {
  min-height: 0;
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.8rem;
}

.panel-hint {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.8rem;
  color: var(--text-mute, var(--text-dim));
  line-height: 1.4;
}

.panel-hint code {
  font-size: 0.78em;
}

.panel-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: auto;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.meter-head h2,
.meter-head h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* —— Btop layout —— */
.btop {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1.4fr);
  grid-template-rows: auto auto minmax(160px, 1fr);
  gap: 0.7rem;
  min-height: calc(100dvh - 3.6rem);
}

.btop-cpu { grid-column: 1 / -1; grid-row: 1; }
.btop-mem { grid-column: 1; grid-row: 2; }
.btop-disk { grid-column: 2; grid-row: 2; }
.btop-proc { grid-column: 3; grid-row: 2 / 4; min-height: 0; display: flex; flex-direction: column; }
.btop-net { grid-column: 1 / 3; grid-row: 3; min-height: 0; }

.btop-panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem 0.85rem;
  min-width: 0;
}

.btop-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: -0.65rem -0.85rem 0.7rem;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-2);
}

.btop-title.sub {
  margin: 0.85rem 0 0.55rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
}

.btop-tag {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.btop-meta {
  font-size: 0.78rem;
  color: var(--text-mute);
}

.meter-value {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--free);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.meter-value.sm { font-size: 0.95rem; }

.meter-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-mute);
  margin-top: 0.4rem;
}

/* CPU */
.cpu-body {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(200px, 0.9fr);
  gap: 0.9rem;
  align-items: stretch;
}

.cpu-graph { min-width: 0; display: flex; flex-direction: column; gap: 0.45rem; }

.cpu-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.load-avg { color: var(--text-dim); }

.spark {
  width: 100%;
  display: block;
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
}

.spark-lg { min-height: 128px; }

.core-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
}

.core-row {
  display: grid;
  grid-template-columns: 1.85rem 1fr 2.6rem;
  gap: 0.45rem;
  align-items: center;
  min-height: 1.35rem;
}

.core-label {
  font-size: 0.72rem;
  color: var(--text-mute);
}

.core-track-h {
  height: 11px;
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.core-fill-h {
  height: 100%;
  width: 0%;
  transition: width 0.25s ease;
}

.core-pct {
  font-size: 0.75rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Bars */
.bar-track {
  height: 10px;
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.bar-track.tall { height: 12px; }

.bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.bar-used { background: var(--used); }
.bar-avail { background: var(--avail); }
.bar-cached { background: var(--cached); }
.bar-free { background: var(--free); }

/* MEM rows */
.mem-stack { display: flex; flex-direction: column; gap: 0.5rem; }

.stat-row {
  display: grid;
  grid-template-columns: 6rem 1fr 5.2rem;
  gap: 0.55rem;
  align-items: center;
}

.stat-lab {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.stat-val {
  font-size: 0.78rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Disks */
.disk-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 300px;
  overflow: auto;
  padding-right: 0.2rem;
}

.disk-row { display: grid; gap: 0.4rem; }

.disk-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.55rem;
  font-size: 0.8rem;
}

.disk-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-pct {
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.disk-row-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-mute);
}

/* Net */
.net-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 0.8rem;
}

.iface-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 200px;
  overflow: auto;
}

.iface-card {
  border: 1px solid var(--line-soft);
  padding: 0.5rem 0.65rem;
  background: var(--bg-0);
}

.iface-card.primary { border-color: var(--line); }

.iface-name {
  font-size: 0.8rem;
  color: var(--cyan);
  margin-bottom: 0.35rem;
}

.iface-grid {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 0.2rem 0.5rem;
  font-size: 0.75rem;
  align-items: baseline;
}

/* Processes */
.btop-proc .table-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line-soft);
}

.btop-proc .input-inline {
  margin-left: auto;
  width: 10rem;
  max-width: 42%;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.proc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.proc-table th {
  position: sticky;
  top: 0;
  background: var(--bg-2);
  text-align: left;
  padding: 0.45rem 0.55rem;
  color: var(--text-mute);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.proc-table th[data-sort="pid"] { width: 4.5rem; }
.proc-table th[data-sort="user"] { width: 5.8rem; }
.proc-table th[data-sort="mem"],
.proc-table th[data-sort="cpu"] {
  width: 4.5rem;
  text-align: right;
}

.proc-table th.sort-asc::after { content: " ↑"; color: var(--free); }
.proc-table th.sort-desc::after { content: " ↓"; color: var(--free); }

.proc-table td {
  padding: 0.38rem 0.55rem;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  vertical-align: middle;
}

.proc-table tbody tr:hover { background: rgba(62, 207, 142, 0.04); }

.proc-table .pid { color: var(--cyan); font-variant-numeric: tabular-nums; }
.proc-table .user {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
}
.proc-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.proc-table .prog {
  overflow: hidden;
  text-overflow: ellipsis;
}
.prog-name { color: var(--text); }
.prog-args {
  display: block;
  color: var(--text-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-size: 0.72rem;
  line-height: 1.3;
  margin-top: 0.08rem;
}

.input-inline { max-width: 200px; }

.table-wrap {
  overflow: auto;
  max-height: min(50vh, 420px);
  border: 1px solid var(--line-soft);
}

/* —— Services —— */
.services-groups {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.svc-group h3 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.svc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.55rem;
}

.svc-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.svc-card.is-busy { opacity: 0.7; }

.svc-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.svc-name { font-weight: 600; flex: 1; min-width: 0; font-size: 0.9rem; }

.svc-unit {
  font-size: 0.72rem;
  color: var(--text-mute);
  width: 100%;
}

.pill {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.42rem;
  border: 1px solid var(--line);
  color: var(--text-dim);
  white-space: nowrap;
}

.pill.active {
  color: var(--free);
  border-color: #1f6b4a;
}

.pill.inactive,
.pill.dead {
  color: var(--text-mute);
  border-color: var(--line);
}

.pill.failed {
  color: var(--danger);
  border-color: #6b2f28;
}

.pill.activating,
.pill.deactivating,
.pill.reloading {
  color: var(--warn);
  border-color: #6a4a1a;
}

.pill.enabled {
  color: var(--info);
  border-color: #2a5a78;
}

.pill.disabled-unit { color: var(--text-mute); }

.svc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.svc-skeleton {
  display: grid;
  gap: 0.55rem;
}

.skel {
  height: 72px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(90deg, var(--bg-1) 25%, var(--bg-2) 50%, var(--bg-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* —— Admin commands —— */
.admin-note {
  margin: 0 0 0.55rem;
  color: var(--text-mute);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 0.65rem;
  min-height: calc(100dvh - 10rem);
}

.admin-palette {
  border: 1px solid var(--line);
  background: var(--bg-1);
  border-radius: var(--radius);
  padding: 0.45rem;
  overflow: auto;
  max-height: calc(100dvh - 10rem);
}

.admin-group + .admin-group {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line-soft);
}

.admin-group h3 {
  margin: 0 0 0.35rem;
  padding: 0 0.35rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.admin-cmd-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-cmd {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.45rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
}

.admin-cmd:hover {
  background: var(--bg-2);
  border-color: var(--line-soft);
}

.admin-cmd.active {
  background: var(--bg-2);
  border-color: var(--line);
}

.admin-cmd.mutating .admin-cmd-label {
  color: var(--warn);
}

.admin-cmd-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--free);
}

.admin-cmd-desc {
  font-size: 0.65rem;
  color: var(--text-mute);
  line-height: 1.3;
}

.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.admin-params {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--line);
  background: var(--bg-1);
  border-radius: var(--radius);
}

.admin-param {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 160px;
  flex: 1;
}

.admin-param > span {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.admin-out {
  flex: 1;
  height: auto;
  min-height: 280px;
  max-height: calc(100dvh - 12rem);
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .admin-palette {
    max-height: 220px;
  }
  .admin-out {
    max-height: calc(100dvh - 22rem);
  }
}

/* —— Logs —— */
.log-view {
  margin: 0;
  height: calc(100dvh - 9.5rem);
  min-height: 300px;
  overflow: auto;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: #b0bac4;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-view .line-err { color: #f0a8a0; }
.log-view .line-warn { color: #e8c888; }
.log-view .line-info { color: #8ec8e8; }

/* —— Terminal —— */
.term-container {
  height: calc(100dvh - 18rem);
  min-height: 240px;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.35rem;
  overflow: hidden;
}

.term-container .xterm { height: 100%; padding: 0.25rem; }

.rcon-panel {
  margin-top: 0.8rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
}

.rcon-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.rcon-input {
  flex: 1;
  max-width: none;
}

.rcon-out {
  margin: 0;
  min-height: 4.5rem;
  max-height: 11rem;
  overflow: auto;
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  color: #b0bac4;
  white-space: pre-wrap;
}

.fallback-msg {
  background: var(--bg-2);
  border: 1px dashed var(--line);
  padding: 1rem 1.1rem;
  color: var(--text-dim);
  margin-bottom: 0.65rem;
  font-size: 0.88rem;
}

.fallback-msg code {
  color: var(--info);
  font-size: 0.9em;
}

.empty-state {
  color: var(--text-mute);
  font-size: 0.82rem;
  padding: 0.9rem 0;
}

/* —— Inventory —— */
.inventory-root {
  min-height: 0;
}

.inv-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  align-items: start;
}

.inv-layout.drawer-open {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
}

.inv-toolbar {
  margin-bottom: 0.65rem;
}

.inv-search {
  min-width: min(100%, 260px);
  flex: 1;
  max-width: 360px;
}

.inv-host-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.inv-stat {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.inv-stat-lab {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.inv-stat-val {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--free);
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-callout {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.7rem;
  border: 1px solid #6a4a1a;
  background: #120e08;
  color: var(--warn);
}

.inv-callout ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.inv-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.inv-cat {
  appearance: none;
  background: var(--bg-1);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inv-cat:hover {
  color: var(--text);
  border-color: #3a4654;
}

.inv-cat.on {
  color: var(--free);
  border-color: #1f6b4a;
  background: #0c1812;
}

.inv-cat-all {
  color: var(--info);
}

.inv-split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 0.7rem;
  margin-bottom: 0.85rem;
}

.inv-map-wrap,
.inv-access {
  min-width: 0;
}

.inv-svg {
  width: 100%;
  height: auto;
  max-height: 280px;
  display: block;
}

.inv-edge {
  stroke: var(--line);
  stroke-width: 1.5;
}

.inv-node circle {
  fill: var(--bg-2);
  stroke: var(--line);
  stroke-width: 1.5;
  cursor: pointer;
}

.inv-node.host circle {
  stroke: var(--free);
  fill: #0c1812;
}

.inv-node.proxy circle {
  stroke: var(--info);
}

.inv-node text {
  fill: var(--text-dim);
  font-size: 11px;
  font-family: var(--mono);
  pointer-events: none;
}

.inv-node.focused circle {
  stroke: var(--free);
  fill: #153528;
}

.inv-node:hover circle {
  stroke: var(--accent);
}

.inv-access-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.inv-access-row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.15rem 0.65rem;
  font-size: 0.82rem;
}

.inv-access-path {
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  grid-row: 1 / 3;
  align-self: center;
}

.inv-access-addr code,
.inv-access-addr a {
  color: var(--cyan);
  word-break: break-all;
}

.inv-access-addr a {
  text-decoration: none;
}

.inv-access-addr a:hover {
  text-decoration: underline;
}

.inv-access-notes {
  color: var(--text-mute);
  font-size: 0.75rem;
  grid-column: 2;
}

.inv-section {
  margin-bottom: 1rem;
}

.inv-sec-head {
  margin: 0 0 0.55rem !important;
  padding: 0.3rem 0 !important;
}

.inv-section-note {
  margin: 0 0 0.65rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.45;
}

.inv-access-foot {
  margin: 0.75rem 0 0;
  color: var(--text-mute);
  font-size: 0.78rem;
}

.inv-access-foot code {
  color: var(--cyan);
  word-break: break-all;
}

.inv-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  margin-bottom: 0.65rem;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.inv-table th,
.inv-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.inv-table th {
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.7rem;
  font-weight: 600;
  background: #0a0e12;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.inv-table tbody tr:last-child td {
  border-bottom: none;
}

.inv-tr {
  cursor: pointer;
}

.inv-tr:hover td {
  background: #0c1410;
}

.inv-tr.selected td {
  background: #0c1812;
}

.inv-table code {
  color: var(--cyan);
  font-size: 0.82rem;
}

.inv-table .inv-ctrl {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.inv-grid-net {
  margin-top: 0.45rem;
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.55rem;
}

.inv-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.inv-card:hover,
.inv-card:focus-visible {
  border-color: #3a8f68;
  outline: none;
}

.inv-card.selected {
  border-color: var(--free);
  background: #0c1812;
}

.inv-card-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.inv-card-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}

.inv-card-desc {
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.4;
}

.inv-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.inv-unit {
  font-size: 0.72rem;
  color: var(--text-mute);
  font-family: var(--mono);
}

.inv-ext {
  margin-left: auto;
  color: var(--info);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.inv-ext:hover {
  text-decoration: underline;
}

.inv-paths {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
}

.inv-path-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
}

.inv-path-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.inv-path-card code {
  color: var(--cyan);
  font-size: 0.82rem;
}

.inv-path-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.inv-masked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0 1rem;
}

.inv-drawer {
  position: sticky;
  top: 3.4rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  max-height: calc(100dvh - 4.2rem);
  overflow: auto;
}

.inv-drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line-soft);
}

.inv-drawer-head h3 {
  margin: 0;
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.inv-drawer-desc {
  margin: 0 0 0.75rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.inv-dl {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.4rem 0.65rem;
  margin: 0;
  font-size: 0.82rem;
}

.inv-dl dt {
  margin: 0;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  align-self: start;
  padding-top: 0.15rem;
}

.inv-dl dd {
  margin: 0;
  word-break: break-word;
}

.inv-dl code,
.inv-dl a {
  color: var(--cyan);
}

.inv-dl a {
  text-decoration: none;
}

.inv-dl a:hover {
  text-decoration: underline;
}

.inv-drawer-hint {
  margin: 0.85rem 0 0;
  color: var(--text-mute);
  font-size: 0.72rem;
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .btop {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
  }
  .btop-cpu { grid-column: 1 / -1; }
  .btop-mem { grid-column: 1; grid-row: 2; }
  .btop-disk { grid-column: 2; grid-row: 2; }
  .btop-net { grid-column: 1 / -1; grid-row: 3; }
  .btop-proc { grid-column: 1 / -1; grid-row: 4; min-height: 340px; }
  .cpu-body { grid-template-columns: 1fr; }
  .net-body { grid-template-columns: 1fr; }
  .inv-layout.drawer-open {
    grid-template-columns: 1fr;
  }
  .inv-drawer {
    position: static;
    max-height: none;
  }
  .inv-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  html,
  body {
    font-size: 15px;
  }
  .btop {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .btop-cpu,
  .btop-mem,
  .btop-disk,
  .btop-net,
  .btop-proc {
    grid-column: 1;
    grid-row: auto;
  }
  .stat-row { grid-template-columns: 5rem 1fr 4.2rem; }
  .topbar {
    padding: 0.55rem 0.75rem;
    gap: 0.65rem;
  }
  .topbar-brand .hostname { display: none; }
  .topbar-brand .brand-mark { font-size: 0.85rem; }
  .nav-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
  }
  .svc-list { grid-template-columns: 1fr; }
  .log-view,
  .term-container { height: calc(100dvh - 11.5rem); }
  .inv-host-strip {
    grid-template-columns: 1fr 1fr;
  }
  .inv-access-row {
    grid-template-columns: 1fr;
  }
  .inv-access-path {
    grid-row: auto;
  }
  .inv-access-notes {
    grid-column: 1;
  }
  .inv-search {
    max-width: none;
    width: 100%;
  }
}
