:root {
  --bg: #f4f5f7;
  --bg-panel: #ffffff;
  --bg-elev: #eef0f3;
  --bg-editor: #ffffff;
  --border: #e2e5eb;
  --text: #3d4450;
  --text-strong: #1a1d24;
  --muted: #7a8290;
  --agent-idle: #7a8290;
  --accent: #8a7349;
  --accent-soft: rgba(138, 115, 73, 0.1);
  --accent-text: #fffaf2;
  --active-file: #2f5f9f;
  --active-file-soft: rgba(59, 111, 184, 0.14);
  --danger: #c14b4b;
  --ok: #2f8f5b;
  --warn: #a67c2a;
  --shadow: 0 8px 24px rgba(20, 24, 32, 0.06);
  --radius: 10px;
  --font: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --icon-size: 14px;
  /* Soft warm highlight — distinct from Ask Agent’s blue chip */
  --selection: rgba(138, 115, 73, 0.22);
}

* { box-sizing: border-box; }

::selection {
  background: var(--selection);
  color: inherit;
}

::-moz-selection {
  background: var(--selection);
  color: inherit;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
}

.ui-icon {
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
  height: 1em;
  width: 1em;
  mask: var(--icon) center / contain no-repeat;
  -webkit-mask: var(--icon) center / contain no-repeat;
  font-size: var(--icon-size);
  vertical-align: -0.12em;
}

.label-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.login-screen {
  min-height: 100%;
  height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-screen[hidden],
#app[hidden] {
  display: none !important;
}

.login-card {
  width: min(380px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px 22px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: block;
  width: 100px;
  height: auto;
}

.brand-logo {
  display: block;
  width: 90px;
  height: auto;
  flex-shrink: 0;
}

.login-card h1 {
  margin: 0;
  font-family: "Syne", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}

.brand h1 {
  margin: 0;
  font-family: "Syne", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  white-space: nowrap;
  position: relative;
  top: 1px;
}

.subtitle, .tagline, .muted {
  color: var(--muted);
  margin: 0;
  font-size: 0.84rem;
  font-weight: 400;
}

.tagline {
  font-size: 0.78rem;
  white-space: nowrap;
}

.login-card label {
  display: grid;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
}

.login-card input {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-strong);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  font-weight: 400;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card input:focus {
  outline: none;
  border-color: rgba(138, 115, 73, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-error {
  color: var(--danger);
  margin: 0;
  font-size: 0.86rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 11px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:hover:not(:disabled) { background: var(--bg-elev); }

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
  font-weight: 500;
}

.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 9px; font-size: 0.8rem; }
.btn.btn-block { width: 100%; }
.btn.icon-only {
  padding: 6px;
  min-width: 32px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 6px 10px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  min-width: 6.5rem;
  box-shadow: none;
  outline: none;
}

.sync-status[hidden] { display: none !important; }
.sync-status.is-saving { color: var(--accent); }
.sync-status.is-saved { color: var(--ok); }

.sync-status .sync-icon {
  transform-origin: center;
  will-change: transform;
}

.sync-status .sync-icon.is-spin {
  animation: wd-spin 0.85s linear infinite;
}

@keyframes wd-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.desklink-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.desklink-chip:hover {
  border-color: rgba(138, 115, 73, 0.45);
  color: var(--accent);
}

.desklink-sep {
  width: 1px;
  align-self: stretch;
  min-height: 1em;
  margin: 0 0.15rem;
  background: currentColor;
  opacity: 0.28;
  flex-shrink: 0;
}

.desklink-chip.is-ready {
  color: var(--ok);
  border-color: rgba(47, 143, 91, 0.28);
  cursor: default;
}

.desklink-chip.is-ready:hover {
  color: var(--ok);
  border-color: rgba(47, 143, 91, 0.28);
}

/* Missing — dark red so “Download Bridge” is hard to miss */
.desklink-chip.is-missing {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.45);
  background: rgba(180, 35, 24, 0.08);
  cursor: pointer;
}

.desklink-chip.is-missing:hover {
  color: #912018;
  border-color: rgba(180, 35, 24, 0.65);
  background: rgba(180, 35, 24, 0.12);
}

/* Outdated — bright orange attention */
.desklink-chip.is-update {
  color: #e85d04;
  border-color: rgba(232, 93, 4, 0.5);
  background: rgba(232, 93, 4, 0.1);
  cursor: pointer;
}

.desklink-chip.is-update:hover {
  color: #c2410c;
  border-color: rgba(232, 93, 4, 0.7);
  background: rgba(232, 93, 4, 0.16);
}

.desklink-chip[hidden] { display: none !important; }

.app {
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
}

.brand-text {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  min-width: 0;
  flex-wrap: wrap;
  padding-bottom: 1px;
}

.brand-sep {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
  user-select: none;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

:root {
  --sidebar-width: 300px; /* default (= min); JS may override with a remembered wider width */
  --sidebar-collapsed-width: 58px;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 0;
  background: var(--bg-panel);
  padding: 0;
  overflow: hidden;
}
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 6px 1fr;
  min-height: 0;
  overflow: hidden;
}

body.is-sidebar-collapsed:not(.is-stacked-layout) .layout {
  grid-template-columns: var(--sidebar-collapsed-width) 0 1fr;
}

.sidebar-resizer {
  position: relative;
  z-index: 4;
  width: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -3px;
  right: -3px;
}

.sidebar-resizer:hover,
.sidebar-resizer:focus-visible,
body.is-resizing-sidebar .sidebar-resizer {
  background: rgba(138, 115, 73, 0.18);
  border-right-color: rgba(138, 115, 73, 0.45);
  outline: none;
}

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

body.is-resizing-sidebar * {
  cursor: col-resize !important;
}

.sidebar-head {
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  padding: 12px 12px 10px 16px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.sidebar-head h2 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-strong);
}

.sidebar-head h2 .ui-icon {
  font-size: 18px;
  color: var(--muted);
}

.sidebar-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sidebar-head-actions .btn.icon-only {
  min-width: 28px;
  padding: 5px;
  color: var(--muted);
}

.sidebar-toggle-icon {
  transition: transform 0.18s ease;
}

/* Wide expanded: refresh floats over file tree (not in header row) */
body:not(.is-stacked-layout):not(.is-sidebar-collapsed) .sidebar-refresh-btn {
  position: absolute;
  top: calc(var(--sidebar-head-height, 46px) + 8px);
  right: 10px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

body:not(.is-stacked-layout):not(.is-sidebar-collapsed) .sidebar-head-actions .sidebar-refresh-btn {
  position: absolute;
}

/* Stacked: refresh + toggle stay in header row */
body.is-stacked-layout .sidebar-head-actions {
  gap: 6px;
}

body.is-stacked-layout .sidebar-refresh-btn,
body.is-stacked-layout .sidebar-toggle-btn {
  position: static;
  background: transparent;
  backdrop-filter: none;
  color: #3d4450;
}

body.is-stacked-layout .sidebar-toggle-btn .ui-icon {
  color: #3d4450;
}

/* Collapsed: dark pill button + white icon (stacked + sidebar rail) */
body.is-sidebar-collapsed .sidebar-toggle-btn {
  background: #3d4450 !important;
  color: #fff !important;
  border-radius: 8px;
}

body.is-sidebar-collapsed .sidebar-toggle-btn:hover:not(:disabled),
body.is-sidebar-collapsed .sidebar-toggle-btn:focus-visible:not(:disabled) {
  background: #2f3540 !important;
  color: #fff !important;
}

body.is-sidebar-collapsed .sidebar-toggle-btn .ui-icon,
body.is-sidebar-collapsed .sidebar-toggle-icon {
  color: #fff !important;
}

/* Wide collapsed rail: stack toggle above files icon */
body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-head {
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 14px 8px 12px;
  justify-content: flex-start;
  border-bottom: 0;
}

body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-head h2 {
  order: 2;
  gap: 0;
  margin: 0;
  padding-top: 10px;
}

body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-head-actions {
  order: 1;
  width: auto;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0;
}

body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-head-actions::after {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  margin-top: 10px;
  background: var(--border);
}

body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-title-text,
body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-head .muted,
body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-refresh-btn {
  display: none;
}

body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-toggle-btn {
  min-width: 28px;
  padding: 5px;
}

body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-toggle-icon {
  font-size: var(--icon-size);
}

body.is-sidebar-collapsed:not(.is-stacked-layout) .sidebar-files-icon {
  font-size: 24px;
  color: #3d4450;
  opacity: 1;
}

.file-tree {
  --thread: #c8ced8;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: 0.86rem;
  font-weight: 400;
  /* Top breath + modest left inset for circle-chevrons */
  padding: 24px 10px 20px 44px;
}

/* Wide expanded only: small top inset for floating refresh */
body:not(.is-stacked-layout):not(.is-sidebar-collapsed) .file-tree {
  padding-top: 40px;
}

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

.sidebar-refresh-btn {
  min-width: 28px;
  padding: 5px;
  color: var(--muted);
}

body.is-sidebar-collapsed .sidebar-body {
  display: none;
}

.ui-icon-agent {
  font-size: 16px;
  opacity: 1;
}

.tree-agent-item {
  margin-bottom: 8px;
}

.tree-dir > summary {
  cursor: pointer;
  list-style: none;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  user-select: none;
  font-weight: 400;
}

.tree-agent > summary.tree-agent-summary {
  /* Keep pill at the old left edge so tree threads do not shift */
  position: relative;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 0;
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: none;
  transition: none;
  -webkit-tap-highlight-color: transparent;
  color: inherit;
}

/* Sits to the left of the pill without affecting layout / threads */
.tree-agent-chevron-wrap {
  box-sizing: border-box;
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
}

.tree-agent-chevron {
  font-size: 18px;
  width: 1em;
  height: 1em;
  color: var(--agent-idle);
  opacity: 1;
}

/* Expanded: same circle size — looks like the outline circle filled in */
.tree-agent[open] > .tree-agent-summary .tree-agent-chevron-wrap {
  width: 18px;
  height: 18px;
  background: var(--agent-idle);
}

.tree-agent[open] > .tree-agent-summary .tree-agent-chevron {
  font-size: 12px; /* plain chevron inside the filled disc */
  color: #fff;
  opacity: 1;
}

.tree-agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 24px;
  color: var(--agent-idle);
  font-weight: 500;
  font-size: 0.82rem;
  line-height: 1.2;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--agent-idle);
  box-shadow: none;
}

/* Inactive: chevron + outline + icon + text all one color */
.tree-agent:not([open]) > .tree-agent-summary .tree-agent-chevron,
.tree-agent:not([open]) > .tree-agent-summary .tree-agent-pill,
.tree-agent:not([open]) > .tree-agent-summary .tree-agent-pill .name,
.tree-agent:not([open]) > .tree-agent-summary .tree-agent-pill .ui-icon,
.tree-agent:not([open]) > .tree-agent-summary .tree-agent-pill .ui-icon-agent {
  color: var(--agent-idle) !important;
}

.tree-agent:not([open]) > .tree-agent-summary .tree-agent-pill {
  background: transparent !important;
  border-color: var(--agent-idle) !important;
}

/* Expanded agent: filled pill (matches filled chevron disc) */
.tree-agent[open] > .tree-agent-summary .tree-agent-pill {
  color: #fff;
  background: var(--agent-idle);
  border-color: var(--agent-idle);
}

/* Keep pill appearance flat — no hover / press / focus flash */
.tree-agent > summary.tree-agent-summary:hover,
.tree-agent > summary.tree-agent-summary:active,
.tree-agent > summary.tree-agent-summary:focus,
.tree-agent > summary.tree-agent-summary:focus-visible {
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  filter: none !important;
}

.tree-agent:not([open]) > summary.tree-agent-summary:hover .tree-agent-pill,
.tree-agent:not([open]) > summary.tree-agent-summary:active .tree-agent-pill,
.tree-agent:not([open]) > summary.tree-agent-summary:focus .tree-agent-pill,
.tree-agent:not([open]) > summary.tree-agent-summary:focus-visible .tree-agent-pill {
  background: transparent !important;
  color: var(--agent-idle) !important;
  border-color: var(--agent-idle) !important;
}

.tree-agent[open] > summary.tree-agent-summary:hover .tree-agent-pill,
.tree-agent[open] > summary.tree-agent-summary:active .tree-agent-pill,
.tree-agent[open] > summary.tree-agent-summary:focus .tree-agent-pill,
.tree-agent[open] > summary.tree-agent-summary:focus-visible .tree-agent-pill {
  background: var(--agent-idle) !important;
  color: #fff !important;
  border-color: var(--agent-idle) !important;
}

.tree-agent > summary::-webkit-details-marker,
.tree-dir > summary::-webkit-details-marker { display: none; }

.tree-missing {
  margin: 2px 0 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
}

/* Nested guide rails + rounded elbow connectors */
.tree-children {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
}

.tree-item {
  position: relative;
  padding-left: 16px;
}

/* Continuous vertical rail (siblings below keep the stem) */
.tree-item::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--thread);
}

/* Last child: stop the stem where the curve begins */
.tree-item.is-last::before {
  bottom: auto;
  height: 6px;
}

/*
 * Soft elbow: vertical → horizontal with a gentle radius.
 * Meets the item mid-line (~13px) for a clean professional look.
 */
.tree-item::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  width: 10px;
  height: 8px;
  box-sizing: border-box;
  border: 0;
  border-left: 1px solid var(--thread);
  border-bottom: 1px solid var(--thread);
  border-bottom-left-radius: 7px;
  background: transparent;
}

/* Agent roots: no outer thread (they are trunks) */
.tree-agent-item {
  padding-left: 0;
}

.tree-agent-item::before,
.tree-agent-item::after {
  display: none;
}

.tree-agent > .tree-children {
  margin-left: 8px;
  padding-left: 2px;
}

.tree-dir > .tree-children {
  margin-left: 2px;
}

.tree-file {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 400;
}

.tree-file:hover,
.tree-dir > summary:hover { background: var(--bg-elev); }

.tree-agent-pill .ui-icon,
.tree-agent-pill .ui-icon-agent {
  color: var(--agent-idle);
}

.tree-agent[open] > .tree-agent-summary .tree-agent-pill .ui-icon,
.tree-agent[open] > .tree-agent-summary .tree-agent-pill .ui-icon-agent {
  color: #fff;
}

.tree-file.active {
  background: var(--active-file-soft);
  color: var(--active-file);
  font-weight: 500;
}

.tree-file .name,
.tree-dir .name,
.tree-agent .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-menu {
  position: fixed;
  z-index: 80;
  min-width: 180px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}
.explorer-menu[hidden] { display: none !important; }
.explorer-menu button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}
.explorer-menu button:hover { background: var(--bg-elev); }
.explorer-menu button.is-danger { color: var(--danger); }
.explorer-menu .menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}

.wd-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 24, 32, 0.35);
}
.wd-modal[hidden] { display: none !important; }
.wd-modal-card {
  width: min(380px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 18px 14px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}
.wd-modal-card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-strong);
  font-weight: 600;
}
.wd-modal-field {
  display: grid;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--muted);
}
.wd-modal-field[hidden] { display: none !important; }
.wd-modal-field input,
.wd-modal-field select {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-strong);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
}
.wd-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
}

.editor-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 2;
}

.editor-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 16px;
}

.editor-header h2 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-strong);
}

.editor-header .ui-icon {
  font-size: 18px;
  color: var(--muted);
}

.editor-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.doc-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.doc-zoom-label {
  min-width: 2.75rem;
  padding: 0 0.1rem;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
  cursor: default;
  line-height: 1;
}

.doc-zoom-btn {
  min-width: 24px;
  padding: 1px 4px;
  font-size: 1.34rem;
  line-height: 1;
  font-weight: 700;
  border: 0;
  border-radius: 6px;
}

.doc-zoom-btn:hover:not(:disabled),
.doc-zoom-btn:focus-visible:not(:disabled) {
  background: var(--bg-elev);
}

.doc-zoom-stage {
  --doc-zoom: 1;
  transform-origin: top center;
  zoom: var(--doc-zoom);
}

@supports not (zoom: 1) {
  .doc-zoom-stage {
    transform: scale(var(--doc-zoom));
    width: calc(100% / var(--doc-zoom));
  }
}

.btn-md-view {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  transition: none;
}

.btn-md-view .ui-icon {
  font-size: 15px;
  color: var(--muted);
}

/* No hover flash (match explorer pills) */
.btn-md-view:hover:not(:disabled),
.btn-md-view:active:not(:disabled),
.btn-md-view:focus:not(:disabled),
.btn-md-view:focus-visible:not(:disabled) {
  background: var(--bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  filter: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.btn-md-view.is-active {
  background: #7a8290;
  border-color: #7a8290;
  color: #fff;
}

.btn-md-view.is-active .ui-icon {
  color: #fff;
}

.btn-md-view.is-active:hover:not(:disabled),
.btn-md-view.is-active:active:not(:disabled),
.btn-md-view.is-active:focus:not(:disabled),
.btn-md-view.is-active:focus-visible:not(:disabled) {
  background: #7a8290 !important;
  border-color: #7a8290 !important;
  color: #fff !important;
}

.btn-md-view.is-active:hover:not(:disabled) .ui-icon,
.btn-md-view.is-active:focus:not(:disabled) .ui-icon {
  color: #fff !important;
}

.md-source {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 320px;
  height: auto;
  margin: 0;
  padding: 28px 36px 48px;
  border: 0;
  border-radius: inherit;
  resize: none;
  outline: none;
  background: var(--bg-editor);
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: hidden; /* grow with content; editor-body scrolls the paper */
  tab-size: 2;
}

.md-source[hidden] {
  display: none !important;
}

.vfs-image-preview {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  height: 100%;
  box-sizing: border-box;
}

.vfs-image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}

.vfs-image-preview[hidden] {
  display: none !important;
}

.workspace.is-md-view .doc-editor {
  display: none;
}

.btn-drive-sync {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.btn-drive-sync:hover:not(:disabled) {
  border-color: rgba(66, 133, 244, 0.45);
  color: #1a73e8;
}

.btn-drive-sync:disabled {
  opacity: 0.72;
  cursor: default;
}

.btn-drive-sync.is-syncing {
  color: var(--accent);
  border-color: rgba(138, 115, 73, 0.35);
}

.btn-drive-sync.is-synced {
  color: var(--ok);
  border-color: rgba(47, 143, 91, 0.28);
}

.btn-history {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.btn-history:hover:not(:disabled) {
  border-color: rgba(138, 115, 73, 0.4);
  color: var(--text-strong);
}

.history-panel {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 24, 32, 0.4);
}

.history-panel[hidden] {
  display: none !important;
}

.history-panel-card {
  width: min(1100px, 100%);
  height: min(720px, 92vh);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.history-panel-head h3 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  color: var(--text-strong);
}

.history-file-label {
  margin: 4px 0 0;
  font-size: 0.8rem;
  word-break: break-all;
}

.history-panel-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
}

.history-list-pane {
  border-right: 1px solid var(--border);
  overflow: auto;
  padding: 10px;
  background: var(--bg);
}

.history-list-status {
  margin: 4px 6px 10px;
  font-size: 0.8rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.history-load-more-wrap {
  margin-top: 10px;
  padding: 0 2px 4px;
}

.history-load-more {
  width: 100%;
  justify-content: center;
}

.history-item {
  width: 100%;
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--bg-panel);
  padding: 6px 52px 6px 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-height: 0;
}

.history-item:hover {
  border-color: var(--border);
}

.history-item.is-active {
  border-color: rgba(138, 115, 73, 0.45);
  box-shadow: inset 0 0 0 1px rgba(138, 115, 73, 0.12);
}

.history-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #e8e2d8;
}

.history-avatar-img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  display: block;
}

.history-avatar-fallback {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: hsl(var(--av-hue, 200) 42% 42%);
}

.history-item-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.history-item-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.history-item-when {
  font-size: 0.64rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.history-version-badge {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  padding: 3px 8px;
  line-height: 1.25;
}

.history-version-badge.is-latest {
  color: #6b5a38;
  background: rgba(138, 115, 73, 0.16);
}

.history-diff-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.history-diff-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.history-diff {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  background: #f4f2ee;
  color: var(--text);
}

.hist-empty {
  margin: 24px auto;
  max-width: 28rem;
  padding: 24px 16px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted);
}

.ide-diff {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.ide-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  font-size: 0.78rem;
  color: var(--muted);
}

.ide-leg-del::before,
.ide-leg-add::before {
  content: "";
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  margin-right: 0.4rem;
  vertical-align: -0.05rem;
}

.ide-leg-del::before {
  background: rgba(180, 35, 24, 0.45);
}

.ide-leg-add::before {
  background: rgba(47, 143, 91, 0.55);
}

.ide-head,
.ide-row {
  display: grid;
  grid-template-columns: 2.1rem 2.1rem 1.2rem minmax(0, 1fr);
  align-items: stretch;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
}

.ide-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ebe7e0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ide-head .ide-gutter,
.ide-head .ide-mark,
.ide-head .ide-code {
  padding: 6px 8px;
}

.ide-body {
  background: #faf9f7;
}

.ide-gutter {
  text-align: right;
  padding: 0 4px;
  color: #9a948a;
  user-select: none;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  background: #f0ebe3;
  font-size: 0.68rem;
  line-height: 1.55;
}

.ide-mark {
  text-align: center;
  padding: 0 2px;
  color: #9a948a;
  user-select: none;
}

.ide-code {
  padding: 0 12px 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-strong);
}

.ide-row.ide-del {
  background: rgba(180, 35, 24, 0.08);
}

.ide-row.ide-del .ide-gutter,
.ide-row.ide-del .ide-mark {
  background: rgba(180, 35, 24, 0.1);
  color: #a3281c;
}

.ide-row.ide-del .ide-code {
  color: #8a1f16;
}

.ide-row.ide-del .ide-mark {
  color: #b42318;
  font-weight: 600;
}

.ide-row.ide-add {
  background: rgba(47, 143, 91, 0.1);
}

.ide-row.ide-add .ide-gutter,
.ide-row.ide-add .ide-mark {
  background: rgba(47, 143, 91, 0.12);
  color: #1f7a45;
}

.ide-row.ide-add .ide-code {
  color: #1a5c34;
}

.ide-row.ide-add .ide-mark {
  color: #2f8f5b;
  font-weight: 600;
}

.ide-row.ide-same:hover {
  background: rgba(0, 0, 0, 0.02);
}

@media (max-width: 800px) {
  .history-panel-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(160px, 36%) 1fr;
  }

  .history-list-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .ide-head,
  .ide-row {
    grid-template-columns: 1.85rem 1.85rem 1.05rem minmax(0, 1fr);
    font-size: 0.74rem;
  }
}


.btn-drive-sync.is-error {
  color: var(--danger);
  border-color: rgba(193, 75, 75, 0.35);
}

.drive-sync-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.disk-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: rgba(166, 124, 42, 0.08);
  border: 1px solid rgba(166, 124, 42, 0.28);
  color: var(--warn);
  padding: 8px 11px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 400;
}

.disk-banner[hidden] { display: none !important; }

.workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; /* keep rounded canvas corners */
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}

.format-bubble {
  position: fixed;
  z-index: 40;
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
  box-shadow: 0 8px 24px rgba(20, 24, 32, 0.12);
  transform: translate(-50%, -100%);
  pointer-events: auto;
}

.format-bubble[hidden] {
  display: none !important;
}

.format-bubble .btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.format-bubble .btn.icon-only {
  min-width: 32px;
  padding: 6px;
}

.format-sep {
  width: 1px;
  align-self: stretch;
  margin: 2px 4px;
  background: var(--border);
}

.format-bubble .btn.ask-agent {
  gap: 0.35rem;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: #dff0ff;
  color: #1a6fad;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.format-bubble .btn.ask-agent:hover:not(:disabled) {
  filter: none;
  background: #cce7ff;
}

.doc-editor {
  min-height: 320px;
  overflow: visible;
  background: var(--bg-editor);
  border-radius: inherit;
}

.doc-editor .tiptap,
.doc-editor .ProseMirror,
.doc-surface {
  outline: none;
  min-height: 100%;
  padding: 28px 36px 48px;
  line-height: 1.7;
  font-family: var(--sans);
  font-size: 1.02rem;
  font-weight: 300;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  border-radius: inherit;
}

.doc-editor.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.workspace-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  pointer-events: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 400;
  background: transparent;
}

.workspace-hint[hidden] { display: none !important; }

.doc-surface p.is-editor-empty:first-child::before,
.doc-surface .is-empty::before {
  color: var(--muted);
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
  font-weight: 400;
}

/* Headings: serif + weight/size — clearly distinct from body even in grayscale */
.doc-surface h1,
.doc-surface h2,
.doc-surface h3 {
  font-family: var(--font);
  font-weight: 600;
  color: var(--text-strong);
  margin: 1.4em 0 0.4em;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.doc-surface h1:first-child,
.doc-surface h2:first-child,
.doc-surface h3:first-child { margin-top: 0; }

.doc-surface h1 { font-size: 1.55rem; font-weight: 600; }
.doc-surface h2 { font-size: 1.28rem; font-weight: 600; }
.doc-surface h3 { font-size: 1.1rem; font-weight: 500; }

.doc-surface p {
  margin: 0.7em 0;
  font-weight: 300;
}

.doc-surface ul,
.doc-surface ol {
  margin: 0.6em 0;
  padding-left: 1.3em;
  font-weight: 300;
}

.doc-surface li { margin: 0.25em 0; }

.doc-surface hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.4em 0;
}

.doc-surface blockquote {
  margin: 0.85em 0;
  padding-left: 14px;
  border-left: 2px solid var(--border);
  color: var(--muted);
  font-weight: 400;
}

.doc-surface code {
  font-family: var(--mono);
  font-size: 0.88em;
  font-weight: 400;
  background: var(--bg-elev);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.doc-surface strong {
  font-weight: 600;
  color: var(--text-strong);
}

/* Stacked layout — ≤1000px (viewport @media + body/html class from app.js for split panes) */
@media (max-width: 1000px) {
  html {
    height: auto;
    overflow-x: hidden;
    overflow-y: scroll;
  }

  body {
    height: auto;
    overflow: visible;
  }

  .app {
    height: auto;
    max-height: none;
    min-height: 100vh;
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 6;
  }

  .layout {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    min-height: auto;
    height: auto;
    overflow: visible;
  }

  .sidebar-resizer {
    display: none;
  }

  .sidebar {
    display: block;
    flex: 0 0 auto;
    width: auto !important;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  .sidebar-head {
    position: sticky;
    top: var(--wd-sticky-top, 0px);
    z-index: 5;
  }

  .file-tree {
    flex: none;
    max-height: none;
    overflow: visible;
    padding-top: 24px;
    padding-bottom: 12px;
  }

  .editor-pane {
    display: block;
    flex: 1 0 auto;
    min-height: auto;
    height: auto;
    overflow: visible;
  }

  .editor-header {
    position: sticky;
    top: var(--wd-sticky-top, 0px);
    z-index: 5;
  }

  .editor-body {
    display: block;
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .workspace {
    min-height: 60vh;
  }

  .doc-surface {
    padding: 20px 18px 36px;
    font-size: 0.98rem;
  }

  .brand-text { gap: 0.3rem; }
}

html.is-stacked-layout {
  height: auto;
  overflow-x: hidden;
  overflow-y: scroll;
}

body.is-stacked-layout {
  height: auto;
  overflow: visible;
}

body.is-stacked-layout .app {
  height: auto;
  max-height: none;
  min-height: 100vh;
  overflow: visible;
}

body.is-stacked-layout .topbar {
  position: sticky;
  top: 0;
  z-index: 6;
}

body.is-stacked-layout .layout {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: auto;
  height: auto;
  overflow: visible;
}

body.is-stacked-layout .sidebar-resizer {
  display: none;
}

body.is-stacked-layout .sidebar {
  display: block;
  flex: 0 0 auto;
  width: auto !important;
  height: auto;
  max-height: none;
  border-right: 0;
  border-bottom: 1px solid var(--border);
  overflow: visible;
}

body.is-stacked-layout .sidebar-head {
  position: sticky;
  top: var(--wd-sticky-top, 0px);
  z-index: 5;
}

body.is-stacked-layout .file-tree {
  flex: none;
  max-height: none;
  overflow: visible;
  padding-top: 24px;
  padding-bottom: 12px;
}

body.is-stacked-layout .editor-pane {
  display: block;
  flex: 1 0 auto;
  min-height: auto;
  height: auto;
  overflow: visible;
}

body.is-stacked-layout .editor-header {
  position: sticky;
  top: var(--wd-sticky-top, 0px);
  z-index: 5;
}

body.is-stacked-layout .editor-body {
  display: block;
  flex: none;
  min-height: auto;
  overflow: visible;
}

body.is-stacked-layout .workspace {
  min-height: 60vh;
}

body.is-stacked-layout .doc-surface {
  padding: 20px 18px 36px;
  font-size: 0.98rem;
}

body.is-stacked-layout .brand-text {
  gap: 0.3rem;
}

body.is-stacked-layout.is-sidebar-collapsed .sidebar {
  border-bottom: 1px solid var(--border);
}

body.is-stacked-layout.is-sidebar-collapsed .sidebar-head {
  border-bottom: 0;
}

/* ===== VPS Explorer (DEV-257) ===== */
.places-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--border);
}

.places-nav[hidden] {
  display: none !important;
}

.place-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.place-item:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.place-item.active {
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 600;
}

.place-item .ui-icon {
  font-size: 15px;
}

.tree-file-vfs .ui-icon {
  font-size: 15px;
}

.vfs-lazy-status {
  padding: 4px 2px;
  font-size: 0.82rem;
}

.vfs-root-children {
  margin-top: 2px;
}

/* Explorer viewer: plain textarea replaces visual editor */
.doc-zoom-stage.is-vfs .doc-editor {
  display: none;
}

.btn-save-vfs:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Toast for vfs copy / ask feedback (format bubble is hidden in viewer) */
.vfs-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 12px);
  z-index: 2000;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.vfs-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== VPS Explorer viewer stage (DEV-261 Monaco) ===== */
.workspace:has(.vfs-stage:not([hidden])) {
  height: 100%;
}

.vfs-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.vfs-stage[hidden] {
  display: none !important;
}

.vfs-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.vfs-stage-path-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.vfs-stage-path {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vfs-stage-state {
  font-size: 0.76rem;
  white-space: nowrap;
}

.vfs-stage-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.vfs-stage-actions .btn {
  white-space: nowrap;
}

.vfs-ask-agent {
  gap: 0.35rem;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: #dff0ff;
  color: #1a6fad;
  font-size: 0.8rem;
  font-weight: 500;
}

.vfs-ask-agent:hover:not(:disabled) {
  background: #cce7ff;
}

.vfs-stage-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.vfs-monaco-wrap {
  flex: 1;
  min-height: 0;
}

.vfs-monaco-wrap[hidden] {
  display: none;
}

.vfs-monaco-wrap .monaco-wrap,
.vfs-monaco-wrap > div {
  position: absolute;
  inset: 0;
}

.vfs-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  font-size: 0.9rem;
}

.vfs-placeholder[hidden] {
  display: none;
}
