/* Code Editor: the Explorer sidebar (sections, the Open editors list, the Extensions toggles and the resize handle).
 * The width comes from --cd-tree-w, set by js/explorer.js. On a phone the sidebar is the drawer (base.css). */
.cd-sec { display: flex; flex-direction: column; flex: none; border-bottom: 1px solid var(--cd-line); min-height: 0; }
.cd-sec-grow { flex: 1 1 0; }
.cd-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px 6px 6px; color: var(--cd-dim); font-size: 11px; letter-spacing: .06em; }
.cd-sec-toggle { display: inline-flex; align-items: center; gap: 4px; min-width: 0; padding: 4px 4px; border: 0; background: none; cursor: pointer; text-align: left; text-transform: uppercase; letter-spacing: inherit; color: inherit; border-radius: 4px; }
.cd-sec-toggle::before { content: '▾'; display: inline-block; width: 10px; font-size: 10px; transition: transform .12s ease; }
.cd-sec.collapsed .cd-sec-toggle::before { transform: rotate(-90deg); }
.cd-sec-toggle:hover, .cd-sec-toggle:focus-visible { color: var(--cd-fg); outline: none; }
.cd-sec-tools { display: flex; gap: 4px; flex: none; }
.cd-sec-body { min-height: 0; overflow: auto; }
.cd-sec:not(.cd-sec-grow) .cd-sec-body { max-height: 34vh; }
.cd-sec.collapsed > .cd-sec-body { display: none; }
.cd-sec-grow > .cd-sec-body { flex: 1 1 auto; }
.cd-row.sel { box-shadow: inset 2px 0 0 var(--cd-dim); }
.cd-row.drop { background: var(--cd-on); outline: 1px dashed var(--cd-accent); outline-offset: -1px; }
.cd-row[draggable="true"] { cursor: grab; }

/* Open editors */
.cd-open-list { list-style: none; margin: 0; padding: 0 4px 8px; }
.cd-open-item { display: flex; align-items: center; min-width: 0; border-radius: 6px; }
.cd-open-item:hover { background: var(--cd-hover); }
.cd-open-item.on { background: var(--cd-on); }
.cd-open-item.on .cd-open-name { color: var(--cd-accent); }
.cd-open-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 0; background: none; cursor: pointer; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cd-fg); }
.cd-open-x { flex: none; border: 0; background: none; padding: 2px 8px; color: var(--cd-faint); cursor: pointer; font-size: 15px; line-height: 1; border-radius: 4px; }
.cd-open-x:hover, .cd-open-x:focus-visible { color: var(--cd-fg); outline: none; background: var(--cd-hover); }
.cd-open-list .cd-hint { padding: 4px 10px; }

/* Extensions */
.cd-ext-list { list-style: none; margin: 0; padding: 0 8px 10px; display: grid; gap: 8px; }
.cd-ext { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px; border: 1px solid var(--cd-line); border-radius: 8px; background: var(--cd-bg); }
.cd-ext-main { min-width: 0; display: grid; gap: 4px; justify-items: start; }
.cd-ext-name { font-weight: 600; cursor: pointer; }
.cd-ext-desc { margin: 0; color: var(--cd-faint); font-size: 12px; line-height: 1.45; }
.cd-switch { display: inline-flex; align-items: center; gap: 6px; flex: none; cursor: pointer; color: var(--cd-dim); font-size: 12px; }
.cd-switch input { width: 34px; height: 18px; margin: 0; accent-color: var(--cd-accent); cursor: pointer; }

/* Resize handle (desktop only) */
.cd-resize { position: absolute; top: 0; bottom: 0; right: -4px; width: 8px; cursor: col-resize; z-index: 3; touch-action: none; }
.cd-resize:hover, .cd-resize:focus-visible, .cd-resize:active { outline: none; background: linear-gradient(to right, transparent 3px, var(--cd-accent) 3px, var(--cd-accent) 5px, transparent 5px); }

@media (min-width: 720px) {
  .cd-tree { position: relative; }
}
@media (max-width: 719px) {
  .cd-resize { display: none; }
  .cd-sec:not(.cd-sec-grow) .cd-sec-body { max-height: 30vh; }
}
