/* Rename by Content — the review screen (config reuses .bulk-* from bulk.css).
   Reuses the app's design tokens (auto dark-mode) and the shared .kp-enter
   entrance. No @keyframes on purpose: the screen rides .kp-enter; rows must NOT
   carry a keyframe entrance because the body is rebuilt on every template
   keystroke (it would replay/flash — see dom-patterns). Everything else is a
   cheap, specific-property transition. No `transition: all`, no reflow props. */

/* The old inline old→new review table moved onto the full-screen editor shell (see
   the `rn-*` sections lower in this file). What survives up here is the subset of the
   original `rename-*` rules the editor still reuses: preset chips (Presets popover),
   the date-format select + segmented control (Options popover), the find/replace
   inputs (Find popover), the apply-to-batch strip + party chip editor (detail pane),
   the save bar, and the save-progress overlay. */

/* Preset chips — reused in the Presets popover. */
.rename-preset-chip {
  font: inherit; font-size: .82rem; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-elev); color: var(--text-soft); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease, transform .15s ease;
}
.rename-preset-chip:hover { border-color: var(--primary); color: var(--text); transform: translateY(-1px); }
.rename-preset-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rename-preset-chip.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
/* Date-format select — reused in the Options popover. */
.rename-date-format { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); color: var(--text); cursor: pointer; }

/* Segmented control — reused for the toolbar sort + the Options join-parties picker. */
.rename-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--bg-soft); gap: 2px; }
.rename-seg-btn {
  font: inherit; font-size: .8rem; padding: 4px 12px; border: none; border-radius: 999px;
  background: transparent; color: var(--text-soft); cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.rename-seg-btn:hover { color: var(--text); }
.rename-seg-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rename-seg-btn.is-active { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* Find / replace inputs — reused in the Find popover. */
.rename-find, .rename-repl {
  font: inherit; font-size: .86rem; padding: 6px 10px; min-width: 0; flex: 1 1 140px; max-width: 230px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rename-find:focus, .rename-repl:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.rename-replace-arrow { flex: none; display: inline-flex; color: var(--text-mute); }
.rename-replace-apply { flex: none; }
.rename-replace-apply.is-active { border-color: var(--primary); color: var(--primary); }
.rename-replace-status { flex: none; font-size: .78rem; }

/* "apply this party to the other N like it?" strip */
.rename-propose-host:empty { display: none; }
.rename-propose {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: var(--radius); background: var(--primary-soft);
}
.rename-propose-msg { display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; color: var(--text); flex: 1 1 240px; }
.rename-propose-msg svg { flex: none; color: var(--primary); }
.rename-propose .btn { flex: none; }

/* (the inline old→new table, row, and detected-field pill styles were removed —
   that review now lives on the editor shell as the list + detail panes) */

/* ── Multi-party chip editor ──────────────────────────────────────────────────
   Chosen parties as an ordered, drag-reorderable, removable chip row + an "add"
   button opening a menu of the OTHER entities the detector found. */
.rename-party { position: relative; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; max-width: 100%; }
.rename-party-empty { color: var(--text-mute); font-size: .76rem; }

.rename-party-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 4px 2px 7px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-elev); color: var(--text); font-size: .76rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rename-party-chip:hover { border-color: var(--border-strong, var(--border)); }
.rename-party-chip.is-dragging { z-index: 4; border-color: var(--primary); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.rename-party-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.rename-party-kind { display: inline-flex; color: var(--text-mute); }

.rename-party-grip {
  display: inline-flex; align-items: center; padding: 0; margin: 0 1px 0 -2px;
  border: none; background: none; color: var(--text-mute); cursor: grab;
  touch-action: none; border-radius: 4px; transition: color .15s ease;
}
.rename-party-grip:hover { color: var(--text-soft); }
.rename-party-grip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rename-party-chip.is-dragging .rename-party-grip { cursor: grabbing; }

.rename-party-x {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 16px; height: 16px; padding: 0; border: none; border-radius: 50%;
  background: none; color: var(--text-mute); cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.rename-party-x:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.rename-party-x:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.rename-party-add {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 22px; height: 22px; padding: 0; border: 1px dashed var(--border); border-radius: 50%;
  background: var(--bg-soft); color: var(--text-soft); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.rename-party-add:hover, .rename-party-add.is-open { border-style: solid; border-color: var(--primary); color: var(--primary); }
.rename-party-add:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.rename-party-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30;
  min-width: 180px; max-width: 280px; max-height: 240px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 4px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-elev); box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}
.rename-party-opt {
  display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;
  padding: 6px 8px; border: none; border-radius: 7px; background: none;
  color: var(--text); font: inherit; font-size: .82rem; cursor: pointer;
  transition: background-color .12s ease;
}
.rename-party-opt:hover, .rename-party-opt:focus-visible { background: var(--bg-soft); outline: none; }
.rename-party-opt .rename-party-kind { color: var(--text-mute); }
.rename-party-opt-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Provenance hint: this candidate came from the file's NAME, not its text. Muted +
   italic so it reads as a secondary source note, never a field label. */
.rename-party-opt-src { flex: none; margin-left: 6px; font-size: .62rem; font-style: italic; color: var(--text-mute); white-space: nowrap; }

/* (filename-provenance pill + inline row-flag styles removed — the detail pane uses
   .rn-detail-src / .rn-detail-flag and the list uses .rn-litem-flag) */

/* Save bar — reused; the controller mounts it into the Save▾ popover. */
.rename-save-extra { display: inline-flex; flex-wrap: wrap; gap: 10px; }

/* ── Save overlay (progress + in-place confirm) ──────────────────────────────── */
.rename-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: color-mix(in srgb, #0b1220 55%, transparent);
}
.rename-overlay-card {
  width: min(440px, 100%); background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: 0 18px 50px rgba(0, 0, 0, .32);
  display: flex; flex-direction: column; gap: 12px;
}
.rename-overlay-title { margin: 0; font-size: 1.05rem; }
.rename-overlay-text { margin: 0; font-size: .9rem; color: var(--text-soft); line-height: 1.5; }
.rename-overlay-text code { font-size: .92em; padding: 1px 5px; border-radius: 5px; background: var(--bg-soft); border: 1px solid var(--border); }
.rename-overlay-bar { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.rename-overlay-fill {
  display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left;
  background: var(--primary); border-radius: inherit; transition: transform .2s ease;
}
.rename-overlay-count { margin: 0; font-size: .82rem; }
.rename-overlay-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* (mobile tweaks for the old inline table were removed with it) */

/* ══════════════════════════════════════════════════════════════════════════════
   Full-screen editor shell (Layout B) — mirrors .outline-overlay / .redact-overlay.
   Prefix is `rn-` (NOT `rename-`) to clear the existing `.rename-overlay` save-progress
   modal (z 1200): this editor sits below it at z 1000. Token-only; reuses the global
   editor keyframes (editorOverlayIn/Out, editorBoxIn/Out, menuIn) + the main.css
   reduced-motion gate. The sort control reuses `.rename-seg` above. No new keyframes.
   ══════════════════════════════════════════════════════════════════════════════ */
.rn-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(8, 10, 16, .88);
  display: flex; align-items: center; justify-content: center; padding: 0;
  animation: editorOverlayIn .2s ease;
}
.rn-editor {
  /* Full-window edge-to-edge — no max-width cap, no card chrome. */
  background: var(--bg-elev); border: 0; border-radius: 0;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  width: 100vw; max-width: 100vw;
  height: 100vh; height: 100dvh;
  box-shadow: none;
  animation: editorBoxIn .32s cubic-bezier(.2, .7, .3, 1);
}
.rn-overlay.closing { animation: editorOverlayOut .2s ease forwards; pointer-events: none; }
.rn-overlay.closing .rn-editor { animation: editorBoxOut .2s ease forwards; }
@media (prefers-reduced-motion: reduce) {
  .rn-overlay, .rn-overlay.closing, .rn-editor, .rn-overlay.closing .rn-editor { animation: none; }
}

/* ── Two-row toolbar ── */
.rn-tb { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.rn-tb-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; }
.rn-tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rn-tb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rn-tb-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rn-summary { font-size: 14px; white-space: nowrap; }
.rn-attn { font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.rn-attn.has-attn { color: #b45309; }
[data-theme="dark"] .rn-attn.has-attn { color: #f59e0b; }
.rn-dl-n { font-variant-numeric: tabular-nums; }
.rn-tb-main { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.rn-tb-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.rn-tb-tools .btn { display: inline-flex; align-items: center; gap: 6px; }
.rn-tb-sep { width: 1px; height: 20px; background: var(--border); flex: 0 0 auto; margin: 0 2px; }
.rn-format-host { display: flex; align-items: center; min-width: 0; }

/* ── Popovers (menuIn; toolbar-anchored) ── */
.rn-pop-wrap { position: relative; }
.rn-pop-chev { margin-left: 1px; opacity: .8; }
.rn-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 5; width: 300px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 14px;
  display: flex; flex-direction: column; gap: 13px;
  animation: menuIn .16s cubic-bezier(.2, .7, .3, 1);
}
.rn-save-wrap .rn-pop { left: auto; right: 0; }
.rn-pop-find { width: 320px; }
.rn-pop[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .rn-pop { animation: none; } }

/* The Save▾ popover body is filled by the controller with the proven _renameSave bar
   (.rename-save-extra), so it carries the default .rn-pop padding — no bespoke styles. */

/* ── Body = two panes split by a hairline (Layout B) ── */
.rn-body {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: minmax(0, 44%) minmax(0, 1fr);
  gap: 1px; background: var(--border);
}
.rn-pane { background: var(--bg-elev); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ── Naming-format token chips (rename-format.js) — drag to reorder, × to remove,
   + to insert, "Type it" for literal text / `/` subfolders. Mirrors the party-chip
   look; new chips pop with the shared rectPopIn. ── */
.rn-fmt-wrap { display: flex; align-items: center; min-width: 0; }
.rn-fmt { position: relative; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.rn-fmt-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 4px 3px 6px; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: 7px; background: var(--primary-soft); color: var(--text); line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rn-fmt-chip:hover { border-color: var(--primary); }
.rn-fmt-chip.is-dragging { z-index: 4; border-color: var(--primary); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.rn-fmt-chip.rn-fmt-pop { animation: rectPopIn .26s cubic-bezier(.34, 1.56, .64, 1); }
.rn-fmt-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .76rem; }
.rn-fmt-grip {
  display: inline-flex; align-items: center; padding: 0; margin-left: -2px;
  border: none; background: none; color: var(--text-mute); cursor: grab;
  touch-action: none; border-radius: 4px; transition: color .15s ease;
}
.rn-fmt-grip:hover { color: var(--text-soft); }
.rn-fmt-grip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rn-fmt-chip.is-dragging .rn-fmt-grip { cursor: grabbing; }
.rn-fmt-x {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 15px; height: 15px; padding: 0; border: none; border-radius: 50%;
  background: none; color: var(--text-mute); cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.rn-fmt-x:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.rn-fmt-x:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rn-fmt-sep { color: var(--text-mute); font-size: .8rem; white-space: pre; padding: 0 1px; }
.rn-fmt-sep.is-folder { color: var(--primary); font-weight: 600; }
.rn-fmt-add {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 22px; height: 22px; padding: 0; border: 1px dashed var(--border); border-radius: 50%;
  background: var(--bg-soft); color: var(--text-soft); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.rn-fmt-add:hover { border-style: solid; border-color: var(--primary); color: var(--primary); }
.rn-fmt-add:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rn-fmt-typeit {
  font: inherit; font-size: .74rem; color: var(--text-mute); background: none; border: none;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 2px 4px;
  transition: color .15s ease;
}
.rn-fmt-typeit:hover { color: var(--primary); }
.rn-fmt-typeit:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.rn-fmt-input {
  font: inherit; font-size: .84rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 5px 9px; min-width: 0; width: min(320px, 42vw);
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rn-fmt-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.rn-fmt-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30;
  min-width: 130px; max-height: 240px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 4px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-elev); box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}
.rn-fmt-opt {
  display: flex; align-items: center; width: 100%; text-align: left;
  padding: 6px 9px; border: none; border-radius: 7px; background: none;
  color: var(--text); font: inherit; cursor: pointer; transition: background-color .12s ease;
}
.rn-fmt-opt:hover, .rn-fmt-opt:focus-visible { background: var(--bg-soft); outline: none; }
.rn-fmt-opt-tok { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }

/* ── Toolbar popover bodies (Presets / Options / Find), filled by the controller ── */
.rn-presets-pop { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.rn-opt-field { display: flex; flex-direction: column; gap: 6px; }
.rn-opt-label { font-size: .78rem; font-weight: 600; color: var(--text-soft); }
.rn-find { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rn-find .rename-find, .rn-find .rename-repl { flex: 1 1 120px; max-width: none; }
.rn-find .rename-replace-apply { flex: 1 1 100%; }
.rn-find .rename-replace-status { flex: 1 1 100%; font-size: .78rem; }

/* ── Left pane: the calm one-line file list (rename-list.js) ── */
.rn-list { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.rn-list-hd { display: flex; flex-direction: column; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.rn-list-hd-main { display: flex; align-items: center; gap: 9px; }
.rn-list-all { display: inline-flex; align-items: center; }
.rn-list-all-cb { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.rn-list-title { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-mute); }
.rn-list-count { margin-left: auto; font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
/* sort lives in the header now — full-width segmented toggle */
.rn-list-sort { display: flex; align-self: stretch; }
.rn-list-sort .rename-seg-btn { flex: 1 1 0; text-align: center; padding: 5px 10px; }
.rn-list-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.rn-list-note { flex: 0 0 auto; margin: 0; padding: 7px 12px; font-size: .76rem; border-top: 1px solid var(--border); }
.rn-list-note:empty { display: none; }

.rn-litem {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px;
  border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.rn-litem:hover { background: var(--bg-soft); }
.rn-litem:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.rn-litem.is-sel { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.rn-litem.is-excluded { opacity: .5; }
.rn-litem-inc { flex: 0 0 auto; width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.rn-litem-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--text-mute); }
.rn-litem-dot[data-state="ok"] { background: var(--success); }
.rn-litem-dot[data-state="flag"] { background: #d97706; }
[data-theme="dark"] .rn-litem-dot[data-state="flag"] { background: #f59e0b; }
.rn-litem-dot[data-state="error"] { background: var(--danger); }
.rn-litem-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.rn-litem-new { font-size: .86rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rn-litem-old { font-size: .74rem; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rn-litem-err { color: var(--danger); }
.rn-litem.is-error .rn-litem-new { font-weight: 500; color: var(--text-soft); }
.rn-litem-flag { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; color: #b45309; max-width: 36%; }
.rn-litem-flag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rn-litem-flag svg { flex: none; }
[data-theme="dark"] .rn-litem-flag { color: #f59e0b; }

/* ── Right pane: per-file correct-and-verify (rename-detail.js) ── */
.rn-detail { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.rn-detail-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
/* "← Files" back button: phones only (master-detail); a no-op chip on desktop. */
.rn-detail-back { display: none; align-items: center; gap: 3px; font: inherit; font-size: .84rem; font-weight: 600; color: var(--text-soft); background: none; border: none; cursor: pointer; padding: 4px 6px 4px 0; margin-right: auto; transition: color .15s ease; }
.rn-detail-back:hover { color: var(--primary); }
.rn-detail-back svg { flex: none; }
.rn-detail-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.rn-detail-pos { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-mute); }
.rn-detail-step { display: inline-flex; align-items: center; gap: 6px; }
.rn-detail-propose-host { flex: 0 0 auto; }
.rn-detail-propose-host:empty { display: none; }
.rn-detail-propose-host .rename-propose { margin: 10px 14px 0; }
.rn-detail-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.rn-detail-empty { color: var(--text-mute); font-size: .9rem; padding: 24px 6px; text-align: center; }
.rn-detail-error { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 7%, var(--bg-elev)); }
.rn-detail-error svg { flex: none; color: var(--danger); margin-top: 2px; }
.rn-detail-error p { margin: 3px 0 0; font-size: .84rem; }

.rn-detail-label { font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); }
.rn-detail-name { display: flex; flex-direction: column; gap: 6px; }
.rn-detail-name-row { display: flex; align-items: center; gap: 8px; }
.rn-detail-name-input {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: .98rem; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.rn-detail-name-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.rn-detail-name-input.is-manual { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-soft); }
.rn-detail-revert { flex: none; font: inherit; font-size: .76rem; color: var(--text-mute); background: none; border: none; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 4px 6px; transition: color .15s ease; }
.rn-detail-revert:hover { color: var(--primary); }
.rn-detail-revert[hidden] { display: none; }

.rn-detail-flag { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: #b45309; }
.rn-detail-flag svg { flex: none; }
.rn-detail-flag[hidden] { display: none; }
[data-theme="dark"] .rn-detail-flag { color: #f59e0b; }

/* Borderless field groups — the input keeps its own outline, so a card box here just
   doubled every border and read as busy. Lean on the grid gap for separation instead. */
.rn-detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 14px; }
.rn-detail-card { display: flex; flex-direction: column; gap: 6px; }
.rn-detail-card-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rn-detail-field {
  width: 100%; font: inherit; font-size: .88rem; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rn-detail-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.rn-detail-field.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }
.rn-detail-party { display: flex; min-width: 0; }
.rn-detail-src { font-size: .68rem; font-style: italic; color: var(--text-mute); }

.rn-conf { display: inline-flex; align-items: center; gap: 4px; }
.rn-conf-bar { width: 4px; height: 11px; border-radius: 1px; background: color-mix(in srgb, var(--text-mute) 30%, transparent); }
.rn-conf-lbl { font-size: .64rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mute); }
.rn-conf-hi .rn-conf-bar.is-on { background: var(--success); }
.rn-conf-mid .rn-conf-bar.is-on { background: #d97706; }
.rn-conf-lo .rn-conf-bar.is-on { background: var(--danger); }

/* Source-page preview (rename-detail-preview.js) — the proof the name fits the file. */
.rn-detail-pv-host { display: flex; }
.rename-pv { display: flex; flex-direction: column; gap: 8px; width: 100%; min-width: 0; }
.rename-pv-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rename-pv-title { font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); }
.rename-pv-proof { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .72rem; }
.rename-pv-nav { display: inline-flex; align-items: center; gap: 6px; }
.rename-pv-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--border); border-radius: 7px; background: var(--bg-elev); color: var(--text-soft); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.rename-pv-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.rename-pv-btn:disabled { opacity: .4; cursor: default; }
.rename-pv-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rename-pv-page { font-size: .8rem; color: var(--text-soft); display: inline-flex; align-items: center; }
.rename-pv-jump { width: 42px; font: inherit; font-size: .8rem; text-align: center; padding: 3px 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-elev); color: var(--text); }
.rename-pv-jump:focus { outline: none; border-color: var(--primary); }
.rename-pv-total { color: var(--text-mute); margin-left: 3px; }
.rename-pv-frame {
  display: flex; align-items: flex-start; justify-content: center;
  min-height: 180px; max-height: 60vh; overflow: auto; padding: 12px;
  border-radius: var(--radius); background: var(--bg-soft);
}
.rename-pv-empty { color: var(--text-mute); font-size: .84rem; text-align: center; max-width: 34ch; align-self: center; padding: 24px 8px; line-height: 1.5; }
.rename-pv-stage { position: relative; }
.rename-pv-stage canvas { display: block; max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 12px rgba(0, 0, 0, .16); }

/* ── Tablet: stack list over detail (still two panes, just vertical) ── */
@media (max-width: 900px) and (min-width: 761px) {
  .rn-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1.1fr); }
}

/* ── Phone: full-screen editor, compact toolbar, master-detail (one pane at a time) ── */
@media (max-width: 760px) {
  .rn-overlay { padding: 0; }
  .rn-editor { border-radius: 0; height: 100vh; height: 100dvh; }

  /* Toolbar: summary on ONE line, then actions; Download grows to fill. Long labels
     ("Save to disk", "Find & replace") trim to their first word so each button group
     packs onto a single row instead of wrapping a stray button to its own line. */
  .rn-tb { padding: 9px 12px; gap: 6px; }
  .rn-tb-meta { gap: 6px 10px; }
  .rn-tb-info { flex-direction: row; align-items: baseline; gap: 6px; flex-wrap: wrap; }
  .rn-lbl-x { display: none; }
  .rn-tb-sep { display: none; }            /* the chip-row divider dangles at the wrap edge on phones */
  .rn-tb-left { flex: 1 1 100%; min-width: 0; }
  .rn-summary { max-width: none; }
  .rn-tb-right { flex: 1 1 100%; }
  .rn-tb-right .btn[data-act="download"] { flex: 1 1 auto; justify-content: center; }
  .rn-pop { width: min(320px, calc(100vw - 24px)); }

  /* One pane at a time: list first, the detail slides in over it on tap. */
  .rn-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); gap: 0; }
  .rn-pane[data-role="detail"] { display: none; }
  .rn-editor.show-detail .rn-pane[data-role="list"] { display: none; }
  .rn-editor.show-detail .rn-pane[data-role="detail"] { display: flex; }
  .rn-detail-back { display: inline-flex; }

  /* Roomier touch targets + a single-column field stack. */
  .rn-detail-fields { grid-template-columns: 1fr; gap: 14px; }
  .rename-pv-frame { max-height: 46vh; }
  .rn-litem { padding: 9px 10px; }
  .rn-list-sort .rename-seg-btn { padding: 7px 10px; }
}
