/* edet-notes.css — the right AUX panel: notes (chapters) and version
   history share one column and are mutually exclusive via
   #edet-app[data-aux="none|notes|history"]. Mobile-first: BASE is the
   off-canvas right drawer; desktop (@media min-width: 721px) makes it a
   static grid column. box-shadow only in the open state (an off-screen
   translateX(100%) shadow would otherwise cast into the viewport —
   CONTEXT.md § 15). Tokens from site.css :root. */

.dr-aux {
    grid-area: aux;
    position: absolute;
    z-index: 30;
    top: 0;
    bottom: 0;
    right: 0;
    width: 82%;
    max-width: 360px;
    display: none;              /* only the active aux pane shows */
    flex-direction: column;
    min-height: 0;
    background: var(--bg);
    /* no left divider — the frost separates it from the editor, exactly like the
       borderless sidebar (mobile slide-over still reads via its box-shadow). */
    overflow: hidden;
    transform: translateX(100%);
    transition: transform var(--dur-med) var(--ease-smooth),
                box-shadow var(--dur-med) var(--ease-smooth);
}
.edet-app[data-aux="notes"] #dr-notes-pane,
.edet-app[data-aux="history"] #dr-history-pane,
.edet-app[data-aux="comments"] #dr-comments-pane {
    display: flex;
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
}
@media (min-width: 721px) {
    .edet-app[data-aux="notes"] #dr-notes-pane,
    .edet-app[data-aux="history"] #dr-history-pane,
    .edet-app[data-aux="comments"] #dr-comments-pane {
        position: static;
        transform: none;
        width: auto;
        max-width: none;
        box-shadow: none;
    }
}

.dr-notes-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.6rem;
}
.dr-notes-title {
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.dr-notes-text {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    resize: none;
    border: none;
    outline: none;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    padding: 0.85rem 0.9rem;
}
.dr-notes-text::placeholder { color: var(--fg-dim); }
.dr-notes-text:disabled { color: var(--fg-dim); }

/* ---- version history panel (shares the aux column) ---- */
.dr-history-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.6rem;
}
.dr-history-title {
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.dr-history-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dr-history-empty { padding: 0.6rem 0.5rem; color: var(--fg-dim); font-size: var(--text-sm); line-height: 1.5; }
.dr-history-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-mono);
    transition: background var(--dur-fast) var(--ease-smooth);
}
.dr-history-item:hover { background: var(--row-hover); }
.dr-history-item.active { background: var(--accent-muted); }
.dr-history-date { color: var(--fg); font-size: var(--text-sm); }
.dr-history-item.active .dr-history-date { color: var(--accent); }
.dr-history-delta { color: var(--fg-muted); font-size: var(--text-xs); }
/* a snapshot row = the preview button + inline Rename/Delete actions beside it */
.dr-history-row { display: flex; align-items: stretch; gap: 0.15rem; }
.dr-history-row .dr-history-item { flex: 1 1 auto; min-width: 0; }
.dr-history-acts { display: flex; flex-direction: column; justify-content: center; gap: 2px; flex: 0 0 auto; opacity: 0; transition: opacity var(--dur-fast) var(--ease-smooth); }
.dr-history-row:hover .dr-history-acts,
.dr-history-acts:focus-within { opacity: 1; }
.dr-history-act {
    display: grid; place-items: center;
    width: 24px; height: 24px;
    background: transparent; border: 1px solid var(--rule); border-radius: 6px;
    color: var(--fg-muted); font-size: var(--text-xs); line-height: 1; cursor: pointer;
    transition: color var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast) var(--ease-smooth);
}
.dr-history-act:hover { color: var(--fg); border-color: var(--fg-dim); }
.dr-history-del:hover { color: var(--status-err); border-color: color-mix(in srgb, var(--status-err) 45%, var(--rule)); }

/* history-version banner inside the preview pane */
.dr-history-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg-raised);
    border: 1px solid var(--rule-hot);
    border-radius: 8px;
}
.dr-history-banner-label {
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}
.dr-history-banner-actions { display: inline-flex; gap: 0.4rem; flex: 0 0 auto; }
.dr-history-banner-actions .dr-btn { height: var(--control-h-compact); font-size: var(--text-xs); }

/* milestone toolbar + named-milestone rows */
.dr-history-bar { display: flex; gap: 0.4rem; padding: 0 0.1rem 0.5rem; }
.dr-history-bar .dr-btn { flex: 1 1 0; justify-content: center; height: var(--control-h-compact); font-size: var(--text-xs); }
.dr-history-item.is-milestone .dr-history-date { color: var(--accent); }

/* line-diff view (compare a snapshot to the current text) */
.dr-history-diff { font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.5; }
.dr-diff-line { white-space: pre-wrap; padding: 0.05rem 0.5rem; border-left: 2px solid transparent; }
.dr-diff-add { background: color-mix(in srgb, var(--status-ok) 14%, transparent); border-left-color: var(--status-ok); color: var(--fg); }
.dr-diff-del { background: color-mix(in srgb, var(--status-err) 14%, transparent); border-left-color: var(--status-err); color: var(--fg-muted); text-decoration: line-through; }
.dr-diff-same { color: var(--fg-dim); }
/* selective-restore hunks: a checkbox per changed section */
.dr-diff-hunk { display: flex; align-items: flex-start; gap: 0.4rem; margin: 0.2rem 0; padding: 0.15rem 0.3rem; border: 1px solid var(--rule); border-radius: 6px; }
.dr-diff-hunk[data-picked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dr-diff-pick { margin-top: 0.25rem; flex: 0 0 auto; }
.dr-diff-hunk-lines { flex: 1 1 auto; min-width: 0; }
.dr-history-selrestore:disabled { opacity: 0.5; }

/* one-line hint in the Version-history panel so it's clear the rows are actionable */
.dr-history-hint { color: var(--fg-dim); font-size: var(--text-xs); line-height: 1.4; padding: 0 0.1rem 0.6rem; }

/* Version-preview OVERLAY (setOverlay('historypreview')) — a centered, readable
   column; the banner (Compare / Restore / selective restore) sticks to the top so
   it's reachable however far you scroll. Renders in EVERY desk mode (the old split
   preview pane was unreachable in grid / scenes-split). */
.dr-history-preview { max-width: 46rem; margin: 0 auto; }
.dr-history-preview .dr-history-banner { position: sticky; top: 0; z-index: 1; }
.dr-history-preview-body { line-height: 1.7; color: var(--fg); }
.dr-history-preview-body h1,
.dr-history-preview-body h2,
.dr-history-preview-body h3 { line-height: 1.3; margin: 1.2em 0 0.4em; }
.dr-history-preview-body p { margin: 0 0 0.9em; }
.dr-history-preview-body ul,
.dr-history-preview-body ol { margin: 0 0 0.9em 1.3em; }
.dr-history-preview-body em { font-style: italic; }
.dr-history-preview-body strong { font-weight: 700; }

/* ---- inline comments panel (shares the aux column) ---- */
.dr-comments-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.dr-comments-empty { padding: 0.6rem 0.5rem; color: var(--fg-dim); font-size: var(--text-sm); line-height: 1.5; }
.dr-comment-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.55rem 0.6rem;
    background: var(--bg-raised);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
}
.dr-comment-item[data-resolved="true"] { opacity: 0.6; border-left-color: var(--rule); }
.dr-comment-item[data-orphan="true"] { border-left-color: var(--status-err, #e66); }
/* author notes: warning-toned left edge so they read as private, not review */
.dr-comment-item[data-kind="note"] { border-left-color: var(--status-warn); border-left-style: dashed; }
.dr-comments-head { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0 0.2rem 0.4rem; }
.dr-comments-notetoggle, .dr-comments-addnote {
    background: transparent; border: 1px solid var(--rule); border-radius: 6px;
    color: var(--fg-dim); cursor: pointer;
    font-family: var(--font-mono); font-size: var(--text-xs); padding: 0.15rem 0.5rem;
}
.dr-comments-notetoggle:hover, .dr-comments-addnote:hover { color: var(--accent); border-color: var(--accent); }
.dr-comments-notetoggle[data-on="false"] { color: var(--fg-muted); }
/* the doc-level note tag (an unanchored note — no jump-to-text affordance) */
.dr-comment-doclevel { color: var(--fg-dim); font-style: italic; cursor: default; }
.dr-comment-doclevel:hover { color: var(--fg-dim); }
.dr-comment-anchor {
    text-align: left;
    background: transparent;
    border: none;
    padding: 0;
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: 1.4;
    cursor: pointer;
}
.dr-comment-anchor:hover { color: var(--accent); }
.dr-comment-body {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 2.2rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.5;
    padding: 0.4rem 0.5rem;
    outline: none;
}
.dr-comment-body:focus { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.dr-comment-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }
.dr-comment-act {
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 6px;
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 0.2rem 0.55rem;
    cursor: pointer;
}
.dr-comment-act:hover { color: var(--fg); background: var(--row-hover); }
.dr-comment-act-danger:hover { color: var(--status-err, #e66); border-color: var(--status-err, #e66); }
