/* ══════════════════════════════════════════════════
   sidebar-nav.css — Collapsible sidebar content-type nav
   + folder drop-target + group actions bar + content list page
   ══════════════════════════════════════════════════ */

.lp-sidenav {
    display: flex;
    flex-direction: column;
    padding: 4px 6px;
    gap: 2px;
}

.lp-sidenav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 0;
    background: transparent;
    color: var(--text-primary, #1d1d1f);
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 120ms ease;
}

.lp-sidenav-item:hover { background: var(--hover-bg, rgba(0, 0, 0, 0.04)); }

.lp-sidenav-item-active {
    background: var(--selected-bg, rgba(0, 0, 0, 0.06));
    font-weight: 500;
}

.lp-sidenav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: var(--text-secondary, #6b6b70);
    flex-shrink: 0;
}

.lp-sidenav-item-active .lp-sidenav-icon { color: var(--text-primary, #1d1d1f); }

.lp-sidenav-label {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lp-sidenav-badge {
    font-size: 11px;
    color: var(--text-secondary, #6b6b70);
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--hover-bg, rgba(0, 0, 0, 0.04));
}

.lp-sidenav-expander .lp-sidenav-chevron svg { transition: transform 150ms ease; }
.lp-sidenav-expanded .lp-sidenav-chevron svg { transform: rotate(180deg); }
.lp-sidenav-item-nested { padding-left: 28px; }

/* ── Folder drop-target highlight ── */

.lp-folder { border-radius: 6px; transition: background 120ms ease, box-shadow 120ms ease; }

.lp-folder-drag-over,
.chat-sb-folder.drag-over {
    background: var(--drop-target-bg, rgba(59, 130, 246, 0.12));
    box-shadow: inset 0 0 0 1px var(--drop-target-border, rgba(59, 130, 246, 0.4));
}

.lp-folder-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary, #1d1d1f);
    border-radius: 6px;
    text-align: left;
}

.lp-folder-header:hover { background: var(--hover-bg, rgba(0, 0, 0, 0.04)); }

.lp-folder-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #6b6b70);
}

.lp-folder-label { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lp-folder-count { font-size: 11px; color: var(--text-secondary, #6b6b70); }
.lp-folder-content { padding-left: 14px; }

/* ── Group actions bar ── */

.lp-group-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    margin: 6px;
    background: var(--surface-bg, #f6f6f7);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    border-radius: 8px;
    font-size: 12px;
    flex-wrap: wrap;
}

.lp-group-actions-count { font-weight: 500; color: var(--text-primary, #1d1d1f); margin-right: auto; }

.lp-group-actions-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary, #1d1d1f);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* Excludes the chat variant, whose buttons paint entirely via the shared New
   Chat / New Folder classes — a generic hover fill here would sit on top of
   the New Chat pill's own background. */
.lp-group-actions:not(.chat-sb-group-actions) .lp-group-actions-btn:hover { background: var(--hover-bg, rgba(0, 0, 0, 0.04)); }
.lp-group-actions-btn-danger { color: var(--danger-fg, #d92d20); }
.lp-group-actions-btn-danger:hover { background: rgba(217, 45, 32, 0.08); }
.lp-group-actions-cancel { margin-left: 4px; color: var(--text-secondary, #6b6b70); }
.lp-group-actions-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; }

/* Chat variant — takes the New Chat / New Folder row's slot while multi-select
   is on (chat-sidebar.js swaps one for the other), and wears that row's classes
   so it IS that row: Merge is the primary `chat-sb-new-btn` pill, Delete and
   Cancel the outlined `chat-sb-folder-btn`. Layout and chrome therefore come
   from chat-features.css; all that is left here is dropping the generic bar's
   card look and the bits the shared classes can't know. */
.lp-group-actions.chat-sb-group-actions {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    flex-wrap: nowrap;
}

/* The folder button is icon-only at rest; here it carries a label. */
.chat-sb-group-actions .chat-sb-folder-btn {
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* Delete reads danger — the red the sidebar context menu already uses — and
   keeps it on hover instead of taking the folder button's accent. */
.chat-sb-group-actions .lp-group-actions-btn-danger { color: var(--danger-fg, #e55); }
.chat-sb-group-actions .lp-group-actions-btn-danger:hover {
    border-color: var(--danger-fg, #e55);
    color: var(--danger-fg, #e55);
    background: rgba(200, 50, 50, 0.15);
}

/* Cancel is the plain-text sibling: same chrome, ordinary foreground. */
.chat-sb-group-actions .lp-group-actions-cancel {
    margin-left: 0;
    color: var(--text-primary);
}

/* Content list page + editor overlay styles live in css/controls/content-page.css. */

/* ── Chat content view container ── */

.chat-content-view { flex: 1; min-height: 0; overflow: hidden; display: flex; }

/* ── Selected chat card (multi-select) ── */

.sidebar-signal-card.selected {
    background: var(--selected-bg, rgba(59, 130, 246, 0.12));
    box-shadow: inset 0 0 0 1px var(--accent, #3b82f6);
}

.chat-sb-select { margin-right: 4px; accent-color: var(--accent, #3b82f6); }
.sidebar-signal-card.dragging { opacity: 0.5; }

/* Shared Recent / Spaces switch used by Chat and Signals. */
.lp-sidebar-view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    min-height: 30px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-surface);
}

.lp-sidebar-view-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 24px;
    padding: 0 10px;
    border: 0;
    border-radius: calc(var(--radius-md, 8px) - 2px);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.lp-sidebar-view-option:hover { color: var(--text-primary); }
.lp-sidebar-view-option.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 600;
}

.lp-sidebar-view-option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    .lp-sidebar-view-option { transition: none; }
}

/* Shared Spaces section heading + inline create form. */
.lp-sidebar-spaces-section {
    display: grid;
    gap: 7px;
    min-width: 0;
    margin: 0 0 8px;
}

.lp-sidebar-spaces-heading {
    display: flex;
    min-height: 28px;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lp-sidebar-spaces-heading-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lp-sidebar-spaces-add,
.lp-sidebar-spaces-more {
    display: inline-grid;
    width: 26px;
    height: 26px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
}

.lp-sidebar-spaces-add:hover,
.lp-sidebar-spaces-add[aria-expanded="true"],
.lp-sidebar-spaces-more:hover,
.lp-sidebar-spaces-more[aria-expanded="true"] {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.lp-sidebar-spaces-add:focus-visible,
.lp-sidebar-spaces-more:focus-visible,
.lp-sidebar-space-form input:focus-visible,
.lp-sidebar-space-actions button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.lp-sidebar-spaces-menu {
    position: fixed;
    z-index: 500;
    min-width: 200px;
    display: grid;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-surface);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.lp-sidebar-spaces-menu[hidden] { display: none; }

.lp-sidebar-spaces-menu-item {
    display: flex;
    align-items: center;
    padding: 4px 3px;
}

.lp-sidebar-space-form {
    display: grid;
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-surface);
}

.lp-sidebar-space-form[hidden] { display: none; }

.lp-sidebar-space-form input {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    outline: 0;
    background: var(--bg-panel);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
}

.lp-sidebar-space-form input::placeholder { color: var(--text-muted); }
.lp-sidebar-space-form p {
    margin: 0;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.45;
}

.lp-sidebar-space-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
}

.lp-sidebar-space-actions button {
    min-height: 25px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.lp-sidebar-space-actions .lp-sidebar-space-create {
    border-color: var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 600;
}

.lp-sidebar-space-actions button:disabled {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.65;
}

/* Compact create row mounted directly beneath a Space or Project header. */
.lp-sidebar-inline-create {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    padding: 5px 8px 6px 34px;
}

.lp-sidebar-inline-create input {
    min-width: 0;
    height: 30px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    outline: 0;
    background: var(--bg-surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
}

.lp-sidebar-inline-create input::placeholder { color: var(--text-muted); }

.lp-sidebar-inline-create button {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-hover);
    color: var(--text-primary);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.lp-sidebar-inline-create input:focus-visible,
.lp-sidebar-inline-create button:focus-visible {
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.lp-sidebar-inline-create button:disabled {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.65;
}

.ch-tree-section-action[data-create-action],
.ch-tree-item-create {
    display: inline-grid;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-left: auto;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 15px;
    line-height: 1;
    opacity: 1;
    cursor: pointer;
}

.ch-tree-section-action[data-create-action]:hover,
.ch-tree-section-action[data-create-action][aria-expanded="true"],
.ch-tree-item-create:hover,
.ch-tree-item-create[aria-expanded="true"] {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ch-tree-section-action[data-create-action]:focus-visible,
.ch-tree-item-create:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.ch-tree-children > .lp-sidebar-inline-create {
    padding-left: 28px;
}

/* Shared compact Space → Project → content presentation. */
.lp-scope-tree {
    display: grid;
    min-width: 0;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 12.5px;
}

.lp-scope-tree .ch-tree-section {
    min-width: 0;
    margin: 0;
}

.lp-scope-tree .ch-tree-section-header {
    display: flex;
    min-width: 0;
    min-height: 28px;
    align-items: center;
    gap: 6px;
    padding: 6px 7px 5px;
    border-radius: var(--radius-md, 8px);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lp-scope-tree .ch-tree-section-header:hover {
    color: var(--text-secondary);
}

.lp-scope-tree .ch-tree-section-label {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lp-scope-tree .ch-tree-chevron,
.lp-scope-tree .ch-tree-item-chevron {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    overflow: hidden;
    color: transparent;
    font-size: 0;
}

.lp-scope-tree .ch-tree-chevron::before,
.lp-scope-tree .ch-tree-item-chevron::before {
    content: "";
    display: block;
    width: 5px;
    height: 5px;
    margin: 1px;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 150ms ease;
}

.lp-scope-tree .ch-tree-chevron.open::before,
.lp-scope-tree .ch-tree-item-chevron.open::before {
    transform: rotate(45deg);
}

.lp-scope-tree .ch-tree-section-badge,
.lp-scope-tree .ch-tree-item-badge {
    flex: 0 0 auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.lp-scope-tree .ch-tree-items {
    min-width: 0;
    margin-left: 5px;
    padding-left: 9px;
    border-left: 1px solid var(--border);
}

.lp-scope-tree .ch-tree-item {
    display: flex;
    min-width: 0;
    min-height: 28px;
    align-items: center;
    gap: 7px;
    margin: 1px 0;
    padding: 5px 7px;
    overflow: hidden;
    border-radius: var(--radius-md, 8px);
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: none;
}

.lp-scope-tree .ch-tree-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.lp-scope-tree .ch-tree-item--active {
    background: var(--bg-surface);
    color: var(--accent);
}

.lp-scope-tree .ch-tree-item-label {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lp-scope-tree .ch-tree-children {
    min-width: 0;
    margin-left: 13px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

.lp-scope-tree .ch-tree-item--chat {
    min-height: 30px;
    padding-left: 12px;
    font-size: 12.5px;
}

.lp-scope-tree .ch-tree-item--caption {
    min-height: 25px;
    margin-top: 5px;
    padding: 6px 7px 4px;
    border-top: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-muted);
    font-family: var(--font-mono, monospace);
    font-size: 9.5px;
    font-style: normal;
    cursor: default;
}

.lp-scope-tree .ch-tree-item--caption:hover {
    background: transparent;
    color: var(--text-muted);
}

.lp-scope-tree .ch-tree-item-action {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    margin-left: 0;
    padding: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
}

.lp-scope-tree .ch-tree-item:hover .ch-tree-item-action {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .lp-scope-tree .ch-tree-chevron::before,
    .lp-scope-tree .ch-tree-item-chevron::before {
        transition: none;
    }
}

/* Shared Space / Project identity avatar and editor. */
.lp-scope-avatar {
    --lp-scope-avatar-color: var(--accent);
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--lp-scope-avatar-color) 42%, var(--border));
    border-radius: 7px;
    background: color-mix(in srgb, var(--lp-scope-avatar-color) 14%, var(--bg-surface));
    color: var(--lp-scope-avatar-color);
    font-family: var(--font-mono, monospace);
    font-size: 9px;
    font-weight: 650;
    line-height: 1;
    letter-spacing: -0.02em;
}

button.lp-scope-avatar {
    cursor: pointer;
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

button.lp-scope-avatar:hover {
    border-color: var(--lp-scope-avatar-color);
    background: color-mix(in srgb, var(--lp-scope-avatar-color) 20%, var(--bg-surface));
}

button.lp-scope-avatar:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.lp-scope-avatar--dialog {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 11px;
}

.lp-scope-identity-overlay .kanban-dialog {
    width: min(360px, calc(100vw - 24px));
}

.lp-scope-identity-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lp-scope-identity-form {
    display: grid;
    gap: 14px;
}

.lp-scope-identity-field {
    display: grid;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 11px;
}

.lp-scope-identity-field small {
    color: var(--text-muted);
    font: inherit;
}

.lp-scope-identity-field input {
    width: 100%;
    min-width: 0;
    height: 35px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    outline: 0;
    background: var(--bg-surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
}

.lp-scope-identity-letters input {
    width: 70px;
    font-family: var(--font-mono, monospace);
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lp-scope-identity-field input:focus-visible {
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.lp-scope-identity-colors {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.lp-scope-identity-colors legend {
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 11px;
}

.lp-scope-color-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lp-scope-color-swatch,
.lp-scope-color-custom {
    --lp-scope-swatch-color: var(--accent);
    position: relative;
    display: inline-grid;
    width: 29px;
    height: 29px;
    padding: 0;
    place-items: center;
    border: 2px solid transparent;
    border-radius: 50%;
    outline: 0;
    background: var(--lp-scope-swatch-color);
    cursor: pointer;
}

.lp-scope-color-swatch.selected,
.lp-scope-color-custom.selected {
    border-color: var(--bg-panel);
    box-shadow: 0 0 0 2px var(--accent);
}

.lp-scope-color-swatch:focus-visible,
.lp-scope-color-custom:focus-within {
    box-shadow: 0 0 0 2px var(--accent);
}

.lp-scope-color-custom {
    overflow: hidden;
    border-color: var(--border);
    background: conic-gradient(
        var(--accent),
        var(--accent-magenta),
        var(--status-warning),
        var(--status-ok),
        var(--accent)
    );
}

.lp-scope-color-custom::after {
    content: "+";
    display: grid;
    width: 15px;
    height: 15px;
    place-items: center;
    border-radius: 50%;
    background: var(--bg-panel);
    color: var(--text-primary);
    font-size: 11px;
    line-height: 1;
    pointer-events: none;
}

.lp-scope-color-custom input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.lp-scope-identity-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    button.lp-scope-avatar { transition: none; }
}
