.terminal-workspace,
.sftp-workspace {
  display: none;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 2.8px;
  background: var(--chrome-strong);
}

.terminal-workspace.active,
.sftp-workspace.active {
  display: grid;
}

.terminal-workspace {
  position: relative;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

.connections-collapsed .terminal-workspace {
  padding: 0;
}

.terminal-workspace.quick-command-bar-visible {
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.terminal-workspace-has-background .terminal-pane {
  background: transparent;
}

.terminal-workspace-embedded-only {
  grid-template-rows: minmax(0, 1fr);
}

.terminal-workspace-embedded-only .terminal-grid {
  gap: 0;
}

.workspace-toolbar {
  min-width: 0;
  margin-bottom: 10px;
}

.terminal-workspace .workspace-toolbar {
  margin-bottom: 0;
}

.workspace-toolbar > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.workspace-toolbar strong {
  font-size: 14px;
}

.terminal-grid {
  display: flex;
  position: relative;
  z-index: 1;
  min-height: 0;
  min-width: 0;
  gap: 10px;
}

.terminal-grid > * {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
}

.terminal-layout-split {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  gap: 2px;
}

.terminal-layout-split-horizontal {
  flex-direction: row;
}

.terminal-layout-split-vertical {
  flex-direction: column;
}

.terminal-layout-leaf {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.terminal-layout-leaf > .terminal-pane,
.terminal-layout-leaf > .embedded-workspace-pane {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.terminal-workspace-pane-maximized .terminal-layout-split {
  display: contents;
}

.terminal-workspace-pane-maximized .terminal-layout-leaf {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.terminal-workspace-pane-maximized .terminal-layout-leaf.terminal-layout-maximized {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .terminal-workspace-pane-maximized .terminal-layout-leaf {
    transition: none;
  }
}

.embedded-workspace-pane {
  position: relative;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--terminal-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.embedded-workspace-pane > .terminal-workspace {
  flex: 1 1 0;
  width: 100%;
  padding: 0;
  background: var(--chrome-strong);
}

.embedded-workspace-pane > .remote-desktop-shell {
  min-width: 0;
}

/* File-browser sub-panes (SFTP / FTP / File Explorer) and the Document viewer
   must fill the embedded pane the same way the terminal surface does.
   `.sftp-workspace.active` and `.file-viewer-workspace.active` are block-level
   flex columns, so as a flex item in this row they would otherwise size to their
   content width — leaving the pane partially empty and the toolbar narrower than
   the pane. */
.embedded-workspace-pane > .sftp-workspace,
.embedded-workspace-pane > .file-viewer-workspace {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
}

.embedded-workspace-pane > .sftp-workspace {
  flex: 1 1 0;
  width: 100%;
}

.embedded-workspace-pane:has(> .embedded-pane-close) > .remote-desktop-shell .remote-desktop-pane > header {
  padding-right: 40px;
}

.embedded-pane-close {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

.embedded-workspace-pane:has(> .remote-desktop-shell) .embedded-pane-close {
  top: 5px;
  color: #95a7bb;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(128, 153, 184, 0.18);
  border-radius: 5px;
}

.embedded-workspace-pane:has(> .remote-desktop-shell) .embedded-pane-close:hover {
  color: #ff7070;
  background: rgba(255, 100, 100, 0.12);
  border-color: rgba(255, 112, 112, 0.28);
}

.terminal-workspace-embedded-only .embedded-workspace-pane {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.terminal-pane-inactive::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: rgba(4, 8, 14, 0.48);
  content: "";
  transition: opacity 120ms ease-out;
}

.terminal-pane-focused::after {
  opacity: 0;
}


.terminal-pane {
  position: relative;
  display: grid;
  grid-template-rows: 34px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #c9d4e2;
  background: linear-gradient(180deg, var(--terminal), var(--terminal-2));
  border: 1px solid var(--terminal-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.terminal-pane-recording {
  outline: 3px solid rgba(196, 62, 62, 0.72);
  outline-offset: 0;
}

/* Input is mirrored to this pane; warn before typing into many sessions. */
/* Input is mirrored to every open terminal Pane while sync is on, including
   Panes on Tabs that are not currently visible, so the cue must be loud: a
   pulsing green outline on each receiving Pane and a pulsing green toolbar
   toggle. */
.terminal-pane-sync-active {
  outline: 2px solid var(--green);
  outline-offset: -2px;
  animation: terminal-sync-pulse 1.6s ease-in-out infinite;
}

.terminal-pane-action.terminal-sync-toggle.active {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 18%, transparent);
  animation: terminal-sync-toggle-pulse 1.6s ease-in-out infinite;
}

@keyframes terminal-sync-pulse {
  0%,
  100% {
    outline-color: color-mix(in srgb, var(--green) 55%, transparent);
  }
  50% {
    outline-color: var(--green);
  }
}

@keyframes terminal-sync-toggle-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent);
  }
  50% {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 28%, transparent);
  }
}

.terminal-pane-search-open {
  grid-template-rows: 34px auto minmax(0, 1fr);
}

.terminal-pane header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  color: #95a7bb;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--terminal-border);
}

.terminal-pane header span {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
}

.terminal-pane-title .terminal-pane-connection-icon {
  flex: 0 0 auto;
}

.terminal-pane header .terminal-pane-title {
  gap: 5px;
}

.terminal-pane header small {
  max-width: 55%;
  margin-left: 8px;
  color: #69798b;
  font-size: 11px;
}

.terminal-pane-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.terminal-pane-actions small {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmux-session-wrapper {
  position: relative;
}

.tmux-session-tag-group,
.tmux-session-rename {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.tmux-session-tag {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  max-width: 220px;
  height: 24px;
  padding: 0 8px;
  overflow: hidden;
  color: #c9d4e2;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(86, 166, 255, 0.12);
  border: 1px solid rgba(86, 166, 255, 0.28);
  border-radius: 5px;
  cursor: pointer;
}

.tmux-session-tag span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tmux-x11-indicator {
  flex: 0 0 auto;
}

.tmux-x11-indicator.disabled {
  color: #7f8a98;
  opacity: 0.45;
}

.tmux-x11-indicator.enabled {
  color: #5ee787;
  opacity: 0.62;
}

.tmux-x11-indicator.rejected {
  color: #ff6b6b;
  opacity: 0.72;
}

.tmux-x11-button {
  flex: 0 0 auto;
}

.tmux-x11-button:disabled {
  cursor: default;
  opacity: 1;
}

.tmux-x11-button.disabled {
  color: #7f8a98;
  opacity: 0.45;
}

.tmux-x11-button.enabled {
  color: #5ee787;
  background: rgba(94, 231, 135, 0.08);
  border-color: rgba(94, 231, 135, 0.2);
}

.tmux-x11-button.rejected {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.22);
}

.tmux-session-edit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: #95a7bb;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
}

.tmux-session-edit-button:hover {
  color: #d9e5f4;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(149, 167, 187, 0.28);
}

.tmux-session-rename input {
  width: 180px;
  height: 24px;
  padding: 0 7px;
  color: #d9e5f4;
  font-size: 11px;
  font-weight: 700;
  background: #101824;
  border: 1px solid #526178;
  border-radius: 5px;
  outline: none;
}

.tmux-session-rename input:focus {
  border-color: #56a6ff;
  box-shadow: 0 0 0 2px rgba(86, 166, 255, 0.18);
}

.tmux-session-rename-error {
  position: absolute;
  top: 28px;
  right: 0;
  z-index: 61;
  width: 240px;
  padding: 7px 8px;
  color: #ffd1d1;
  background: #2a1216;
  border: 1px solid #8a3a42;
  border-radius: 6px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.tmux-session-menu {
  position: absolute;
  top: 30px;
  right: 0;
  z-index: 60;
  width: min(360px, 80vw);
  max-height: 320px;
  padding: 10px;
  overflow: auto;
  color: #d9e5f4;
  background: #0f1722;
  border: 1px solid #7f90a7;
  border-radius: 8px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.tmux-session-menu-portal {
  position: fixed;
  top: 0;
  right: auto;
  left: 0;
  z-index: 260;
  max-height: min(320px, calc(100vh - 16px));
}

.tmux-session-menu header,
.tmux-session-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.tmux-session-menu p {
  margin: 8px 0 0;
  color: #9fb0c6;
  font-size: 12px;
}

.tmux-session-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.tmux-session-row {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  justify-items: stretch;
  min-width: 0;
  padding: 6px 7px;
  color: #d9e5f4;
  background: #151f2c;
  border: 1px solid #526178;
  border-radius: 6px;
  display: grid;
  gap: 4px;
  position: relative;
}

.tmux-session-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  gap: 6px;
  align-items: center;
  justify-self: stretch;
  min-width: 0;
  inline-size: 100%;
}

.tmux-session-row-info {
  display: grid;
  min-width: 0;
  inline-size: 100%;
  gap: 1px;
  padding: 0;
  text-align: left;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.tmux-session-row-info:hover strong {
  color: #a8d4ff;
}

.tmux-session-row-info.in-app strong {
  color: #56a6ff;
}

.tmux-session-row strong,
.tmux-session-row small {
  max-width: none;
  margin: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmux-session-row strong {
  color: #e5edf8;
  font-size: 12px;
}

.tmux-session-row small {
  color: #9fb0c6;
  font-size: 11px;
}

.tmux-session-row .tmux-session-rename {
  width: 100%;
}

.tmux-session-row .tmux-session-rename input {
  width: 100%;
}

.tmux-session-row .tmux-session-rename-error {
  position: static;
  width: auto;
  margin: 2px 0 0;
  box-shadow: none;
}

.ssh-port-menu {
  width: min(300px, 80vw);
}

.ssh-port-row .tmux-session-row-info {
  cursor: default;
}

.ssh-port-row .tmux-session-row-main {
  grid-template-columns: minmax(0, 1fr) auto;
}

.tmux-mouse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #526178;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

.tmux-mouse-toggle:hover {
  color: #9fb0c6;
  border-color: #526178;
}

.tmux-mouse-toggle.active {
  color: #56a6ff;
  background: rgba(86, 166, 255, 0.1);
  border-color: rgba(86, 166, 255, 0.35);
}

.tmux-session-directions {
  display: flex;
  gap: 4px;
  padding-top: 2px;
  border-top: 1px solid #2a3a4f;
}

.tmux-direction-btn {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  height: 26px;
  color: #7f96af;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #384d63;
  border-radius: 4px;
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s,
    border-color 0.1s;
}

.tmux-direction-btn:hover {
  color: #d9e5f4;
  background: rgba(86, 166, 255, 0.1);
  border-color: rgba(86, 166, 255, 0.35);
}

.terminal-pane-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #95a7bb;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  cursor: pointer;
}

.terminal-pane-action-text {
  gap: 5px;
  width: auto;
  min-width: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
}

.terminal-pane-action:disabled {
  color: #536174;
  cursor: default;
  opacity: 0.55;
}

.terminal-pane-action.active,
.quick-command-toggle.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.quick-command-bar {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  min-height: 38px;
  padding: 6px;
  overflow-x: auto;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.quick-command-button,
.quick-command-empty,
.quick-command-manage {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  justify-content: center;
  height: 26px;
  min-width: 0;
  padding: 0 9px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--quick-command-accent, var(--accent));
  border-radius: 6px;
  cursor: pointer;
}

.quick-command-button:hover,
.quick-command-empty:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.quick-command-button span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-command-empty {
  color: var(--text-muted);
  border-left-color: var(--border-strong);
}

.quick-command-manage {
  width: 28px;
  margin-left: auto;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
  border-left-width: 1px;
  opacity: 0;
  transition:
    opacity 150ms ease-out,
    color 120ms ease-out;
}

.quick-command-bar:hover .quick-command-manage,
.quick-command-bar:focus-within .quick-command-manage {
  opacity: 1;
}

.quick-command-manage:hover,
.quick-command-manage:focus-visible {
  color: var(--text);
  background: transparent;
  border-color: transparent;
}

.terminal-recording-button {
  width: 20px;
  height: 20px;
  color: #a94d4d;
  background: rgba(169, 77, 77, 0.06);
}

.terminal-recording-button.active {
  background: rgba(169, 77, 77, 0.1);
  color: #bf5a5a;
}

.terminal-ssh-forwarding-button {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
  border-color: color-mix(in srgb, var(--green) 28%, transparent);
}

.terminal-ssh-forwarding-button.has-failure {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border-color: color-mix(in srgb, var(--amber) 28%, transparent);
}

.sshf-backdrop {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sshf {
  max-height: min(840px, calc(100vh - 48px));
}

.sshf-gateway-ports-hint {
  max-width: 480px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.sshf-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  overflow: visible;
}

.sshf-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sshf-mode {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 11px;
  color: var(--text);
  text-align: left;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 60ms ease;
}

.sshf-mode:hover {
  background: var(--hover);
}

.sshf-mode:active {
  transform: translateY(1px);
}

.sshf-mode.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.sshf-mode .m-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sshf-mode .m-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.sshf-mode.active .m-flag {
  color: var(--surface);
  background: var(--accent);
  box-shadow: none;
}

.sshf-mode .m-name {
  font-size: 13px;
  font-weight: 650;
}

.sshf-mode .m-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  color: var(--surface);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  background: var(--text-muted);
  border-radius: 999px;
}

.sshf-mode.active .m-badge {
  background: var(--accent);
}

.sshf-mode .m-desc {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.sshf-diagram {
  position: relative;
  box-sizing: border-box;
  height: 156px;
  padding: 20px 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 50% -20%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 65%),
    var(--surface-muted);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.sshf-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 102px;
}

.sshf-node {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 110px;
}

.sshf-tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.sshf-tile.pc { background: linear-gradient(160deg, #54545a, #2a2a2e); }
.sshf-tile.server { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 88%, #fff), color-mix(in srgb, var(--accent) 78%, #000)); }
.sshf-tile.globe { background: linear-gradient(160deg, #8a8f99, #5b606b); }

.sshf-cap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-width: 100%;
  text-align: center;
}

.sshf-cap .role {
  max-width: 108px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.sshf-cap .ep {
  max-width: 108px;
  overflow: hidden;
  color: var(--text-muted);
  font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sshf-tile.listen::after {
  position: absolute;
  inset: -5px;
  border: 1.5px solid var(--accent);
  border-radius: 18px;
  animation: sshf-pulse 2s ease-out infinite;
  content: "";
}

.sshf-listen-chip {
  position: absolute;
  top: -9px;
  left: 50%;
  display: inline-flex;
  gap: 3px;
  align-items: center;
  padding: 2px 6px;
  color: #fff;
  font-size: 8.5px;
  font-weight: 750;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--green);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
}

.sshf-listen-chip i {
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
}

.sshf-track {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 44px;
  height: 54px;
}

.sshf-rail {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 6px;
  background: color-mix(in srgb, var(--text-muted) 32%, transparent);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--border);
  transform: translateY(-50%);
}

.sshf-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  animation: sshf-flow 1.8s linear infinite;
}

.sshf-dot.two { animation-delay: 0.6s; }
.sshf-dot.three { animation-delay: 1.2s; }
.sshf-track.rtl .sshf-dot { animation-direction: reverse; }

@keyframes sshf-pulse {
  0% { opacity: 0.55; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(1.18); }
}

@keyframes sshf-flow {
  0% { left: 2%; opacity: 0; transform: scale(0.6); }
  12%, 88% { opacity: 1; transform: scale(1); }
  100% { left: 98%; opacity: 0; transform: scale(0.6); }
}

@media (prefers-reduced-motion: reduce) {
  .sshf-dot,
  .sshf-tile.listen::after,
  .fan-wires path {
    animation: none;
  }
}

.sshf-fan {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin-left: -22px;
}

.sshf-fan.left {
  margin-right: -22px;
  margin-left: 0;
}

.fan-wires {
  flex: 0 0 auto;
  overflow: visible;
  color: color-mix(in srgb, var(--accent) 55%, var(--text-muted));
}

.fan-wires path {
  stroke-dasharray: 2.5 4;
  animation: sshf-fan-flow 1.8s linear infinite;
}

@keyframes sshf-fan-flow {
  to { stroke-dashoffset: -13; }
}

.sshf-targets {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 7px;
  justify-content: center;
  max-width: 104px;
  max-height: 100%;
}

.sshf-targets.dense {
  gap: 6px;
  max-width: 34px;
}

.tg-node {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  height: 32px;
}

.sshf-targets.dense .tg-node { height: 24px; }

.tg-ico {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--surface);
  font-size: 11px;
  font-weight: 700;
  background: color-mix(in srgb, var(--text-muted) 82%, var(--surface));
  border-radius: 9px;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--text) 18%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--surface) 18%, transparent);
}

.sshf-targets.dense .tg-ico {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

.tg-cap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sshf-fan.left .tg-node { flex-direction: row-reverse; }
.sshf-fan.left .tg-cap { align-items: flex-end; text-align: right; }

.tg-cap .nm {
  max-width: 64px;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-node.more .tg-ico {
  color: var(--text-muted);
  background: var(--surface-muted);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.sshf-active {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sa-head {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 0 1px 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.sa-count {
  padding: 1px 7px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  background: var(--surface-muted);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.sa-empty {
  padding: 4px 2px 2px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.sa-list {
  display: flex;
  flex-direction: column;
  max-height: 168px;
  overflow-y: auto;
}

.sa-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 30px minmax(0, 1fr) 56px 38px 24px;
  gap: 8px;
  align-items: center;
  padding: 9px 2px 9px 4px;
  border-bottom: 1px solid var(--border);
}

.sa-row:first-child {
  border-top: 1px solid var(--border);
}

.sa-dot {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
}

.sa-dot.active {
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent);
}

.sa-failed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
}

.sa-row.failed .sa-time {
  color: var(--amber);
}

.sa-local,
.sa-remote {
  overflow: hidden;
  color: var(--text);
  font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sa-endpoint-link {
  min-width: 0;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-underline-offset: 2px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.sa-endpoint-link:hover,
.sa-endpoint-link:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
  outline: none;
}

.sa-remote,
.sa-time {
  color: var(--text-muted);
  text-align: right;
}

.sa-arr {
  display: inline-flex;
  justify-content: center;
  color: var(--text-muted);
}

.sa-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sa-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.sa-del:hover {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 14%, transparent);
}

.sshf-pairs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sshf-pairs.one {
  grid-template-columns: 1fr;
}

.sshf-pair {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 13px;
  background: var(--surface-muted);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.sshf-pair .pair-h {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
}

.sshf-pair .pdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.sshf-pair .pdot.listen {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sshf-pair .pdot.dest {
  background: var(--text-muted);
}

.sshf-pair small {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.sshf-row3 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 9px;
  align-items: end;
}

.sshf-pair .kk-inp {
  background: var(--surface);
}

.sshf-editable-dropdown {
  position: relative;
}

.sshf-editable-dropdown .kk-inp {
  padding-right: 34px;
}

.sshf-editable-dropdown-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 30px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-left: 1px solid transparent;
  border-radius: 0 7px 7px 0;
  cursor: pointer;
}

.sshf-editable-dropdown-toggle:hover,
.sshf-editable-dropdown-toggle[aria-expanded="true"] {
  color: var(--text);
  background: var(--hover);
  border-left-color: var(--border);
}

.sshf-editable-dropdown-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  width: 300px;
  max-width: calc(100vw - 64px);
  max-height: min(240px, 40vh);
  padding: 4px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sshf-editable-dropdown-menu button {
  width: 100%;
  padding: 7px 9px;
  color: var(--text);
  font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.sshf-editable-dropdown-menu button:hover,
.sshf-editable-dropdown-menu button.selected {
  background: var(--accent-soft);
}

.sshf-cmd {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 11px;
  color: #e6edf6;
  background: #11141a;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.sshf-cmd .cmd-prompt {
  flex: 0 0 auto;
  color: var(--green);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12.5px;
}

.sshf-cmd code {
  min-width: 0;
  overflow-x: auto;
  font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  scrollbar-width: none;
}

.terminal-recording-status {
  align-items: center;
  color: #ff7070;
  display: inline-flex;
  font-size: 11px;
  font-weight: 750;
  height: 24px;
  line-height: 1;
  padding: 0 4px;
}

.terminal-recordings-backdrop {
  align-items: flex-start;
  background: rgba(12, 18, 25, 0.34);
  display: flex;
  inset: 28px 0 0;
  justify-content: center;
  padding-top: 42px;
  position: absolute;
  z-index: 8;
}

.terminal-recordings-dialog {
  background: var(--chrome);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text);
  max-height: min(460px, calc(100% - 32px));
  overflow: hidden;
  width: min(620px, calc(100% - 48px));
}

.terminal-recordings-dialog header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 10px 8px 14px;
}

.terminal-recordings-dialog header > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.terminal-recordings-dialog strong,
.terminal-recordings-dialog small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-recordings-dialog small {
  color: var(--text-muted);
  font-size: 11px;
}

.terminal-recordings-dialog > p {
  color: var(--text-muted);
  margin: 0;
  padding: 14px;
}

.terminal-recordings-actions {
  display: inline-flex;
  gap: 4px;
}

.terminal-recordings-list {
  display: grid;
  max-height: 380px;
  overflow: auto;
  padding: 6px;
}

.terminal-recording-row {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  display: grid;
  gap: 10px;
  grid-template-columns: 18px minmax(0, 1fr);
  min-height: 42px;
  padding: 7px 8px;
  text-align: left;
}

.terminal-recording-row:hover {
  background: var(--surface);
}

.terminal-recording-row > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.toolbar-icon-button {
  width: 32px;
  padding: 0;
}

.terminal-pane-close:hover {
  color: #ff7070;
  background: rgba(255, 100, 100, 0.12);
}

.terminal-search-bar {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) minmax(54px, auto) repeat(3, 24px);
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 6px 8px;
  background: rgba(9, 14, 21, 0.9);
  border-bottom: 1px solid var(--terminal-border);
}

.terminal-search-bar input {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  color: #d9e2ef;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(128, 153, 184, 0.28);
  border-radius: 5px;
  font-size: 12px;
  outline: none;
}

.terminal-search-bar input:focus {
  border-color: #5aa0ff;
}

.terminal-search-count {
  min-width: 54px;
  color: #95a7bb;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.terminal-search-count.empty {
  color: #f28b82;
}

.terminal-pane pre,
.approval-card pre,
.assistant-message-text-attachment pre,
.assistant-selection-context pre,
.proposal-context-details pre {
  margin: 0;
  overflow: auto;
  font-family: "Cascadia Mono", "SF Mono", "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.58;
}

.terminal-pane pre {
  padding: 14px;
}

.terminal-pane code {
  color: #d9e2ef;
}

.xterm-host {
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--terminal-surface-background, rgba(12, 18, 25, 0.95));
}

.xterm-host .xterm {
  height: 100%;
  padding: 8px;
}

.xterm-host .xterm .xterm-viewport {
  background-color: transparent;
}

.xterm-host .xterm .xterm-viewport::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sftp-popup-dialog-backdrop {
  padding: 24px;
}

.connection-dialog.sftp-popup-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(90vw, calc(100vw - 48px));
  height: min(90vh, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
  /* One consistent surface for the whole dialog (the grey field the panes
     sit on); the white panes/toolbar/transfer bar are the only cards. */
  background: var(--app-bg);
}

/* No separate dialog header — the SFTP titlebar (with the close button) is the
   single top row, rendered inside the workspace below. */
.sftp-popup-dialog-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px 12px 12px;
}

.sftp-popup-dialog-body .sftp-workspace {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.local-terminal-popup-dialog-body .terminal-workspace {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.connection-dialog.sftp-popup-dialog.local-terminal-popup-dialog {
  background: var(--chrome-strong);
  border-color: var(--terminal-border);
}

.connection-dialog.sftp-popup-dialog .local-terminal-popup-dialog-body {
  padding: 0;
}

.terminal-connection-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.terminal-pane > .terminal-connection-background {
  inset: 34px 0 0;
}

.terminal-pane-search-open .terminal-connection-background {
  inset-block-start: 74px;
}

.terminal-bg-layer-fill,
.terminal-bg-layer-fill video,
.terminal-connection-background .dw-dynamic-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.terminal-bg-media::after {
  position: absolute;
  inset: 0;
  display: block;
  background: var(--terminal-bg-dim-color, transparent);
  content: "";
}

.xterm-host {
  position: relative;
  z-index: 1;
}

.terminal-bg-popover {
  z-index: 260;
}

.terminal-opacity-panel {
  min-width: 210px;
  padding: 10px;
}

.terminal-opacity-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.terminal-opacity-control input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.terminal-connection-background .dw-canvas-bg {
  inset: 0;
}

.terminal-connection-background .dw-canvas-bg::after {
  background: transparent;
}

/* Quick Select mode: keyboard or pointer-driven actions on visible tokens. */
.terminal-quick-select-overlay {
  position: absolute;
  inset: 0;
  z-index: 240;
  outline: none;
  cursor: default;
}

.terminal-quick-select-hint {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transform: translateY(-2px);
  padding: 0 4px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  line-height: 16px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.terminal-quick-select-hint:hover,
.terminal-quick-select-hint:focus-visible {
  background: var(--surface-muted);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}

.terminal-quick-select-hint strong {
  color: var(--accent);
  font-weight: 750;
  text-transform: uppercase;
}

.terminal-quick-select-hint-text {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.terminal-quick-select-help {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

/* Color scheme submenu: long curated list needs its own scroll. */
.terminal-color-scheme-panel {
  width: max-content;
  min-width: 220px;
  max-height: min(420px, 60vh);
  overflow-y: auto;
}

.terminal-color-scheme-panel .terminal-menu-item {
  white-space: nowrap;
}

.terminal-color-scheme-item:hover:not(:disabled),
.terminal-color-scheme-item:focus-visible {
  filter: brightness(1.14);
  box-shadow: inset 0 0 0 2px currentColor;
  outline: none;
}

.terminal-color-scheme-check {
  margin-left: auto;
  color: inherit;
}


/* OSC 133 exit-status gutter mark on failed commands. */
.terminal-command-failed-mark {
  width: 4px !important;
  border-radius: 2px;
  background: var(--terminal-failed-mark-color, var(--red));
  opacity: 0.85;
  pointer-events: none;
}
