/* ---------------------------------------------------------------- base */
*,
*::before,
*::after { box-sizing: border-box; }

html, body, #root { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.45;
  font-feature-settings: 'cv01', 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  user-select: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
::selection { background: var(--accent-soft); }

:focus { outline: none; }
:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--text-faint); }
*::-webkit-scrollbar-track { background: transparent; }

.boot { height: 100%; display: grid; place-items: center; }
.boot-spinner, .spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- shell */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.panes {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 0 8px 8px;
  gap: 0;
}

.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
}
.pane.sidebar { flex: none; }
.pane.content { flex: 1; }
.pane.preview { flex: none; }
.pane.is-active { border-color: var(--border-strong); }

/* Draggable splitter between panes */
.resizer {
  flex: none;
  width: 8px;
  cursor: col-resize;
  position: relative;
  touch-action: none;
}
.resizer::after {
  content: '';
  position: absolute;
  top: 12px; bottom: 12px; left: 3.5px;
  width: 1px;
  border-radius: 1px;
  background: transparent;
  transition: background var(--fast) var(--ease), box-shadow var(--fast);
}
.resizer:hover::after,
.resizer.dragging::after { background: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
body.is-resizing, body.is-resizing * { cursor: col-resize !important; user-select: none !important; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 14px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em;
  color: var(--text-strong);
  min-width: 0;
  margin-right: 6px;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-fg);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
}
.brand-sub { color: var(--text-faint); font-weight: 500; }
.nav-group { display: flex; align-items: center; gap: 2px; }
.topbar .crumbs { flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; }

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 3px transparent;
}
.live-dot.on { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }

/* ------------------------------------------------------------- crumbs */
.crumbs {
  display: flex; align-items: center;
  height: 32px; padding: 0 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--r-md);
  overflow: hidden;
  gap: 1px;
}
.crumb {
  display: flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 7px;
  border: 0; background: none;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
  max-width: 220px;
  flex-shrink: 1;
  min-width: 0;
}
.crumb span { overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.current { color: var(--text-strong); font-weight: 500; flex-shrink: 0; }
.crumb.drop-over { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.crumb-sep { color: var(--text-faint); flex: none; }
.crumbs .search-label { padding: 0 8px; color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; }
.crumbs .search-label b { color: var(--text-strong); font-weight: 500; }

/* --------------------------------------------------------------- search */
.search {
  position: relative;
  width: 260px;
  flex: none;
}
.search input {
  width: 100%;
  height: 32px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 0 64px 0 32px;
  font-size: var(--text-sm);
  color: var(--text-strong);
  transition: border-color var(--fast), box-shadow var(--fast);
  user-select: text;
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { border-color: var(--accent-line); box-shadow: var(--focus-ring); }
.search > svg { position: absolute; left: 10px; top: 9px; color: var(--text-faint); pointer-events: none; }
.search .search-kbd { position: absolute; right: 8px; top: 7px; pointer-events: none; }
.search .search-clear { position: absolute; right: 6px; top: 5px; }

/* --------------------------------------------------------------- panes */
.pane-header {
  height: var(--cmdbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--divider);
}
.pane-title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  color: var(--text-faint);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pane-body { flex: 1; min-height: 0; overflow: auto; position: relative; }

/* --------------------------------------------------------------- sidebar */
.tree { padding: 6px 6px 12px; outline: none; }
.tree-row {
  display: flex; align-items: center; gap: 4px;
  height: 28px;
  padding-right: 8px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: var(--text-md);
  cursor: default;
  position: relative;
  white-space: nowrap;
}
.tree-row:hover { background: var(--hover); color: var(--text); }
.tree-row.current { background: var(--active); color: var(--text-strong); }
.tree:focus-within .tree-row.current,
.pane.is-active .tree-row.current { background: var(--accent-soft); color: var(--text-strong); }
.pane.is-active .tree-row.current .tree-icon { color: var(--accent-text); }
.tree-row.drop-over { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); color: var(--text-strong); }
.tree-row.is-cut { opacity: 0.5; }
.tree-row .tree-name { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.tree-row .tree-count { font-size: var(--text-2xs); color: var(--text-faint); font-family: var(--font-mono); }
.tree-twisty {
  width: 18px; height: 18px; flex: none;
  display: grid; place-items: center;
  border: 0; background: none; padding: 0;
  color: var(--text-faint);
  border-radius: var(--r-xs);
}
.tree-twisty:hover { color: var(--text); background: var(--hover); }
.tree-twisty svg { transition: transform var(--fast) var(--ease); }
.tree-twisty.open svg { transform: rotate(90deg); }
.tree-icon { flex: none; color: var(--text-faint); }
.tree-row.root .tree-icon { color: var(--text-muted); }
.tree-section {
  padding: 12px 10px 6px;
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 600;
}
.tree-row .rename-input { height: 22px; }

.sidebar-footer {
  flex: none;
  border-top: 1px solid var(--divider);
  padding: 12px 14px 14px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.storage-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.storage-row b { color: var(--text-strong); font-weight: 500; }
.storage-bar { height: 4px; border-radius: 4px; background: var(--active); overflow: hidden; display: flex; gap: 1px; }
.storage-bar span { display: block; height: 100%; }
.storage-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; color: var(--text-faint); }
.storage-legend i { display: inline-block; width: 6px; height: 6px; border-radius: 2px; margin-right: 5px; vertical-align: 1px; }

/* --------------------------------------------------------------- content */
.cmdbar { gap: 2px; padding: 0 8px; }
.cmdbar .spacer { flex: 1; }
.cmd-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; flex: none; }

.content-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  outline: none;
}
.content-scroll.drag-over-ext { background: var(--accent-softer); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile, 132px), 1fr));
  gap: 8px;
  padding: 12px;
  align-content: start;
  min-height: 100%;
}

.tile {
  position: relative;
  display: flex; flex-direction: column;
  border-radius: var(--r-md);
  padding: 6px 6px 8px;
  border: 1px solid transparent;
  cursor: default;
  transition: background var(--fast), border-color var(--fast);
}
.tile:hover { background: var(--hover); }
.tile.selected { background: var(--accent-soft); border-color: var(--accent-line); }
.tile.focused { box-shadow: inset 0 0 0 1px var(--accent-line); }
.tile.selected.focused { border-color: var(--accent); }
.tile.drop-over { background: var(--accent-soft); border-color: var(--accent); }
.tile.is-cut { opacity: 0.45; }

.tile-thumb {
  aspect-ratio: 1 / 0.82;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  border: 1px solid var(--divider);
  display: grid; place-items: center;
  overflow: hidden;
  position: relative;
}
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile-thumb.is-folder, .tile-thumb.is-icon { background: transparent; border-color: transparent; }
.tile-thumb .badge {
  position: absolute; right: 5px; bottom: 5px;
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 5px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.62); color: #fff;
  backdrop-filter: blur(4px);
  display: flex; align-items: center; gap: 3px;
}
.tile-thumb .ext-badge {
  position: absolute; left: 50%; bottom: 14%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tile-name {
  margin-top: 7px;
  font-size: var(--text-sm);
  color: var(--text);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0 2px;
}
.tile.selected .tile-name { color: var(--text-strong); }
.tile-meta { font-size: var(--text-2xs); color: var(--text-faint); text-align: center; margin-top: 2px; }
.tile .rename-input { margin-top: 6px; text-align: center; }

/* list (details) view */
.list { min-height: 100%; padding: 0 0 12px; }
.list-head, .list-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 150px 110px 84px;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
}
.list.with-location .list-head,
.list.with-location .list-row { grid-template-columns: minmax(200px, 1fr) minmax(120px, 0.6fr) 150px 84px; }
.list-head {
  position: sticky; top: 0; z-index: 2;
  height: 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--divider);
  font-size: var(--text-xs);
  color: var(--text-faint);
}
.list-head button {
  border: 0; background: none; padding: 0; text-align: left;
  display: flex; align-items: center; gap: 4px;
  color: inherit; font-weight: 500;
  height: 100%;
}
.list-head button:hover, .list-head button.sorted { color: var(--text); }
.list-head .num, .list-row .num { justify-content: flex-end; text-align: right; }
.list-row {
  height: 34px;
  margin: 0 6px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: var(--text-md);
  color: var(--text-muted);
}
.list-row:first-of-type { margin-top: 4px; }
.list-row:hover { background: var(--hover); }
.list-row.selected { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.list-row.focused { border-color: var(--accent-line); }
.list-row.drop-over { background: var(--accent-soft); border-color: var(--accent); }
.list-row.is-cut { opacity: 0.45; }
.list-row .cell-name { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.list-row .cell-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.list-row .cell.mono { font-family: var(--font-mono); font-size: 11.5px; }
.list-thumb { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; flex: none; border: 1px solid var(--divider); }

/* marquee selection */
.marquee {
  position: absolute;
  border: 1px solid var(--accent);
  background: var(--accent-softer);
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
}

/* drop overlay */
.drop-hint {
  position: absolute;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  white-space: nowrap;
}
.drop-frame {
  position: absolute; inset: 6px;
  border: 1.5px dashed var(--accent-line);
  border-radius: var(--r-md);
  pointer-events: none;
  z-index: 4;
}

/* empty states */
.empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  gap: 6px;
  color: var(--text-muted);
  padding: 24px;
  pointer-events: none;
}
.empty > * { pointer-events: auto; }
.empty-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-faint);
  margin-bottom: 10px;
}
.empty h3 { margin: 0; font-size: var(--text-lg); color: var(--text-strong); font-weight: 500; letter-spacing: -0.01em; }
.empty p { margin: 0 0 12px; font-size: var(--text-sm); max-width: 320px; }
.empty .row { display: flex; gap: 8px; }

/* status bar */
.statusbar {
  height: var(--statusbar-h);
  flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  border-top: 1px solid var(--divider);
  font-size: var(--text-xs);
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
}
.statusbar b { color: var(--text-muted); font-weight: 500; }
.statusbar .spacer { flex: 1; }
.statusbar .zoom { display: flex; align-items: center; gap: 6px; }
.statusbar input[type='range'] { width: 90px; }

/* --------------------------------------------------------------- preview */
.preview-empty { padding: 28px 20px; text-align: center; color: var(--text-muted); }
.pv {
  display: flex; flex-direction: column;
  height: 100%;
  min-height: 0;
}
.pv-head {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 10px 14px;
  border-bottom: 1px solid var(--divider);
  min-height: var(--cmdbar-h);
}
.pv-head .pv-title { flex: 1; min-width: 0; }
.pv-head .pv-name {
  font-size: var(--text-md); font-weight: 500; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  user-select: text;
}
.pv-head .pv-sub { font-size: var(--text-xs); color: var(--text-faint); }
.pv-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.pv-body.scroll { overflow: auto; }
.pv-stage {
  flex: 1; min-height: 0;
  display: grid; place-items: center;
  padding: 14px;
  overflow: hidden;
}

.pv-details { flex: none; border-top: 1px solid var(--divider); }
.pv-details-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  border: 0; background: none;
  font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint);
}
.pv-details-toggle:hover { color: var(--text-muted); }
.pv-details-toggle svg { transition: transform var(--fast) var(--ease); }
.pv-details-toggle.open svg { transform: rotate(90deg); }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; padding: 0 14px 14px; font-size: var(--text-sm); }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; user-select: text; word-break: break-word; }
.kv dd.mono { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }

.pv-hero {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 36px 20px 24px; text-align: center;
}
.pv-hero h3 { margin: 6px 0 0; font-size: var(--text-lg); font-weight: 500; color: var(--text-strong); word-break: break-word; }
.pv-hero p { margin: 0; font-size: var(--text-sm); color: var(--text-muted); }
.pv-hero .row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.pv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 14px 16px; }
.pv-stat { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; background: var(--panel-2); }
.pv-stat b { display: block; font-size: var(--text-lg); color: var(--text-strong); font-weight: 500; letter-spacing: -0.01em; }
.pv-stat span { font-size: var(--text-xs); color: var(--text-faint); }

/* image viewer */
.image-viewer { position: absolute; inset: 0; display: flex; flex-direction: column; }
.image-canvas {
  flex: 1; min-height: 0; overflow: auto;
  display: grid; place-items: center;
  background-color: var(--checker-a);
  background-image:
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-b) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  cursor: zoom-in;
}
.image-canvas.actual { place-items: start; cursor: zoom-out; }
.image-canvas.actual > .image-wrap { margin: auto; }
.image-wrap { position: relative; display: grid; }
.image-wrap img { grid-area: 1 / 1; }
.image-canvas.fit .image-wrap { max-width: 100%; max-height: 100%; padding: 14px; width: 100%; height: 100%; }
.image-canvas.fit img { width: 100%; height: 100%; object-fit: contain; }
.image-wrap .lowres { filter: blur(8px); transform: scale(1.01); }
.image-wrap .full { opacity: 0; transition: opacity var(--med) var(--ease); }
.image-wrap .full.loaded { opacity: 1; }
.image-toolbar {
  flex: none;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--divider);
  font-size: var(--text-xs);
  color: var(--text-faint);
}
.image-toolbar .spacer { flex: 1; }

/* multi-select gallery */
.multi-grid {
  display: grid;
  gap: 8px;
  padding: 12px;
}
.multi-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  overflow: hidden;
  display: flex; flex-direction: column;
  cursor: default;
  transition: border-color var(--fast);
}
.multi-card:hover { border-color: var(--border-strong); }
.multi-card .mc-thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--panel); position: relative; }
.multi-card .mc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.multi-card .mc-info { padding: 7px 9px 8px; border-top: 1px solid var(--divider); min-width: 0; }
.multi-card .mc-name { font-size: var(--text-sm); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-card .mc-meta { font-size: var(--text-2xs); color: var(--text-faint); }
.multi-card .mc-remove {
  position: absolute; top: 6px; right: 6px;
  opacity: 0; transition: opacity var(--fast);
}
.multi-card:hover .mc-remove { opacity: 1; }
.multi-summary { display: flex; gap: 8px; padding: 12px 12px 0; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--panel-2);
}
.chip b { color: var(--text-strong); font-weight: 500; }

/* pdf / other */
.pv-frame { flex: 1; border: 0; width: 100%; background: #fff; }

/* markdown rendering */
.md {
  padding: 18px 22px 32px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  user-select: text;
  overflow-wrap: anywhere;
}
.md h1, .md h2, .md h3, .md h4 { color: var(--text-strong); letter-spacing: -0.015em; line-height: 1.25; margin: 1.4em 0 0.5em; font-weight: 600; }
.md h1 { font-size: 1.7em; margin-top: 0.2em; }
.md h2 { font-size: 1.35em; padding-bottom: 0.3em; border-bottom: 1px solid var(--divider); }
.md h3 { font-size: 1.12em; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 0.9em; }
.md a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid var(--accent-line); }
.md code { font-family: var(--font-mono); font-size: 0.88em; padding: 0.15em 0.4em; border-radius: 4px; background: var(--active); }
.md pre { padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--border); overflow: auto; }
.md pre code { padding: 0; background: none; font-size: 12px; }
.md blockquote { margin-left: 0; padding: 2px 14px; border-left: 3px solid var(--accent-line); color: var(--text-muted); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.6em 0; }
.md img { max-width: 100%; border-radius: var(--r-sm); }
.md table { border-collapse: collapse; width: 100%; font-size: 0.93em; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--panel-2); color: var(--text-strong); font-weight: 500; }
.md input[type='checkbox'] { accent-color: var(--accent); }

/* editor */
.editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor-bar {
  flex: none;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--divider);
  font-size: var(--text-xs);
  color: var(--text-faint);
}
.editor-bar .spacer { flex: 1; }
.editor-split { flex: 1; min-height: 0; display: flex; }
.editor-split.vertical { flex-direction: column; }
.editor-split > * { flex: 1; min-width: 0; min-height: 0; overflow: auto; }
.editor-split > * + * { border-left: 1px solid var(--divider); }
.editor-split.vertical > * + * { border-left: 0; border-top: 1px solid var(--divider); }
.cm-host { height: 100%; }
.cm-host .cm-editor { height: 100%; }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); display: inline-block; }
.save-state { display: flex; align-items: center; gap: 6px; padding: 0 6px; white-space: nowrap; }

/* Panes take keyboard focus but shouldn't draw a ring around the whole area. */
.content-scroll:focus-visible, .tree:focus-visible, .pane-body:focus-visible { box-shadow: none; }

/* Editor toolbar adapts to the preview panel width. */
.editor { container-type: inline-size; }
.editor-bar > * { white-space: nowrap; flex-shrink: 0; }
.editor-bar .spacer { flex-shrink: 1; min-width: 4px; }
@container (max-width: 560px) { .editor-bar .ed-kbd { display: none; } }
@container (max-width: 470px) { .editor-bar .ed-stats { display: none; } }
@container (max-width: 340px) { .editor-bar .segmented button { padding: 0 6px; font-size: 0; gap: 0; } .editor-bar .segmented button svg { width: 14px; height: 14px; } }
.tree-row.tree-file { color: var(--text-muted); }
.tree-row.tree-file .tree-icon { display: grid; place-items: center; width: 16px; }

/* close buttons in the right-hand panels */
.pv-head-sep { width: 1px; height: 18px; background: var(--divider); flex: none; }
