.app-shell.file-editor-shell { height: var(--file-editor-height, 100dvh); min-height: 0; overflow: hidden; }
.file-editor-shell > .sidebar { height: 100%; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.content.file-editor-content { position: relative; height: 100%; min-height: 0; min-width: 0; padding: 0; gap: 0; overflow: hidden; }
.content.file-editor-standalone { height: var(--file-editor-height, 100dvh); }
.file-editor-surface {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--surface, #202425);
  color: #eef3f3;
}

.file-editor-main { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.file-editor-header { display: flex; align-items: flex-start; gap: 16px; padding: 16px 20px; max-height: 35%; overflow: auto; border-bottom: 1px solid var(--line, #353a3b); }
.file-editor-heading { min-width: 0; flex: 1; }
.file-editor-surface .file-editor-heading h2 { margin: 0; font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; max-height: 2.8em; overflow: auto; }
.file-editor-surface .file-editor-path { margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted, #a3adae); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-editor-source { color: #80dce0; font-weight: 600; }
.file-editor-workspace { flex: 1; min-height: 0; position: relative; background: #1e1e1e; }
.file-editor-host { position: absolute; inset: 0; overflow: hidden; }
.file-editor-loading, .file-editor-load-error { height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 20px; text-align: center; overflow: auto; color: var(--muted, #a3adae); font-size: 13px; }
.file-editor-surface .file-editor-load-error p { margin: 0; color: #ffabb1; overflow-wrap: anywhere; }
.file-editor-diagnostics { flex: 0 1 auto; min-height: 36px; max-height: 24%; overflow: auto; overscroll-behavior: contain; border-top: 1px solid var(--line, #353a3b); padding: 8px 20px; }
.file-editor-surface .file-editor-validation { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted, #a3adae); }
.file-editor-diagnostics[data-state=valid] .file-editor-validation { color: #92deb2; }
.file-editor-diagnostics[data-state=invalid] .file-editor-validation, .file-editor-diagnostics[data-state=error] .file-editor-validation { color: #ffabb1; }
.file-editor-errors { padding: 0; margin: 8px 0 0; list-style: none; display: grid; gap: 6px; }
.file-editor-errors .link-button { display: block; width: 100%; white-space: normal; overflow-wrap: anywhere; color: #ffb1b6; line-height: 1.5; font-size: 12px; }
.file-editor-surface .file-editor-save-error { flex: 0 1 auto; min-height: 24px; max-height: 15%; overflow: auto; margin: 0; padding: 8px 20px; font-size: 13px; color: #ffabb1; border-top: 1px solid var(--line, #353a3b); overflow-wrap: anywhere; }
.file-editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line, #353a3b); }
.file-editor-state { min-width: 0; font-size: 12px; line-height: 1.5; color: var(--muted, #a3adae); overflow-wrap: anywhere; }
.file-editor-state.is-dirty { color: #f1d682; }
.file-editor-footer > button { flex-shrink: 0; min-width: 130px; }
.file-editor-header, .file-editor-footer { flex-shrink: 0; }
.file-editor-confirmation { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; padding: 20px; overflow: auto; overscroll-behavior: contain; background: transparent; color: #eef3f3; }
.file-editor-confirmation[open] { display: grid; place-items: center; }
.file-editor-confirmation::backdrop { background: #000a; }
.file-editor-confirm-card { width: min(510px, 100%); min-width: 0; max-height: 100%; overflow: auto; padding: 24px; background: #272d2e; border: 1px solid #535d5f; border-radius: 8px; box-shadow: 0 25px 100px #0008; }
.file-editor-confirm-card h3 { font-size: 18px; line-height: 1.4; margin: 0 0 12px; }
.file-editor-surface .file-editor-confirm-card p { font-size: 13px; line-height: 1.6; color: #bac5c5; margin: 0 0 12px; overflow-wrap: anywhere; }
.file-editor-surface #file-editor-confirm-status { color: #ffabb1; }
.file-editor-surface #file-editor-confirm-status:empty { display: none; }
.file-editor-confirm-card .modal-actions { flex-wrap: wrap; gap: 8px; }
.file-editor-confirm-card .modal-actions button { min-height: 38px; }
.file-editor-surface button:focus-visible { outline: 2px solid #53d4d6; outline-offset: 2px; }
.file-editor-surface [hidden] { display: none !important; }
body:has(.file-editor-surface) #toasts { bottom: 128px; max-height: max(60px, calc(100dvh - 260px)); overflow: hidden; pointer-events: none; }

@media (max-width: 700px) {
  .app-shell.file-editor-shell { grid-template-rows: auto minmax(0, 1fr); }
  .file-editor-shell > .sidebar { height: auto; max-height: min(200px, 28dvh, calc(var(--file-editor-height, 100dvh) * .32)); }
  .file-editor-shell > .sidebar > * { flex-shrink: 0; }
}

@media (max-width: 600px) {
  .file-editor-header { padding: 12px; gap: 8px; }
  .file-editor-footer { padding: 10px 12px; gap: 8px; }
  .file-editor-diagnostics, .file-editor-surface .file-editor-save-error { padding: 8px 12px; }
  .file-editor-state { font-size: 11px; }
  .file-editor-footer > button { min-width: 112px; }
  .file-editor-confirmation { padding: 12px; }
  .file-editor-confirm-card { padding: 18px; }
  .file-editor-confirm-card .modal-actions { flex-direction: column-reverse; }
  .file-editor-confirm-card .modal-actions button { width: 100%; }
}

@media (max-height: 500px) {
  .file-editor-header { padding-block: 8px; }
  .file-editor-footer { padding-block: 8px; }
}
