/* servers.css
   The Servers page loads settings.css first for the shared section and
   modal styling (including the apps-manage rows), so this file only
   carries what is specific to this page: the lead-in that explains what
   a server is, and the pair of actions under it.

   That explanation exists because "agent token" is the mechanism, not
   the thing a person came here to do. Someone landing on this page for
   the first time has a machine somewhere and wants it on their
   dashboard; the page should say that in those words. */

/* one line per token inside a machine's card. the control is small and
   quiet on purpose: revoking a token cuts off whatever is using it, so
   it should not sit at the same weight as the things you do daily. */
/* a machine nobody has set up yet is not a failure, so it is not red.
   amber reads as "your move" rather than "something broke". */
.token-status-badge.waiting{
  color: var(--warn);
  border-color: var(--warn);
}

.token-status-badge.offline{
  color: var(--muted);
  border-color: var(--border);
}

.token-status-badge.connected{
  color: var(--ok);
  border-color: var(--ok);
}

.machine-waiting{
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--warn);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  max-width: 52ch;
}

.machine-waiting strong{ color: var(--text); }

/* the modal stays open after handing over the command, watching for the
   machine to turn up. three states: still waiting, connected, and given
   up asking. */
/* this modal has three actions where most have two, and the default
   row squeezed them until the labels broke mid-word */
#tokenRevealModalOverlay .modal-actions{
  flex-wrap: wrap;
  gap: 8px;
}

#tokenRevealModalOverlay .modal-actions .btn{
  white-space: nowrap;
}

.connect-watch{
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12.5px;
  color: var(--muted);
}

.connect-watch-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}

.connect-watch.waiting{ border-color: var(--warn); }
.connect-watch.waiting .connect-watch-text{ color: var(--text); }

.connect-watch-dot.waiting{
  background: var(--warn);
  animation: connectPulse 1.4s ease-in-out infinite;
}

@keyframes connectPulse{
  0%, 100%{ opacity: 1; }
  50%{ opacity: 0.25; }
}

.connect-watch.connected{ border-color: var(--ok); }
.connect-watch.connected .connect-watch-text{ color: var(--ok); font-weight: 600; }
.connect-watch-dot.connected{ background: var(--ok); }

.connect-watch.gave-up{ border-style: dashed; }

/* a pulse that never stops is worse than none for anyone who finds
   motion distracting */
@media (prefers-reduced-motion: reduce){
  .connect-watch-dot.waiting{ animation: none; }
}

.token-inline-action{
  margin-left: 8px;
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

.token-inline-action:hover{ color: var(--danger); }

.token-value.revoked{ opacity: 0.5; text-decoration: line-through; }

.servers-lead{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  max-width: 62ch;
  margin: 0 0 16px;
}

.servers-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* the primary action is a real primary button here, unlike the ghost
   button this was when it sat at the bottom of Settings: on this page
   adding a machine is the point, not one option among a dozen */
.servers-actions .btn{
  padding: 9px 18px;
}

/* A machine row carries a name, a token, a region field and four
   buttons, which is a lot more than a settings toggle. The 720px column
   that suits Appearance and Preferences squeezes the name onto two
   lines and crowds the controls, so this page gets a wider one. */
.settings-layout{
  max-width: 1060px;
  /* one column here on purpose: a machine row is a wide thing with a
     name, a token, a region field and four buttons, so two of them
     side by side would put every one of those back into a squeeze */
  grid-template-columns: 1fr;
}

/* and give the row's two halves room to sit side by side rather than
   wrapping the name under its own buttons */
.token-row .token-info{ min-width: 260px; }

/* allowed to shrink, so the buttons wrap onto a second line inside the
   card instead of running off its right edge. flex-shrink: 0 used to
   keep this as wide as every button in one line, which is wider than
   the card once a server has all of them (status page, sharing, people,
   delete...), so the wrap below never got the chance to happen. */
.token-actions{
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

/* the region/label box, in the theme rather than the browser's white */
.token-region{
  width: 120px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s var(--ease);
}
.token-region::placeholder{ color: var(--muted); }
.token-region:hover{ border-color: var(--muted); }
.token-region:focus{ border-color: var(--accent); }

@media (max-width: 880px){
  .token-row{ flex-direction: column; }
  .token-actions{ width: 100%; }
}

/* ---------- WHICH KIND OF SERVER ----------
   Two cards rather than a dropdown: the choice decides what the product
   can do for the rest of that server's life, and a dropdown would make
   it look like a preference. Each card says what it gets you, because
   that is the actual difference and the words "agent" and "direct" mean
   nothing to anyone reading them for the first time. */

.add-kind-options{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.add-kind-card{
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
}

.add-kind-card:hover{
  border-color: var(--accent);
  background: var(--surface2);
  transform: translateY(-1px);
}

.add-kind-card:focus-visible{
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}

.add-kind-title{
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.add-kind-sub{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* what you actually get, which is the whole basis for choosing */
.add-kind-gets{
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent-2);
  line-height: 1.6;
}

/* said before they commit, not after: "why can't I restart it" is the
   question this is here to stop anyone ever having to ask */
.field-hint.direct-caveat{
  margin-top: 4px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border-left: 2px solid var(--border);
  background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.6;
}

/* ---------- people on a server ---------- */
.people-list{ margin: 4px 0 16px; }
.people-row{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.people-row:last-child{ border-bottom: none; }
.people-email{ font-family: var(--mono); font-size: 12px; color: var(--text); }
.people-pending{ font-size: 11px; color: var(--muted); }
.people-role, .people-role-badge{ margin-left: auto; }
.people-role-badge{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}
.people-remove{ padding: 4px 10px; font-size: 11px; }
.people-empty{ font-size: 12px; color: var(--muted); padding: 6px 0; }
.people-invite{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px){ .people-invite{ grid-template-columns: 1fr; } }
.people-role{
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 6px;
}
