.hl-code-editor,
.hl-code-file-viewer {
  --hl-code-editor-bg: #ffffff;
  --hl-code-editor-fg: #172033;
  --hl-code-editor-muted: #6b7280;
  --hl-code-editor-border: #d9dee8;
  --hl-code-editor-gutter-bg: #f7f8fb;
  --hl-code-editor-active-line: #f3f6fb;
  --hl-code-editor-selection: rgba(46, 125, 246, 0.24);
  --hl-code-editor-panel-bg: #ffffff;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.hl-code-editor[data-theme='dark'],
.hl-code-file-viewer[data-theme='dark'] {
  --hl-code-editor-bg: #151922;
  --hl-code-editor-fg: #e8ecf5;
  --hl-code-editor-muted: #9aa4b2;
  --hl-code-editor-border: #2f3747;
  --hl-code-editor-gutter-bg: #111620;
  --hl-code-editor-active-line: rgba(255, 255, 255, 0.06);
  --hl-code-editor-selection: rgba(81, 144, 255, 0.34);
  --hl-code-editor-panel-bg: #171d28;
}

.hl-code-editor {
  width: 100%;
  height: 100%;
  min-height: 220px;
  overflow: hidden;
  background: var(--hl-code-editor-bg);
  color: var(--hl-code-editor-fg);
}

.hl-code-editor__mount {
  width: 100%;
  height: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.hl-code-editor .cm-editor {
  width: 100%;
  height: 100%;
  min-width: 0;
  max-width: 100%;
}

.hl-code-editor .cm-scroller {
  max-width: 100%;
  overflow: auto;
}

.hl-code-editor--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hl-code-editor-border);
  color: var(--hl-code-editor-muted);
  font: 13px/1.4 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.hl-code-editor .cm-line.hl-code-editor__diff-line--added {
  background: rgba(22, 163, 74, 0.2);
  box-shadow: inset 3px 0 rgba(22, 163, 74, 0.72);
  color: #14532d;
}

.hl-code-editor .cm-line.hl-code-editor__diff-line--removed {
  background: rgba(220, 38, 38, 0.18);
  box-shadow: inset 3px 0 rgba(220, 38, 38, 0.72);
  color: #7f1d1d;
}

.hl-code-editor[data-theme='dark'] .cm-line.hl-code-editor__diff-line--added {
  background: rgba(34, 197, 94, 0.26);
  box-shadow: inset 3px 0 rgba(34, 197, 94, 0.88);
  color: #bbf7d0;
}

.hl-code-editor[data-theme='dark'] .cm-line.hl-code-editor__diff-line--removed {
  background: rgba(248, 113, 113, 0.24);
  box-shadow: inset 3px 0 rgba(248, 113, 113, 0.88);
  color: #fecaca;
}

.hl-code-file-viewer {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--hl-code-editor-border);
  background: var(--hl-code-editor-bg);
  color: var(--hl-code-editor-fg);
}

.hl-code-file-viewer__tree {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--hl-code-editor-border);
  background: var(--hl-code-editor-gutter-bg);
  padding: 8px 0;
}

.hl-code-file-viewer__tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--hl-code-editor-muted);
  cursor: pointer;
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-align: left;
}

.hl-code-file-viewer__tree-item > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hl-code-file-viewer__tree-item:hover {
  background: var(--hl-code-editor-active-line);
  color: var(--hl-code-editor-fg);
}

.hl-code-file-viewer__tree-item--selected {
  background: rgba(46, 125, 246, 0.14);
  color: var(--hl-code-editor-fg);
}

.hl-code-file-viewer__tree-item--dir {
  font-weight: 600;
}

.hl-code-file-viewer__status {
  margin-left: auto;
  flex: 0 0 auto;
  border: 1px solid var(--hl-code-editor-border);
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--hl-code-editor-muted);
  font: 10px/1.4 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.hl-code-file-viewer__status[data-status='added'] {
  border-color: rgba(22, 163, 74, 0.34);
  color: #15803d;
}

.hl-code-file-viewer__status[data-status='modified'] {
  border-color: rgba(37, 99, 235, 0.34);
  color: #2563eb;
}

.hl-code-file-viewer__status[data-status='removed'] {
  border-color: rgba(220, 38, 38, 0.34);
  color: #dc2626;
}

.hl-code-file-viewer[data-theme='dark'] .hl-code-file-viewer__status[data-status='added'] {
  color: #86efac;
}

.hl-code-file-viewer[data-theme='dark'] .hl-code-file-viewer__status[data-status='modified'] {
  color: #93c5fd;
}

.hl-code-file-viewer[data-theme='dark'] .hl-code-file-viewer__status[data-status='removed'] {
  color: #fca5a5;
}

.hl-code-file-viewer__editor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
}

.hl-code-file-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 38px;
  min-width: 0;
  max-width: 100%;
  padding: 0 12px;
  border-bottom: 1px solid var(--hl-code-editor-border);
  color: var(--hl-code-editor-muted);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow: hidden;
}

.hl-code-file-viewer__header span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--hl-code-editor-fg);
}

.hl-code-file-viewer__header span:last-child {
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  .hl-code-file-viewer {
    grid-template-columns: 1fr;
    grid-template-rows: 160px minmax(0, 1fr);
  }

  .hl-code-file-viewer__tree {
    border-right: 0;
    border-bottom: 1px solid var(--hl-code-editor-border);
  }
}
