.remote-dialog {
  --text: light-dark(#17181b, #ededf0);
  --muted: light-dark(#66686f, #a9abb2);
  --surface: light-dark(#fff, #202124);
  --line: light-dark(#e5e6e8, #393a3e);
  --accent: light-dark(#3075c9, #8ab4f8);
  --accent-hover: light-dark(#2465b4, #a7c6fa);
  --focus: var(--accent);
  --danger: light-dark(#b3261e, #f4a6a2);
  --remote-hover: light-dark(#f3f4f5, #303136);
  --remote-field: light-dark(#f7f8f9, #27282c);
  width: min(660px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 14px 48px #191b2030;
  font-size: 14px;
}

.remote-dialog::backdrop { background: #191b203d; }
.remote-dialog[open]:not(.workspace-popover) { display: flex; flex-direction: column; }
.remote-dialog:is([data-view="pair"], [data-view="ssh"]) { width: min(600px, calc(100vw - 32px)); }
.remote-dialog[data-view="remove"] { width: min(440px, calc(100vw - 32px)); }
.remote-dialog :focus-visible { outline-offset: -2px; }
.remote-header { display: flex; align-items: center; gap: 8px; padding: 16px 20px 12px 24px; }
.remote-header h1 { flex: 1; margin: 0; font-size: 20px; font-weight: 600; }
.remote-content { overflow: auto; overscroll-behavior: contain; padding: 0 24px 24px; }
.remote-dialog .button { min-height: 32px; gap: 6px; padding: 4px 12px; font-size: 13px; font-weight: 500; }
.remote-dialog .button-primary { color: light-dark(#fff, #101d30); }
.remote-dialog :is(.button-secondary, .button-text):hover:enabled { background: var(--remote-hover); }
.remote-dialog .remote-icon-button { min-width: 32px; padding-inline: 5px; color: var(--muted); font-size: 20px; line-height: 1; }
.remote-toolbar { display: flex; justify-content: flex-end; gap: 8px; }
.remote-group-heading { display: flex; align-items: center; justify-content: space-between; }
.remote-group-heading .button { padding-inline: 3px; }
.remote-group + .remote-group { margin-top: 17px; }
.remote-group h2 { margin: 0 0 7px; font-size: 15px; font-weight: 550; }
.remote-group-heading h2 { margin: 0; }
.remote-dialog .device-list { margin: 0; }
.remote-dialog .device-list:not(:empty) { border: 1px solid var(--line); border-radius: 10px; }
.remote-dialog .device-row {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 59px;
  padding: 8px 12px;
  border: 0;
}
.remote-dialog .device-row + .device-row { border-top: 1px solid var(--line); }
.remote-dialog .device-identity { flex: 1; }
.remote-dialog .device-name { font-size: 15px; font-weight: 550; }
.remote-dialog .device-state { font-size: 12px; overflow-wrap: anywhere; }
.remote-dialog .device-state-online { color: light-dark(#30733d, #90c69b); }
.remote-dialog .device-actions { gap: 5px; }
.remote-dialog .remote-row-action {
  position: absolute;
  z-index: 1;
  inset: 48% 10px auto auto;
  border-color: var(--line);
  background: var(--surface);
  color: var(--danger);
  box-shadow: 0 4px 14px #191b2024;
}
.remote-status, .remote-dialog .feedback { margin: 8px 0 0; font-size: 13px; }
.remote-status, .remote-dialog p:not(.feedback-error) { color: var(--muted); }
.remote-device-icon {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  color: var(--muted);
}
.remote-device-icon:is([data-kind="online"], [data-kind="offline"], [data-kind="cloud"])::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}
.remote-device-icon:is([data-kind="online"], [data-kind="cloud"])::before { background: light-dark(#599946, #79b967); }
.remote-device-icon[data-kind="ssh"]::before {
  padding: 0 1px;
  border: 1px solid currentColor;
  border-radius: 3px;
  content: "›_";
  font: bold 10px/11px monospace;
}
.remote-tabs { display: flex; gap: 4px; padding-bottom: 12px; margin-bottom: 15px; border-bottom: 1px solid var(--line); }
.remote-tabs .button { color: var(--muted); }
.remote-tabs .button[aria-pressed="true"] { background: var(--remote-hover); color: var(--text); }
.remote-dialog textarea, .ssh-connect-field input, .remote-dialog .device-pair-field input {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--remote-field);
  color: var(--text);
  font: 13px/1.45 ui-monospace, monospace;
}
.remote-dialog textarea { width: 100%; resize: vertical; }
.remote-dialog .device-pair-field { flex-wrap: nowrap; }
.remote-dialog .device-pair-field :is(textarea, input) { flex: 1; }
#device-code { letter-spacing: .035em; font-weight: 600; }
.pairing-guide label[for="device-mode"] { color: var(--muted); margin-inline-end: 5px; }
.pairing-guide .device-command-actions { margin-top: 5px; }
#open-paired-device { margin-top: 12px; }
.ssh-connect-field { display: flex; gap: 8px; margin: 10px 0 4px; }
.ssh-connect-field input { flex: 1; }
#ssh-fingerprint, .remote-dialog .device-pairing {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--remote-field);
}
#ssh-fingerprint code { display: block; margin: 10px 0; overflow-wrap: anywhere; }
#ssh-fingerprint .device-actions, .remote-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.remote-confirm-actions { margin-top: 18px; }
.remote-dialog .remote-destructive { border-color: var(--danger); background: var(--surface); color: var(--danger); }
.remote-dialog .remote-destructive:hover { background: var(--remote-hover); }
@media (max-width: 600px) {
  .remote-dialog[open]:not(.workspace-popover) {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top)));
    margin: 0;
    border-radius: 18px 18px 0 0;
  }
  .remote-header { flex-wrap: wrap; padding: 18px 14px 8px 18px; }
  .remote-toolbar { order: 1; width: 100%; }
  .remote-dialog:not(.workspace-popover)::before {
    position: absolute;
    inset: 8px 0 auto;
    width: 36px;
    height: 4px;
    margin-inline: auto;
    border-radius: 4px;
    background: var(--line);
    content: "";
  }
  .remote-content { padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
  .remote-dialog .button { min-height: 44px; }
  .remote-dialog .remote-icon-button { min-width: 44px; }
  .remote-dialog .device-row { padding-inline: 8px; gap: 5px; }
  .remote-dialog .device-actions .button { padding-inline: 6px; }
  .remote-dialog .device-pair-field { align-items: stretch; }
}
