/* Merge-cards modal (card-merge.js). Colours follow the app tokens in style.css, with fallbacks. */
body.cm-lock { overflow: hidden; }
.cm-overlay { position: fixed; inset: 0; z-index: 10050; background: rgba(22, 33, 31, .55);
    display: flex; align-items: flex-start; justify-content: center; padding: 3vh 12px; overflow-y: auto; }
.cm-modal { background: var(--card-background, #fff); color: var(--text-primary, #16211f); width: 100%; max-width: 960px;
    border-radius: 12px; box-shadow: 0 16px 36px -14px rgba(22, 33, 31, .4); display: flex; flex-direction: column; }
.cm-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
    border-bottom: 1px solid var(--border-color, #e2ddd3); }
.cm-title { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.cm-title .hexicon { width: 24px; height: 24px; }
.cm-x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--text-secondary, #6a7876); }
.cm-body { padding: 16px 18px 20px; }
.cm-muted { color: var(--text-secondary, #6a7876); font-size: 14px; }
.cm-h { margin: 18px 0 8px; font-size: 15px; }
.cm-input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border-strong, #d4cdbf);
    border-radius: 8px; font: inherit; background: #fff; color: inherit; }
.cm-input:focus { outline: none; border-color: var(--accent, #17736f); box-shadow: var(--focus-ring, 0 0 0 3px rgba(23,115,111,.15)); }
.cm-text { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; resize: vertical; }
.cm-label { display: block; font-size: 13px; font-weight: 600; margin-top: 10px; }
.cm-label .cm-input { margin-top: 4px; font-weight: 400; }
.cm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cm-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 280px; overflow-y: auto; }
.cm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; width: 100%;
    padding: 9px 12px; border: 1px solid var(--border-color, #e2ddd3); border-radius: 8px; background: #fff; cursor: pointer; font: inherit; }
.cm-row:hover { border-color: var(--accent, #17736f); background: var(--accent-wash, #e4f3f1); }
.cm-row-main { display: flex; flex-direction: column; min-width: 0; }
.cm-row-name { font-weight: 600; font-size: 14px; }
.cm-row-meta { font-size: 12px; color: var(--text-secondary, #6a7876); }
.cm-badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: var(--paper-2, #f2efe8);
    color: var(--secondary-gray-dark, #394745); white-space: nowrap; font-weight: 500; }
.cm-badge.cm-warn { background: #fde7e1; color: #a3401c; }
.cm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cm-pane { border: 1px solid var(--border-color, #e2ddd3); border-radius: 10px; padding: 12px; min-width: 0; }
.cm-pane-label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary, #6a7876); margin-top: 6px; }
.cm-pane-title { font-weight: 700; font-size: 16px; margin-top: 4px; }
.cm-pane-path, .cm-tags { font-size: 12px; color: var(--text-secondary, #6a7876); margin-top: 2px; }
.cm-content { margin-top: 8px; max-height: 260px; overflow: auto; font-size: 14px; line-height: 1.5; word-break: break-word; }
.cm-preview { border: 1px dashed var(--border-strong, #d4cdbf); border-radius: 8px; padding: 10px; }
.cm-content img, .cm-img { max-width: 100%; height: auto; }
.cm-chip { display: inline-block; padding: 0 7px; border-radius: 10px; background: var(--accent-wash, #e4f3f1);
    color: var(--accent-dark, #115c59); font-size: 12px; }
.cm-note { background: #fff6e0; border: 1px solid #f0d58a; color: #6b4e00; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-top: 8px; }
.cm-error { background: #fdeaea; border: 1px solid #f3b4b4; color: #9b1c1c; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-top: 10px; }
.cm-error[hidden] { display: none; }
.cm-scope { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 12px; font-size: 14px; }
.cm-scope label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.cm-moves { margin-top: 12px; font-size: 14px; }
.cm-moves ul { margin: 4px 0 0; padding-left: 20px; }
.cm-ai { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.cm-ai .cm-input { flex: 1 1 220px; width: auto; }
.cm-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.cm-actions-left { justify-content: flex-start; margin-top: 10px; }
.cm-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border-strong, #d4cdbf);
    border-radius: 8px; background: #fff; color: inherit; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; }
.cm-btn:hover:not(:disabled) { border-color: var(--accent, #17736f); color: var(--accent, #17736f); }
.cm-btn:disabled { opacity: .55; cursor: default; }
.cm-btn.cm-primary { background: var(--accent, #17736f); border-color: var(--accent, #17736f); color: #fff; }
.cm-btn.cm-primary:hover:not(:disabled) { background: var(--accent-dark, #115c59); color: #fff; }
.cm-btn .hexicon { width: 18px; height: 18px; }
.cm-loading { display: flex; align-items: center; gap: 10px; padding: 24px 0; color: var(--text-secondary, #6a7876); }
.cm-spin { width: 20px; height: 20px; border: 3px solid var(--border-color, #e2ddd3); border-top-color: var(--accent, #17736f);
    border-radius: 50%; animation: cm-rot .8s linear infinite; display: inline-block; }
.cm-spin-sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes cm-rot { to { transform: rotate(360deg); } }
@media (max-width: 700px) {
    .cm-overlay { padding: 0; }
    .cm-modal { border-radius: 0; min-height: 100vh; }
    .cm-cols, .cm-two { grid-template-columns: 1fr; }
}

/* Picker rows: snippet, hover-preview link, Compare / Merge buttons (2026-11-14) */
.cm-row { cursor: default; }
.cm-row-main { flex: 1; }
.cm-row-snip { font-size: 12.5px; color: var(--text-secondary, #6a7876); margin-top: 3px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cm-row-snip:empty { display: none; }
.cm-row-link { font-weight: 400; text-decoration: none; margin-left: 4px; color: var(--accent, #17736f); }
.cm-row-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.cm-btn.cm-btn-sm { padding: 5px 10px; font-size: 13px; }
.cm-compare { margin-top: 14px; padding: 12px; border: 1px solid var(--border-strong, #d4cdbf); border-radius: 10px; background: var(--surface-2, #faf8f4); }
.cm-compare .cm-content { max-height: 420px; }
/* Why this card is kept */
.cm-why { margin-bottom: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px;
    background: var(--accent-wash, #e4f3f1); color: var(--accent-dark, #115c59); border: 1px solid #b9ddd8; }
.cm-why.cm-why-manual { background: #f3f1ec; color: #5b5546; border-color: #ddd6c8; }
@media (max-width: 700px) {
    .cm-row { flex-wrap: wrap; }
    .cm-row-btns { width: 100%; justify-content: flex-end; }
}
/* The link-card hover preview (card-preview.js, z-index 9990) must sit above this modal */
body.cm-lock .cpv-wrap { z-index: 10060 !important; }

/* Admin-only tool marker (merge is privilege 5) */
.admin-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600;
    letter-spacing: .03em; text-transform: uppercase; vertical-align: middle; line-height: 1.6;
    background: #ede7fb; color: #5b3fa6; border: 1px solid #d6cbf3; }
.qm-admin-btn { position: relative; }
.qm-admin-btn[hidden] { display: none; }
.qm-admin-badge { position: absolute; top: -6px; right: -10px; margin: 0; font-size: 8.5px; padding: 0 4px; line-height: 1.5; }
.action-btn[hidden] { display: none; }
