* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
  margin: 0;
}

html,
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}


.sidebar-header,
.assistant-header,
.workspace-toolbar,
.file-pane header,
.transfer-queue header,
.approval-card header,
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.add-connection-anchor {
  display: inline-flex;
}

.sidebar-header {
  min-height: 28px;
}

.sidebar-header h1 {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.connection-sidebar .icon-button {
  width: 27px;
  height: 27px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.connection-sidebar .icon-button:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.connection-sidebar .icon-button:disabled {
  color: var(--text-faint);
  background: transparent;
  cursor: not-allowed;
}

.panel-label {
  margin: 0 0 3px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
}

.icon-button {
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface);
}

.icon-button:disabled {
  color: var(--text-faint);
  background: var(--surface-muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.search-box {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 34px;
  margin: 18px 0 10px;
  padding: 0 10px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
}


.toolbar-button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

.toolbar-button:disabled {
  color: var(--text-faint);
  background: var(--surface-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.approve-button {
  color: #ffffff;
  background: var(--green);
}

.approve-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.terminal-menu-wrapper {
  position: relative;
  display: inline-flex;
}

.terminal-menu > .terminal-menu-wrapper,
.terminal-menu > .tmux-session-wrapper {
  display: flex;
  width: 100%;
}

.terminal-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  display: grid;
  min-width: 180px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  box-shadow: var(--shadow);
  padding: 4px 0;
}

.terminal-menu.app-launcher-menu {
  position: fixed;
  right: auto;
  z-index: 160;
  width: max-content;
}

.terminal-menu.ai-coding-add-menu {
  position: fixed;
  right: auto;
  z-index: 160;
  width: max-content;
}

.terminal-menu-item {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 30px;
  padding: 6px 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.terminal-menu-item:hover:not(:disabled) {
  background: var(--surface-muted);
}

.terminal-menu-item:disabled {
  color: var(--text-faint);
  cursor: default;
}

.terminal-menu-chevron {
  margin-left: auto;
}

.terminal-menu-submenu {
  position: relative;
}

.terminal-menu-submenu::after {
  position: absolute;
  top: 0;
  left: -8px;
  width: 8px;
  height: 100%;
  content: "";
}

.terminal-menu-submenu-panel {
  position: absolute;
  top: -5px;
  right: calc(100% + 4px);
  display: none;
  min-width: 160px;
}

.terminal-menu-submenu:hover .terminal-menu-submenu-panel,
.terminal-menu-submenu:focus-within .terminal-menu-submenu-panel {
  display: grid;
}


.terminal-context-menu,
.sftp-context-menu,
.tree-context-menu {
  position: fixed;
  z-index: 40;
  display: grid;
  width: 170px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.tree-context-menu {
  overflow: visible;
}

.terminal-context-menu button,
.sftp-context-menu button,
.tree-context-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.terminal-context-menu button:last-child,
.sftp-context-menu button:last-child,
.tree-context-menu button:last-child {
  border-bottom: 0;
}

.terminal-context-menu button:hover:not(:disabled),
.sftp-context-menu button:hover:not(:disabled),
.tree-context-menu button:hover:not(:disabled) {
  background: var(--surface-muted);
}

.terminal-context-menu button:disabled,
.sftp-context-menu button:disabled,
.tree-context-menu button:disabled {
  color: var(--text-faint);
  cursor: default;
}

.terminal-context-menu {
  z-index: 60;
  width: 190px;
}

.terminal-context-menu button {
  justify-content: space-between;
}

.terminal-context-menu .menu-item-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.terminal-context-menu kbd {
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
}

.tree-context-menu button {
  justify-content: flex-start;
}

.tree-context-menu .menu-item-icon {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.tree-context-menu button:hover:not(:disabled) .menu-item-icon {
  color: var(--text);
}

.tree-context-submenu {
  position: relative;
}

.tree-context-submenu::after {
  position: absolute;
  top: 0;
  left: 100%;
  width: 8px;
  height: 100%;
  content: "";
}

.tree-context-submenu-menu {
  position: absolute;
  top: -1px;
  left: calc(100% + 4px);
  z-index: 41;
  display: none;
  width: 180px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.tree-context-menu .menu-shortcut {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.tree-context-submenu:hover .tree-context-submenu-menu,
.tree-context-submenu:focus-within .tree-context-submenu-menu {
  display: grid;
}

.tree-context-menu .tree-submenu-trigger {
  width: 100%;
}

.tree-context-menu .menu-item-chevron {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--text-muted);
}

.tree-context-menu button:hover:not(:disabled) .menu-item-chevron {
  color: var(--text);
}


.primary-button,
.secondary-button {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.secondary-button {
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.secondary-button.danger {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: default;
  opacity: 0.55;
}


.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 26% 18%, rgba(37, 99, 235, 0.2), transparent 30%),
    radial-gradient(
      circle at 72% 82%,
      rgba(192, 38, 211, 0.16),
      transparent 32%
    ),
    rgba(15, 23, 42, 0.34);
}

.connection-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background: rgba(15, 23, 42, 0.18);
}

.connection-dialog,
.settings-dialog {
  display: grid;
  gap: 11px;
  padding: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.connection-dialog {
  gap: 10px;
  width: min(560px, calc(100vw - 40px));
  padding: 14px;
  overflow: hidden;
  background: var(--chrome);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.connection-dialog-backdrop .connection-dialog {
  width: min(560px, calc(100vw - 40px));
  min-width: 0;
  padding: 14px;
  box-shadow: var(--shadow);
}

.connection-dialog-backdrop .connection-dialog-wide {
  width: min(900px, calc(100vw - 40px));
}

.connection-dialog-backdrop .app-update-dialog {
  width: min(520px, calc(100vw - 40px));
}

.connection-dialog-backdrop .app-confirm-dialog {
  width: min(420px, calc(100vw - 40px));
}

.app-confirm-message {
  margin: 0;
  white-space: pre-wrap;
}

.app-update-notes {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.45;
}

.settings-dialog {
  width: min(460px, calc(100vw - 40px));
}

.approve-button.danger {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.approve-button.danger:hover {
  opacity: 0.88;
}


.connection-dialog label,
.settings-section label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.connection-dialog label span,
.settings-section label span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.field-hint {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.35;
}

.connection-dialog input,
.connection-dialog select,
.connection-dialog textarea,
.settings-dialog input,
.settings-dialog select,
.settings-section input,
.settings-section select,
.settings-section textarea {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
  font-size: 13px;
}

.connection-dialog textarea {
  height: auto;
  min-height: 82px;
  padding: 7px 8px;
  resize: vertical;
}

.settings-section label {
  gap: 5px;
}

.settings-section label span {
  font-size: 13px;
}

.settings-dialog input,
.settings-dialog select,
.settings-section input,
.settings-section select {
  height: 34px;
  padding: 0 9px;
  font-size: 14px;
}

.settings-section textarea {
  min-height: 96px;
  height: auto;
  padding: 8px 9px;
  resize: vertical;
}

.settings-section textarea.ai-custom-instructions-textarea {
  background: #ffffff;
}

.connection-dialog input:focus,
.connection-dialog select:focus,
.connection-dialog textarea:focus,
.settings-dialog input:focus,
.settings-dialog select:focus,
.settings-section input:focus,
.settings-section select:focus,
.settings-section textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.connection-dialog input:disabled,
.connection-dialog select:disabled,
.connection-dialog .connection-session-toggle input[type="checkbox"]:disabled {
  color: var(--text-faint);
  cursor: default;
  background: var(--surface-muted);
  opacity: 0.72;
}

.connection-dialog .connection-session-toggle input[type="checkbox"]:disabled::after {
  background: var(--text-faint);
}

:root:not([data-color-scheme]) .settings-section input:not([readonly]):not(:disabled),
:root:not([data-color-scheme]) .settings-section select:not(:disabled),
[data-color-scheme="default"] .settings-section input:not([readonly]):not(:disabled),
[data-color-scheme="default"] .settings-section select:not(:disabled) {
  background: var(--surface);
}

.settings-section input[readonly],
.settings-section input:disabled {
  color: var(--text-muted);
  cursor: default;
  background: var(--surface-muted);
}

.input-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.input-with-button.ssh-key-input-actions {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.input-with-button .toolbar-button {
  height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.settings-section .input-with-button .toolbar-button {
  height: 34px;
  padding: 0 12px;
}

.connection-dialog .dialog-actions {
  justify-content: flex-end;
  padding-top: 3px;
}

.connection-dialog .approve-button {
  min-width: 104px;
}

.ssh-key-email-dialog {
  width: min(420px, calc(100vw - 40px));
}

.ssh-key-email-dialog .dialog-actions {
  justify-content: flex-end;
}
