/* ====================================================================
   DESIGN TOKENS — single source of truth for color, spacing, type.
   Light values live on :root; dark values override under
   [data-theme="dark"] (set on <html> from the theme selector).
   ==================================================================== */
:root {
    /* Brand / accent */
    --accent: #08c988;
    --accent-hover: #06b377;
    --accent-soft: #e8f5e9;
    --accent-contrast: #ffffff;

    /* Surfaces */
    --bg: #ffffff;
    --bg-elev: #ffffff;      /* dropdowns, settings panel, popovers */
    --bg-muted: #f8f9fa;     /* toolbar, subtle fills */
    --bg-hover: #f1f3f5;

    /* Text */
    --text: #1f2328;
    --text-muted: #6c757d;
    --text-faint: #9aa0a6;

    /* Borders */
    --border: #e2e4e8;
    --border-strong: #c8ccd2;

    /* Radii / shadows */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.12);

    /* Diff palette (GitHub-like) */
    --diff-add-line: #e6ffec;
    --diff-add-text: #abf2bc;
    --diff-del-line: #ffebe9;
    --diff-del-text: #ffc1ba;
    --diff-gutter: #ffd33d;
    --diff-add-strong: #1a7f37;   /* outlines, edge bars, fold chevrons */
    --diff-del-strong: #cf222e;

    /* Alignment gap (the empty .cm-mergeSpacer CM6 draws opposite an
       add/remove). Kept faint + neutral so it reads as "no content here"
       without grabbing attention — the block on the other pane stands out. */
    --diff-gap-fill: rgba(130, 130, 130, 0.07);
    --diff-changed-line: rgba(130, 130, 130, 0.07);   /* calm neutral: gap lines + modified lines */

    /* Ignored (excluded from diff) — subdued gray so matches read as "not
       compared" without the pull of red/green. Reduced-opacity fill + dimmed
       text keep them present but minimally noticeable. */
    --diff-ignore-line: rgba(128, 128, 128, 0.14);
    --diff-ignore-text: rgba(120, 120, 120, 0.55);

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;

    /* Type */
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

[data-theme="dark"] {
    --accent: #08c988;
    --accent-hover: #0adba0;
    --accent-soft: #17372a;
    --accent-contrast: #06231a;

    --bg: #1e1e1e;
    --bg-elev: #2a2a2c;
    --bg-muted: #252526;
    --bg-hover: #34343a;

    --text: #e6e6e6;
    --text-muted: #a0a4ab;
    --text-faint: #777b82;

    --border: #3a3a3e;
    --border-strong: #4a4a50;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow: 0 6px 22px rgba(0, 0, 0, 0.5);

    --diff-add-line: #102a1b;
    --diff-add-text: #1f5a36;
    --diff-del-line: #3a1618;
    --diff-del-text: #6e2b28;
    --diff-gutter: #b9933a;
    --diff-add-strong: #3fb950;
    --diff-del-strong: #f85149;

    --diff-gap-fill: rgba(255, 255, 255, 0.045);
    --diff-changed-line: rgba(255, 255, 255, 0.045);

    --diff-ignore-line: rgba(180, 180, 180, 0.12);
    --diff-ignore-text: rgba(200, 200, 200, 0.35);
}

* {
    box-sizing: border-box;
}

#container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.intro {
    padding: 8px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.intro-left,
.intro-center,
.intro-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.intro-left {
    flex: 1;
}

.intro-center {
    justify-content: center;
    flex: 1;
}

.intro-right {
    justify-content: flex-end;
    flex: 1;
}

#view-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
    /* Important for flex child scrolling */
    display: flex;
    flex-direction: row;
}

/* Button styles */
button {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

button:hover {
    background: #f5f5f5;
    border-color: #999;
}

button.active {
    background: #08c988;
    color: white;
    border-color: #08c988;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Pane-specific buttons */
.pane-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    font-size: 12px;
    padding: 4px 10px;
}

.copy-btn {
    display: none;
}

/* CodeMirror 6 custom styling */
.cm-editor {
    height: 100%;
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.cm-scroller {
    overflow: auto;
}

/* Merge view styling - Fixed to match actual DOM structure */
.cm-mergeView {
    height: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex: 1;
}

/* The wrapper that contains both editors */
.cm-mergeViewEditors {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: 100% !important;
    gap: 2px;
    flex: 1;
}

/* Force each editor to be exactly 50% */
.cm-mergeViewEditor {
    flex: 1 1 50% !important;
    width: 50% !important;
    max-width: 50% !important;
    min-width: 0 !important;
    /* Critical: allows shrinking below content size */
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden !important;
    /* Prevent overflow from breaking layout */
    position: relative;
}

/* Editor container within each panel */
.cm-mergeView .cm-editor {
    height: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Scroller must respect parent constraints. It fills the editor (flex child);
   a percentage height was resolving to the content height, which left the
   horizontal bar floating mid-pane under an empty editor. */
.cm-mergeView .cm-scroller {
    overflow: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
}

/* Content sizes to its text. It used to be width: 100% of the scroller, which
   sits beside the gutters, so with Word wrap off it always overflowed by the
   gutter width and drew a horizontal bar under short lines. Wrapping still
   fits the pane: CM6's .cm-lineWrapping lets the content shrink. */
.cm-mergeView .cm-content {
    min-width: 0 !important;
}

/* Ensure lines don't stretch the container */
.cm-mergeView .cm-line {
    max-width: 100% !important;
}

/* Word wrap specific styles */
.cm-mergeView .cm-line[style*="white-space: pre-wrap"] {
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* No wrap mode - ensure horizontal scrolling */
.cm-mergeView .cm-line[style*="white-space: pre"] {
    max-width: none;
    /* Allow line to extend for scrolling */
    white-space: pre !important;
}

/* ====================================================================
         DIFF HIGHLIGHTING - Enhanced Red/Green Scheme
         Matches modern Git/GitHub diff visualization
         ==================================================================== */

/* Changed (modified-but-present) line — faint tint so a value/key edit is
   visible even with character highlighting off. Pure insert/delete lines
   override this with their own full-width red/green via <ins>/<del>. */
.cm-changedLine {
    background-color: var(--diff-changed-line) !important;
}

/* Deleted lines (left side) - Red background */
.cm-deletedLine {
    background-color: var(--diff-del-line) !important;
    display: inline-block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Inserted lines (right side) - Green background */
.cm-insertedLine {
    background-color: var(--diff-add-line) !important;
    display: inline-block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Changed text within deleted lines - Darker red highlight */
.cm-deletedLine .cm-changedText {
    background-color: var(--diff-del-text) !important;
    font-weight: 500 !important;
}

/* Changed text within inserted lines - Darker green highlight */
.cm-insertedLine .cm-changedText {
    background-color: var(--diff-add-text) !important;
    font-weight: 500 !important;
}

/* Legacy chunk backgrounds (fallback for older code) */
.cm-deletedChunk {
    background-color: var(--diff-del-line) !important;
}

.cm-insertedChunk {
    background-color: var(--diff-add-line) !important;
}

/* Legacy text backgrounds (fallback) */
.cm-deletedText {
    background-color: var(--diff-del-text) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
}

.cm-insertedText {
    background-color: var(--diff-add-text) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
}

/* Remove underlines from del/ins elements */
del.cm-deletedLine,
ins.cm-insertedLine,
del,
ins {
    text-decoration: none !important;
    background-image: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

/* Ensure changed text doesn't have underlines either */
.cm-changedText {
    text-decoration: none !important;
    background-image: none !important;
    border-bottom: none !important;
}

/* Gutter markers for changed lines */
.cm-changedLineGutter {
    background-color: var(--diff-gutter) !important;
    width: 3px !important;
    margin-left: 2px !important;
}

/* Per-side gutter tint: left pane (a) marks removals/edits in red,
   right pane (b) marks additions/edits in green — mirrors the line colors. */
.cm-merge-a .cm-changedLineGutter {
    background-color: var(--diff-del-text) !important;
}

.cm-merge-b .cm-changedLineGutter {
    background-color: var(--diff-add-text) !important;
}

/* ====================================================================
   ALIGNMENT GAP ("no content here")
   When a whole array item / object exists on only one side, CM6 keeps
   the panes aligned by inserting a blank .cm-mergeSpacer on the side
   that lacks those lines. We give it only a faint neutral fill so the
   region reads as intentionally empty without grabbing attention — the
   added/removed block on the OTHER pane is what should stand out.
   ==================================================================== */
.cm-mergeSpacer {
    background-color: var(--diff-gap-fill);
}

/* ====================================================================
   IGNORED KEYS (excluded from diff)
   Lines belonging to an excluded key get the .cm-ignoredLine line
   decoration. It must WIN over the red/green diff classes, so every rule
   here is more specific (two classes) and/or !important. The char-level
   .cm-changedText highlight is flattened so nothing red/green shows.
   Two skins:
     • neutral (default off-tint) — background removed, just dimmed text
     • .ignore-styled (toggle on) — subdued gray fill so it's clearly "ignored"
   ==================================================================== */
.cm-ignoredLine,
.cm-changedLine.cm-ignoredLine,
.cm-deletedLine.cm-ignoredLine,
.cm-insertedLine.cm-ignoredLine {
    background-color: transparent !important;
}

/* Kill the character-level red/green inside ignored lines. */
.cm-ignoredLine .cm-changedText,
.cm-ignoredLine .cm-deletedText,
.cm-ignoredLine .cm-insertedText {
    background-color: transparent !important;
    font-weight: normal !important;
    color: var(--diff-ignore-text) !important;
}

/* Dim the whole ignored line so it recedes from the compared content. */
.cm-ignoredLine {
    color: var(--diff-ignore-text) !important;
}

/* Optional subdued gray skin (checkbox "Show grayed-out style"). */
.ignore-styled .cm-ignoredLine,
.ignore-styled .cm-changedLine.cm-ignoredLine,
.ignore-styled .cm-deletedLine.cm-ignoredLine,
.ignore-styled .cm-insertedLine.cm-ignoredLine {
    background-color: var(--diff-ignore-line) !important;
}

/* Status bar removed (was #diff-status) */

/* Error message area */
#conversion-error-area {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4444;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    display: none;
    z-index: 2000;
    max-width: 80%;
    text-align: center;
}

/* Per-pane action buttons */
.pane-controls {
    position: absolute;
    top: 10px;
    right: 22px;
    z-index: 100;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

/* Show pane controls only on panel hover */
.cm-mergeViewEditor:hover .pane-controls {
    opacity: 0.85;
    pointer-events: auto;
}

.pane-controls button {
    font-size: 11px;
    padding: 4px 8px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
}

.pane-controls button:hover {
    opacity: 1;
    background: #f5f5f5;
}

/* Per-pane file actions: CSV→JSON / JSON→CSV / Export.
   They live in the bar under each editor (see "Panel titles & branch tabs"
   at the end of this file), which decides where they sit and when they show.
   Built on the theme tokens, so one rule set serves light and dark. */
.csv-convert-btn,
.json-convert-btn,
.export-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 9px;
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1;
    color: var(--text-muted);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.csv-convert-btn:hover,
.json-convert-btn:hover,
.export-dropdown-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.export-dropdown-container {
    position: relative;
}

.export-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    padding: 4px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.export-dropdown-item {
    display: block;
    width: 100%;
    padding: 7px 10px;
    font-family: var(--font-ui);
    font-size: 12px;
    text-align: left;
    color: var(--text);
    background: none;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
}

.export-dropdown-item:hover {
    background: var(--bg-hover);
    border: 0;
}

/* Dark theme — Copy / Paste / Clear hover buttons */
.cm-theme-dark .pane-controls button {
    background: #2d2d2d;
    color: #ccc;
    border-color: #555;
}

.cm-theme-dark .pane-controls button:hover {
    background: #3d3d3d;
    color: #eee;
    border-color: #777;
}

.pane-wrapper {
    position: relative;
    flex: 1;
}

/* Dropdown panels */
.dropdown-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    min-width: 260px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1210;
    margin-top: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
}

.dropdown-item+.dropdown-item {
    margin-top: 6px;
}

/* Responsive design */
@media (max-width: 768px) {
    .intro {
        flex-wrap: wrap;
    }

    button {
        font-size: 12px;
        padding: 5px 10px;
    }

    .pane-controls button {
        font-size: 10px;
        padding: 3px 6px;
    }

    .intro-left,
    .intro-center,
    .intro-right {
        flex: 100%;
        justify-content: flex-start;
    }
}

button {
    white-space: nowrap;
}


/* ------------------------------------------------------------ */
/* v6/css/app.css */
/* ------------------------------------------------------------ */
body {
    margin: 0;
    padding: 0;
}

.contentPage {
    max-width: 100% !important;
    padding: 0 !important;
}

#container {
    background-color: white;
    width: 100%;
    margin: 0;
    padding: 0;
}

#view {
    width: 100%;
    padding: 0;
    margin: 0;
}

.CodeMirror-merge {
    width: 100%;
}

.CodeMirror-merge-pane {
    width: 47%;
}

.CodeMirror-merge-gap {
    width: 6%;
}

#container:fullscreen #view {
    width: 100%;
}

#container:fullscreen .CodeMirror-merge,
#container:fullscreen .CodeMirror-merge .CodeMirror {
    height: 100vh;
}

#viewHeader {
    padding: 10px;
    margin: 8px auto 16px auto;
    text-align: center;
}

/* Share button specific styling */
.toggle-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.toggle-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Improved visual feedback for share button */
.toggle-button.share-success {
    background-color: #28a745 !important;
    color: white !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.toggle-button {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    margin: 0 5px;
    font-size: 14px;
}

.toggle-button.active {
    background-color: #4CAF50;
    color: white;
}

.CodeMirror-merge-collapsed-line {
    display: none !important;
}

.CodeMirror-merge-spacer {
    display: none;
}

select.toggle-button {
    height: 30px;
}

#diff-status {
    text-align: center;
    margin: 10px 0;
    font-size: 16px;
    color: #333;
}

@media (max-width: 1250px) {
    #fs {
        visibility: hidden;
    }

    #viewHeader {
        margin: auto;
        text-align: center;
        height: 40px;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }
}

.CodeMirror-merge-pane.show-diffs-only .CodeMirror-line {
    display: none;
}

.CodeMirror-merge-pane.show-diffs-only .CodeMirror-merge-r-chunk .CodeMirror-line,
.CodeMirror-merge-pane.show-diffs-only .CodeMirror-merge-l-chunk .CodeMirror-line {
    display: block;
    background-color: #f0f8ff;
    /* Light blue background for better visibility */
}

/* Add some padding around diff chunks */
.CodeMirror-merge-pane.show-diffs-only .CodeMirror-merge-r-chunk,
.CodeMirror-merge-pane.show-diffs-only .CodeMirror-merge-l-chunk {
    padding: 5px 0;
    margin: 5px 0;
    border-top: 2px solid #ddd;
    border-bottom: 2px solid #ddd;
}

/* Add context lines before and after diffs */
.CodeMirror-merge-pane.show-diffs-only .CodeMirror-merge-r-chunk .CodeMirror-line:first-child,
.CodeMirror-merge-pane.show-diffs-only .CodeMirror-merge-l-chunk .CodeMirror-line:first-child {
    border-top: 1px solid #eee;
    padding-top: 5px;
}

.CodeMirror-merge-pane.show-diffs-only .CodeMirror-merge-r-chunk .CodeMirror-line:last-child,
.CodeMirror-merge-pane.show-diffs-only .CodeMirror-merge-l-chunk .CodeMirror-line:last-child {
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

/* Clear button styling */
.clear-btn {
    position: absolute;
    top: 5px;
    z-index: 100;
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.clear-btn:hover {
    opacity: 1;
    background-color: #e9ecef;
}

.clear-btn-left {
    right: 10px;
}

.clear-btn-right {
    right: 10px;
}

/* Paste button styling */
.paste-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    z-index: 100;
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.paste-btn:hover {
    opacity: 1;
    background-color: #e9ecef;
}

/* Copy button styling (shown on hover) */
.copy-btn {
    position: absolute;
    top: 5px;
    right: 90px; /* leave space for Clear/Paste at right:10px */
    z-index: 100;
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;              /* hidden by default */
    pointer-events: none;     /* don't block hover when hidden */
    transition: opacity 0.2s, background-color 0.2s;
}

.copy-btn:hover {
    background-color: #e9ecef;
}

/* Reveal copy button when hovering over a pane */
.CodeMirror-merge-pane:hover .copy-btn {
    opacity: 0.9;
    pointer-events: auto;
}

/* Success feedback */
.copy-btn.copied {
    background-color: #28a745;
    color: #fff;
}

/* Dropdown menu for controls */
.controls-dropdown {
    display: inline-block;
}
.controls-menu {
    border-radius: 6px;
}
.controls-menu > div, .controls-menu > button, .controls-menu > label, .controls-menu > select {
    display: block;
    margin: 6px 0;
}

/* Slightly adjust the dropdown button */
.controls-dropdown > .toggle-button {
    display: inline-flex;
    align-items: center;
}

/* Add to your CSS or in a <style> tag */
.CodeMirror-merge-pane .CodeMirror-line:empty::before {
    content: " ";
    color: #ccc;
    font-style: italic;
}

.CodeMirror-merge-pane .CodeMirror-line:empty {
    min-height: 1.3em;
    background-color: #f9f9f9;
    border-left: 3px solid #e0e0e0;
}

/* CodeMirror 6 placeholder styling */
.cm-placeholder {
    color: #999 !important;
    font-style: normal !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    opacity: 0.7 !important;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere;
    /* Padding must stay inside the pane width, or it creates a horizontal overflow */
    box-sizing: border-box;
    max-width: 100%;
    padding: 20px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Scrollbars: thin and quiet. The native horizontal bar only shows when a
   line really overflows (overflow: auto), and it no longer sits under an
   empty pane. */
.cm-scroller,
.cm-mergeView .cm-scroller,
.branch-tabs {
    scrollbar-width: thin;
    scrollbar-color: #c4c4c4 transparent;
    scrollbar-gutter: auto;
}

.cm-scroller::-webkit-scrollbar,
.cm-mergeView .cm-scroller::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.cm-scroller::-webkit-scrollbar-track,
.cm-mergeView .cm-scroller::-webkit-scrollbar-track {
    background: transparent;
}

.cm-scroller::-webkit-scrollbar-thumb,
.cm-mergeView .cm-scroller::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.cm-scroller::-webkit-scrollbar-thumb:hover,
.cm-mergeView .cm-scroller::-webkit-scrollbar-thumb:hover {
    background: #9a9a9a;
    background-clip: padding-box;
}

.cm-scroller::-webkit-scrollbar-corner,
.cm-mergeView .cm-scroller::-webkit-scrollbar-corner {
    background: transparent;
}

[data-theme="dark"] .cm-scroller,
[data-theme="dark"] .cm-mergeView .cm-scroller {
    scrollbar-color: #555 transparent;
}

[data-theme="dark"] .cm-scroller::-webkit-scrollbar-thumb,
[data-theme="dark"] .cm-mergeView .cm-scroller::-webkit-scrollbar-thumb {
    background: #555;
    background-clip: padding-box;
}

[data-theme="dark"] .cm-scroller::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .cm-mergeView .cm-scroller::-webkit-scrollbar-thumb:hover {
    background: #777;
    background-clip: padding-box;
}

/* Panel name input styling */
.panel-name-container {
    position: absolute;
    bottom: 8px;
    right: 10px;
    z-index: 100;
}

.panel-name-input {
    width: 140px;
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: rgba(248, 249, 250, 0.95);
    color: #666;
    outline: none;
    transition: all 0.2s ease;
    opacity: 0.5;
}

.panel-name-input:hover {
    opacity: 0.75;
    border-color: #aaa;
    background: rgba(255, 255, 255, 0.98);
}

.panel-name-input:focus {
    opacity: 1;
    border-color: #888;
    box-shadow: 0 0 0 2px rgba(128, 128, 128, 0.15);
    width: 180px;
    color: #444;
    background: #fff;
}

.panel-name-input::placeholder {
    color: #aaa;
    font-style: italic;
}

/* When input has value, show it more prominently */
.panel-name-input:not(:placeholder-shown) {
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.98);
    font-weight: 500;
    color: #555;
    border-color: #999;
}

/* Adjust position when CSV button is visible */
.cm-mergeViewEditor .panel-name-container {
    bottom: 8px;
}

/* Dark theme support */
.cm-editor[style*="background-color: rgb(30"] .panel-name-input,
.cm-theme-dark .panel-name-input {
    background: rgba(50, 50, 50, 0.95);
    color: #999;
    border-color: #555;
}

.cm-theme-dark .panel-name-input:hover {
    border-color: #666;
    color: #aaa;
}

.cm-theme-dark .panel-name-input:focus {
    border-color: #888;
    color: #ccc;
}

.cm-theme-dark .panel-name-input:not(:placeholder-shown) {
    color: #bbb;
    background: rgba(60, 60, 60, 0.98);
}

/* Responsive - smaller on mobile */
@media (max-width: 768px) {
    .panel-name-input {
        width: 100px;
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .panel-name-input:focus {
        width: 130px;
    }
}

/* Branch selector, tabs and branch list: see "Panel titles & branch tabs"
   at the end of this file. */

/* ===== Drop Overlay for Snapshot Import ===== */
#drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

#drop-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.drop-overlay-content {
    background: #fff;
    border-radius: 16px;
    padding: 48px 64px;
    text-align: center;
    border: 3px dashed #007bff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.drop-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.drop-text {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.drop-subtext {
    font-size: 14px;
    color: #666;
}

/* Dark theme support for drop overlay */
.cm-theme-dark #drop-overlay,
[data-theme="dark"] #drop-overlay {
    background: rgba(0, 0, 0, 0.85);
}

.cm-theme-dark .drop-overlay-content,
[data-theme="dark"] .drop-overlay-content {
    background: #2d2d2d;
    border-color: #0d6efd;
}

.cm-theme-dark .drop-text,
[data-theme="dark"] .drop-text {
    color: #eee;
}

.cm-theme-dark .drop-subtext,
[data-theme="dark"] .drop-subtext {
    color: #aaa;
}

/* ====================================================================
   MODERN CHROME  (toolbar, buttons, menus, settings, status, footer)
   Everything below is token-driven so light/dark stay in sync. This
   block is intentionally last so it wins over older hardcoded rules.
   ==================================================================== */

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
}

#container {
    background: var(--bg);
}

/* ---- Toolbar ---- */
.intro {
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border);
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
}

.intro-center {
    gap: var(--space-2);
}

.toolbar-divider {
    width: 1px;
    align-self: stretch;
    min-height: 22px;
    background: var(--border);
    margin: 0 var(--space-1);
}

/* ---- Buttons ---- */
button,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.2;
    color: var(--text);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

button:hover,
.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

button:active,
.btn:active {
    transform: translateY(0.5px);
}

button:disabled,
.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-contrast);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.btn-icon {
    padding: 6px 9px;
    text-decoration: none;
}

.v5-link {
    text-decoration: none;
    font-size: 12.5px;
}

/* ---- Quick toggles ---- */
.toolbar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 5px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    transition: background .15s, color .15s;
}

.toolbar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.toolbar-toggle input,
.setting-row input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---- Diff summary pill ---- */
#diff-summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 14px;
    white-space: nowrap;
}

#diff-summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
    flex: 0 0 auto;
}

#diff-summary[data-state="diff"] {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

#diff-summary[data-state="diff"]::before {
    background: var(--accent);
}

#diff-summary[data-state="same"]::before {
    background: #2da44e;
}

/* Diff could not be computed precisely (CM6 fell back to a crude match on
   content too large for its scan) — say so rather than reporting a count
   that means nothing. */
#diff-summary[data-state="warn"] {
    color: #8a5a00;
    border-color: #e0b050;
    background: rgba(224, 176, 80, 0.14);
    white-space: normal;
    max-width: 46ch;
}

#diff-summary[data-state="warn"]::before {
    background: #e0a020;
}

[data-theme="dark"] #diff-summary[data-state="warn"] {
    color: #f0c674;
    border-color: #8a6a20;
    background: rgba(224, 176, 80, 0.12);
}

/* ---- Diff navigation ---- */
.diff-nav {
    display: inline-flex;
    gap: 2px;
}

.diff-nav .btn {
    font-size: 13px;
    font-weight: 600;
    padding: 5px 9px;
}

/* ---- Menus / dropdowns ---- */
.menu-anchor {
    position: relative;
    display: inline-block;
}

.dropdown-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--space-2);
    z-index: 1210;   /* above the floating Details panel (1200), under modals */
    font-family: var(--font-ui);
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--text);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
}

.dropdown-item + .dropdown-item {
    margin-top: 4px;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.dropdown-link {
    text-decoration: none;
    color: inherit;
}

.dropdown-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin: 12px 0 6px;
    padding: 0 2px;
}

.dropdown-select {
    width: 100%;
}

.dropdown-hint {
    margin-top: 10px;
    padding: 8px 10px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-muted);
    border-radius: var(--radius);
}

/* ---- Settings panel ---- */
.settings-panel {
    min-width: 340px;
    max-height: calc(100vh - 100px);
    padding: var(--space-4);
    overflow-y: auto;
}

.settings-panel-left {
    left: 0;
    right: auto;
}

.settings-section-title {
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}

.settings-section-divided {
    margin-top: 18px;
}

.setting-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s;
}

.setting-row:hover {
    background: var(--bg-hover);
}

.setting-row input[type="checkbox"] {
    margin-top: 2px;
    flex: 0 0 auto;
}

.setting-row.row-inline {
    align-items: center;
    justify-content: space-between;
    cursor: default;
}

.setting-row.row-perf {
    background: rgba(240, 173, 78, 0.14);
}

.setting-row.row-perf:hover {
    background: rgba(240, 173, 78, 0.22);
}

.setting-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.setting-title {
    font-size: 13px;
    color: var(--text);
}

.setting-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ====================================================================
   Progressive disclosure — ⓘ info icon + on-demand tooltip
   --------------------------------------------------------------------
   Verbose descriptions (.setting-desc / .ignore-desc) are hidden and
   revealed on hover/focus (desktop) or tap (touch) via a subtle info
   icon next to the title. The popover is portaled to <body>, so a
   scrolling panel (overflow-y:auto) never clips it. See enhanceInfoTips().
   ==================================================================== */
.is-tip-source { display: none !important; }

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 6px;
    padding: 0;
    flex: 0 0 auto;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 999px;
    cursor: help;
    vertical-align: middle;
    opacity: .55;
    transition: opacity .15s, color .15s, box-shadow .15s;
}

.info-icon:hover,
.info-icon:focus-visible,
.info-icon[aria-expanded="true"] {
    opacity: 1;
    color: var(--accent);
    outline: none;
}

.info-icon:focus-visible {
    box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Keep the icon on the title's baseline within a section-title bar. */
.settings-section-title .info-icon {
    color: var(--text-muted);
    vertical-align: -1px;
}

.info-tip {
    position: fixed;
    z-index: 2000;
    width: max-content;
    max-width: 300px;
    padding: 9px 11px;
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.info-tip code {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 4px;
}

.settings-select,
.settings-input-num {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 8px;
    cursor: pointer;
}

.settings-input-num {
    width: 92px;
    text-align: right;
}

.settings-select:focus,
.settings-input-num:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.perf-status {
    margin-top: 12px;
    padding: 8px 10px;
    font-size: 11px;
    color: var(--text);
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
}

/* ---- Ignore keys / patterns dropdown ---- */
.ignore-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    margin-left: 6px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: var(--accent);
    border-radius: 999px;
}

.ignore-panel {
    min-width: 320px;
}

.ignore-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
}

.ignore-desc code {
    font-family: var(--font-mono);
    font-size: 10.5px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 4px;
}

.ignore-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.ignore-input {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 8px;
}

.ignore-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.ignore-input-row .btn {
    flex: 0 0 auto;
}

.ignore-error {
    margin-top: 8px;
    font-size: 11px;
    color: #d14343;
}

.ignore-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.ignore-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 6px 5px 10px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.ignore-item-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    word-break: break-all;
}

.ignore-item-regex {
    color: var(--accent);
}

.ignore-remove {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.ignore-remove:hover {
    color: #fff;
    background: #d14343;
}

.ignore-empty {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-faint);
    font-style: italic;
}

/* ---- Footer ---- */
.app-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-muted);
    border-top: 1px solid var(--border);
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

.footer-sep {
    color: var(--text-faint);
}

/* ---- Editor frame in dark mode ---- */
[data-theme="dark"] .cm-mergeViewEditor {
    border-color: var(--border);
}
/* ==== Record pager + field-level diff details ==========================
   Shown for collections too large to render whole: the panes hold one page
   of records, while the counts and the breakdown below come from the
   structural model and describe the WHOLE dataset. */
.record-pager {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    font-size: 12px;
    white-space: nowrap;
}

.record-pager #record-pager-label {
    min-width: 11ch;
    text-align: center;
    color: var(--text-muted, #666);
}

.record-pager .btn-icon:disabled {
    opacity: 0.35;
    cursor: default;
}

.diff-details {
    position: absolute;
    top: 60px;
    right: 16px;
    z-index: 1200;
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: var(--panel-bg, #fff);
    color: var(--text, #222);
    border: 1px solid var(--border, #ddd);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
}

.diff-details-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border, #eee);
}

.diff-details-head strong {
    flex: 0 0 auto;
}

.diff-details-section {
    flex: 0 0 auto;
    padding: 8px 12px 2px;
    font-weight: 600;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.05em;
}

.diff-details-head input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 4px 8px;
    border: 1px solid var(--border, #ddd);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
}

.diff-details-meta {
    flex: 0 0 auto;
    padding: 8px 12px;
    color: var(--text-muted, #666);
    border-bottom: 1px solid var(--border, #eee);
}

.diff-details-fields {
    flex: 0 0 auto;
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--border, #eee);
    max-height: 34vh;
    min-height: 0;
    overflow-y: auto;
}

.diff-details-items {
    flex: 1 1 40%;
    min-height: 120px;
    padding: 4px 0;
    overflow-y: auto;
}

.dd-field-row,
.dd-item-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 12px;
}

.dd-item-row {
    cursor: pointer;
    border-left: 3px solid transparent;
}

.dd-item-row:hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.04));
    border-left-color: var(--accent, #4a90d9);
}

/* The row you last jumped to keeps its place while you read the panes. */
.dd-item-row.is-active {
    background: rgba(74, 144, 217, 0.14);
    border-left-color: var(--accent, #4a90d9);
}
[data-theme="dark"] .dd-item-row.is-active {
    background: rgba(74, 144, 217, 0.22);
}

/* Field rows filter the item list, so they need to read as controls too. */
.dd-field-row {
    cursor: pointer;
    border-left: 3px solid transparent;
}
.dd-field-row:hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.04));
    border-left-color: var(--accent, #4a90d9);
}
[data-theme="dark"] .dd-field-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.dd-field-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-count {
    flex: 0 0 auto;
    color: var(--text-muted, #666);
    font-variant-numeric: tabular-nums;
}

.dd-bar {
    flex: 0 0 90px;
    height: 6px;
    border-radius: 3px;
    background: var(--border, #eee);
    overflow: hidden;
}

.dd-bar > span {
    display: block;
    height: 100%;
    background: var(--accent, #4a90d9);
}

.dd-badge {
    flex: 0 0 auto;
    padding: 0 6px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dd-badge.changed { background: rgba(74, 144, 217, 0.18); color: #2a6db0; }
.dd-badge.added   { background: rgba(64, 160, 88, 0.18);  color: #2f7d45; }
.dd-badge.removed { background: rgba(200, 72, 72, 0.18);  color: #a83a3a; }
.dd-badge.moved   { background: rgba(140, 100, 200, 0.18); color: #6a4aa8; }

.dd-empty {
    padding: 14px 12px;
    color: var(--text-muted, #777);
}

[data-theme="dark"] .diff-details {
    background: var(--panel-bg, #23272e);
    border-color: var(--border, #3a3f47);
}

[data-theme="dark"] .dd-item-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .dd-badge.changed { background: rgba(74, 144, 217, 0.25); color: #8ec2f0; }
[data-theme="dark"] .dd-badge.added   { background: rgba(64, 160, 88, 0.25);  color: #8ed6a4; }
[data-theme="dark"] .dd-badge.removed { background: rgba(200, 72, 72, 0.25);  color: #f0a0a0; }
[data-theme="dark"] .dd-badge.moved   { background: rgba(140, 100, 200, 0.28); color: #c0a8f0; }

/* --- "here is the record you asked for" flash ----------------------------
   Scrolling a record into view is not enough feedback when both panes are
   full of red and green — the eye has nothing to land on. Fades out on its
   own so it never competes with the diff colours. */
.cm-recordFlash {
    background-color: rgba(74, 144, 217, 0.28) !important;
    box-shadow: inset 3px 0 0 var(--accent, #4a90d9);
    animation: record-flash 1.8s ease-out forwards;
}
[data-theme="dark"] .cm-recordFlash {
    background-color: rgba(74, 144, 217, 0.34) !important;
}
@keyframes record-flash {
    0%   { opacity: 1; }
    55%  { opacity: 1; }
    100% { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
    .cm-recordFlash { animation: none; }
}

/* ============================================================
   Processing panel — progress / ETA / cancel for long operations
   Non-blocking by design: it floats above the editors, never covers
   them, and only the panel itself takes pointer events, so the app
   stays usable while a large comparison runs.
   ============================================================ */
.proc-panel {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 4000;
    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 12px 14px;
    background: var(--bg-elev, #fff);
    border: 1px solid var(--border, #e2e4e8);
    border-radius: var(--radius-lg, 10px);
    box-shadow: var(--shadow, 0 4px 16px rgba(0, 0, 0, 0.12));
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text, #1f2328);
    /* Hidden until the work is slow enough to be worth reporting. */
    display: none;
    animation: proc-in 140ms ease-out;
}

.proc-panel.is-visible {
    display: block;
}

@keyframes proc-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.proc-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.proc-head {
    margin-bottom: 6px;
}

.proc-title {
    flex: 1;
    font-weight: 600;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.proc-spinner {
    width: 12px;
    height: 12px;
    flex: none;
    border: 2px solid var(--border-strong, #c8ccd2);
    border-top-color: var(--accent, #08c988);
    border-radius: 50%;
    animation: proc-spin 700ms linear infinite;
}

@keyframes proc-spin {
    to { transform: rotate(360deg); }
}

.proc-cancel {
    flex: none;
    padding: 3px 10px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text, #1f2328);
    background: var(--bg-muted, #f8f9fa);
    border: 1px solid var(--border-strong, #c8ccd2);
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
}

.proc-cancel:hover {
    background: var(--diff-del-line, #ffebe9);
    border-color: #d9534f;
    color: #b02a25;
}

.proc-phase {
    margin-bottom: 6px;
    color: var(--text-muted, #6c757d);
}

.proc-track {
    height: 5px;
    background: var(--bg-hover, #f1f3f5);
    border-radius: 3px;
    overflow: hidden;
}

.proc-fill {
    height: 100%;
    width: 0;
    background: var(--accent, #08c988);
    border-radius: 3px;
    transition: width 140ms linear;
}

.proc-meta {
    margin-top: 6px;
    justify-content: space-between;
    color: var(--text-faint, #9aa0a6);
    font-size: 11px;
}

.proc-meta .proc-eta {
    flex: none;
    white-space: nowrap;
}

.proc-meta .proc-count {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .proc-cancel:hover {
    background: rgba(200, 72, 72, 0.22);
    border-color: #c85050;
    color: #f0a0a0;
}

@media (max-width: 560px) {
    .proc-panel {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: 12px;
    }
}

/* ==========================================================================
   Ingest & repair surfaces
   Added with the JSON auto-fix / linting work. Three problems these solve:
     - errors had nowhere to live except #diff-summary, which the next
       updateDiffStatus() overwrote 50 ms later  -> .notice-strip
     - nothing anywhere reported whether a panel held valid JSON  -> .pane-chip
     - repair had to be previewable to be trustworthy             -> .repair-modal
   ========================================================================== */

/* --- busy state on the diff pill (was declared in JS but never styled) ---- */
#diff-summary[data-state="busy"] {
    color: var(--text-muted);
    border-color: var(--border-strong);
    background: var(--bg-muted);
}
#diff-summary[data-state="busy"]::before {
    background: var(--text-faint);
    animation: diff-busy-pulse 1.1s ease-in-out infinite;
}
@keyframes diff-busy-pulse {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    #diff-summary[data-state="busy"]::before { animation: none; }
}

/* --- notice strip (floating toasts) --------------------------------------
   These used to be an in-flow block between the toolbar and the panels, so
   every notice pushed the editors down and back up again — the diff you were
   reading jumped under the cursor. They are overlaid now: fixed to the
   bottom-left corner, out of the way of the progress panel (bottom-right)
   and the per-pane branch selectors (bottom of each pane), and taking no
   layout space at all, so nothing moves when one appears.
   --------------------------------------------------------------------------- */
.notice-strip {
    position: fixed;
    left: var(--space-3);
    bottom: 52px;                       /* clear of the app footer */
    z-index: 3000;                      /* under .proc-panel (4000) + modals */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    width: min(460px, calc(100vw - 32px));
    max-height: min(60vh, 520px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px;                       /* room for the focus ring */
    /* The stack itself must never eat clicks meant for the editor beneath. */
    pointer-events: none;
}
.notice-strip:empty { display: none; }

.notice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: var(--radius);
    background: var(--bg-elev);
    box-shadow: var(--shadow, 0 4px 16px rgba(0, 0, 0, 0.12));
    font-family: var(--font-ui);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text);
    pointer-events: auto;
    animation: notice-in 140ms ease-out;
}
@keyframes notice-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .notice { animation: none; }
}
.notice[data-kind="warn"]  { border-left-color: #e0a020; }
.notice[data-kind="error"] { border-left-color: #d1242f; }
.notice[data-kind="info"]  { border-left-color: var(--accent); }
.notice[data-kind="ok"]    { border-left-color: #2da44e; }

.notice-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.notice-actions { display: flex; gap: var(--space-1); flex: 0 0 auto; flex-wrap: wrap; }
.notice-actions .btn { padding: 2px 8px; font-size: 12px; }
.notice-close {
    flex: 0 0 auto;
    border: 0;
    background: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: 0 2px;
    font-size: 13px;
    line-height: 1.3;
}
.notice-close:hover { color: var(--text); }

/* Narrow viewports: the progress panel goes full width at the bottom, so put
   the notices above it rather than beside it. */
@media (max-width: 720px) {
    .notice-strip {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: 96px;
    }
}

/* --- per-pane content chips ---------------------------------------------- */
.pane-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3) 0;
}
.pane-chip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    padding: 4px var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-muted);
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-muted);
}
.pane-chip-dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-faint);
}
.pane-chip-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pane-chip-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.pane-chip-actions .btn { padding: 1px 7px; font-size: 11.5px; }

.pane-chip[data-state="empty"]   { opacity: 0.6; }
.pane-chip[data-state="valid"] .pane-chip-dot   { background: #2da44e; }
.pane-chip[data-state="fixable"] .pane-chip-dot { background: #e0a020; }
.pane-chip[data-state="fixable"] {
    color: #8a5a00;
    border-color: #e0b050;
    background: rgba(224, 176, 80, 0.10);
}
.pane-chip[data-state="invalid"] .pane-chip-dot { background: #d1242f; }
.pane-chip[data-state="invalid"] {
    color: #a4232c;
    border-color: #e0949a;
    background: rgba(209, 36, 47, 0.07);
}
.pane-chip[data-state="text"] .pane-chip-dot { background: var(--text-faint); }

[data-theme="dark"] .pane-chip[data-state="fixable"] {
    color: #f0c674;
    border-color: #8a6a20;
    background: rgba(224, 176, 80, 0.10);
}
[data-theme="dark"] .pane-chip[data-state="invalid"] {
    color: #ff9a9a;
    border-color: #7a2a30;
    background: rgba(209, 36, 47, 0.12);
}

/* --- repair preview modal ------------------------------------------------- */
.repair-modal {
    position: fixed;
    inset: 0;
    z-index: 1260;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.repair-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}
.repair-modal-body {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: min(80vh, 640px);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    font-family: var(--font-ui);
}
.repair-modal-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}
.repair-modal-head h2 {
    flex: 1 1 auto;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.repair-summary {
    padding: var(--space-3) var(--space-4);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.repair-summary ul { margin: var(--space-2) 0 0; padding-left: 18px; }
.repair-summary li { margin: 2px 0; color: var(--text-muted); }
.repair-changes {
    flex: 1 1 auto;
    overflow: auto;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
}
.repair-diff-row {
    display: grid;
    grid-template-columns: 3.5em 1fr;
    gap: var(--space-2);
    padding: 1px 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.repair-diff-row .ln { color: var(--text-faint); text-align: right; user-select: none; }
.repair-diff-row[data-kind="del"] { background: var(--diff-del-line); }
.repair-diff-row[data-kind="add"] { background: var(--diff-add-line); }
.repair-diff-gap {
    padding: 2px 0 2px 4.5em;
    color: var(--text-faint);
    font-size: 11px;
}
.repair-modal-foot {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
}
.repair-modal-spacer { flex: 1 1 auto; }
.repair-hint { font-size: 11.5px; color: var(--text-faint); }

/* --- format menu, clean options, sort options ----------------------------- */
.format-group { display: inline-flex; }
.format-group #btn-format { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-caret {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: 1px;
    padding-left: 7px;
    padding-right: 7px;
}
.dropdown-hint {
    color: var(--text-faint);
    font-size: 11px;
    margin-left: 6px;
}
.clean-options {
    display: grid;
    gap: 2px;
    max-height: 190px;
    overflow-y: auto;
    padding: var(--space-1) 0 var(--space-2);
}
.clean-options label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 1px 2px;
}
.clean-options label:hover { color: var(--text); }
.clean-options input { margin-top: 2px; flex: 0 0 auto; }

.sort-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) 0 0;
}
.sort-target {
    font-size: 11.5px;
    color: var(--text-muted);
    padding: 0 0 var(--space-2);
}
.sort-target b { color: var(--text); font-weight: 600; }

/* --- lint gutter / diagnostics ------------------------------------------- */
/* CM6 ships defaults, but they assume a light background. */
/* The marker is the primary "something is wrong here, fix it" affordance, so
   it has to look and behave like a control: pointer cursor, a hit area wider
   than the 12px dot, and a visible hover state. */
.cm-lint-marker {
    width: 0.9em;
    height: 0.9em;
    cursor: pointer;
    box-sizing: content-box;
    padding: 2px 3px;
    margin: -2px -3px;
    border-radius: 3px;
    transition: background-color 120ms ease;
}
.cm-lint-marker:hover { background-color: rgba(209, 36, 47, 0.16); }
.cm-diagnostic { font-family: var(--font-ui); font-size: 12px; }
.cm-diagnostic-error { border-left-color: #d1242f; }
.cm-diagnostic-warning { border-left-color: #e0a020; }
/* The class lives on the <ul> INSIDE .cm-tooltip, never on the same element,
   so the old `.cm-tooltip.cm-tooltip-lint` selector matched nothing and the
   inline diagnostic tooltip kept CM6's light-theme default on a dark page. */
.cm-tooltip:has(> .cm-tooltip-lint),
.cm-tooltip .cm-tooltip-lint {
    background: var(--bg-elev);
    border-radius: var(--radius);
    color: var(--text);
}
.cm-tooltip:has(> .cm-tooltip-lint) {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* --- pinned lint popover (replaces CM6's hover-only gutter tooltip) -------
   Why this exists rather than styling the library's tooltip: that one closes
   itself from a window mousemove the moment the pointer leaves the ~12px
   marker, so the Fix button inside it could not be reached. See LintPop in
   v6/index.html.
   -------------------------------------------------------------------------- */
.lint-pop {
    position: fixed;
    z-index: 3500;              /* over the editors, under .proc-panel (4000) */
    display: none;
    width: max-content;
    max-width: 340px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 10px);
    background: var(--bg-elev);
    box-shadow: var(--shadow, 0 4px 16px rgba(0, 0, 0, 0.18));
    font-family: var(--font-ui);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text);
}
.lint-pop.is-open { display: block; }

.lint-pop-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 6px;
}
.lint-pop-badge {
    flex: 0 0 auto;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.lint-pop-badge.error   { background: rgba(209, 36, 47, 0.12); color: #a4232c; }
.lint-pop-badge.warning { background: rgba(224, 160, 32, 0.14); color: #8a5a00; }
[data-theme="dark"] .lint-pop-badge.error   { background: rgba(209, 36, 47, 0.22); color: #ff9a9a; }
[data-theme="dark"] .lint-pop-badge.warning { background: rgba(224, 176, 80, 0.18); color: #f0c674; }

.lint-pop-where {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11.5px;
    color: var(--text-muted);
}
.lint-pop-close {
    flex: 0 0 auto;
    border: 0;
    background: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: 0 2px;
    font-size: 13px;
    line-height: 1.3;
}
.lint-pop-close:hover { color: var(--text); }

.lint-pop-msg { overflow-wrap: anywhere; }
.lint-pop-msg + .lint-pop-msg { margin-top: 4px; }
.lint-pop-note {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--text-muted);
}
.lint-pop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: 10px;
}
.lint-pop-actions .btn { padding: 3px 10px; font-size: 12px; }

@media (max-width: 720px) {
    .pane-chips { grid-template-columns: 1fr; }
    .repair-modal-body { max-height: 90vh; }
}

/* ==========================================================================
   Panel titles & branch tabs
   The panel title (chip) and each branch tab show the same name — the active
   branch's — and both edit it in place. Tabs live in a real bar under each
   editor rather than floating over the last lines of code; hiding them
   (the eye) collapses the bar back to floating controls with a dropdown.

   Everything here is paint-only: no rule depends on document size, and the
   JS behind it never touches the diff, so it costs nothing on large data.
   ========================================================================== */

:root {
    --branch-unsaved: #d98e04;
    --branch-unsaved-halo: rgba(217, 142, 4, 0.18);
    --branch-danger: #cf222e;
    --branch-danger-soft: rgba(207, 34, 46, 0.12);
}
[data-theme="dark"] {
    --branch-unsaved: #f0b43c;
    --branch-unsaved-halo: rgba(240, 180, 60, 0.2);
    --branch-danger: #ff8b8b;
    --branch-danger-soft: rgba(255, 120, 120, 0.14);
}

/* --- panel title in the chip -------------------------------------------- */
.pane-chip-title {
    position: relative;
    flex: 0 1 auto;
    min-width: 2ch;
    max-width: 45%;
    margin: 0 -4px;
    padding: 1px 16px 1px 5px;          /* right: room for the pencil */
    border: 1px solid transparent;
    border-radius: 5px;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
    transition: background-color 0.15s, border-color 0.15s;
}
/* Pencil: says "you can rename this" without a label. */
.pane-chip-title::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 4px;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M11.1 1.9a1.8 1.8 0 0 1 2.6 0l.4.4a1.8 1.8 0 0 1 0 2.6L5.4 13.6 1.5 14.5l.9-3.9z'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M11.1 1.9a1.8 1.8 0 0 1 2.6 0l.4.4a1.8 1.8 0 0 1 0 2.6L5.4 13.6 1.5 14.5l.9-3.9z'/%3E%3C/svg%3E") center / contain no-repeat;
    opacity: 0;
    transition: opacity 0.15s;
}
.pane-chip:hover .pane-chip-title::after { opacity: 0.35; }
.pane-chip-title:hover::after,
.pane-chip-title:focus-visible::after { opacity: 0.8; }
.pane-chip-title:hover {
    background: var(--bg);
    border-color: var(--border-strong);
}
.pane-chip-title:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.pane-chip[data-state="fixable"] .pane-chip-title,
.pane-chip[data-state="invalid"] .pane-chip-title { color: inherit; }
.pane-chip-text::before {
    content: '·';
    margin-right: 6px;
    opacity: 0.6;
}

/* --- the rename box (title, tab, branch list) --------------------------- */
.inline-rename {
    min-width: 6ch;
    max-width: 100%;
    height: 22px;
    padding: 0 6px;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 5px;
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.inline-rename.pane-chip-title-input {
    max-width: 45%;
    margin: 0 -4px;
    font-size: 12.5px;
}
.branch-tab .inline-rename { height: 20px; }

/* --- the bar under each editor ------------------------------------------ */
.cm-mergeViewEditor {
    display: flex;
    flex-direction: column;
}
.cm-mergeView .cm-mergeViewEditor > .cm-editor {
    flex: 1 1 0;
    min-height: 0;
    height: auto !important;
}

.pane-footer {
    position: relative;
    z-index: 250;                 /* menus open upward, over the gutters (200) */
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    gap: 8px;
    height: 32px;
    padding: 0 6px 0 4px;
    background: var(--bg-muted);
    /* The top rule is a shadow, not a border: the active tab paints over it,
       so it reads as the sheet the editor above belongs to. */
    box-shadow: inset 0 1px 0 var(--border);
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-muted);
}
.branch-strip {
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    min-width: 0;
}
.pane-footer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

/* Icon buttons: branch list, new branch, show/hide tabs. */
.pane-footer.is-tabs .branch-selector-btn,
.branch-tab-add,
.branch-tabs-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    padding: 0;
    color: var(--text-muted);
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}
.pane-footer.is-tabs .branch-selector-btn:hover,
.pane-footer.is-tabs .branch-selector-btn[aria-expanded="true"],
.branch-tab-add:hover,
.branch-tabs-toggle:hover {
    color: var(--text);
    background: var(--bg-hover);
    border-color: transparent;
}
.branch-tab-add { margin-left: 2px; }
.branch-tab-add:hover { color: var(--accent); }
.branch-tabs-toggle[aria-pressed="false"] { color: var(--text-faint); }

/* Hairline dividers: after the branch list, and before the eye (a view
   control, not a file action). */
.pane-footer.is-tabs .branch-selector-container::after {
    content: '';
    align-self: center;
    width: 1px;
    height: 16px;
    margin: 0 4px 0 6px;
    background: var(--border);
}
.pane-footer.is-tabs .branch-tabs-toggle { position: relative; margin-left: 5px; }
.pane-footer.is-tabs .branch-tabs-toggle::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 5px;
    bottom: 5px;
    width: 1px;
    background: var(--border);
}

/* The pane's file actions: shown only when they apply. */
.pane-footer .csv-convert-btn:not(.visible),
.pane-footer .json-convert-btn:not(.visible),
.pane-footer .export-dropdown-container:not(.visible) {
    display: none;
}

/* Save — visible only while the active branch has unsaved changes; the dot
   is the same one its tab shows. */
.branch-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px 0 9px;
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1;
    color: var(--text);
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.branch-save-btn::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--branch-unsaved);
}
.branch-save-btn[hidden] { display: none; }
.branch-save-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.branch-save-btn:disabled { opacity: 0.6; cursor: default; }

/* --- tabs ----------------------------------------------------------------- */
.branch-tabs {
    position: relative;          /* each tab's offsetLeft is measured from here */
    display: flex;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
    padding: 0 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;       /* wheel, arrows and the branch list scroll it */
}
.branch-tabs::-webkit-scrollbar { display: none; }
.branch-tabs.fade-start {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 20px);
            mask-image: linear-gradient(to right, transparent, #000 20px);
}
.branch-tabs.fade-end {
    -webkit-mask-image: linear-gradient(to left, transparent, #000 20px);
            mask-image: linear-gradient(to left, transparent, #000 20px);
}
.branch-tabs.fade-start.fade-end {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
            mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
}

/* A sheet tab hanging from the editor. Same weight active or not, so tabs
   never change width (and shove their neighbours) when you switch. */
.branch-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    height: 28px;
    max-width: 220px;
    padding: 0 5px 1px 11px;
    border: 1px solid transparent;
    border-top: 0;
    border-radius: 0 0 8px 8px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background-color 0.12s, color 0.12s;
}
.branch-tab.is-main { padding-right: 11px; }
.branch-tab:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.branch-tab[aria-selected="true"] {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
    box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.25);
}
.branch-tab[aria-selected="true"]::after {
    content: '';
    position: absolute;
    left: 11px;
    right: 11px;
    bottom: 3px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
}
/* Hairline dividers between resting tabs, dropped beside the hovered or
   active one so it reads as a single shape. */
.branch-tab + .branch-tab::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 8px;
    bottom: 9px;
    width: 1px;
    background: var(--border);
}
.branch-tab:hover::before,
.branch-tab:hover + .branch-tab::before,
.branch-tab[aria-selected="true"]::before,
.branch-tab[aria-selected="true"] + .branch-tab::before { opacity: 0; }
.branch-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -3px;
}
.branch-tab-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.branch-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--text-faint);
    opacity: 0.45;
    transition: opacity 0.12s, background-color 0.12s, color 0.12s;
}
.branch-tab:hover .branch-tab-close,
.branch-tab[aria-selected="true"] .branch-tab-close { opacity: 1; }
.branch-tab-close:hover {
    background: var(--branch-danger-soft);
    color: var(--branch-danger);
    border: 0;
}

/* Per-branch save state: saved = check, unsaved = amber dot (click saves),
   saving = spinner. */
.branch-tab-status {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
}
.branch-tab-status::before { content: ''; display: block; }
.branch-tab-status[data-state="saved"]::before {
    width: 3.5px;
    height: 7px;
    margin-top: -2px;
    border: solid var(--text-faint);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    opacity: 0.75;
}
.branch-tab[aria-selected="true"] .branch-tab-status[data-state="saved"]::before {
    border-color: var(--accent);
    opacity: 1;
}
.branch-tab-status[data-state="unsaved"] { cursor: pointer; }
.branch-tab-status[data-state="unsaved"]::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--branch-unsaved);
    box-shadow: 0 0 0 2.5px var(--branch-unsaved-halo);
    transition: box-shadow 0.15s;
}
.branch-tab-status[data-state="unsaved"]:hover::before {
    box-shadow: 0 0 0 4px var(--branch-unsaved-halo);
}
.branch-tab-status[data-state="saving"]::before {
    width: 9px;
    height: 9px;
    border: 1.5px solid var(--accent);
    border-right-color: transparent;
    border-radius: 50%;
    animation: branch-saving-spin 0.7s linear infinite;
}
@keyframes branch-saving-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .branch-tab-status[data-state="saving"]::before { animation: none; }
}

/* --- the branch button -------------------------------------------------- */
/* Tabs on: an icon at the left end of the bar (every branch, plus move and
   reset). Tabs off: a labelled dropdown naming the current branch. */
.branch-selector-container {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}
.branch-selector-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    white-space: nowrap;
    cursor: pointer;
}
.branch-selector-btn .branch-icon { font-size: 12px; }
.branch-selector-btn .branch-arrow { font-size: 9px; opacity: 0.6; }
.branch-selector-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* In the dropdown button only problems are worth a mark — no check. */
.branch-selector-btn .branch-tab-status[data-state="saved"] { display: none; }

/* --- tabs hidden: floating controls over the editor --------------------- */
.pane-footer.is-compact {
    position: absolute;
    left: 10px;
    right: 20px;
    bottom: 10px;
    height: auto;
    padding: 0;
    background: none;
    box-shadow: none;
    pointer-events: none;           /* the gaps between buttons are editor */
}
.pane-footer.is-compact .branch-tabs { display: none; }
.pane-footer.is-compact .branch-strip,
.pane-footer.is-compact .pane-footer-actions {
    align-items: center;
    gap: 6px;
}
.pane-footer.is-compact .branch-strip > *,
.pane-footer.is-compact .branch-save-btn,
.pane-footer.is-compact .branch-tabs-toggle {
    pointer-events: auto;
}
.pane-footer.is-compact .branch-selector-btn,
.pane-footer.is-compact .branch-tab-add,
.pane-footer.is-compact .branch-tabs-toggle,
.pane-footer.is-compact .branch-save-btn,
.pane-footer.is-compact .csv-convert-btn,
.pane-footer.is-compact .json-convert-btn,
.pane-footer.is-compact .export-dropdown-btn {
    height: 26px;
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}
.pane-footer.is-compact .branch-tab-add,
.pane-footer.is-compact .branch-tabs-toggle { width: 26px; }
.pane-footer.is-compact .branch-selector-btn {
    max-width: 260px;
    padding: 0 10px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text);
}
.pane-footer.is-compact .branch-selector-btn:hover,
.pane-footer.is-compact .branch-tab-add:hover,
.pane-footer.is-compact .branch-tabs-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.pane-footer.is-compact .branch-strip,
.pane-footer.is-compact .branch-tabs-toggle {
    opacity: 0.85;
    transition: opacity 0.2s;
}
.cm-mergeViewEditor:hover .pane-footer.is-compact .branch-strip,
.cm-mergeViewEditor:hover .pane-footer.is-compact .branch-tabs-toggle {
    opacity: 1;
}
/* File actions stay out of the way until the pointer is over the panel, as
   they always did when they floated over the code. */
.pane-footer.is-compact .csv-convert-btn,
.pane-footer.is-compact .json-convert-btn,
.pane-footer.is-compact .export-dropdown-container {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.cm-mergeViewEditor:hover .pane-footer.is-compact .csv-convert-btn,
.cm-mergeViewEditor:hover .pane-footer.is-compact .json-convert-btn,
.cm-mergeViewEditor:hover .pane-footer.is-compact .export-dropdown-container {
    opacity: 1;
    pointer-events: auto;
}

/* --- branch list (the dropdown) ------------------------------------------ */
.branch-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    z-index: 1001;
    min-width: 240px;
    max-width: 300px;
    max-height: 360px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text);
}
.branch-dropdown-section-header {
    padding: 6px 8px 4px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-faint);
}
.branch-dropdown-section-header .section-icon { display: none; }
.branch-dropdown-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 5px;
    color: var(--text);
    cursor: pointer;
}
.branch-dropdown-item:hover { background: var(--bg-hover); }
.branch-dropdown-item.active {
    background: var(--accent-soft);
    font-weight: 600;
}
.branch-dropdown-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
}
.branch-item-name {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}
.branch-item-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.branch-item-icon {
    flex: 0 0 auto;
    font-size: 12px;
    opacity: 0.75;
}
.branch-item-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.12s;
}
.branch-dropdown-item:hover .branch-item-actions,
.branch-dropdown-item:focus-within .branch-item-actions { opacity: 1; }
.branch-action-icon {
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0.75;
    cursor: pointer;
}
.branch-action-icon:hover {
    opacity: 1;
    background: var(--border);
}
.branch-action-icon.branch-action-delete:hover { background: var(--branch-danger-soft); }
.branch-dropdown-divider {
    height: 1px;
    margin: 4px 2px;
    background: var(--border);
}
.branch-dropdown-item.branch-action { color: var(--text-muted); }
.branch-dropdown-item.branch-action:hover { color: var(--text); }
.branch-dropdown-item.branch-delete { color: var(--branch-danger); }
.branch-dropdown-item.branch-info {
    cursor: default;
    padding: 4px 8px 2px;
    font-size: 10.5px;
    color: var(--text-faint);
}
.branch-dropdown-item.branch-info:hover { background: none; }

/* --- delete confirmation ------------------------------------------------- */
.confirm-pop {
    position: fixed;
    z-index: 3500;
    width: max-content;
    max-width: min(320px, calc(100vw - 16px));
    padding: var(--space-3);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-family: var(--font-ui);
    font-size: 12.5px;
    color: var(--text);
    animation: notice-in 120ms ease-out;
}
.confirm-pop-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}
.confirm-pop-text {
    margin-top: 4px;
    color: var(--text-muted);
}
.confirm-pop-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-3);
}
.confirm-pop-actions .btn { padding: 4px 12px; font-size: 12.5px; }
.btn-danger {
    color: #fff;
    background: #cf222e;
    border-color: #cf222e;
}
.btn-danger:hover {
    background: #a40e26;
    border-color: #a40e26;
}
@media (prefers-reduced-motion: reduce) {
    .confirm-pop { animation: none; }
}

/* ====================================================================
   KEY COMPARISON — one table of every key: match / different / one side
   (utils/key_compare.js, initKeyCompare in index.html). Rows are absolutely
   positioned at a fixed height so 300k of them can be virtualized.
   ==================================================================== */
.kc-modal {
    position: fixed;
    inset: 0;
    z-index: 1250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.kc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}
.kc-body {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1400px, 100%);
    height: min(88vh, 960px);
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    font-family: var(--font-ui);
    font-size: 12.5px;
    overflow: hidden;
}
.kc-head {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}
.kc-head h2 {
    flex: 0 0 auto;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}
.kc-summary {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.kc-summary strong { color: var(--text); }
.kc-t-changed { color: #b26a00; }
.kc-t-left    { color: #b4383a; }
.kc-t-right   { color: #2f7d45; }
.kc-t-equal   { color: var(--text-muted); }

.kc-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border);
}
.kc-toolbar-2 { background: var(--bg-muted); }
.kc-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.kc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}
.kc-chip:hover { background: var(--bg-hover); }
.kc-chip[aria-selected="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}
.kc-chip-n {
    color: var(--text-muted);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}
/* A colour key on each chip, matching the row edges and badges below. */
.kc-chip::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--border-strong);
}
.kc-f-valueDiff::before   { background: #e0a030; }
.kc-f-keyDiff::before     { background: linear-gradient(90deg, #d05555 50%, #45a865 50%); }
.kc-f-leftOnly::before    { background: #d05555; }
.kc-f-rightOnly::before   { background: #45a865; }
.kc-f-keysMatch::before   { background: linear-gradient(90deg, #9aa0a6 50%, #e0a030 50%); }
.kc-f-valuesMatch::before { background: #9aa0a6; }
.kc-f-ignored::before     { background: repeating-linear-gradient(45deg, #9aa0a6 0 2px, transparent 2px 4px); }

.kc-group { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kc-seg {
    padding: 4px 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}
.kc-seg + .kc-seg { border-left: 1px solid var(--border); }
.kc-seg[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); }
#kc-search {
    flex: 0 1 280px;
    min-width: 140px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: inherit;
    font: inherit;
}
.kc-spacer { flex: 1 1 auto; }
.kc-count { color: var(--text-muted); font-variant-numeric: tabular-nums; }

.kc-table {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.kc-row {
    display: grid;
    grid-template-columns: 170px minmax(180px, 1.1fr) minmax(120px, 1fr) minmax(120px, 1fr);
    align-items: center;
    column-gap: 10px;
    padding: 0 var(--space-4);
}
.kc-header {
    flex: 0 0 auto;
    height: 30px;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.kc-header > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-h-left  { color: #b4383a; }
.kc-h-right { color: #2f7d45; }
.kc-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}
.kc-spacer-rows { position: relative; }
.kc-spacer-rows .kc-row {
    position: absolute;
    left: 0;
    right: 0;
    height: 30px;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    cursor: pointer;
}
.kc-spacer-rows .kc-row:hover { background: var(--bg-hover); }
/* The left edge says what happened to the key at a glance while scrolling. */
.kc-row.kc-s-changed   { border-left-color: #e0a030; }
.kc-row.kc-s-leftOnly  { border-left-color: #d05555; }
.kc-row.kc-s-rightOnly { border-left-color: #45a865; }
.kc-row.kc-s-mixed     { border-left-color: #8a6ad0; }
.kc-row.kc-s-equal .kc-path,
.kc-row.kc-s-ignored .kc-path { color: var(--text-muted); }

.kc-status { display: flex; align-items: center; gap: 6px; min-width: 0; }
.kc-badge {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.kc-b-equal     { background: rgba(130, 130, 130, 0.16); color: var(--text-muted); }
.kc-b-changed   { background: rgba(224, 160, 48, 0.2);  color: #9a5b00; }
.kc-b-leftOnly  { background: rgba(208, 85, 85, 0.18);  color: #a83a3a; }
.kc-b-rightOnly { background: rgba(69, 168, 101, 0.18); color: #2f7d45; }
.kc-b-mixed     { background: rgba(138, 106, 208, 0.2); color: #6a4aa8; }
.kc-b-ignored   { background: transparent; color: var(--text-faint); border: 1px dashed var(--border-strong); }
.kc-sub {
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kc-path,
.kc-cell {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 12px;
}
.kc-cell { padding: 3px 6px; border-radius: var(--radius-sm); }
.kc-cell.kc-del { background: var(--diff-del-line); }
.kc-cell.kc-add { background: var(--diff-add-line); }
.kc-cell.kc-gap { background: var(--diff-gap-fill); }
.kc-cell.kc-ign { color: var(--text-faint); }
.kc-missing {
    font-family: var(--font-ui);
    font-style: italic;
    font-size: 11px;
    color: var(--text-faint);
}
.kc-note {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    padding: 0 5px;
    border-radius: 3px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10.5px;
    pointer-events: none;
}
.kc-empty {
    flex: 1 1 auto;
    padding: 40px var(--space-4);
    text-align: center;
    color: var(--text-muted);
}
.kc-foot {
    flex: 0 0 auto;
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11.5px;
}
.kc-foot code { font-size: 11px; }

[data-theme="dark"] .kc-t-changed { color: #e8b25a; }
[data-theme="dark"] .kc-t-left,
[data-theme="dark"] .kc-h-left    { color: #f0a0a0; }
[data-theme="dark"] .kc-t-right,
[data-theme="dark"] .kc-h-right   { color: #8ed6a4; }
[data-theme="dark"] .kc-b-changed   { background: rgba(224, 160, 48, 0.25); color: #f0c070; }
[data-theme="dark"] .kc-b-leftOnly  { background: rgba(208, 85, 85, 0.25);  color: #f0a0a0; }
[data-theme="dark"] .kc-b-rightOnly { background: rgba(69, 168, 101, 0.25); color: #8ed6a4; }
[data-theme="dark"] .kc-b-mixed     { background: rgba(138, 106, 208, 0.28); color: #c0a8f0; }

/* Phone width: the table scrolls sideways inside its own box, never the page. */
@media (max-width: 720px) {
    .kc-modal { padding: 0; }
    .kc-body { height: 100vh; border-radius: 0; }
    .kc-row { grid-template-columns: 96px 160px 140px 140px; min-width: 580px; }
    .kc-spacer-rows { min-width: 600px; }
    .kc-sub { display: none; }
}

/* ====================================================================
   TOOLBAR — two calm rows
   Row 1 (.intro):       tools that change the content or the view
   Row 2 (.compare-bar): the comparison result and how to inspect it
   Every control that existed before is still here; the tools got one
   height, one icon set and one spacing rhythm, and the result got a row
   of its own instead of being squeezed between buttons.
   ==================================================================== */
.i {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.i-caret { width: 14px; height: 14px; margin-left: -2px; opacity: 0.6; }

.intro {
    min-height: 48px;
    padding: 6px var(--space-3);
    gap: var(--space-3);
    flex-wrap: nowrap;
}
.intro-left,
.intro-right {
    gap: 6px;
    min-width: 0;
}
.intro-left { flex: 1 1 auto; }
.intro-right { flex: 0 0 auto; }

.intro .btn,
.compare-bar .btn {
    height: 32px;
    padding: 0 10px;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}
.intro .btn-caret { padding: 0 7px; }
.compare-bar .btn-icon { width: 30px; height: 30px; padding: 0; justify-content: center; }
.intro .toolbar-divider { min-height: 20px; margin: 0 2px; align-self: center; height: 20px; }

/* Collapse / Highlight: pressed-state chips over real checkboxes. */
.toggle-group {
    display: inline-flex;
    height: 32px;
    padding: 2px;
    gap: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
}
.toggle-group .toolbar-toggle {
    position: relative;
    height: 26px;
    padding: 0 9px;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}
.toggle-group .toolbar-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}
.toggle-group .toolbar-toggle:has(input:checked) {
    color: var(--accent);
    background: var(--accent-soft);
}
.toggle-group .toolbar-toggle:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Open menu = pressed button. */
.menu-anchor:has(> .dropdown-panel[style*="display: block"]) > .btn:not(.btn-primary) {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn-quiet-danger { color: var(--text-muted); }
.btn-quiet-danger:hover { color: #cf222e; }
[data-theme="dark"] .btn-quiet-danger:hover { color: #ff7b72; }

/* ---- Row 2: comparison bar ---- */
.compare-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 44px;
    padding: 6px var(--space-3);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-ui);
}
.compare-left,
.compare-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}
.compare-left { flex: 1 1 auto; }
.compare-right { flex: 0 0 auto; gap: 4px; }
.compare-bar .diff-nav { gap: 2px; flex: 0 0 auto; }
.compare-bar #diff-summary {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.compare-bar .record-pager { margin-left: 0; }
.compare-right .btn[aria-pressed="true"] {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;
}
/* The floating Details panel opens under both bars, not over them. */
.diff-details { top: 100px; }

/* ---- Menus: icon + label + right-aligned hint ---- */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dropdown-item .i { color: var(--text-muted); }
.dropdown-item .dropdown-hint {
    margin: 0 0 0 auto;
    padding: 0 0 0 12px;
    background: none;
}
#extra-settings-panel { min-width: 260px; padding: var(--space-2) var(--space-2) var(--space-3); }
.dropdown-label-first { margin-top: 4px; }
.dropdown-tip {
    display: block;
    margin: 12px 0 0;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: var(--bg-muted);
    color: var(--text-muted);
}
.dropdown-tip kbd {
    font-family: var(--font-ui);
    font-size: 10.5px;
    padding: 0 4px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 3px;
    background: var(--bg-elev);
}

/* ---- Narrower windows: labels give way to icons (titles still say what
   each one does), the result row keeps its full width. ---- */
@media (max-width: 880px) {
    .intro .toolbar-toggle .btn-label,
    #btn-settings .btn-label,
    #btn-ignore .btn-label,
    #btn-clear-all .btn-label,
    #btn-extra-settings .btn-label { display: none; }
    #btn-settings, #btn-ignore, #btn-clear-all, #btn-extra-settings { padding: 0 9px; }
}
@media (max-width: 768px) {
    /* Wrap rather than scroll: a scrolling toolbar would clip its own menus. */
    .intro { flex-wrap: wrap; row-gap: 6px; }
    .intro-left { flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-start; }
    .intro-right { flex: 0 0 auto; justify-content: flex-end; }
    .intro .toolbar-divider { display: none; }
    .settings-panel { min-width: 0; width: min(340px, calc(100vw - 24px)); }
    #btn-sort .btn-label, #btn-sort .i-caret { display: none; }
    .compare-bar { flex-wrap: wrap; }
    .compare-right .btn-label { display: none; }
}
@media (max-width: 520px) {
    #btn-format .btn-label { display: none; }
}
/* Phones: a menu anchored to its button runs off the screen, so every
   toolbar menu becomes a sheet across the viewport just under the bars. */
@media (max-width: 640px) {
    .intro .dropdown-panel,
    .intro .settings-panel {
        position: fixed;
        top: 96px;
        left: 8px;
        right: 8px;
        width: auto;
        min-width: 0;
        max-height: calc(100vh - 112px);
        overflow-y: auto;
        margin-top: 0;
    }
}

/* ====================================================================
   HIGHLIGHT STYLES + FOLDED CHANGES
   Settings → Highlight style sets data-diff-style on #view-container.
   'lines' is the original look and has no rules here. The others leave a
   MODIFIED line plain (.cm-diffPart, set by diffStylePlugin) and put the
   emphasis on what changed in it; a line added or removed whole
   (.cm-diffFull) keeps its fill in Values and Characters.
   ==================================================================== */
#view-container:not([data-diff-style="lines"]) .cm-diffPart .cm-deletedLine,
#view-container:not([data-diff-style="lines"]) .cm-diffPart .cm-insertedLine {
    background-color: transparent !important;
}

/* Values: the whole changed value (or key) is the mark, not stray characters. */
#view-container[data-diff-style="values"] .cm-diffPart .cm-changedText {
    background-color: transparent !important;
    font-weight: inherit !important;
}
/* .cm-diffValue: the token a change falls in — every change in Values; in
   Characters and Outline only a value that changed purely by what the OTHER
   side gained, which leaves no changed characters on this side to mark. */
#view-container:is([data-diff-style="values"], [data-diff-style="chars"]) .cm-merge-a .cm-diffValue {
    background-color: var(--diff-del-text);
    border-radius: 3px;
}
#view-container:is([data-diff-style="values"], [data-diff-style="chars"]) .cm-merge-b .cm-diffValue {
    background-color: var(--diff-add-text);
    border-radius: 3px;
}

/* Outline: no fills at all. Changed text is outlined (dashed on the left,
   where it was removed; solid on the right); whole added / removed lines get
   an edge bar instead of a coloured background. */
#view-container[data-diff-style="outline"] :is(.cm-changedText, .cm-diffValue) {
    background-color: transparent !important;
    outline-offset: -1px;
    border-radius: 2px;
}
#view-container[data-diff-style="outline"] .cm-merge-a :is(.cm-changedText, .cm-diffValue) {
    outline: 1.5px dashed var(--diff-del-strong);
}
#view-container[data-diff-style="outline"] .cm-merge-b :is(.cm-changedText, .cm-diffValue) {
    outline: 1.5px solid var(--diff-add-strong);
}
#view-container[data-diff-style="outline"] .cm-diffFull .cm-deletedLine,
#view-container[data-diff-style="outline"] .cm-diffFull .cm-insertedLine {
    background-color: transparent !important;
}
#view-container[data-diff-style="outline"] .cm-merge-a .cm-line.cm-diffFull {
    background-image: linear-gradient(to right, var(--diff-del-strong) 3px, transparent 3px);
}
#view-container[data-diff-style="outline"] .cm-merge-b .cm-line.cm-diffFull {
    background-image: linear-gradient(to right, var(--diff-add-strong) 3px, transparent 3px);
}
#view-container[data-diff-style="outline"] .cm-diffFull .cm-changedText {
    outline: none;
}

/* Ignored keys win over every style. */
.cm-ignoredLine .cm-diffValue { background-color: transparent !important; }
#view-container .cm-ignoredLine .cm-changedText { outline: none !important; }

/* Folded block of differences: the same row as CM6's "⦚ N unchanged lines ⦚",
   with an edge bar that says what was folded. */
.cm-collapsedChange {
    box-shadow: inset 3px 0 0 var(--diff-gutter);
}
.cm-collapsedChange[data-kind="removed"] { box-shadow: inset 3px 0 0 var(--diff-del-strong); }
.cm-collapsedChange[data-kind="added"]   { box-shadow: inset 3px 0 0 var(--diff-add-strong); }
.cm-collapsedChange:focus-visible { outline: 2px solid var(--accent, #0969da); outline-offset: -2px; }

/* Fold chevron, only on blocks big enough to fold. */
.cm-changeFoldGutter .cm-gutterElement {
    padding: 0 1px;
    width: 14px;
    text-align: center;
}
.cm-changeFold {
    cursor: pointer;
    color: var(--diff-del-strong);
    font-size: 11px;
    line-height: inherit;
    border-radius: 3px;
    user-select: none;
}
.cm-merge-b .cm-changeFold { color: var(--diff-add-strong); }
.cm-changeFold:hover { background: var(--diff-changed-line); filter: brightness(0.8); }
#view-container.no-change-folds .cm-changeFoldGutter { display: none; }

/* Sticky header for the open foldable block at the top of a pane
   (stickyBlockPlugin). Overlays the first visible row, like an editor's
   sticky scroll, so showing it never moves the text. */
.cm-stickyBlock {
    position: absolute;
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 6px 0 4px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    box-shadow: inset 3px 0 0 var(--diff-gutter), 0 2px 6px rgba(0, 0, 0, 0.08);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
}
.cm-stickyBlock[hidden] { display: none; }
.cm-stickyBlock[data-kind="removed"] { box-shadow: inset 3px 0 0 var(--diff-del-strong), 0 2px 6px rgba(0, 0, 0, 0.08); }
.cm-stickyBlock[data-kind="added"]   { box-shadow: inset 3px 0 0 var(--diff-add-strong), 0 2px 6px rgba(0, 0, 0, 0.08); }
.cm-stickyBlock button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.cm-stickyBlock button:hover { background: var(--bg-hover); }
.cm-stickyBlock button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cm-stickyBlock-btn { flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 4px; }
.cm-stickyBlock-line {
    flex: 1 1 auto;
    min-width: 0;
    height: 22px;
    padding: 0 4px;
    text-align: left;
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cm-stickyBlock-meta {
    flex: 0 1 auto;
    color: var(--text-muted);
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#view-container.no-change-folds .cm-stickyBlock { display: none; }
.has-sticky-block .pane-controls { top: 36px; }

/* ---------------------------------------------------------------------------
   RESTORE CARD — a large saved comparison is offered at startup instead of
   loaded unasked (index.html "Restoring the last comparison"). It sits over
   the empty panels; the toolbar and the panels themselves stay usable.
   --------------------------------------------------------------------------- */
.restore-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    width: min(420px, calc(100% - 32px));
    padding: var(--space-4) var(--space-4) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elev);
    box-shadow: var(--shadow);
    font-family: var(--font-ui);
    color: var(--text);
}
.restore-card-title { margin: 0; font-size: 15px; font-weight: 600; }
.restore-card-sub { margin: 2px 0 var(--space-3); font-size: 12.5px; color: var(--text-muted); }
.restore-card-rows {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px var(--space-3);
    margin: 0 0 var(--space-3);
    font-size: 13px;
}
.restore-card-rows dt { color: var(--text-muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.restore-card-rows dd { margin: 0; overflow-wrap: anywhere; }
.restore-card-actions { display: flex; gap: var(--space-2); }

/* ===== EQUIVALENT VALUES — Ignore-panel summary + #equiv-modal ===== */
.equiv-summary { display: flex; align-items: flex-start; gap: var(--space-2); }
.equiv-summary .setting-row { flex: 1 1 auto; min-width: 0; }
.equiv-open { flex: 0 0 auto; margin-top: 2px; }
.equiv-summary-line { margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: var(--text-muted); }

.equiv-modal-body { width: min(760px, 100%); max-height: min(88vh, 820px); }
.equiv-modal .repair-modal-head { gap: var(--space-3); }
.equiv-scroll { flex: 1 1 auto; overflow: auto; padding: var(--space-3) var(--space-4) var(--space-4); }
.equiv-lead { margin: 0 0 var(--space-3); font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }

/* On/off switch in the dialog header */
.equiv-switch { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer;
    font-size: 12.5px; font-weight: 600; color: var(--text); user-select: none; }
.equiv-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.equiv-switch-track { position: relative; width: 34px; height: 20px; border-radius: 10px;
    background: var(--border-strong); transition: background .15s; }
.equiv-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
    border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.equiv-switch input:checked + .equiv-switch-track { background: var(--accent); }
.equiv-switch input:checked + .equiv-switch-track::after { transform: translateX(14px); }
.equiv-switch input:focus-visible + .equiv-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.equiv-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
    margin-bottom: var(--space-3); padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border); border-left: 3px solid var(--diff-gutter);
    border-radius: var(--radius); background: var(--bg-muted); font-size: 12.5px; color: var(--text); }
.equiv-banner[hidden] { display: none; }

.equiv-section { margin-top: var(--space-4); }
.equiv-section:first-of-type { margin-top: 0; }
.equiv-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-2); }
.equiv-section-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.equiv-hint { font-size: 11.5px; color: var(--text-muted); }
.equiv-modal.is-off .equiv-section:not(.equiv-try) { opacity: .6; }

/* Groups: a card per group, its values as chips */
.equiv-groups { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.equiv-group { display: grid; grid-template-columns: auto minmax(110px, 170px) minmax(0, 1fr) auto; gap: var(--space-2);
    align-items: center; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 6px var(--space-2); }
.equiv-group.is-unused { background: var(--bg-muted); }
.equiv-group.is-unused .equiv-chips { opacity: .6; }
.equiv-group-head { display: contents; }
.equiv-group-head .btn { grid-column: 4; grid-row: 1; }
.equiv-group > .equiv-chips { grid-column: 3; grid-row: 1; }
.equiv-group-head input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.equiv-group-name { flex: 1 1 auto; min-width: 0; border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: var(--text); font: 600 13px var(--font-ui); padding: 3px 6px; }
.equiv-group-name:hover { border-color: var(--border); }
.equiv-group-name:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.equiv-empty { padding: var(--space-3); border: 1px dashed var(--border-strong); border-radius: var(--radius);
    font-size: 12.5px; color: var(--text-muted); text-align: center; }
.equiv-add { margin-top: var(--space-2); }

.equiv-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 30px; padding: 3px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); cursor: text; }
.equiv-chips:focus-within { border-color: var(--accent); }
.equiv-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 1px 2px 1px 7px;
    border-radius: 999px; background: var(--bg-hover); border: 1px solid var(--border);
    font: 12px var(--font-mono); color: var(--text); }
.equiv-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equiv-chip.is-empty > span { font-family: var(--font-ui); font-style: italic; color: var(--text-muted); }
.equiv-chip button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
    width: 18px; height: 18px; border-radius: 50%; line-height: 1; font-size: 13px; }
.equiv-chip button:hover, .equiv-chip button:focus-visible { background: var(--border); color: var(--text); }
.equiv-chip-input { flex: 1 1 120px; min-width: 100px; border: 0; outline: none; background: transparent;
    color: var(--text); font: 12.5px var(--font-mono); padding: 3px 4px; }

/* Rules: a toggle card each */
.equiv-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.equiv-rule { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3);
    background: var(--bg); transition: border-color .15s, background .15s; }
.equiv-rule.is-on { border-color: var(--accent); background: var(--accent-soft); }
.equiv-rule-main { display: flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; }
.equiv-rule-main input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); flex: 0 0 auto; }
.equiv-rule-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.equiv-rule-title { font-size: 13px; font-weight: 600; color: var(--text); }
.equiv-rule-ex { font-size: 12px; color: var(--text-muted); }
.equiv-rule-ex code { font-family: var(--font-mono); color: var(--text); background: var(--bg-muted);
    padding: 0 4px; border-radius: var(--radius-sm); }
.equiv-rule-note { margin: 6px 0 0 24px; font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
.equiv-rule .equiv-chips { margin: 6px 0 0 24px; }
.equiv-rule.is-on:has(.equiv-chips) { grid-column: 1 / -1; }
.equiv-rule:not(.is-on) .equiv-chips, .equiv-rule:not(.is-on) .equiv-rule-note:has(+ .equiv-chips) { display: none; }

/* Try it */
.equiv-try-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--space-2); align-items: center; }
.equiv-try-row .ignore-input { font-family: var(--font-mono); width: 100%; box-sizing: border-box; }
.equiv-verdict { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.equiv-verdict.is-equal { background: var(--diff-add-line); color: var(--diff-add-strong); }
.equiv-verdict.is-diff  { background: var(--diff-del-line); color: var(--diff-del-strong); }
.equiv-try-why { margin-top: 6px; font-size: 12px; color: var(--text-muted); min-height: 1.4em; }

@media (max-width: 640px) {
    .equiv-group { grid-template-columns: auto minmax(0, 1fr) auto; }
    .equiv-group-head .btn { grid-column: 3; }
    .equiv-group > .equiv-chips { grid-column: 1 / -1; grid-row: 2; }
    .equiv-rules { grid-template-columns: minmax(0, 1fr); }
    .equiv-try-row { grid-template-columns: minmax(0, 1fr); }
    .equiv-verdict { justify-self: start; }
    .equiv-modal .repair-hint { display: none; }
}

/* More ▾ → Reset everything: destructive, so it reads differently on hover. */
.dropdown-item-danger:hover { color: var(--diff-del-strong); border-color: currentColor; }

/* ==========================================================================
   RIGHT-CLICK MENU (index.html "Right-click menu", utils/json_context.js)
   Above the dropdowns and Details, under the modals.
   ========================================================================== */
.ctx-menu {
    position: fixed;
    z-index: 1240;
    min-width: 232px;
    max-width: min(340px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    padding: 5px;
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.35;
    color: var(--text);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
}
.ctx-menu-head {
    margin: -5px -5px 5px;
    padding: 9px 12px 9px;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
    border-radius: 9px 9px 0 0;
}
.ctx-menu-path {
    margin-bottom: 5px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ctx-menu-side { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.ctx-menu-side + .ctx-menu-side { margin-top: 2px; }
.ctx-menu-tag {
    flex: none;
    width: 34px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ctx-menu-val {
    min-width: 0;
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ctx-menu-side[data-side="left"] .ctx-menu-val { color: var(--diff-del-strong); }
.ctx-menu-side[data-side="right"] .ctx-menu-val { color: var(--diff-add-strong); }
.ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 32px;
    padding: 5px 9px;
    text-align: left;
    font: inherit;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}
.ctx-menu-icon { flex: none; width: 16px; display: inline-flex; justify-content: center; color: var(--text-muted); }
.ctx-menu-icon .i { width: 15px; height: 15px; }
.ctx-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-menu-caret { flex: none; width: 13px; height: 13px; color: var(--text-muted); }
.ctx-menu-item:hover,
.ctx-menu-item:focus,
.ctx-menu-item[aria-expanded="true"] { background: var(--bg-hover); outline: none; }
.ctx-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ctx-menu-item[aria-disabled="true"] { color: var(--text-muted); cursor: default; background: transparent; }
.ctx-menu-sep { height: 1px; margin: 5px 4px; background: var(--border); }
@media (forced-colors: active) {
    .ctx-menu-item:focus { outline: 2px solid Highlight; outline-offset: -2px; }
}

/* ==========================================================================
   RESET DIALOG (More ▾ → Reset…) — reuses the repair-modal shell
   ========================================================================== */
.reset-modal-body { width: min(460px, calc(100vw - 24px)); }
.reset-body { padding: 4px 16px 12px; overflow-y: auto; }
.reset-lead { margin: 8px 0 4px; color: var(--text-muted); font-size: 13px; }
.reset-group-label {
    margin: 12px 0 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.reset-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
}
.reset-option + .reset-option { margin-top: 6px; }
.reset-option:hover { background: var(--bg-hover); }
.reset-option:has(input:checked) { border-color: var(--diff-del-strong); }
.reset-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.reset-option input { margin-top: 3px; flex: none; }
.reset-desc { display: block; margin-top: 2px; color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.reset-summary { margin: 12px 0 0; font-size: 12.5px; }
#reset-apply:disabled { opacity: 0.5; cursor: not-allowed; }
