/* Machines panel — slide-in drawer launched from the sidebar's "Machines"
   nav item. Lists every connected machine, lets the user switch / rename /
   remove, and ships the install one-liner so they can add more. */

.machines-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr min(420px, 100vw);
}
.machines-panel[hidden] { display: none; }

.machines-panel__backdrop {
  background: rgba(5, 7, 11, 0.55);
  backdrop-filter: blur(4px);
  cursor: pointer;
  animation: fade-in var(--t-med) var(--ease);
}

.machines-panel__sheet {
  background: linear-gradient(180deg, var(--surface-1), var(--bg-tint));
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 16px;
  overflow-y: auto;
  animation: slide-in var(--t-med) var(--ease);
}

@keyframes slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.machines-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.machines-panel__header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.machines-panel__header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.machines-panel__close {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
  width: 28px; height: 28px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.machines-panel__close:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.machines-panel__sub {
  font-size: 12.5px;
  color: var(--fg-muted);
}

/* List items */
.machines-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.machines-list:empty::after {
  content: "No machines yet. Run the installer on one and visit the URL it prints.";
  display: block;
  color: var(--fg-dim);
  font-size: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}

.machine-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.machine-row:hover { border-color: var(--border-strong); }
.machine-row.is-active {
  border-color: var(--accent-strong);
  background: linear-gradient(135deg, var(--surface-2), var(--accent-soft));
}

.machine-row__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.machine-row__dot[data-state="online"]      { background: var(--success); box-shadow: 0 0 8px var(--success); }
.machine-row__dot[data-state="connecting"]  { background: var(--warning); box-shadow: 0 0 8px var(--warning); animation: pulse 1.2s var(--ease) infinite; }
.machine-row__dot[data-state="offline"]     { background: var(--danger);  box-shadow: 0 0 8px var(--danger); }

.machine-row__body { min-width: 0; }
.machine-row__name {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.machine-row__name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.machine-row__type {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  padding: 1px 6px;
  background: var(--surface-1);
  border-radius: 999px;
  border: 1px solid var(--border);
}
.machine-row__meta {
  font-size: 11.5px;
  color: var(--fg-dim);
  margin-top: 2px;
}

.machine-row__actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.machine-row__btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.machine-row__btn:hover {
  background: var(--surface-1);
  color: var(--fg);
}
.machine-row__btn.is-danger:hover {
  background: rgba(255, 122, 138, 0.15);
  color: var(--danger);
}
.machine-row__btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.machine-row__name-input {
  font: inherit;
  font-size: 13.5px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--accent-strong);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  outline: none;
  width: 100%;
  max-width: 220px;
}

/* "Add another machine" section */
.machines-panel__add {
  margin-top: 8px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.machines-panel__add h3 {
  font-size: 13.5px;
  font-weight: 600;
}
.machines-panel__hint {
  color: var(--fg-muted);
  font-size: 12px;
}
.machines-panel__windows summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--fg-dim);
  padding-top: 4px;
}
.machines-panel__windows[open] summary { color: var(--fg-muted); }

/* "On your account" — machines registered to the signed-in account but
   not present on this device. Visibility-only ghost rows. */
.account-machines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.account-machines[hidden] { display: none; }
.account-machines__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
}
.account-machines__hint {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: -4px;
}
.account-machines-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Remote (account-only) rows read as "registered but not here": dimmed,
   dashed border, no switch affordance. */
.machine-row--remote {
  background: transparent;
  border-style: dashed;
  opacity: 0.82;
}
.machine-row--remote:hover { opacity: 1; }

/* No-machine empty state — shown in the workspace when nothing is connected. */
.empty-state--no-machine {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--fg-muted);
  gap: 8px;
}
.empty-state--no-machine[hidden] { display: none; }
