/**
 * Docs surface styles — consumed by:
 *   /dashboard/#docs                     (shell: tree + welcome/folder/doc)
 *   /dashboard/docs/?documentId=…        (standalone editor, focus mode)
 *
 * Consumes the design tokens from ulfratech.css (--primary-*, --shadow-*) and
 * dashboard.css (--dash-*, --status-*). Adds only docs-specific rules — no
 * token redefinitions, no Bootstrap overrides.
 */

/* ── Shell: 2-pane file-manager layout ────────────────────────────────────── */

:root {
    --docs-tree-width: 280px;
    --docs-tree-min:   220px;
    --docs-tree-max:   420px;
    --docs-header-h:   3.25rem;
}

/* The customer shell's .content-area has default padding for ordinary pages.
   When the docs shell mounts inside it, neutralize that padding so the file
   manager runs edge-to-edge. The is-docs-shell-host class is set by shell.js
   for browsers that pre-date :has(); the :has() rule covers the rest.

   The height pin is load-bearing: .dashboard-layout is `min-height: 100vh`
   (it can grow when content is tall), so without an explicit cap here the
   tree sidebar grows past the viewport instead of scrolling inside. We pin
   to viewport-minus-topbar so the inner flex chain has a definite height
   to constrain against. */
.content-area.is-docs-shell-host,
.content-area:has(> .docs-shell) {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - var(--topbar-height, 60px));
    max-height: calc(100vh - var(--topbar-height, 60px));
}

.docs-shell {
    display: grid;
    grid-template-columns: var(--docs-tree-width) 1fr;
    /* Explicit single row that fills the container — `auto` would shrink
       to content and leave grid items at their intrinsic height, which
       defeats the inner scroll containers. */
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    position: relative;
    background: var(--dash-bg, #f4f6f9);
}

.docs-tree-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--dash-surface, #fff);
    border-right: 1px solid var(--dash-border, rgba(0,0,0,0.06));
    overflow: hidden;
}

.docs-content-pane-wrap {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--dash-bg, #f4f6f9);
}

.docs-content-pane {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 2rem;
}

.docs-content-pane > .docs-content {
    max-width: 1100px;
    margin: 0 auto;
}

.docs-content-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-height: var(--docs-header-h);
    padding: 0.65rem 1.5rem;
    background: var(--dash-surface, #fff);
    border-bottom: 1px solid var(--dash-border, rgba(0,0,0,0.06));
}

.docs-content-header-slot {
    flex: 1;
    min-width: 0;
}

.docs-drawer-toggle {
    flex: 0 0 auto;
    padding: 0.25rem 0.5rem;
    color: var(--text-200);
}

/* iOS HIG / Material recommend ≥44px tap targets. On mobile bump the
   hamburger to that height + matching width so it's actually thumb-able. */
@media (max-width: 768px) {
    .docs-drawer-toggle {
        min-width: 2.75rem;
        min-height: 2.75rem;
        font-size: 1.25rem;
        margin-right: 0.25rem;
    }
}

/* ── Workspace switcher (multi-tenant only) ──────────────────────────────── */

.docs-workspace-switcher {
    padding: 0.65rem 0.6rem 0.5rem;
    border-bottom: 1px solid var(--dash-border, rgba(0,0,0,0.06));
    flex: 0 0 auto;
}

.docs-workspace-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    background: var(--dash-bg, #f4f6f9);
    border: 1px solid transparent;
    border-radius: 0.5rem;
    color: var(--text-100, #1a1a1a);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast, 0.15s ease), border-color var(--transition-fast, 0.15s ease);
}

.docs-workspace-trigger:hover {
    background: rgba(94, 74, 174, 0.08);
    border-color: rgba(94, 74, 174, 0.15);
}

.docs-workspace-trigger > .bi:first-child {
    color: var(--primary-100);
    font-size: 1rem;
}

.docs-workspace-trigger .bi-chevron-expand {
    margin-left: auto;
    color: var(--text-300);
    font-size: 0.8rem;
}

.docs-workspace-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.docs-workspace-menu {
    width: max-content;
    min-width: 100%;
    max-width: 22rem;
    font-size: 0.88rem;
}

.docs-workspace-menu .dropdown-item.active {
    background: rgba(94, 74, 174, 0.10);
    color: var(--text-100);
}

/* ── Tree sidebar ─────────────────────────────────────────────────────────── */

.docs-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0.9rem 0.5rem;
    flex: 0 0 auto;
}

.docs-tree-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-100, #1a1a1a);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.docs-tree-title:hover {
    color: var(--primary-100, #5E4AAE);
}

.docs-tree-title .bi {
    color: var(--primary-100, #5E4AAE);
    font-size: 1rem;
}

.docs-tree-new {
    color: var(--primary-100);
    text-decoration: none;
}

.docs-tree-new:hover {
    color: var(--primary-200);
    transform: scale(1.05);
}

.docs-tree-filter {
    position: relative;
    padding: 0 0.75rem 0.5rem;
    flex: 0 0 auto;
}

.docs-tree-filter .bi-search {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-65%);
    color: var(--text-300);
    font-size: 0.8rem;
    pointer-events: none;
}

.docs-tree-filter input {
    padding-left: 1.7rem;
    background: var(--dash-bg, #f4f6f9);
    border-color: transparent;
}

.docs-tree-filter input:focus {
    background: #fff;
    border-color: var(--primary-200, #9076e0);
    box-shadow: 0 0 0 2px rgba(94, 74, 174, 0.12);
}

.docs-tree-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    padding: 0.25rem 0.5rem 0.75rem;
    min-height: 0;

    /* Scroll shadows: a thin gradient appears at top/bottom only when the
       body is actually scrolled. The trick is a background-attachment: local
       gradient that scrolls with the content (the white fade) layered over
       a fixed gradient (the shadow). Subtle but very effective at signalling
       overflow without a scrollbar. */
    /* Flat surface — no gradient shadow overlay per design rule. */
    background: var(--dash-surface, #fff);
}

.docs-tree-body::-webkit-scrollbar { width: 8px; }
.docs-tree-body::-webkit-scrollbar-track { background: transparent; }
.docs-tree-body::-webkit-scrollbar-thumb {
    background: var(--dash-border-2, rgba(0,0,0,0.10));
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.docs-tree-body:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.20);
    background-clip: padding-box;
    border: 2px solid transparent;
}
.docs-tree-body { scrollbar-color: rgba(0,0,0,0.10) transparent; scrollbar-width: thin; }

/* "Cargar más" row — appears at the bottom of any folder whose backend
   listing still has more pages. */
.docs-tree-load-more {
    padding: 0.25rem 0 0.4rem;
    padding-left: calc(var(--depth, 0) * 0.9rem + 1.25rem);
}

.docs-tree-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.55rem;
    background: transparent;
    border: 0;
    color: var(--text-300, #717171);
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 0.3rem;
    transition: background var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
}

.docs-tree-load-more-btn:hover {
    background: rgba(94, 74, 174, 0.08);
    color: var(--primary-100, #5E4AAE);
}

.docs-tree-load-more-btn:disabled {
    cursor: progress;
    opacity: 0.75;
}

.docs-tree-load-more-btn .bi {
    font-size: 0.75rem;
}

.docs-tree-footer {
    flex: 0 0 auto;
    padding: 0.5rem 0.9rem;
    border-top: 1px solid var(--dash-border, rgba(0,0,0,0.06));
}

.docs-tree-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-200, #4a4a4a);
    text-decoration: none;
}

.docs-tree-footer-link:hover {
    color: var(--primary-100);
}

.docs-tree-empty {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-300);
}

.docs-tree-empty p {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

/* ── Tree rows ────────────────────────────────────────────────────────────── */

.docs-tree-node {
    --depth: 0;
    position: relative;
}

.docs-tree-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding-left: calc(var(--depth, 0) * 0.9rem);
    border-radius: 0.375rem;
    transition:
        background var(--transition-fast, 0.15s ease),
        box-shadow var(--transition-fast, 0.15s ease),
        transform var(--transition-fast, 0.15s ease);
    cursor: pointer;
}

.docs-tree-row:hover {
    background: rgba(94, 74, 174, 0.07);
}

/* Active row gets:
   1. A slightly deeper bg tint so the selection reads from a glance.
   2. A 3px accent strip pinned to the leftmost edge of the sidebar
      (IDE convention — anchors the eye to "this is your current spot"
      independent of how deeply nested the row is).
   3. A soft glow ring (inner box-shadow) so the strip feels integrated
      with the row, not pasted on.
   The strip uses ::before with negative margin so it lives in the
   sidebar gutter, outside the row's padding box. */
.docs-tree-node.is-active > .docs-tree-row {
    background: rgba(94, 74, 174, 0.14);
    box-shadow: inset 0 0 0 1px rgba(94, 74, 174, 0.08);
}

.docs-tree-node.is-active > .docs-tree-row::before {
    content: "";
    position: absolute;
    left: -0.5rem;          /* reach into the .docs-tree-body's left padding */
    top: 0.25rem;
    bottom: 0.25rem;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--primary-100, #5E4AAE);
    box-shadow: 0 0 8px rgba(94, 74, 174, 0.35);
}

.docs-tree-node.is-active > .docs-tree-row .docs-tree-label {
    color: var(--primary-100);
    font-weight: 600;
}

/* Subtle "press" feedback on the row when the user clicks (between
   pointerdown and the actual selection). Keeps the click feeling
   physical without overshadowing the active state. */
.docs-tree-row:active {
    transform: scale(0.995);
}

/* Vertical guide lines between siblings, IDE-style. The container
   carries --parent-depth (stamped by tree-sidebar.js) so the line
   lands exactly under the parent's chevron. The line stops short of
   the top + bottom so it doesn't crowd the rows above and below. */
.docs-tree-children {
    position: relative;
}

.docs-tree-children::before {
    content: "";
    position: absolute;
    /* parent-depth columns of 0.9rem, then half the chevron's 1.25rem
       width to align with the chevron's centerline. */
    left: calc(var(--parent-depth, 0) * 0.9rem + 0.625rem);
    top: 0.15rem;
    bottom: 0.15rem;
    width: 1px;
    background: rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

/* Show the guide line a hair brighter when the hovered branch crosses
   it — helps the user mentally pin the cursor to its ancestry. */
.docs-tree-children:hover::before {
    background: rgba(94, 74, 174, 0.14);
}

.docs-tree-chevron,
.docs-tree-chevron-spacer {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--text-300);
    padding: 0;
    cursor: pointer;
}

.docs-tree-chevron .bi {
    font-size: 0.75rem;
    transition: transform var(--transition-fast, 0.18s ease), color var(--transition-fast, 0.15s ease);
}

.docs-tree-chevron.is-loading .bi {
    animation: docsChevronSpin 0.9s linear infinite;
    opacity: 0.7;
}

@keyframes docsChevronSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* The JS swaps the icon class (bi-chevron-right ↔ bi-chevron-down)
   when a folder opens, which is instant. We layer a CSS rotate on
   top so the icon visibly *turns* into the new orientation instead
   of jump-cutting. The two effects compound: same end glyph, smoother
   path to get there. */
.docs-tree-chevron.is-open:not(.is-loading) .bi {
    transform: rotate(90deg);
}

.docs-tree-chevron:hover {
    color: var(--text-100);
    background: rgba(94, 74, 174, 0.08);
    border-radius: 4px;
}

.docs-tree-link {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.5rem 0.35rem 0.1rem;
    text-decoration: none;
    color: var(--text-100, #1a1a1a);
    font-size: 0.9rem;
    line-height: 1.25;
}

.docs-tree-link:hover {
    color: var(--text-100);
}

.docs-tree-icon {
    flex: 0 0 1rem;
    width: 1rem;
    font-size: 0.95rem;
    color: var(--text-300);
    transition: color var(--transition-fast, 0.15s ease), transform var(--transition-normal, 0.25s ease);
}

.docs-tree-link.is-folder .docs-tree-icon {
    color: var(--accent-100, #00BFFF);
}

/* Closed-folder icon sits in a muted accent tone; the open-folder
   icon (bi-folder2-open) reads as the warmer "you're inside this"
   state. The pop animation triggers each render where the open icon
   is present — when JS toggles from closed to open the new icon is
   freshly mounted, so the animation fires every time a user expands
   a folder. Restrained: 220ms, scale 0.85 → 1, no overshoot. */
.docs-tree-link.is-folder .docs-tree-icon.bi-folder2-open {
    color: var(--primary-100, #5E4AAE);
    animation: docsFolderPop 0.22s ease-out;
}

@keyframes docsFolderPop {
    0%   { transform: scale(0.85); opacity: 0.55; }
    60%  { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1);    opacity: 1; }
}

/* Document icon gets a slight warm tint on hover so the user feels
   the row is reactive without changing the whole row background more
   than the existing hover bg already does. */
.docs-tree-row:hover .docs-tree-link.is-document .docs-tree-icon {
    color: var(--primary-200, #9076e0);
}

/* Staggered entrance for the initial root render — `is-fresh` is
   added to the tree body the first time it paints in a session and
   removed on next interaction so subsequent re-renders don't keep
   re-animating (which would look jittery on every expand/collapse).
   The :nth-child delays cap at 14 so a 100-doc root doesn't take 1.5s
   to settle; anything past that just fades in instantly. */
.docs-tree-body.is-fresh > .docs-tree-node {
    animation: docsTreeRowFadeIn 0.35s ease-out backwards;
}
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(1)  { animation-delay: 0.02s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(2)  { animation-delay: 0.04s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(3)  { animation-delay: 0.06s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(4)  { animation-delay: 0.08s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(5)  { animation-delay: 0.10s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(6)  { animation-delay: 0.12s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(7)  { animation-delay: 0.14s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(8)  { animation-delay: 0.16s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(9)  { animation-delay: 0.18s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(10) { animation-delay: 0.20s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(11) { animation-delay: 0.22s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(12) { animation-delay: 0.24s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(13) { animation-delay: 0.26s; }
.docs-tree-body.is-fresh > .docs-tree-node:nth-child(n+14) { animation-delay: 0.28s; }

@keyframes docsTreeRowFadeIn {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Honour reduced-motion preference — drop the chevron rotate, the
   folder pop, and the staggered fade-in. The colour + accent strip
   work alone don't carry motion. */
@media (prefers-reduced-motion: reduce) {
    .docs-tree-chevron .bi,
    .docs-tree-icon,
    .docs-tree-row {
        transition: none;
    }
    .docs-tree-link.is-folder .docs-tree-icon.bi-folder2-open,
    .docs-tree-body.is-fresh > .docs-tree-node {
        animation: none;
    }
}

.docs-tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-tree-children {
    /* nested rows handled by row padding-left + --depth */
}

/* ── Tree row: per-row "more" button ──────────────────────────────────────── */

.docs-tree-row-more {
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--text-300);
    padding: 0;
    border-radius: 0.25rem;
    margin-right: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition-fast, 0.15s ease), background var(--transition-fast, 0.15s ease);
    cursor: pointer;
}

.docs-tree-row:hover .docs-tree-row-more,
.docs-tree-row:focus-within .docs-tree-row-more {
    opacity: 1;
}

.docs-tree-row-more:hover {
    background: rgba(0,0,0,0.06);
    color: var(--text-100);
}

a.docs-tree-link:focus {
    outline: 2px solid var(--primary-100);
    outline-offset: -2px;
    border-radius: 0.25rem;
}

/* ── Folder view (inside shell) ───────────────────────────────────────────── */

.docs-folder-header {
    min-width: 0;
}

/* Inline "go up" button next to the folder title. Style is intentionally
   subtle — primary CTAs in the header are the create buttons. */
.docs-folder-up {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    margin-right: 0.4rem;
    background: var(--dash-bg, #f4f6f9);
    border: 1px solid var(--dash-border-2, rgba(0,0,0,0.10));
    border-radius: 0.35rem;
    color: var(--text-200, #4a4a4a);
    text-decoration: none;
    vertical-align: middle;
    transition: background var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
}

.docs-folder-up:hover {
    background: rgba(94, 74, 174, 0.10);
    color: var(--primary-100, #5E4AAE);
}

.docs-folder-header .docs-breadcrumb {
    margin-bottom: 0;
}

/* Legacy overview-grid kept for back-compat with any leftover surfaces;
   the new welcome pane has its own grid below. */
.docs-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .docs-overview-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Phase B: multi-select, bulk toolbar, inline rename, context menu ─────── */

.docs-folder-view {
    position: relative;
    padding-bottom: 4.5rem; /* leave room for sticky bulk toolbar */
}

.docs-folder-checkbox-cell {
    width: 2.25rem;
    padding-left: 0.85rem !important;
    padding-right: 0 !important;
}

.docs-folder-checkbox-cell .form-check-input {
    margin: 0;
    cursor: pointer;
}

.docs-folder-table tr.is-selected td {
    background: rgba(94, 74, 174, 0.10);
}

.docs-folder-table tr.is-selected:hover td {
    background: rgba(94, 74, 174, 0.15);
}

a.docs-folder-name {
    color: var(--text-100, #1a1a1a);
}

a.docs-folder-name:focus {
    outline: 2px solid var(--primary-100);
    outline-offset: 1px;
    border-radius: 0.25rem;
}

.docs-bulk-toolbar {
    position: sticky;
    bottom: 1rem;
    margin: 1rem auto 0;
    max-width: 720px;
    background: var(--text-100, #1a1a1a);
    color: #fff;
    border-radius: 0.75rem;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.2));
    z-index: 10;
    animation: docsBulkToolbarIn 0.18s ease-out;
}

.docs-bulk-toolbar[hidden] { display: none !important; }

.docs-bulk-count {
    font-size: 0.9rem;
    font-weight: 500;
}

.docs-bulk-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.docs-bulk-actions .btn-outline-secondary {
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}

.docs-bulk-actions .btn-outline-secondary:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.4);
    color: #fff;
}

.docs-bulk-actions .btn-outline-danger {
    border-color: rgba(255, 99, 99, 0.55);
    color: #ff8a8a;
}

.docs-bulk-actions .btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fff;
}

.docs-bulk-actions .btn-link {
    color: rgba(255,255,255,0.65);
}
.docs-bulk-actions .btn-link:hover {
    color: #fff;
}

@keyframes docsBulkToolbarIn {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

/* Inline rename input — sits in the slot vacated by the label so layout
   doesn't jump. Form-control sizing is tight to match the label baseline. */
.docs-rename-input {
    padding: 0.15rem 0.4rem;
    height: auto;
    line-height: 1.25;
    font-size: inherit;
    max-width: 22rem;
    border-color: var(--primary-200);
    box-shadow: 0 0 0 2px rgba(94, 74, 174, 0.18);
}

/* Context menu host + menu (mounted on <body> via context-menu.js). */
.docs-context-menu-host {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1080;
}

.docs-context-menu {
    position: fixed;
    pointer-events: auto;
    list-style: none;
    margin: 0;
    padding: 0.3rem 0;
    min-width: 12rem;
    max-width: 18rem;
    background: var(--dash-surface, #fff);
    border: 1px solid var(--dash-border, rgba(0,0,0,0.08));
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.10);
    font-size: 0.9rem;
    opacity: 0;
    transform: scale(0.96);
    transform-origin: top left;
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.docs-context-menu.is-open {
    opacity: 1;
    transform: scale(1);
}

.docs-context-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    color: var(--text-100);
    outline: none;
}

.docs-context-item:hover,
.docs-context-item:focus-visible {
    background: rgba(94, 74, 174, 0.10);
}

.docs-context-item.is-danger {
    color: #b91c1c;
}

.docs-context-item.is-danger:hover,
.docs-context-item.is-danger:focus-visible {
    background: rgba(239, 68, 68, 0.10);
}

.docs-context-item.is-disabled {
    opacity: 0.55;
    cursor: default;
    color: var(--text-300);
}

.docs-context-item .bi {
    width: 1rem;
    font-size: 0.95rem;
    text-align: center;
    flex-shrink: 0;
}

.docs-context-icon-spacer {
    width: 1rem;
    flex-shrink: 0;
}

.docs-context-sep {
    height: 1px;
    margin: 0.25rem 0;
    background: var(--dash-border-2, rgba(0,0,0,0.10));
}

/* Confirm modal — bulk list inside the body. */
.docs-confirm-list {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    max-height: 14rem;
    overflow-y: auto;
    color: var(--text-200);
    font-size: 0.9rem;
}

.docs-confirm-list li {
    padding: 0.1rem 0;
}

.docs-confirm-list .docs-confirm-more {
    list-style: none;
    margin-left: -1.1rem;
    color: var(--text-300);
    font-style: italic;
}

/* ── Welcome pane ─────────────────────────────────────────────────────────── */

.docs-welcome {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.docs-welcome-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 1.75rem;
    background: rgba(94, 74, 174, 0.07);
    border: 1px solid var(--dash-border);
    border-radius: 0.85rem;
}

.docs-welcome-hero .page-title {
    font-size: 1.5rem;
}

.docs-welcome-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.docs-welcome-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.docs-welcome-section-head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-100);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-welcome-section-head h2 .bi {
    color: var(--primary-100);
}

.docs-welcome-section-more {
    font-size: 0.85rem;
    color: var(--primary-100);
    text-decoration: none;
}

.docs-welcome-section-more:hover { text-decoration: underline; }

.docs-welcome-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.docs-welcome-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: var(--dash-surface, #fff);
    border: 1px solid var(--dash-border);
    border-radius: 0.6rem;
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
}

.docs-welcome-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--dash-shadow-md, 0 4px 16px rgba(0,0,0,0.09));
    color: inherit;
}

.docs-welcome-card-icon {
    flex: 0 0 2.2rem;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(94, 74, 174, 0.10);
    color: var(--primary-100);
    border-radius: 0.5rem;
    font-size: 1.05rem;
}

.docs-welcome-card-icon--shared {
    background: rgba(0, 191, 255, 0.12);
    color: var(--accent-200, #00619a);
}

.docs-welcome-card-body {
    flex: 1;
    min-width: 0;
}

.docs-welcome-card-title {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-100);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-welcome-card-meta {
    font-size: 0.78rem;
    color: var(--text-300);
}

.docs-welcome-card--skeleton {
    pointer-events: none;
}

.docs-welcome-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--dash-surface);
    border: 1px dashed var(--dash-border-2);
    border-radius: 0.6rem;
    color: var(--text-200);
}

.docs-welcome-empty .bi {
    font-size: 1.5rem;
    color: var(--text-300);
}

/* ── Mobile drawer ────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .docs-shell {
        grid-template-columns: 1fr;
    }
    .docs-tree-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(85vw, 320px);
        z-index: 1041;
        transform: translateX(-100%);
        transition: transform var(--transition-normal, 0.3s ease);
        box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.2));
    }
    .docs-shell.drawer-open .docs-tree-sidebar {
        transform: translateX(0);
    }
    .docs-drawer-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1040;
        display: block;
    }
    .docs-drawer-backdrop[hidden] {
        display: none;
    }
    .docs-content-header {
        padding: 0.5rem 0.85rem;
    }
    .docs-content-pane {
        padding: 1rem 0.85rem 1.5rem;
    }
    .docs-welcome-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem;
    }
}

@media (min-width: 769px) {
    .docs-drawer-toggle { display: none !important; }
    .docs-drawer-backdrop { display: none !important; }
}

.docs-card {
    background: var(--dash-surface, #fff);
    border: 1px solid var(--dash-border, #e5e7eb);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: var(--dash-shadow, var(--shadow-sm));
}

.docs-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.docs-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-100, #1a1a1a);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-card-title .bi {
    color: var(--primary-100);
    font-size: 1.1rem;
}

/* ── Tree / list rows ─────────────────────────────────────────────────────── */

.docs-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    border-radius: 0.375rem;
    color: var(--text-100);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast, 0.15s ease);
}

.docs-tree-item:hover {
    background: var(--primary-300, #f3f0ff);
}

.docs-tree-item .bi {
    font-size: 1rem;
    width: 1.2rem;
    text-align: center;
    color: var(--text-300, #717171);
    flex-shrink: 0;
}

.docs-tree-item.is-folder .bi-folder2,
.docs-tree-item.is-folder .bi-folder-fill {
    color: var(--accent-100, #00bfff);
}

.docs-tree-item .docs-tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.92rem;
}

.docs-tree-item .docs-tree-meta {
    font-size: 0.8rem;
    color: var(--text-300, #717171);
    flex-shrink: 0;
}

.docs-tree-item .docs-tree-actions {
    display: none;
    flex-shrink: 0;
}

.docs-tree-item:hover .docs-tree-actions,
.docs-tree-item:focus-within .docs-tree-actions {
    display: inline-flex;
}

/* ── Folder view table ────────────────────────────────────────────────────── */

.docs-folder-table {
    width: 100%;
    border-collapse: collapse;
}

.docs-folder-table th {
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-300);
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--dash-border);
    background: var(--dash-bg, #fafafa);
}

.docs-folder-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--dash-border-2, #f0f0f0);
    font-size: 0.92rem;
    vertical-align: middle;
}

.docs-folder-table tr:hover td {
    background: var(--primary-300, #f3f0ff);
}

.docs-folder-row-actions {
    display: inline-flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition-fast, 0.15s ease);
}

.docs-folder-table tr:hover .docs-folder-row-actions {
    opacity: 1;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */

.docs-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-300);
    margin-bottom: 0.5rem;
}

.docs-breadcrumb a {
    color: var(--primary-100);
    text-decoration: none;
}

.docs-breadcrumb a:hover {
    text-decoration: underline;
}

.docs-breadcrumb .bi-chevron-right {
    font-size: 0.7rem;
    opacity: 0.5;
}

/* ── Empty states ─────────────────────────────────────────────────────────── */

.docs-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-200);
}

.docs-empty .docs-empty-icon {
    font-size: 3rem;
    color: var(--text-300);
    opacity: 0.5;
    margin-bottom: 0.75rem;
}

.docs-empty h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-100);
    margin-bottom: 0.5rem;
}

.docs-empty p {
    font-size: 0.95rem;
    max-width: 28rem;
    margin: 0 auto 1.25rem;
}

.docs-empty .docs-empty-link {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--primary-100);
    text-decoration: none;
}

.docs-empty .docs-empty-link:hover {
    text-decoration: underline;
}

/* ── Skeleton rows ────────────────────────────────────────────────────────── */

@keyframes docsSkeletonPulse {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 0.9; }
}

.docs-skeleton-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    animation: docsSkeletonPulse 1.5s ease-in-out infinite;
}

.docs-skeleton-rect {
    background: var(--dash-border, #e5e7eb);
    border-radius: 0.25rem;
    height: 0.85rem;
}

/* ── Quota meter (overview header) ────────────────────────────────────────── */

.docs-quota-meter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-300);
}

.docs-quota-bar {
    width: 8rem;
    height: 6px;
    background: var(--dash-border, #e5e7eb);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.docs-quota-bar-fill {
    height: 100%;
    background: var(--primary-100);
    transition: width var(--transition-normal, 0.3s ease);
}

.docs-quota-meter[data-level="amber"] .docs-quota-bar-fill { background: var(--status-amber, #f59e0b); }
.docs-quota-meter[data-level="red"]   .docs-quota-bar-fill { background: var(--status-red, #ef4444); }

/* ── Save-status pill (editor topbar, Phase 2) ────────────────────────────── */

.docs-save-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    background: var(--dash-bg, #f5f5f5);
    color: var(--text-300);
    transition: background var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
}

.docs-save-pill .spinner-border-sm { width: 0.8rem; height: 0.8rem; }

.docs-save-pill[data-state="saving"]  { background: var(--dash-bg); color: var(--text-300); }
.docs-save-pill[data-state="saved"]   { background: var(--status-green-bg, #e6f9ee); color: var(--status-green, #047857); }
.docs-save-pill[data-state="offline"] { background: var(--status-amber-bg, #fef3c7); color: var(--status-amber, #b45309); }
.docs-save-pill[data-state="error"]   { background: var(--status-red-bg, #fee2e2); color: var(--status-red, #b91c1c); }

/* ── Editor topbar (rendered into the shell header slot or standalone topbar) */

.docs-editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.docs-editor-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 0;        /* basis 0 so left section yields width before overflowing */
    min-width: 0;       /* allows shrinking past intrinsic min so nothing overlaps */
}

.docs-editor-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.docs-editor-back {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Title input: the most-squishable thing in the left cluster. flex-basis 0
   + min-width 0 lets it collapse all the way down on narrow widths — the
   user sees fewer characters but the right cluster never overlaps it. */
.docs-editor-title-input {
    max-width: 28rem;
    font-size: 0.95rem;
    background: transparent;
    flex: 1 1 0;
    min-width: 0;
    width: auto;        /* override Bootstrap .form-control's width: 100% */
}

.docs-editor-title-input:focus {
    background: var(--dash-bg, #f4f6f9);
    box-shadow: none;
    border-color: transparent;
}

/* Read-only viewer (shared-doc): the title is rendered as a span instead
   of an input. The span inherits the input's sizing rules above so the
   topbar stays balanced; this block just gives it a baseline so it
   vertically aligns with the back button + badge. */
span.docs-editor-title-input {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    line-height: 1.5;
}

.docs-readonly-badge {
    flex: 0 0 auto;
    font-weight: 500;
}

/* Save pill never grows; on narrow screens it sheds its text and keeps
   only the icon so the title has room. */
.docs-save-pill {
    flex: 0 0 auto;
    min-width: 0;
}

@media (max-width: 900px) {
    .docs-save-pill [data-role=save-status-label] {
        display: none;
    }
    .docs-editor-topbar { gap: 0.35rem; }
    .docs-editor-topbar-right { gap: 0.25rem; }
}

/* When the editor mounts into the shell pane it needs to fill the available
   height edge-to-edge — the welcome/folder views use the pane's default
   padding, but the editor wants its own surface to the edges. */
.docs-content-pane:has(> .docs-editor-body) {
    padding: 0;
}

.docs-editor-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.docs-editor-body > .docs-editor-shell {
    flex: 1;
    min-height: 0;
}

/* ── Editor body (Phase 2) ────────────────────────────────────────────────── */

.docs-editor-shell {
    display: grid;
    grid-template-columns: 1fr;
    height: 100%;
}

.docs-editor-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

/* Three pane modes — preview-first by default. The host always carries
   both children (editor + preview); the mode class chooses visibility
   without remounting CodeMirror or losing scroll. */
.docs-editor-pane.is-preview .docs-cm-host,
.docs-editor-pane.is-edit    [data-role=preview-host] {
    display: none;
}
.docs-editor-pane.is-preview [data-role=preview-host],
.docs-editor-pane.is-edit    .docs-cm-host {
    display: block;
    flex: 1;
    min-height: 0;
}
.docs-editor-pane.is-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1px;
    background: var(--dash-border);
}
.docs-editor-pane.is-split .docs-cm-host,
.docs-editor-pane.is-split [data-role=preview-host] {
    display: block;
    min-height: 0;
    min-width: 0;
}

/* Segmented mode toggle. Active button uses brand purple instead of
   Bootstrap's default-dark active state so it reads as a switch, not a
   submit. */
.docs-editor-modes .btn.active {
    background: var(--primary-100, #5E4AAE);
    border-color: var(--primary-100, #5E4AAE);
    color: #fff;
}
.docs-editor-modes .btn.active:hover {
    background: var(--primary-200, #9076e0);
    border-color: var(--primary-200, #9076e0);
    color: #fff;
}

.docs-editor-textarea {
    flex: 1;
    width: 100%;
    min-height: 60vh;
    border: none;
    padding: 1.5rem 2rem;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.55;
    resize: none;
    outline: none;
    background: #fff;
    color: var(--text-100);
}

/* Empty-state placeholder for a blank document. Whole block is clickable
   (the editor-mount handler intercepts dblclick on the preview host and
   the inline button does a single click). */
.docs-editor-preview-empty {
    --reading-width: 720px;
    max-width: var(--reading-width);
    margin: 4rem auto 0;
    padding: 3rem 2rem;
    border: 1px dashed var(--dash-border-2, rgba(0,0,0,0.10));
    border-radius: 0.85rem;
    text-align: center;
    color: var(--text-300, #717171);
    user-select: none;
    background: var(--dash-surface, #fff);
    transition: border-color var(--transition-fast, 0.15s ease), background var(--transition-fast, 0.15s ease);
}

.docs-editor-preview-empty:hover {
    border-color: var(--primary-200, #9076e0);
    cursor: pointer;
}

.docs-editor-preview-empty .bi-pencil-square {
    font-size: 2.5rem;
    color: var(--primary-100, #5E4AAE);
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.docs-editor-preview-empty p {
    margin: 0 0 0.25rem;
    color: var(--text-200, #4a4a4a);
}

.docs-editor-preview-empty .docs-editor-preview-empty-hint {
    font-size: 0.92rem;
    color: var(--text-300, #717171);
    margin-bottom: 1rem;
}

.docs-editor-preview-empty button {
    margin-top: 0.4rem;
}

/* Reading view: centered ~720px column, generous line-height, system serif-
   feeling font stack. Editor mode keeps the monospace + full width. */
.docs-editor-preview {
    --reading-width: 720px;
    padding: 2.5rem 2rem 6rem;
    background: #fff;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-100, #1a1a1a);
    letter-spacing: 0.005em;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.docs-editor-preview > * {
    max-width: var(--reading-width);
    margin-left: auto;
    margin-right: auto;
}

/* Tighten the body element default spacing inside paragraphs. */
.docs-editor-preview p {
    margin: 0 auto 1em;
}

/* Headings: bigger hierarchy + a subtle bottom rule on h1/h2 to break long
   documents into scannable sections. */
.docs-editor-preview h1,
.docs-editor-preview h2,
.docs-editor-preview h3,
.docs-editor-preview h4,
.docs-editor-preview h5,
.docs-editor-preview h6 {
    color: var(--text-100, #1a1a1a);
    font-weight: 700;
    margin: 1.6em auto 0.55em;
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.docs-editor-preview h1 { font-size: 2.1rem; padding-bottom: .35rem; border-bottom: 1px solid var(--dash-border-2, rgba(0,0,0,0.08)); }
.docs-editor-preview h2 { font-size: 1.6rem; padding-bottom: .3rem;  border-bottom: 1px solid var(--dash-border-2, rgba(0,0,0,0.06)); }
.docs-editor-preview h3 { font-size: 1.25rem; }
.docs-editor-preview h4 { font-size: 1.05rem; color: var(--text-200, #4a4a4a); }
.docs-editor-preview h5 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-300, #717171); }

/* First heading shouldn't push down from the top. */
.docs-editor-preview > :first-child { margin-top: 0; }

/* Images / media never spill past the reading column. */
.docs-editor-preview img,
.docs-editor-preview svg,
.docs-editor-preview video {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    display: block;
    margin: 1rem auto;
}

/* Code blocks get the brand bg + monospaced. Inline code gets a chip. */
.docs-editor-preview pre {
    background: #0f172a;
    color: #e5e7eb;
    border-radius: 0.55rem;
    padding: 1rem 1.15rem;
    overflow-x: auto;
    line-height: 1.55;
    font-size: 0.88rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.docs-editor-preview pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.docs-editor-preview code {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    background: rgba(94, 74, 174, 0.10);
    color: var(--primary-100, #5E4AAE);
    padding: 0.1em 0.4em;
    border-radius: 0.25rem;
}

.docs-editor-preview blockquote {
    border-left: 4px solid var(--primary-100);
    padding: 0.25rem 0 0.25rem 1.15rem;
    color: var(--text-200);
    margin: 1.25rem auto;
    background: rgba(94, 74, 174, 0.04);
    border-radius: 0 0.35rem 0.35rem 0;
}

.docs-editor-preview ul, .docs-editor-preview ol {
    padding-left: 1.5rem;
}
.docs-editor-preview li { margin: 0.25rem 0; }
.docs-editor-preview li > p:last-child { margin-bottom: 0; }

.docs-editor-preview a {
    color: var(--primary-100, #5E4AAE);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.docs-editor-preview a:hover { color: var(--primary-200, #9076e0); }

.docs-editor-preview hr {
    border: 0;
    border-top: 1px solid var(--dash-border-2, rgba(0,0,0,0.08));
    margin: 2rem auto;
    max-width: var(--reading-width);
}

/* Mermaid diagram container — produced by editor-markdown's
   _renderMermaidBlocks. Stays inside the reading column and centers
   the SVG; very large diagrams scroll horizontally rather than
   blowing past the column. */
.docs-editor-preview .docs-mermaid {
    max-width: var(--reading-width);
    margin: 1.5rem auto;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--dash-border-2, rgba(0,0,0,0.08));
    border-radius: 0.55rem;
    text-align: center;
    overflow-x: auto;
}

.docs-editor-preview .docs-mermaid svg {
    max-width: 100%;
    height: auto;
}

.docs-editor-preview .docs-mermaid.is-error {
    text-align: left;
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.40);
    color: var(--text-200);
}

.docs-editor-preview .docs-mermaid.is-error summary {
    cursor: pointer;
    font-weight: 500;
    color: #b45309;
}

.docs-editor-preview .docs-mermaid.is-error summary .bi {
    color: #b45309;
    margin-right: 0.25rem;
}

.docs-editor-preview .docs-mermaid.is-error pre {
    margin: 0.6rem 0 0;
    padding: 0.55rem 0.75rem;
    background: #fff;
    color: var(--text-200);
    border-radius: 0.35rem;
    font-size: 0.85rem;
    max-width: none;
    box-shadow: none;
}

.docs-editor-preview table {
    border-collapse: collapse;
    width: 100%;
    max-width: var(--reading-width);
    margin: 1rem auto;
    font-size: 0.95rem;
}
.docs-editor-preview th,
.docs-editor-preview td {
    border: 1px solid var(--dash-border-2);
    padding: 0.45rem 0.7rem;
    text-align: left;
}
.docs-editor-preview thead th { background: var(--dash-bg, #f4f6f9); }

/* CodeMirror editor host */
.docs-cm-host {
    flex: 1;
    min-height: 60vh;
    overflow: auto;
}

.docs-cm-host .cm-editor {
    height: 100%;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
    font-size: 0.95rem;
}

.docs-cm-host .cm-scroller {
    padding: 1rem 1.5rem;
    line-height: 1.55;
}

.docs-cm-host .cm-content {
    caret-color: var(--primary-100);
}

/* ── Conflict modal columns (Phase 3) ─────────────────────────────────────── */

.docs-conflict-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-height: 50vh;
    overflow-y: auto;
}

.docs-conflict-col {
    border: 1px solid var(--dash-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: var(--dash-bg, #fafafa);
}

.docs-conflict-col h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-300);
    margin: 0 0 0.5rem;
}

.docs-conflict-col pre {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    margin: 0;
    color: var(--text-100);
}

/* ── Drag & drop ──────────────────────────────────────────────────────────── */

/* Source row while a drag is in flight. Half-opacity so the user can see
   where the row was without losing track of the cursor. */
.docs-tree-row.is-dragging,
.docs-folder-table tr.is-dragging {
    opacity: 0.45;
}

.docs-tree-row.is-dragging .docs-tree-link {
    pointer-events: none;
}

/* Folder drop target (tree). The row stays draggable but gets a tinted
   background, a 2-px primary outline, and a soft glow so the user
   knows it'll accept the drop. The glow doubles as a focus indicator
   in case the user is keyboard-navigating during a touch drag. */
.docs-tree-row.is-drop-target {
    background: rgba(94, 74, 174, 0.18);
    outline: 2px solid var(--primary-100, #5E4AAE);
    outline-offset: -2px;
    border-radius: 0.375rem;
    box-shadow: 0 0 0 6px rgba(94, 74, 174, 0.12);
    animation: docsDropTargetPulse 1.2s ease-in-out infinite;
}

@keyframes docsDropTargetPulse {
    0%, 100% { box-shadow: 0 0 0 6px rgba(94, 74, 174, 0.12); }
    50%      { box-shadow: 0 0 0 10px rgba(94, 74, 174, 0.06); }
}

@media (prefers-reduced-motion: reduce) {
    .docs-tree-row.is-drop-target {
        animation: none;
    }
}

/* Root-level drop zone (the tree-body itself when not over a folder row).
   We draw a soft dashed border instead of tinting the whole body so the
   highlight reads as "drop here = ungroup" rather than "drop into". */
[data-role=tree-body].is-drop-root {
    outline: 2px dashed var(--primary-200, #9076e0);
    outline-offset: -4px;
    background: rgba(94, 74, 174, 0.04);
    border-radius: 0.5rem;
}

/* Folder drop target in the folder-view table. */
.docs-folder-table tr.is-drop-target td {
    background: rgba(94, 74, 174, 0.16) !important;
    box-shadow: inset 0 0 0 2px var(--primary-100, #5E4AAE);
}

/* Breadcrumb drop target. */
.docs-breadcrumb a.is-drop-crumb {
    background: rgba(94, 74, 174, 0.16);
    outline: 2px solid var(--primary-100);
    outline-offset: 2px;
    border-radius: 0.35rem;
    text-decoration: none;
}

/* ── ⌘K command palette ──────────────────────────────────────────────────── */

.docs-palette-host {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.docs-palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 18, 38, 0.45);
    backdrop-filter: blur(2px);
    pointer-events: auto;
}

.docs-palette {
    position: relative;
    margin-top: 12vh;
    width: min(640px, 92vw);
    background: var(--dash-surface, #fff);
    border-radius: 0.85rem;
    box-shadow: 0 24px 64px rgba(20, 18, 38, 0.25), 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    animation: docsPaletteIn 0.14s ease-out;
}

@keyframes docsPaletteIn {
    from { transform: translateY(-8px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.docs-palette-search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--dash-border, rgba(0,0,0,0.06));
}

.docs-palette-search .bi-search {
    color: var(--text-300, #717171);
    font-size: 1rem;
}

.docs-palette-search input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 1.05rem;
    color: var(--text-100, #1a1a1a);
}

.docs-palette-search input::placeholder {
    color: var(--text-300, #9b9b9b);
}

.docs-palette-kbd {
    font-size: 0.7rem;
    color: var(--text-300, #717171);
    background: var(--dash-bg, #f4f6f9);
    padding: 0.1rem 0.4rem;
    border-radius: 0.3rem;
    border: 1px solid var(--dash-border-2, rgba(0,0,0,0.10));
}

.docs-palette-results {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0.4rem 0.4rem 0.6rem;
}

.docs-palette-section-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-300, #717171);
    padding: 0.65rem 0.85rem 0.25rem;
}

.docs-palette-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-100, #1a1a1a);
}

.docs-palette-row.is-active,
.docs-palette-row:hover {
    background: rgba(94, 74, 174, 0.12);
}

.docs-palette-row-icon {
    flex: 0 0 1rem;
    width: 1rem;
    color: var(--primary-100, #5E4AAE);
    font-size: 1rem;
    text-align: center;
}

.docs-palette-row-body {
    flex: 1;
    min-width: 0;
}

.docs-palette-row-label {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-palette-row-label mark {
    background: rgba(0, 191, 255, 0.18);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.docs-palette-row-sub {
    font-size: 0.78rem;
    color: var(--text-300, #717171);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-palette-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-300);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.docs-palette-empty .bi {
    font-size: 1.5rem;
    opacity: 0.6;
}

.docs-palette-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 1rem;
    border-top: 1px solid var(--dash-border, rgba(0,0,0,0.06));
    background: var(--dash-bg, #f4f6f9);
    font-size: 0.78rem;
    color: var(--text-300, #717171);
}

.docs-palette-footer kbd {
    background: var(--dash-surface, #fff);
    border: 1px solid var(--dash-border-2, rgba(0,0,0,0.10));
    border-radius: 0.25rem;
    padding: 0.05rem 0.35rem;
    margin-right: 0.15rem;
    font-size: 0.7rem;
    color: var(--text-200);
}

/* ── ⌘K hint button in the tree header ───────────────────────────────────── */

.docs-tree-cmdk {
    border: 1px solid var(--dash-border-2, rgba(0,0,0,0.10));
    background: var(--dash-bg, #f4f6f9);
    border-radius: 0.3rem;
    padding: 0.05rem 0.3rem;
    color: var(--text-300, #717171);
    font-size: 0.7rem;
    cursor: pointer;
    transition: background var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    margin-right: 0.25rem;
}

.docs-tree-cmdk:hover {
    background: rgba(94, 74, 174, 0.10);
    color: var(--primary-100, #5E4AAE);
}

.docs-tree-cmdk kbd {
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
}

/* ── Editor: asset drop overlay ──────────────────────────────────────────── */

.docs-editor-body.is-asset-dropping {
    position: relative;
}

.docs-editor-body.is-asset-dropping::after {
    content: 'Suelta para subir';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(94, 74, 174, 0.10);
    color: var(--primary-100, #5E4AAE);
    border: 3px dashed var(--primary-200, #9076e0);
    font-weight: 600;
    font-size: 1.05rem;
    pointer-events: none;
    z-index: 5;
    border-radius: 0.5rem;
    margin: 0.5rem;
}

/* ── Asset library modal ─────────────────────────────────────────────────── */

.docs-asset-library .modal-body {
    padding: 1rem 1.25rem;
}

.docs-asset-library-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.docs-asset-library-filters {
    display: inline-flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.docs-asset-library-search {
    position: relative;
    flex: 1;
    min-width: 12rem;
}

.docs-asset-library-search .bi {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-300);
    font-size: 0.85rem;
}

.docs-asset-library-search input {
    padding-left: 1.7rem;
    background: var(--dash-bg, #f4f6f9);
    border-color: transparent;
}

.docs-asset-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.25rem;
}

.docs-asset-library-footer {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
}

.docs-asset-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    background: var(--dash-surface, #fff);
    border: 1px solid var(--dash-border, rgba(0,0,0,0.06));
    border-radius: 0.6rem;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
}

.docs-asset-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--dash-shadow-md, 0 4px 16px rgba(0,0,0,0.09));
}

.docs-asset-card-thumb {
    width: 100%;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dash-bg, #f4f6f9);
    overflow: hidden;
}

.docs-asset-card-thumb.is-icon {
    color: var(--primary-100, #5E4AAE);
    font-size: 2rem;
}

.docs-asset-card-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.docs-asset-card-body {
    padding: 0.55rem 0.7rem 0.7rem;
}

.docs-asset-card-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-100, #1a1a1a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-asset-card-meta {
    font-size: 0.75rem;
    color: var(--text-300, #717171);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-asset-card--skeleton {
    pointer-events: none;
}

/* Wrap + overlay for the per-card "new version" affordance. The wrap is
   needed because <button> inside <button> is invalid; the card-pick
   button and the new-version button sit as siblings inside the wrap. */
.docs-asset-card-wrap {
    position: relative;
}

/* Folder cards reuse the same card shell as assets — the only visual
   difference is the icon colour and a subtle background tint to mark
   them as folders. */
.docs-asset-card-wrap--folder .docs-asset-card {
    background: var(--primary-50, #f7f4ff);
}
.docs-asset-card-thumb--folder {
    color: var(--primary-100, #5E4AAE);
    font-size: 2.4rem;
}

/* ── Asset versions modal ──────────────────────────────────────────────── */

.docs-asset-versions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.docs-asset-version-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--dash-border, rgba(0,0,0,0.06));
    border-radius: 0.45rem;
    margin-bottom: 0.45rem;
    background: var(--dash-surface, #fff);
}
.docs-asset-version-row.is-current {
    border-color: var(--primary-100, #5E4AAE);
    background: var(--primary-50, #f7f4ff);
}
.docs-asset-version-row-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
}
.docs-asset-version-row-meta {
    color: var(--text-300, #717171);
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.docs-asset-version-row-actions {
    display: inline-flex;
    gap: 0.4rem;
    flex-shrink: 0;
}
.docs-asset-versions-footer {
    margin-top: 0.5rem;
    text-align: center;
}

/* Drag-drop affordances. The asset card being dragged dims; folder
   cards (or breadcrumb crumbs) under the cursor highlight. */
.docs-asset-card-wrap.is-dragging {
    opacity: 0.5;
    cursor: grabbing;
}
.docs-asset-card-wrap[draggable=true] {
    cursor: grab;
}
.docs-asset-card-wrap--folder.is-drop-target {
    outline: 2px dashed var(--primary-100, #5E4AAE);
    outline-offset: -2px;
    background: var(--primary-50, #f1edff);
}
.docs-asset-card--folder.is-drop-target,
.docs-asset-breadcrumb-link.is-drop-target {
    background: var(--primary-50, #f1edff);
    color: var(--primary-100, #5E4AAE);
    text-decoration: underline;
}

/* Breadcrumb above the library grid. Compact, single-line; "/" sep
   keeps the bar tight. Each segment except the current one is a link
   that navigates up. */
.docs-asset-library-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.55rem;
    color: var(--text-300, #717171);
    font-size: 0.88rem;
}
.docs-asset-library-breadcrumb i.bi {
    color: var(--primary-100, #5E4AAE);
}
.docs-asset-breadcrumb-link {
    color: var(--text-300, #717171);
    text-decoration: none;
}
.docs-asset-breadcrumb-link:hover {
    color: var(--primary-100, #5E4AAE);
    text-decoration: underline;
}
.docs-asset-breadcrumb-sep {
    color: var(--text-400, #aaa);
}
.docs-asset-breadcrumb-current {
    color: var(--text-100, #1a1a1a);
    font-weight: 600;
}
/* Top-right action cluster: stacks the "new version" and "delete"
   buttons side-by-side. Always visible (was hover-only and missed
   even with a mouse). Sibling layout because <button> in <button>
   is invalid HTML. */
.docs-asset-card-actions {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    display: flex;
    gap: 0.3rem;
}
.docs-asset-card-action {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-300, #717171);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity var(--transition-fast, 0.15s ease),
                color   var(--transition-fast, 0.15s ease),
                background var(--transition-fast, 0.15s ease),
                transform var(--transition-fast, 0.15s ease);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.docs-asset-card-action i {
    font-size: 1.05rem;
    line-height: 1;
}
.docs-asset-card-wrap:hover .docs-asset-card-action,
.docs-asset-card-action:focus-visible {
    opacity: 1;
}
.docs-asset-card-action:hover {
    opacity: 1;
    background: #fff;
    transform: scale(1.06);
}
.docs-asset-card-update:hover {
    color: var(--primary-100, #5E4AAE);
}
.docs-asset-card-delete:hover {
    color: var(--danger, #d9534f);
}

/* ── Inline OpenAPI spec preview card (renders in markdown preview) ──────── */

.docs-openapi-card {
    border: 1px solid var(--dash-border, rgba(0,0,0,0.08));
    border-radius: 0.65rem;
    padding: 0.85rem 1rem;
    margin: 1rem 0;
    background: var(--dash-surface, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.docs-openapi-card-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.docs-openapi-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    background: var(--primary-50, #f1edff);
    color: var(--primary-100, #5E4AAE);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.docs-openapi-card-title {
    flex: 1 1 auto;
    min-width: 0;
}
.docs-openapi-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-100, #1a1a1a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.docs-openapi-card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
}
.docs-openapi-card-meta .badge {
    font-weight: 500;
    font-size: 0.7rem;
}
.docs-openapi-card-desc {
    margin-top: 0.6rem;
    color: var(--text-200, #4a4a4a);
    font-size: 0.9rem;
    line-height: 1.45;
}
.docs-openapi-card-source {
    margin-top: 0.65rem;
}
.docs-openapi-card-source summary {
    cursor: pointer;
    color: var(--text-300, #717171);
    font-size: 0.85rem;
}
.docs-openapi-card-source pre {
    margin-top: 0.5rem;
    max-height: 360px;
    overflow: auto;
    padding: 0.65rem 0.85rem;
    border-radius: 0.4rem;
    background: var(--dash-bg, #f4f6f9);
    font-size: 0.78rem;
    line-height: 1.5;
}

/* Redoc inline render — keep it height-bounded so a 100-path spec
   doesn't blow out the editor view. Internal scroll inside the
   mount; the surrounding card stays at a sensible size. */
.docs-openapi-card-redoc {
    margin-top: 0.65rem;
}
.docs-openapi-card-redoc summary {
    cursor: pointer;
    color: var(--text-300, #717171);
    font-size: 0.85rem;
}
.docs-openapi-redoc-mount {
    margin-top: 0.5rem;
    max-height: 70vh;
    overflow: auto;
    border: 1px solid var(--dash-border, rgba(0,0,0,0.06));
    border-radius: 0.45rem;
    background: var(--dash-surface, #fff);
    /* Redoc paints its own typography; we just give it a frame. */
}

/* Operations list — paths + method badges + summary, one row per path */
.docs-openapi-ops {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.docs-openapi-op {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0.2rem 0.65rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--dash-border, rgba(0,0,0,0.06));
    border-radius: 0.45rem;
    background: var(--dash-bg, #fafbfc);
}
.docs-openapi-op-methods {
    grid-row: 1;
    grid-column: 1;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-self: start;
}
.docs-openapi-op-path {
    grid-row: 1;
    grid-column: 2;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.86rem;
    color: var(--text-100, #1a1a1a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.docs-openapi-op-summary {
    grid-row: 2;
    grid-column: 2;
    font-size: 0.8rem;
    color: var(--text-300, #717171);
    line-height: 1.4;
}

.docs-openapi-method {
    display: inline-block;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.18rem 0.4rem;
    border-radius: 0.25rem;
    color: #fff;
    text-transform: uppercase;
    min-width: 3.3em;
    text-align: center;
}
.docs-openapi-method--get     { background: #1f8a4e; }
.docs-openapi-method--post    { background: #2563eb; }
.docs-openapi-method--put     { background: #b45309; }
.docs-openapi-method--patch   { background: #9333ea; }
.docs-openapi-method--delete  { background: #b91c1c; }
.docs-openapi-method--options { background: #475569; }
.docs-openapi-method--head    { background: #475569; }
.docs-openapi-method--trace   { background: #475569; }

/* ── Peer-overwrite toast (realtime reconciliation) ───────────────────────── */

.docs-overwrite-toast-host {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.docs-overwrite-toast {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--text-100, #1a1a1a);
    color: #fff;
    border-radius: 0.65rem;
    padding: 0.8rem 1rem;
    min-width: 360px;
    max-width: 540px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.2));
    pointer-events: auto;
    animation: docsOverwriteIn 0.2s ease-out;
}

.docs-overwrite-toast-body {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
}

.docs-overwrite-toast-body .bi {
    color: var(--status-amber, #f59e0b);
    font-size: 1.25rem;
    flex: 0 0 auto;
}

.docs-overwrite-toast-body strong {
    display: block;
    font-weight: 500;
}

.docs-overwrite-toast-body .text-muted {
    color: rgba(255,255,255,0.65) !important;
}

.docs-overwrite-toast-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 0 0 auto;
}

.docs-overwrite-toast-actions .btn-outline-light {
    border-color: rgba(255,255,255,0.3);
}

@keyframes docsOverwriteIn {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── History drawer (Phase 3) ─────────────────────────────────────────────── */

.docs-history-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    background: #fff;
    border-left: 1px solid var(--dash-border);
    box-shadow: var(--shadow-lg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--transition-normal, 0.3s ease);
}

.docs-history-drawer.open {
    transform: translateX(0);
}

.docs-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.docs-history-row {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--dash-border-2, #f0f0f0);
    cursor: pointer;
}

.docs-history-row:hover {
    background: var(--primary-300, #f3f0ff);
}

.docs-history-row .docs-history-meta {
    font-size: 0.8rem;
    color: var(--text-300);
}

/* ── Share modal collaborator rows (Phase 4) ──────────────────────────────── */

.docs-share-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--dash-border-2, #f0f0f0);
}

.docs-share-row:last-child {
    border-bottom: none;
}

.docs-share-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: var(--primary-100);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.docs-share-row .docs-share-meta {
    flex: 1;
    min-width: 0;
}

.docs-share-row .docs-share-name {
    font-size: 0.92rem;
    font-weight: 500;
}

.docs-share-row .docs-share-permission {
    font-size: 0.8rem;
    color: var(--text-300);
}
