.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;    /* fallback for browsers without dvh */
  height: 100dvh;   /* track the VISIBLE viewport so the sidebar "Connected"
                       footer + terminal bottom stay in-fold on mobile (the
                       collapsing URL/toolbar strip is excluded). Was 100vh,
                       which overshot the fold at every width >760px. */
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(124, 140, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(94, 226, 160, 0.06), transparent 60%),
    var(--bg);
}

.workspace {
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  min-width: 0;
  min-height: 0;
}

.workspace__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, var(--bg-tint), var(--bg));
}

.workspace__actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* Workspace holds N per-machine tab-bars stacked atop one another in the
   header; only `.tabs.is-active` is visible. Same idea for `.panes` below
   inside `.panes-host`. Keeping inactive machines in the DOM (display:none
   instead of detached) preserves the xterm.js renderer state so switching
   back is a no-flicker repaint. */
.tabs-host {
  display: flex;
  align-items: stretch;
  min-width: 0;
  flex: 1;
  position: relative;
  height: 100%;
}
.tabs-host > .tabs { display: none; flex: 1; min-width: 0; }
.tabs-host > .tabs.is-active { display: flex; }

.panes-host {
  position: relative;
  min-height: 0;
  min-width: 0;
  background: var(--bg);
}
.panes {
  position: absolute;
  inset: 0;
  display: none;
  min-height: 0;
  min-width: 0;
  background: var(--bg);
}
.panes.is-active { display: block; }

/* Machine chip lives in the header to the left of the tab bar, showing
   which machine you're currently driving. Click → opens the Machines
   panel where you can switch. */
.machine-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  margin-right: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.machine-chip[hidden] { display: none; }
.machine-chip:hover { background: var(--surface-1); border-color: var(--accent-strong); }
.machine-chip__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.machine-chip__dot[data-state="online"] { background: var(--success); box-shadow: 0 0 6px var(--success); }
.machine-chip__dot[data-state="connecting"] { background: var(--warning); box-shadow: 0 0 6px var(--warning); animation: pulse 1.2s var(--ease) infinite; }
.machine-chip__dot[data-state="offline"] { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.machine-chip__caret { font-size: 10px; color: var(--fg-dim); }

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--fg-muted);
  gap: 8px;
}
.empty-state[hidden] { display: none; }
.empty-state__icon {
  font-size: 48px;
  color: var(--fg-dim);
  margin-bottom: 8px;
}
.empty-state h2 { color: var(--fg); font-size: 18px; font-weight: 600; }
.empty-state p { font-size: 13px; }
