* {
  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;
}

/* Workspace icon sits to the left of the panel title, mirroring the rail. */
.sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sidebar-title h1 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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 {
  --button-shadow-color: var(--border-strong);
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  box-shadow: var(--button-shadow);
}

.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 {
  --button-shadow-color: var(--border-strong);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--button-shadow);
}

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

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

.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 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 560;
  letter-spacing: -0.005em;
  transition: background 0.12s, border-color 0.12s, transform 0.04s, box-shadow 0.12s;
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(0.5px);
}

.primary-button {
  --button-shadow-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
  border: 0.5px solid transparent;
  box-shadow: var(--button-shadow);
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-press);
}

.secondary-button {
  --button-shadow-color: var(--border-strong);
  color: var(--text);
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  box-shadow: var(--button-shadow);
}

.secondary-button:hover:not(:disabled) {
  background: var(--hover);
}

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

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


.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  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: 130;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background:
    radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%),
    rgba(15, 23, 42, 0.32);
}

[data-color-scheme="dark"] .connection-dialog-backdrop,
[data-color-scheme="purple"] .connection-dialog-backdrop,
[data-color-scheme="blue-see"] .connection-dialog-backdrop {
  background:
    radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    rgba(0, 0, 0, 0.5);
}

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

.connection-dialog {
  gap: 10px;
  width: min(560px, calc(100vw - 40px));
  padding: 14px;
  overflow: hidden;
  background: var(--surface);
  border-color: var(--border);
  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: normal;
  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;
}

.app-update-notes h1,
.app-update-notes h2,
.app-update-notes h3,
.app-update-notes h4,
.app-update-notes h5,
.app-update-notes h6,
.app-update-notes p,
.app-update-notes ul,
.app-update-notes ol,
.app-update-notes blockquote,
.app-update-notes table {
  margin: 0 0 0.65em;
}

.app-update-notes > :last-child {
  margin-bottom: 0;
}

.app-update-notes h1,
.app-update-notes h2,
.app-update-notes h3,
.app-update-notes h4,
.app-update-notes h5,
.app-update-notes h6 {
  font-size: 0.95rem;
}

.app-update-notes ul,
.app-update-notes ol {
  padding-left: 1.25rem;
}

.app-update-notes :not(pre) > code {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.app-update-notes pre {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  background: var(--surface);
}

.app-update-notes a {
  color: var(--accent);
}

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

.approve-button.danger {
  --button-shadow-color: var(--red);
  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;
}

/* Form-field labels above use a stacked grid, but a `.search-box` label is a
   horizontal row (magnifier + input). Keep it flex so the input stays to the
   right of the icon instead of dropping below it and overflowing the row. */
.connection-dialog label.search-box,
.settings-section label.search-box {
  display: flex;
  gap: 8px;
}

.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: 32px;
  padding: 0 11px;
  color: var(--text);
  background: var(--surface-muted);
  border: 0.5px solid var(--border-strong);
  border-radius: 8px;
  outline: 0;
  font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

:is(.connection-dialog, .settings-dialog, .settings-section)
  :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    select,
    textarea
  ) {
  --control-shadow-color: var(--border-strong);
  box-shadow: var(--control-shadow);
}

/* Connection-dialog fields sit on the white sheet with a hairline border —
   a white fill, not a grey one (design language). */
.connection-dialog input,
.connection-dialog select,
.connection-dialog textarea {
  background: var(--surface);
}

.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: var(--ring);
}

:is(.connection-dialog, .settings-dialog, .settings-section)
  :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    select,
    textarea
  ):focus {
  box-shadow: var(--ring), var(--control-shadow);
}

.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;
}

.connection-dialog .input-with-button .toolbar-button {
  height: 32px;
}

.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;
}
