/* -------- Design Files panel (full right pane) ---------------------- */
.df-panel {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  min-height: 0;
  background: var(--bg);
}
.df-panel.no-preview { grid-template-columns: minmax(0, 1fr); }
.df-reloading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(1px);
}
.df-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.df-main:last-child { border-right: none; }
.df-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.df-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 20px 6px;
  font-size: 14px;
  color: var(--text-muted);
}
.df-breadcrumb-btn {
  all: unset;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 14px;
  transition: color 120ms cubic-bezier(0.23, 1, 0.32, 1), background 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.df-breadcrumb-btn:hover { color: var(--text); background: var(--bg-subtle); }
.df-breadcrumb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.df-breadcrumb-segment { display: inline-flex; align-items: center; }
.df-breadcrumb-sep { padding: 0 2px; color: var(--text-faint); font-size: 12px; user-select: none; }
.df-breadcrumb-current { padding: 2px 4px; color: var(--text-strong); font-weight: 600; font-size: 14px; }
/* Single-line top toolbar: left = up + refresh + breadcrumbs, right = file actions. */
.df-topbar {
  margin: 0 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.df-topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}
.df-topbar-left .df-breadcrumbs {
  padding: 0;
  margin: 0;
  min-width: 0;
}
.df-topbar-right {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.df-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.df-actions button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.df-actions button:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text);
}
.df-actions button.danger { color: var(--red); }
.df-actions button.danger:hover:not(:disabled) {
  background: var(--red-bg);
  color: var(--red);
}
/* Upload error banner. */
.df-upload-banner {
  margin: 0 20px 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--red-border, var(--border));
  border-radius: var(--radius-sm);
  background: var(--red-bg);
  color: var(--red);
  font-size: 12px;
}
.df-upload-banner button {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  padding: 3px 9px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Batch-selection action bar. Shown above the list when any row is selected. */
.df-batch-bar {
  margin: 0 20px 8px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  animation: df-batch-enter 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes df-batch-enter {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.df-batch-count {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-strong);
}
.df-batch-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.df-batch-actions button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.df-batch-actions button:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text);
}
.df-batch-actions button.danger { color: var(--red); }
.df-batch-actions button.danger:hover:not(:disabled) {
  background: var(--red-bg);
  color: var(--red);
}
.df-batch-clear { color: var(--text-faint); }
.df-section { display: flex; flex-direction: column; gap: 0; }
.df-section + .df-section { margin-top: 0; }
.df-section-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 600;
  padding: 8px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-soft);
}
.df-section-count {
  margin-left: 8px;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0;
}
.df-file-row {
  transition: background 120ms ease;
}
.df-file-row:hover { background: var(--blue-bg); }
.df-file-row.active:not(.selected) { background: var(--blue-bg); }
.df-file-row.active.selected { background: var(--blue); }
.df-file-row.active:not(.selected) .df-row-name { color: var(--text-strong); }
.df-file-row.selected { background: var(--blue); }

.df-cell-check {
  text-align: center;
  vertical-align: middle;
}
.df-cell-icon {
  text-align: center;
  vertical-align: middle;
}
.df-cell-name {
  padding: 10px 12px 10px 0;
  vertical-align: middle;
  /* Force ellipsis truncation in auto-layout tables (#3260). Without
     `max-width: 0` and `min-width: 0`, a long `f.name` would expand
     this td and push the kind / mtime / menu cells off-screen — even
     though `.df-row-name` already has `text-overflow: ellipsis`. The
     `:not(.no-preview)` overrides in `routines.css` already pin the
     row's children to `width: 100%` when a preview pane is open; this
     baseline rule covers the no-preview state the issue reports. */
  max-width: 0;
  min-width: 0;
}
.df-cell-openable {
  cursor: pointer;
}

.df-row-name-btn {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.df-row-name-btn:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
}
.df-row-name-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.df-row-openable { cursor: pointer; }

.df-row {
  display: grid;
  grid-template-columns: 28px 36px 1fr auto auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 11px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  position: relative;
  transition: background 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.df-row-live-artifact {
  grid-template-columns: 36px minmax(0, 1fr) auto;
}
.df-row-plugin-folder {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, auto);
  cursor: default;
}
.df-row-folder-main {
  appearance: none;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.df-plugin-install {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-panel);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
}
.df-plugin-install:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.df-plugin-install:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.df-plugin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.df-inline-notice {
  margin: 0 20px 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 12px;
}
.df-inline-notice a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.df-row:hover { background: var(--blue-bg); }
.df-row.active:not(.selected) { background: var(--blue-bg); color: var(--text); }
.df-row.active:not(.selected) .df-row-name { color: var(--text-strong); }
.df-row.selected { background: var(--blue); }
.df-row.selected .df-row-name { color: #fff; }
.df-row.selected .df-row-sub,
.df-row.selected .df-row-time { color: rgba(255, 255, 255, 0.82); }
.df-row.selected .df-row-check { color: #fff; }

.df-row-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 120ms cubic-bezier(0.23, 1, 0.32, 1), background 120ms ease, color 120ms ease;
}
.df-row:hover .df-row-check,
.df-row-check:focus-visible,
.df-row-check[aria-checked="true"],
.df-panel.has-selection .df-row-check { opacity: 1; }
.df-row-check:hover { background: var(--border); color: var(--text); }
.df-row-check[aria-checked="true"] { color: var(--accent-strong); }
.df-dir-row .df-row-check { cursor: default; }

.df-row-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 14px;
  position: relative;
}
.df-row-icon[data-kind="folder"] { background: var(--bg-muted); color: var(--text-soft); }
.df-row-icon[data-kind="html"] { background: var(--accent-tint); color: var(--accent-strong); }
.df-row-icon[data-kind="image"] { background: var(--green-bg); color: var(--green); }
.df-row-icon[data-kind="code"] { background: #fff7d8; color: #8c6700; }
.df-row-icon[data-kind="text"] { background: var(--bg-subtle); color: var(--text-muted); }
.df-row-icon[data-kind="sketch"] { background: var(--purple-bg); color: var(--purple); }
.df-row-icon[data-kind="stylesheet"] { background: var(--blue-bg); color: var(--blue, var(--accent-strong)); }
.df-row-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  /* Constrain the wrap to the cell's content box so the ellipsis on
     `.df-row-name` engages even in the auto-layout table state
     (#3260). */
  max-width: 100%;
}
.df-row-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* `max-width: 100%` on a flex child pairs with the wrap's
     `min-width: 0` so the long filename collapses to the cell width
     instead of pushing the kind / mtime / menu columns off-screen
     (#3260). */
  max-width: 100%;
  min-width: 0;
}
.df-rename-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  padding: 3px 6px;
}
.df-row-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1.35;
}
.df-row-sub > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.df-row-sub-kind,
.df-row-sub-time {
  display: none;
}
.df-row-time {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.df-row-menu {
  background: transparent;
  border: none;
  padding: 4px 6px;
  color: var(--text-muted);
  font-size: 16px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.df-row:hover .df-row-menu { opacity: 1; }
.df-row-menu:focus { opacity: 1; }
.df-row-menu:hover { background: var(--border); color: var(--text); }
.df-row-menu-placeholder {
  pointer-events: none;
  visibility: hidden;
}
.df-section-more {
  margin: 6px 20px 10px;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
}
.df-section-more:hover:not(:disabled) {
  background: var(--bg-muted);
  color: var(--text);
}
.df-row-collapse {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0;
  width: 18px;
  text-align: center;
  font-size: 12px;
  cursor: pointer;
}
.df-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 320px;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--border-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-soft) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
.df-empty-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 36px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow:
    0 1px 0 rgba(15, 15, 15, 0.02),
    0 8px 24px -12px rgba(15, 15, 15, 0.08);
  max-width: min(420px, 92%);
  text-align: center;
}
.df-empty-title {
  font-size: 16px;
  color: var(--text-strong);
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.df-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease, border-color 120ms ease;
}
.df-empty-cta:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}
.df-empty-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Static useful-info footer pinned above the drop zone. */
.df-useful-info {
  margin: auto 20px 4px;
  padding: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
}
.df-useful-info-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
}
.df-useful-info-tip {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.df-drop {
  margin: 12px 16px 16px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--text-muted);
}
.df-drop.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-panel));
  color: var(--text);
}
.df-drop .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.df-drop .desc {
  font-size: 12px;
  line-height: 1.5;
  max-width: 56ch;
}

/* Right preview pane in design files */
.df-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  border-left: 1px solid var(--border);
  position: relative;
}
.df-preview-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 32px;
}
.df-preview-thumb {
  margin: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  aspect-ratio: 16/10;
  flex-shrink: 0;
  position: relative;
}
.df-preview-thumb.is-openable {
  cursor: pointer;
}
.df-preview-thumb-open {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}
.df-preview-thumb-open:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.df-preview-thumb-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.df-preview-thumb iframe,
.df-preview-thumb img,
.df-preview-thumb video {
  width: 100%; height: 100%; border: none; background: white; object-fit: cover; display: block;
}
.df-preview-thumb .sketch-preview,
.df-preview-thumb .sketch-preview svg {
  width: 100%;
  height: 100%;
  display: block;
}
.df-preview-thumb audio {
  width: calc(100% - 24px);
  position: absolute;
  left: 12px;
  bottom: 12px;
}
.df-preview-meta {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: center;
  align-items: center;
}
.df-preview-open-cta {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  margin-bottom: 4px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-panel);
  color: var(--text-strong);
  box-shadow: var(--shadow-xs);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms cubic-bezier(0.23, 1, 0.32, 1), border-color 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.df-preview-open-cta:hover {
  background: var(--bg-panel);
  border-color: var(--accent);
  color: var(--accent);
}
.df-preview-open-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.df-preview-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}
.df-preview-download:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.df-preview-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  word-break: break-word;
}
.df-preview-kind { font-size: 12px; color: var(--text-muted); }
.df-preview-stats { font-size: 11.5px; color: var(--text-muted); }
.df-preview-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.df-preview-actions button,
.df-preview-actions .ghost-link {
  font-size: 12px;
  min-height: 30px;
  padding: 0 11px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.df-preview-actions button:hover,
.df-preview-actions .ghost-link:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}
.df-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-panel) 92%, transparent);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
  transition: opacity 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .df-preview-close {
    opacity: 0;
    pointer-events: none;
  }

  .df-preview:hover .df-preview-close,
  .df-preview-close:focus-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (any-pointer: coarse) {
  .df-preview-close {
    opacity: 1;
    pointer-events: auto;
  }
}
.df-preview-close:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-strong);
}

/* Row context menu */
.df-row-popover {
  position: fixed;
  z-index: 200;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 4px;
  min-width: 160px;
  display: flex;
  flex-direction: column;
}
.df-row-popover button {
  background: transparent;
  border: none;
  padding: 7px 10px;
  font-size: 12.5px;
  text-align: left;
  border-radius: 4px;
  color: var(--text);
}
.df-row-popover button:hover { background: var(--bg-subtle); }
.df-row-popover button.danger { color: var(--red); }
.df-row-popover button.danger:hover { background: var(--red-bg); }
