.terminal-monogram svg,
.local-ssh-toolbar svg,
.local-ssh-connect-button svg,
.local-ssh-password button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.local-ssh-sheet {
  --local-visible-height: 100dvh;
  --local-viewport-top: 0px;
  position: fixed;
  inset: 0;
  z-index: 320;
  display: none;
  color: #242a35;
  background: #e5eaed;
}

.local-ssh-sheet.open { display: block; }
.local-ssh-sheet > .sheet-backdrop { display: none; }
.local-ssh-panel {
  position: absolute;
  top: var(--local-viewport-top);
  left: 0;
  display: flex;
  width: 100%;
  height: var(--local-visible-height);
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #e5eaed;
}

.local-ssh-toolbar {
  display: grid;
  min-height: 72px;
  flex: 0 0 auto;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: #e5eaed;
}

.local-ssh-tool-button {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: #65717b;
  background: #d5dee2;
  font: 400 34px/1 system-ui, sans-serif;
}

.local-ssh-tool-button svg { width: 27px; height: 27px; stroke-width: 2.4; }
.local-ssh-add { padding-bottom: 3px; }
.local-ssh-tool-button:active { transform: scale(.96); background: #ccd7dc; }

.local-ssh-current {
  display: grid;
  min-width: 0;
  height: 48px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 14px;
  background: #cbd4dc;
}

.local-ssh-current > svg { width: 25px; height: 25px; color: #424957; }
.local-ssh-current > strong {
  overflow: hidden;
  color: #303542;
  font: 650 16px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#disconnectLocalSsh {
  width: 22px;
  padding: 4px 0;
  border: 0;
  color: #8b4650;
  background: transparent;
  font: 800 22px/1 system-ui, sans-serif;
}

.local-ssh-body { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.local-ssh-library,
.local-ssh-connect { box-sizing: border-box; width: min(100%, 620px); margin: 0 auto; }
.local-ssh-library { padding: 28px 18px calc(28px + env(safe-area-inset-bottom)); }
.local-ssh-library > header span,
.local-ssh-form-head span { color: #697780; font-size: 10px; font-weight: 750; letter-spacing: .16em; }
.local-ssh-library h2,
.local-ssh-form-head h2 { margin: 5px 0 0; color: #252c36; font-size: 25px; letter-spacing: -.035em; }
.local-ssh-library > header p { margin: 8px 0 0; color: #6b7780; font-size: 13px; line-height: 1.55; }
.local-ssh-profiles { display: grid; gap: 10px; margin-top: 24px; }
.local-ssh-empty { padding: 34px 18px; border: 1px dashed #bcc8ce; border-radius: 18px; color: #74818a; text-align: center; font-size: 13px; }

.local-ssh-profile {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(63, 75, 83, .1);
  border-radius: 18px;
  background: rgba(255,255,255,.62);
  box-shadow: 0 8px 24px rgba(68, 81, 90, .07);
}

.local-ssh-profile-connect {
  display: grid;
  min-width: 0;
  min-height: 76px;
  flex: 1;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 10px 12px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.local-ssh-profile-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  color: #e9f6f1;
  background: #315c51;
  font: 700 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.local-ssh-profile-copy { display: grid; min-width: 0; gap: 5px; }
.local-ssh-profile-copy strong,
.local-ssh-profile-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-ssh-profile-copy strong { font-size: 15px; }
.local-ssh-profile-copy small { color: #748089; font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.local-ssh-profile-state { color: #3b7466; font-size: 11px; font-style: normal; font-weight: 700; }
.local-ssh-profile.connecting .local-ssh-profile-state { animation: localPulse 1s ease-in-out infinite alternate; }
.local-ssh-profile-delete { width: 38px; border: 0; color: #9b6a70; background: transparent; font-size: 20px; }

.local-ssh-connect { display: grid; gap: 16px; padding: 24px 18px calc(28px + env(safe-area-inset-bottom)); overflow-y: auto; }
.local-ssh-form-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 6px; }
.local-ssh-form-head button { padding: 8px 0 4px 14px; border: 0; color: #52636d; background: transparent; font-weight: 650; }
.local-ssh-field { display: grid; min-width: 0; gap: 7px; }
.local-ssh-field > span:first-child { color: #65727b; font-size: 12px; font-weight: 650; }
.local-ssh-field input {
  box-sizing: border-box;
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid rgba(68, 82, 91, .14);
  border-radius: 13px;
  outline: none;
  color: #252c36;
  background: rgba(255,255,255,.72);
  font: inherit;
}
.local-ssh-field input:focus { border-color: #628f83; box-shadow: 0 0 0 3px rgba(49,92,81,.1); }
.local-ssh-field input::placeholder { color: #8b979e; }
.local-ssh-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 12px; }
.local-ssh-password { position: relative; display: block; }
.local-ssh-password input { padding-right: 52px; }
.local-ssh-password button { position: absolute; top: 6px; right: 6px; display: grid; width: 40px; height: 40px; padding: 0; place-items: center; border: 0; color: #697780; background: transparent; }
.local-ssh-password button svg { width: 20px; height: 20px; }
.local-ssh-hint { display: flex; align-items: center; gap: 7px; margin: -2px 0 0; color: #6b7780; font-size: 11px; }
.local-ssh-hint i { width: 7px; height: 7px; border-radius: 50%; background: #2a9f80; box-shadow: 0 0 0 4px rgba(42,159,128,.1); }
.local-ssh-hint b { margin-left: auto; font-weight: 650; }
.local-ssh-connect-button { display: flex; min-height: 54px; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 14px; color: #f4f7f6; background: #293c38; font: inherit; font-weight: 700; }
.local-ssh-connect-button svg { width: 19px; height: 19px; }
.local-ssh-connect-button:disabled { opacity: .55; }

.local-terminal[hidden],
.local-ssh-library[hidden],
.local-ssh-connect[hidden],
.local-sftp[hidden],
#disconnectLocalSsh[hidden] { display: none !important; }

.local-terminal { display: grid; min-height: 0; flex: 1; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; background: #e5eaed; }
#localTerminalOutput { box-sizing: border-box; min-width: 0; min-height: 0; padding: 14px 12px 6px; overflow: hidden; outline: 0; background: #e5eaed; touch-action: manipulation; -webkit-touch-callout: none; }
#localTerminalOutput .xterm { height: 100%; }
#localTerminalOutput .xterm-viewport { background: #e5eaed !important; scrollbar-color: #a8b3b9 transparent; scrollbar-width: thin; }
#localTerminalOutput .xterm-screen { min-height: 100%; }

.local-terminal-context {
  position: fixed;
  z-index: 3200;
  display: flex;
  min-height: 46px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 13px;
  background: rgba(34,36,58,.97);
  box-shadow: 0 12px 32px rgba(25,30,38,.28);
  animation: localContextIn .14s ease-out;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.local-terminal-context[hidden] { display: none !important; }
.local-terminal-context button {
  min-width: 58px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid rgba(255,255,255,.07);
  color: #f2f3f7;
  background: transparent;
  font: 650 13px system-ui, sans-serif;
}
.local-terminal-context button:last-child { border-right: 0; }
.local-terminal-context button:active { border-radius: 9px; background: rgba(255,255,255,.12); }

.local-terminal-tools {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: stretch;
  gap: 0;
  padding: 0 0 env(safe-area-inset-bottom);
  overflow-x: auto;
  background: #22243a;
  scrollbar-width: none;
}
.local-terminal-tools::-webkit-scrollbar { display: none; }
.local-terminal-tools button {
  min-width: 39px;
  min-height: 58px;
  flex: 1 1 48px;
  padding: 0 4px;
  border: 0;
  border-right: 1px solid rgba(255,255,255,.045);
  color: #f0f1f5;
  background: transparent;
  font: 650 10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.local-terminal-tools button:active,
.local-terminal-tools button.active { color: #fff; background: #30334e; }
#localTerminalKeyboard { font-size: 20px; }
#localTerminalClear { color: #cbd0dc; }
.local-ssh-sheet.keyboard-open .local-terminal-tools { padding-bottom: 0; }

.local-sftp { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; background: #edf1f3; }
.local-sftp-head { display: grid; min-height: 62px; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid rgba(54,67,76,.1); }
.local-sftp-head > button { min-width: 42px; height: 40px; padding: 0 10px; border: 0; border-radius: 11px; color: #4d5d67; background: #dce4e8; font-weight: 700; }
.local-sftp-head > button svg { width: 22px; height: 22px; }
.local-sftp-head > div { display: grid; min-width: 0; gap: 2px; }
.local-sftp-head span { color: #738089; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.local-sftp-head strong { overflow: hidden; color: #303744; font: 600 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.local-sftp-parent { min-height: 42px; padding: 0 18px; border: 0; border-bottom: 1px solid rgba(54,67,76,.08); color: #51656f; background: rgba(255,255,255,.4); text-align: left; font-weight: 650; }
.local-sftp-list { display: grid; align-content: start; gap: 1px; min-height: 0; padding: 8px 10px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; }
.local-sftp-list > p { padding: 32px 12px; color: #74818a; text-align: center; font-size: 12px; }
.local-sftp-entry { display: grid; min-height: 56px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 0 4px 0 10px; border-bottom: 1px solid rgba(54,67,76,.075); }
.local-sftp-open { display: grid; min-width: 0; min-height: 52px; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; padding: 0; border: 0; color: #2d3540; background: transparent; text-align: left; }
.local-sftp-open > i { font-size: 21px; font-style: normal; }
.local-sftp-open > span { display: grid; min-width: 0; gap: 4px; }
.local-sftp-open strong, .local-sftp-open small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-sftp-open strong { font-size: 13px; }
.local-sftp-open small { color: #7c888f; font-size: 10px; }
.local-sftp-download { min-width: 48px; height: 36px; border: 0; border-radius: 10px; color: #426b60; background: #dce8e4; font-size: 11px; font-weight: 700; }

@keyframes localPulse { to { opacity: .45; } }
@keyframes localContextIn { from { opacity: 0; transform: translateY(4px) scale(.97); } }
@media (prefers-reduced-motion: reduce) {
  .local-terminal-context { animation: none; }
}
@media (min-width: 760px) {
  .local-ssh-toolbar { grid-template-columns: 52px minmax(0, 520px) 52px; justify-content: center; }
  .local-ssh-panel { left: 50%; width: min(100%, 960px); transform: translateX(-50%); box-shadow: 0 0 70px rgba(36,46,53,.18); }
}
@media (orientation: landscape) and (max-height: 560px) {
  .local-ssh-toolbar { min-height: 56px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .local-ssh-tool-button, .local-ssh-current { height: 42px; }
  .local-terminal-tools, .local-terminal-tools button { min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .local-ssh-profile.connecting .local-ssh-profile-state { animation: none; }
}
