/* LobsterMane code workspace. Uses the dashboard's v7 (Viktor) design tokens. */

.code-embedded-host {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  container-type: inline-size;
}

.code-embedded-host > * {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.code-embedded-host .code-shell {
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.code-embedded-host .code-loading,
.code-embedded-host .code-unavailable {
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

@container (max-width: 760px) {
  .code-embedded-host .code-shell {
    isolation: isolate;
  }

  .code-embedded-host .code-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(310px, 86%) !important;
    max-width: 86%;
    margin-left: 0 !important;
    border-right: 1px solid var(--border-strong);
    box-shadow: 14px 0 36px rgba(26, 24, 43, 0.18);
    transform: translateX(0);
  }

  .code-embedded-host .code-shell.sidebar-closed .code-sidebar {
    transform: translateX(-105%);
    box-shadow: none;
  }

  .code-embedded-host .code-resizer {
    display: none;
  }

  .code-embedded-host .code-branch,
  .code-embedded-host .code-change-summary,
  .code-embedded-host .code-quick-open > span,
  .code-embedded-host .code-quick-open kbd {
    display: none;
  }

  .code-embedded-host .code-quick-open {
    width: 27px;
    padding: 0;
    border-color: transparent;
  }
}

.code-loading,
.code-unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 240px;
  margin: 0 10px 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-muted);
}

.code-unavailable {
  flex-direction: column;
  text-align: center;
  padding: 40px;
}

.code-unavailable > .icon {
  width: 30px;
  height: 30px;
  color: var(--text-faint);
}

.code-unavailable h2,
.code-unavailable p {
  margin: 0;
}

.code-unavailable h2 {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
}

.code-unavailable p {
  max-width: 420px;
  font-size: 13px;
}

.code-shell {
  position: relative;
  display: flex;
  height: 100%;
  min-height: 0;
  margin: 0 10px 10px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.code-sidebar {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-width: 480px;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface-muted);
  transition:
    margin-left 0.16s ease,
    transform 0.16s ease;
}

.code-shell.sidebar-closed .code-sidebar {
  margin-left: calc(-1 * var(--code-sidebar-width, 286px));
}

.code-sidebar-tabs {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 6px 7px 0;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.code-sidebar-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 0 9px;
  border: 0;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.code-sidebar-tab:hover {
  color: var(--text);
  background: var(--hover);
}

.code-sidebar-tab.active {
  color: var(--text);
  background: var(--surface-muted);
}

.code-sidebar-tab.active::after {
  content: '';
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.code-sidebar-tab .icon {
  width: 13px;
  height: 13px;
}

.code-sidebar-count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.code-sidebar-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.code-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 9px 5px 13px;
}

.code-sidebar-title {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

.code-sidebar-actions .conv-action {
  width: 23px;
  height: 23px;
}

.code-sidebar-search-wrap {
  position: relative;
  flex: 0 0 auto;
  padding: 3px 9px 8px;
}

.code-sidebar-search-wrap > .icon {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 19px;
  width: 13px;
  height: 13px;
  color: var(--text-faint);
  pointer-events: none;
}

.code-sidebar-filter {
  height: 30px;
  min-height: 30px;
  padding: 4px 11px 4px 31px;
  border-color: transparent;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-size: 12px;
}

.code-sidebar-filter:focus {
  border-color: var(--accent-line);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.code-tree,
.code-change-list,
.code-search-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 1px 7px 14px;
}

.code-tree-row {
  --tree-depth: 0;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 27px;
  padding: 2px 7px 2px calc(6px + var(--tree-depth) * 14px);
  gap: 5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  cursor: default;
}

.code-tree-row.file::before {
  content: '';
  width: 11px;
  flex: 0 0 11px;
}

.code-tree-row:hover {
  background: var(--hover);
  color: var(--text);
}

.code-tree-row.file {
  cursor: pointer;
}

.code-tree-row.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.code-tree-chevron {
  display: inline-grid;
  place-items: center;
  width: 11px;
  height: 15px;
  flex: 0 0 11px;
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  transform-origin: center;
  transition: transform 0.1s ease;
}

.code-tree-row.expanded .code-tree-chevron {
  transform: rotate(90deg);
}

.code-file-glyph {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 4px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.code-file-glyph.folder {
  position: relative;
  width: 15px;
  height: 11px;
  margin-inline: 0.5px;
  border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--warn) 13%, transparent);
}

.code-file-glyph.folder::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 1px;
  width: 7px;
  height: 4px;
  border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--warn) 13%, var(--surface-muted));
}

.code-file-glyph.ext-ts,
.code-file-glyph.ext-tsx {
  color: #2563a5;
  background: rgba(37, 99, 165, 0.09);
}

.code-file-glyph.ext-js,
.code-file-glyph.ext-jsx,
.code-file-glyph.ext-mjs,
.code-file-glyph.ext-cjs {
  color: #96710c;
  background: rgba(242, 194, 48, 0.13);
}

.code-file-glyph.ext-json {
  color: #8a6810;
}

.code-file-glyph.ext-css,
.code-file-glyph.ext-scss {
  color: #8b4fa5;
}

.code-file-glyph.ext-md,
.code-file-glyph.ext-mdx {
  color: #47718f;
}

.code-file-glyph.ext-yml,
.code-file-glyph.ext-yaml {
  color: #b45309;
}

.code-file-glyph.ext-png,
.code-file-glyph.ext-jpg,
.code-file-glyph.ext-jpeg,
.code-file-glyph.ext-gif,
.code-file-glyph.ext-webp {
  color: #5f8c3d;
}

.code-tree-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-tree-parent {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-tree-status {
  margin-left: auto;
  padding-left: 4px;
  color: var(--warn-text);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
}

.code-tree-status.status-untracked,
.code-change-kind.status-untracked {
  color: var(--ok-text);
}

.code-tree-status.status-deleted,
.code-change-kind.status-deleted {
  color: var(--danger-text);
}

.code-sidebar-empty,
.code-sidebar-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 86px;
  padding: 18px;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

.code-sidebar-error {
  color: var(--danger-text);
}

.code-search-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 28px 16px;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

kbd {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-faint);
  font-family: var(--font);
  font-size: 9.5px;
  line-height: 1;
}

.code-search-result {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 2px;
  margin-bottom: 3px;
  padding: 7px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.code-search-result:hover {
  background: var(--hover);
}

.code-search-result-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.code-search-result-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-search-result-line {
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: 9.5px;
}

.code-search-result-path {
  overflow: hidden;
  padding-left: 22px;
  color: var(--text-faint);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-search-preview {
  display: block;
  overflow: hidden;
  margin: 2px 0 0 22px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-change-list {
  padding-top: 3px;
}

.code-change-row {
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr) auto 14px;
  align-items: center;
  width: 100%;
  min-height: 39px;
  gap: 6px;
  padding: 4px 7px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.code-change-row:hover,
.code-change-row.active {
  background: var(--hover);
}

.code-change-row.active {
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.code-change-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.code-change-name,
.code-change-parent {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-change-name {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.code-change-parent {
  color: var(--text-faint);
  font-size: 9.5px;
}

.code-change-stats {
  display: flex;
  gap: 3px;
  font-family: var(--mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.code-change-stats .add {
  color: var(--ok-text);
}

.code-change-stats .del {
  color: var(--danger-text);
}

.code-change-kind {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--warn-text);
}

.code-clean-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 34px 16px;
  color: var(--text-faint);
  font-size: 11.5px;
  text-align: center;
}

.code-clean-state strong {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.code-clean-check {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid var(--ok-line);
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok-text);
  font-size: 13px;
}

.code-resizer {
  position: relative;
  z-index: 5;
  flex: 0 0 5px;
  width: 5px;
  margin-left: -3px;
  cursor: col-resize;
  touch-action: none;
}

.code-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 1px;
  background: transparent;
}

.code-resizer:hover::after,
.code-resizer:focus-visible::after,
body.code-resizing .code-resizer::after {
  background: var(--accent-line);
}

body.code-resizing {
  cursor: col-resize;
  user-select: none;
}

.code-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 46px;
  gap: 12px;
  padding: 6px 10px 6px 13px;
  border-bottom: 1px solid var(--border);
}

.code-toolbar-project,
.code-toolbar-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.code-project-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-shared-badge {
  height: 20px;
  font-size: 10px;
}

.code-branch,
.code-change-summary {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  height: 25px;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10.5px;
  white-space: nowrap;
}

.code-change-summary {
  cursor: pointer;
}

.code-change-summary:hover,
.code-change-summary.dirty {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.code-branch .icon,
.code-change-summary .icon {
  width: 12px;
  height: 12px;
}

.code-sync-count {
  font-family: var(--mono);
  font-size: 9px;
}

.code-toolbar-action {
  width: 27px;
  height: 27px;
}

.code-toolbar-action.active {
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.code-toolbar-action.spinning .icon {
  animation: code-spin 0.75s linear infinite;
}

@keyframes code-spin {
  to {
    transform: rotate(360deg);
  }
}

.code-quick-open {
  height: 28px;
  padding: 0 7px 0 10px;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
}

.code-quick-open .icon {
  width: 12px;
  height: 12px;
}

.code-quick-open kbd {
  margin-left: 5px;
  background: var(--surface-muted);
}

.code-wrap-icon {
  font-family: var(--mono);
  font-size: 14px;
}

.code-tabs {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  height: 36px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  scrollbar-width: none;
}

.code-tabs::-webkit-scrollbar {
  display: none;
}

.code-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 120px;
  max-width: 210px;
  height: 36px;
  flex: 0 1 170px;
  gap: 6px;
  padding: 0 7px 0 10px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}

.code-tab:hover {
  background: var(--hover);
  color: var(--text);
}

.code-tab.active {
  background: var(--surface);
  color: var(--text);
}

.code-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.code-tab-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-tab-state {
  width: 10px;
  flex: 0 0 10px;
  color: var(--accent-text);
  font-size: 8px;
  text-align: center;
}

.code-tab.saving .code-tab-state {
  font-size: 12px;
  animation: code-spin 0.75s linear infinite;
}

.code-tab.has-error .code-tab-state {
  color: var(--danger-text);
  font-size: 10px;
  font-weight: 700;
}

.code-tab-close {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 5px;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
}

.code-tab:hover .code-tab-close,
.code-tab.active .code-tab-close,
.code-tab:focus-within .code-tab-close {
  opacity: 1;
}

.code-tab-close:hover {
  background: var(--active);
  color: var(--text);
}

.code-tab.dirty .code-tab-close:not(:hover) {
  color: transparent;
  opacity: 1;
}

.code-tab.dirty .code-tab-close:not(:hover)::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.code-tabs-empty {
  display: flex;
  align-items: center;
  padding: 0 13px;
  color: var(--text-faint);
  font-size: 10.5px;
}

.code-surface-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 38px;
  gap: 12px;
  padding: 4px 9px 4px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.code-surface-head:empty {
  display: none;
}

.code-breadcrumbs {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.code-breadcrumb {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  padding: 2px 3px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.code-breadcrumb:hover {
  background: var(--hover);
  color: var(--text);
}

.code-breadcrumb.current {
  color: var(--text-secondary);
  font-weight: 500;
  cursor: default;
}

.code-breadcrumb-sep {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 14px;
}

.code-surface-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
}

.code-surface-actions .btn {
  height: 26px;
  padding-inline: 9px;
  gap: 5px;
  font-size: 10.5px;
}

.code-surface-actions .btn .icon {
  width: 12px;
  height: 12px;
}

.code-save-action {
  width: 25px;
  height: 25px;
}

.code-banner-host {
  flex: 0 0 auto;
}

.code-banner-host:empty {
  display: none;
}

.code-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 39px;
  padding: 6px 11px 6px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
}

.code-banner.conflict {
  border-color: rgba(217, 119, 6, 0.2);
  background: var(--warn-soft);
}

.code-banner.error {
  border-color: rgba(196, 35, 35, 0.18);
  background: var(--danger-soft);
}

.code-banner.warning {
  background: var(--surface-muted);
  color: var(--text-muted);
}

.code-banner-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.code-banner-copy strong {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.code-banner-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.code-banner .btn {
  height: 25px;
  padding-inline: 10px;
  font-size: 10.5px;
}

.code-surface {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.code-surface-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  gap: 9px;
  min-height: 160px;
  color: var(--text-faint);
  font-size: 12px;
}

.code-empty-surface {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 210px;
  padding: 32px;
  color: var(--text-faint);
  text-align: center;
}

.code-empty-surface > .icon {
  width: 31px;
  height: 31px;
  margin-bottom: 3px;
}

.code-empty-surface h2,
.code-empty-surface p {
  margin: 0;
}

.code-empty-surface h2 {
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
}

.code-empty-surface p {
  max-width: 380px;
  font-size: 12px;
}

.code-empty-surface.error > .icon,
.code-empty-surface.error p {
  color: var(--danger-text);
}

.code-image-preview {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  background-image:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
}

.code-image-preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-xs);
  object-fit: contain;
  box-shadow: 0 8px 28px rgba(26, 24, 43, 0.14);
}

.code-editor-host {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.code-editor-host .CodeMirror {
  height: 100%;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
}

.code-editor-host .CodeMirror-scroll {
  min-height: 100%;
}

.code-editor-host .CodeMirror-gutters {
  border-right: 1px solid var(--border);
  background: var(--surface-muted);
}

.code-editor-host .CodeMirror-linenumber {
  min-width: 31px;
  padding: 0 8px 0 5px;
  color: var(--text-faint);
  font-size: 10px;
}

.code-editor-host .CodeMirror-activeline-gutter .CodeMirror-linenumber {
  color: var(--accent-text);
}

.code-editor-host .CodeMirror-activeline-background {
  background: color-mix(in srgb, var(--text) 2.6%, transparent);
}

.code-editor-host .CodeMirror-selected,
.code-editor-host .CodeMirror-focused .CodeMirror-selected {
  background: var(--accent-ring);
}

.code-editor-host .CodeMirror-cursor {
  border-left-color: var(--accent);
}

.code-editor-host .CodeMirror-matchingbracket {
  border-bottom: 1px solid var(--accent);
  color: var(--accent-text) !important;
}

.code-editor-host .CodeMirror-foldmarker {
  color: var(--accent-text);
  text-shadow: none;
}

.code-editor-host .CodeMirror-foldgutter-open,
.code-editor-host .CodeMirror-foldgutter-folded {
  color: var(--text-faint);
}

.code-editor-host .cm-comment {
  color: #85818b;
}

.code-editor-host .cm-keyword,
.code-editor-host .cm-operator {
  color: #9a4d9c;
}

.code-editor-host .cm-string,
.code-editor-host .cm-string-2 {
  color: #9a5a2e;
}

.code-editor-host .cm-number,
.code-editor-host .cm-atom {
  color: #bf4f32;
}

.code-editor-host .cm-def,
.code-editor-host .cm-variable-2,
.code-editor-host .cm-property {
  color: #336d91;
}

.code-editor-host .cm-tag,
.code-editor-host .cm-attribute {
  color: #8a5d21;
}

.code-editor-host .cm-header {
  color: var(--text);
  font-weight: 700;
}

.code-editor-host .cm-link {
  color: var(--accent-text);
}

.code-editor-host .CodeMirror-dialog {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11px;
  box-shadow: var(--shadow-card);
}

.code-editor-host .CodeMirror-dialog input {
  width: auto;
  min-width: 220px;
  height: 26px;
  min-height: 26px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
}

.code-revealed-line {
  background: color-mix(in srgb, var(--accent) 13%, transparent) !important;
  transition: background 0.45s ease;
}

.code-statusbar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 24px;
  gap: 12px;
  padding: 2px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.code-status-spacer {
  flex: 1;
}

.code-save-state {
  color: var(--text-muted);
  font-family: var(--font);
}

.code-save-state.state-unsaved,
.code-save-state.state-conflict {
  color: var(--warn-text);
}

.code-save-state.state-save-failed {
  color: var(--danger-text);
}

.code-diff {
  display: table;
  width: max-content;
  min-width: 100%;
  padding: 7px 0 24px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
}

.code-diff-line {
  display: table-row;
  min-height: 19px;
}

.code-diff-number,
.code-diff-code {
  display: table-cell;
  white-space: pre;
}

.code-diff-number {
  width: 44px;
  min-width: 44px;
  padding: 0 7px;
  border-right: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-size: 9.5px;
  text-align: right;
  user-select: none;
}

.code-diff-code {
  width: 100%;
  padding: 0 16px 0 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.code-diff-line.add .code-diff-number,
.code-diff-line.add .code-diff-code {
  background: color-mix(in srgb, var(--ok) 9%, var(--surface));
}

.code-diff-line.delete .code-diff-number,
.code-diff-line.delete .code-diff-code {
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}

.code-diff-line.add .code-diff-code {
  color: var(--ok-text);
}

.code-diff-line.delete .code-diff-code {
  color: var(--danger-text);
}

.code-diff-line.hunk .code-diff-number,
.code-diff-line.hunk .code-diff-code {
  padding-top: 4px;
  padding-bottom: 4px;
  background: color-mix(in srgb, #4f7aa6 8%, var(--surface));
  color: #4f6f8f;
}

.code-diff-line.meta .code-diff-number,
.code-diff-line.meta .code-diff-code,
.code-diff-line.note .code-diff-number,
.code-diff-line.note .code-diff-code {
  color: var(--text-faint);
}

.code-diff-warning {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 2;
}

.code-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(10vh, 70px) 16px 20px;
  background: rgba(26, 24, 43, 0.22);
  backdrop-filter: blur(2px);
}

.code-palette {
  display: flex;
  flex-direction: column;
  width: min(620px, calc(100vw - 28px));
  max-height: min(610px, 74vh);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

.code-palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 52px;
  padding: 7px 12px 7px 16px;
  border-bottom: 1px solid var(--border);
}

.code-palette-search > .icon {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.code-palette-input {
  flex: 1;
  min-width: 0;
  height: 37px;
  min-height: 37px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
  box-shadow: none !important;
}

.code-palette-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 7px;
}

.code-palette-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 43px;
  gap: 10px;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.code-palette-row:hover,
.code-palette-row.selected {
  background: var(--surface-2);
  color: var(--text);
}

.code-palette-row.selected {
  box-shadow: inset 2px 0 0 var(--accent);
}

.code-palette-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.code-palette-name,
.code-palette-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-palette-name {
  color: inherit;
  font-size: 13px;
  font-weight: 500;
}

.code-palette-path {
  color: var(--text-faint);
  font-size: 10.5px;
}

.code-palette-empty {
  padding: 32px;
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
}

.code-palette-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 11px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-size: 9.5px;
}

.code-file-modal {
  z-index: 260;
}

@media (max-width: 1100px) {
  .code-shared-badge {
    display: none;
  }

  .code-branch {
    max-width: 150px;
    overflow: hidden;
  }

  .code-branch > span:not(.code-sync-count) {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .code-quick-open > span {
    display: none;
  }
}

@media (max-width: 900px) {
  .code-toolbar {
    padding-inline: 8px;
  }

  .code-project-name {
    max-width: 120px;
  }

  .code-change-summary span {
    display: none;
  }
}

@media (max-width: 760px) {
  .code-shell {
    isolation: isolate;
  }

  .code-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(310px, 86%) !important;
    max-width: 86%;
    margin-left: 0 !important;
    border-right: 1px solid var(--border-strong);
    box-shadow: 14px 0 36px rgba(26, 24, 43, 0.18);
    transform: translateX(0);
  }

  .code-shell.sidebar-closed .code-sidebar {
    transform: translateX(-105%);
    box-shadow: none;
  }

  .code-resizer {
    display: none;
  }

  .code-toolbar {
    min-height: 42px;
  }

  .code-project-name {
    max-width: 110px;
  }

  .code-branch,
  .code-change-summary {
    display: none;
  }

  .code-quick-open {
    width: 27px;
    padding: 0;
    border-color: transparent;
  }

  .code-quick-open kbd {
    display: none;
  }

  .code-tab {
    min-width: 105px;
    flex-basis: 135px;
  }

  .code-surface-actions .btn {
    width: 26px;
    padding: 0;
  }

  .code-surface-actions .code-action-label {
    display: none;
  }

  .code-breadcrumb {
    max-width: 92px;
  }

  .code-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 8px 10px;
  }

  .code-banner-actions {
    align-self: flex-end;
  }

  .code-statusbar > span:nth-last-child(-n + 3) {
    display: none;
  }

  .code-editor-host .CodeMirror {
    font-size: 11.5px;
  }

  .code-diff-number {
    width: 34px;
    min-width: 34px;
    padding-inline: 4px;
  }

  .code-diff-code {
    padding-inline: 7px 12px;
  }
}

@media (max-width: 480px) {
  .code-project-name {
    display: none;
  }

  .code-toolbar-project,
  .code-toolbar-actions {
    gap: 3px;
  }

  .code-tabs {
    height: 34px;
  }

  .code-tab {
    height: 34px;
    min-width: 96px;
    flex-basis: 120px;
    padding-left: 7px;
  }

  .code-surface-head {
    padding-left: 7px;
  }

  .code-breadcrumb:not(.current),
  .code-breadcrumb-sep {
    display: none;
  }

  .code-breadcrumb.current {
    max-width: 125px;
  }

  .code-palette-overlay {
    padding: 54px 8px 8px;
  }

  .code-palette {
    width: 100%;
    max-height: calc(100vh - 62px);
    border-radius: var(--radius);
  }
}

@media (prefers-reduced-motion: reduce) {
  .code-sidebar,
  .code-tree-chevron {
    transition: none;
  }

  .code-toolbar-action.spinning .icon,
  .code-tab.saving .code-tab-state {
    animation: none;
  }
}
