/*
 * content-page.css — Generic CRUD list page for Chat content types.
 *
 * Styles the content-page (header / search / grid / empty state) and the
 * right-side content-drawer (form fields / counters / validation / footer).
 * Pairs with content-page.js + content-drawer.js.
 *
 * Uses the project's theme tokens defined in shell.css (--bg-panel,
 * --bg-surface, --border, --accent, --text-*, --radius). Light/dark themes
 * swap via the html[data-theme="light"] selector at the top of shell.css —
 * everything in this file is theme-agnostic.
 */

/* ── Page shell ─────────────────────────────────────────────── */

.lp-content-page {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--bg-primary);
}

/*
 * The inner is a non-scrolling flex column: the header (title/search/toolbar)
 * stays pinned and only .lp-content-page-list scrolls — mirroring the chat
 * search page (fixed controls, scrollable .chat-search-results). Bottom padding
 * moves onto the list so the scroll area, not a dead gap, owns it.
 */
.lp-content-page-inner {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px 32px 0;
    box-sizing: border-box;
}

/*
 * Centered, max-width content column (opt-in via descriptor.centered) so the
 * grid/list isn't edge-to-edge on wide viewports. Non-centered pages keep
 * filling the full width.
 */
.lp-content-page-centered .lp-content-page-inner {
    /* width:100% makes the column a definite size so it fills up to max-width.
     * Without it, the auto inline margins below disable the flex `align-items:
     * stretch`, leaving the inner shrink-to-fit (sized to its content) — which
     * makes content-light pages render far narrower than max-width. */
    width: 100%;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Header ─────────────────────────────────────────────────── */

.lp-content-page-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.lp-content-page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lp-content-page-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.lp-content-page-title-actions {
    display: flex;
    gap: 8px;
}

.lp-content-page-new {
    padding: 8px 16px;
    border-radius: var(--radius, 8px);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    font-family: inherit;
    transition: background 120ms ease, border-color 120ms ease;
}

.lp-content-page-new:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.lp-content-page-new:active { filter: brightness(0.95); }

/*
 * High-contrast solid "New" button (opt-in via descriptor.primaryNew). Inverts
 * with the theme — near-black on light, near-white on dark — matching the
 * prompts mock's prominent action button.
 */
.lp-content-page-new-primary {
    background: var(--text-primary);
    color: var(--bg-panel);
    border-color: var(--text-primary);
    font-weight: 600;
}

.lp-content-page-new-primary:hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
    filter: brightness(1.12);
}

/* ── Toolbar (filter pills · view toggle · sort) ─────────────── */

.lp-content-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lp-content-filter-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.lp-content-filter-pill {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-panel);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.lp-content-filter-pill:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.lp-content-filter-pill-active,
.lp-content-filter-pill-active:hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-panel);
}

.lp-content-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* View toggle — two icon buttons in a bordered shell */
.lp-content-view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-panel);
}

.lp-content-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.lp-content-view-btn + .lp-content-view-btn { border-left: 1px solid var(--border); }

.lp-content-view-btn:hover { color: var(--text-primary); }

.lp-content-view-btn-active,
.lp-content-view-btn-active:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Sort dropdown */
.lp-content-sort { position: relative; }

.lp-content-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-panel);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 120ms ease, background 120ms ease;
}

.lp-content-sort-btn:hover,
.lp-content-sort-btn-open { border-color: var(--text-muted); }

.lp-content-sort-lead { display: inline-flex; color: var(--text-muted); }
.lp-content-sort-caret { display: inline-flex; color: var(--text-muted); }

.lp-content-sort-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    min-width: 180px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-panel);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.lp-content-sort-menu[hidden] { display: none; }

.lp-content-sort-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.lp-content-sort-item:hover { background: var(--bg-hover); }

.lp-content-sort-check {
    display: inline-flex;
    color: var(--accent);
    width: 16px;
}

/* ── Search ─────────────────────────────────────────────────── */

.lp-content-page-search {
    position: relative;
    display: flex;
    align-items: center;
}

.lp-content-page-search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.lp-content-page-search-input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-panel);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

/* Clear (×) button — right-aligned inside the search pill, shown only when the
 * box has text (toggled via the [hidden] attribute from content-page.js). */
.lp-content-page-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.lp-content-page-search-clear[hidden] { display: none; }

.lp-content-page-search-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.lp-content-page-search-input::placeholder { color: var(--text-muted); }

.lp-content-page-search-input:hover { border-color: var(--text-muted); }

.lp-content-page-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ── List + grid ────────────────────────────────────────────── */

/* The sole scroll region — fills the height left under the pinned header.
 * Bottom padding gives the last row breathing room above the panel edge. */
.lp-content-page-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 24px;
    /* Thin, light scrollbar matching the left sidebar (.sidebar-list) instead
     * of the heavy default. Firefox uses these two; WebKit uses the rules below. */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.lp-content-page-list::-webkit-scrollbar { width: 6px; }
.lp-content-page-list::-webkit-scrollbar-track { background: transparent; }
.lp-content-page-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.lp-content-page-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Top scroll-fade — list content dissolves into the pinned filter/sort row as
 * it scrolls up (mirrors the chat search page). Applied only while scrolled
 * (is-scrolled, toggled in content-page.js) so the first row stays crisp at
 * rest. Mask fades to transparent, so it's theme-agnostic. */
.lp-content-page-list.is-scrolled {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 32px);
    mask-image: linear-gradient(to bottom, transparent 0, #000 32px);
}

/*
 * Three columns at desktop, two at tablet, one on mobile. The breakpoints
 * align with the points where each column would otherwise drop below ~280px
 * of width and start truncating prompt names mid-word.
 */
.lp-content-page-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 720px)  { .lp-content-page-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .lp-content-page-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── Card ───────────────────────────────────────────────────── */

.lp-content-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-panel);
    box-sizing: border-box;
    min-height: 124px;
    transition:
        background 140ms ease,
        border-color 140ms ease,
        box-shadow 140ms ease,
        transform 140ms ease;
}

.lp-content-card-clickable { cursor: pointer; }

.lp-content-card-clickable:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.lp-content-card-clickable:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.lp-content-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    letter-spacing: -0.005em;
}

.lp-content-card-sub {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    flex: 1;
}

.lp-content-card-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

/* ── Category identity colors ───────────────────────────────────
 * One base hue per built-in prompt category, exposed as --lp-cat so banners,
 * icons, and badges all derive from a single value. New tokens (not skin
 * tokens) live here by design — they're category-identity colors, not theme
 * surfaces. A card/badge with no category class falls back to --text-muted.
 */
.lp-cat-banner, .lp-cat-badge { --lp-cat: var(--text-muted); }
.lp-cat--writing  { --lp-cat: #3b82f6; }
.lp-cat--code     { --lp-cat: #16a34a; }
.lp-cat--analysis { --lp-cat: #9333ea; }
.lp-cat--research { --lp-cat: #d97706; }
.lp-cat--workflow { --lp-cat: #0d9488; }
.lp-cat--other    { --lp-cat: #64748b; }

/* ── Banner card variant (descriptor.cardVariant = 'banner') ───── */

/* Slightly taller min so the banner + body breathe; banner bleeds to edges. */
.lp-content-card-banner {
    padding: 0;
    overflow: hidden;
    gap: 0;
    min-height: 0;
}

.lp-cat-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    color: var(--lp-cat);
    background: color-mix(in srgb, var(--lp-cat) 13%, var(--bg-panel));
}

.lp-cat-banner svg { width: 22px; height: 22px; }

.lp-content-card-banner .lp-content-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 0;
}

/* Content preview — always exactly two lines, ellipsis on overflow. (flex:none
 * overrides the base .lp-content-card-sub flex:1 so the clamp height is fixed
 * and cards stay uniform.) */
.lp-content-card-banner .lp-content-card-sub {
    flex: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    min-height: calc(1.5em * 2);
}

.lp-content-card-banner .lp-content-card-footer {
    margin-top: auto;
    padding: 12px 16px 14px;
    border-top: none;
    justify-content: flex-start;
}

/* Keep the panel background on hover — only the accent border + shadow lift
 * (inherited from .lp-content-card-clickable:hover) change. The base hover
 * fills with --bg-hover, which greys the card body under the colored banner. */
.lp-content-card-banner.lp-content-card-clickable:hover {
    background: var(--bg-panel);
}

/* Usage count in the card footer — pushed to the trailing edge, muted, with a
 * small icon. Sits opposite the category badge (footer is justify-start). */
.lp-content-card-uses {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.lp-content-card-uses svg { width: 13px; height: 13px; opacity: 0.8; }

/* Category badge — tinted pill used in card footer + list view */
.lp-cat-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--lp-cat);
    background: color-mix(in srgb, var(--lp-cat) 14%, transparent);
}

/* ── List / table view (descriptor.listColumns + view='list') ──── */

.lp-content-table {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Column track widths track the Prompts descriptor's listColumns
 * (Name · Preview · Category · Uses · Created) — the only listColumns
 * consumer today. */
.lp-content-table-head,
.lp-content-table-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.4fr) minmax(0, 2.4fr) 120px 80px 120px;
    align-items: center;
    gap: 16px;
    padding: 12px 12px;
}

.lp-content-table-head {
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.lp-content-table-row {
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    transition: background 120ms ease;
}

.lp-content-table-row-clickable { cursor: pointer; }
.lp-content-table-row-clickable:hover { background: var(--bg-hover); }
.lp-content-table-row-clickable:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.lp-content-table-cell {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Name cell — icon + bold name */
.lp-content-table-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
}

.lp-content-table-name-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--lp-cat, var(--text-muted));
}

.lp-content-table-name-icon svg { width: 18px; height: 18px; }

.lp-content-table-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lp-content-table-created { color: var(--text-muted); }

/* Uses column — muted, tabular count. */
.lp-content-table-uses {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* On narrow widths drop the preview column so name/category/uses/created survive. */
@media (max-width: 860px) {
    .lp-content-table-head,
    .lp-content-table-row { grid-template-columns: minmax(140px, 1.6fr) 110px 80px 110px; }
    .lp-content-table-cell-preview { display: none; }
}

/* ── Empty state ────────────────────────────────────────────── */

.lp-content-page-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 56px 16px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    background: var(--bg-panel);
}

.lp-content-page-empty-icon {
    display: inline-flex;
    color: var(--text-muted);
    opacity: 0.7;
}

.lp-content-page-empty-text {
    margin: 0;
    font-size: 13px;
    text-align: center;
}

/*
 * Card actions row — only used by read-only descriptors that haven't migrated
 * to the edit drawer yet. Drawer-backed cards put delete inside the drawer.
 */
.lp-content-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

.lp-content-card-action {
    padding: 4px 10px;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-family: inherit;
}

.lp-content-card-action:hover { background: var(--bg-hover); }

.lp-content-card-action-danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
}

.lp-content-card-action-danger:hover { background: rgba(239, 68, 68, 0.12); }

/* ── Drawer overlay ─────────────────────────────────────────── */

.lp-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    pointer-events: auto;
    z-index: 1100;
    display: flex;
    justify-content: flex-end;
    transition: background 200ms ease;
}

.lp-drawer-overlay.lp-drawer-open {
    background: rgba(0, 0, 0, 0.45);
}

.lp-drawer-panel {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.32);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 220ms ease;
}

.lp-drawer-overlay.lp-drawer-open .lp-drawer-panel {
    transform: translateX(0);
}

.lp-drawer-header {
    padding: 22px 24px 14px;
    border-bottom: 1px solid var(--border);
}

.lp-drawer-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.lp-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 24px;
}

.lp-drawer-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Drawer field ───────────────────────────────────────────── */

.lp-drawer-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lp-drawer-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.lp-drawer-label-invalid { color: #ef4444; }

.lp-drawer-input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-surface);
    outline: none;
    box-sizing: border-box;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.lp-drawer-input::placeholder { color: var(--text-muted); }

.lp-drawer-input:hover:not(:focus) { border-color: var(--text-muted); }

.lp-drawer-input:focus {
    border-color: var(--accent);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

textarea.lp-drawer-input {
    resize: vertical;
    min-height: 110px;
    line-height: 1.5;
    font-family: inherit;
}

/* ── Image field (content-drawer type: 'image') — compact native picker ── */
.lp-drawer-image {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lp-drawer-image-file {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 100%;
}
/* Shown only once an image is picked or an existing one loads. */
.lp-drawer-image-current {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lp-drawer-image-current[hidden] { display: none; }
.lp-drawer-image-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
}
.lp-drawer-image-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    text-decoration: underline;
}
.lp-drawer-image-remove:hover { color: #e55; }

/* ── Single-select dropdown (content-drawer type: 'select') ──────────── */
select.lp-drawer-select {
    cursor: pointer;
    appearance: auto;   /* native dropdown affordance */
}

/* ── Chips field (content-drawer type: 'chips') — single-select pills ── */
.lp-drawer-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lp-drawer-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.lp-drawer-chip:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.lp-drawer-chip-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    transition: color 120ms ease;
}

.lp-drawer-chip:hover .lp-drawer-chip-icon { color: var(--text-secondary); }

.lp-drawer-chip-selected,
.lp-drawer-chip-selected:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
}

.lp-drawer-chip-selected .lp-drawer-chip-icon { color: var(--accent); }

.lp-drawer-chip:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ── Multi-select field (content-drawer type: 'multiselect') ─────────── */
.lp-drawer-multiselect { position: relative; }
.lp-drawer-ms-control {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    background: var(--bg-surface);
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.lp-drawer-ms-control:hover { border-color: var(--text-muted); }
.lp-drawer-ms-control:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.lp-drawer-ms-chips {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.lp-drawer-ms-placeholder { color: var(--text-muted); font-size: 14px; }
.lp-drawer-ms-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px 2px 8px;
    border-radius: 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-primary);
    max-width: 100%;
}
.lp-drawer-ms-chip > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.lp-drawer-ms-chip-x {
    flex-shrink: 0;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}
.lp-drawer-ms-chip-x:hover { color: #e55; }
.lp-drawer-ms-caret { flex-shrink: 0; color: var(--text-muted); font-size: 12px; }
.lp-drawer-ms-menu {
    position: absolute;
    z-index: 10;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 220px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    background: var(--bg-surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.lp-drawer-ms-menu[hidden] { display: none; }
.lp-drawer-ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
}
.lp-drawer-ms-option:hover { background: var(--bg-hover); }
.lp-drawer-ms-empty {
    padding: 10px 8px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.lp-drawer-field-invalid .lp-drawer-input {
    border-color: #ef4444;
}

.lp-drawer-field-invalid .lp-drawer-input:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.lp-drawer-error {
    min-height: 16px;
    font-size: 12px;
    color: #ef4444;
    line-height: 1.3;
}
/* Collapse the reserved error line when there's no message, so fields with a
   validator don't sit taller than image/select/multiselect fields (which have
   no error row). The 16px reservation only applies once an error is shown. */
.lp-drawer-error:empty { min-height: 0; }

.lp-drawer-counter {
    align-self: flex-end;
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Drawer footer ──────────────────────────────────────────── */

.lp-drawer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 14px 24px 18px;
    border-top: 1px solid var(--border);
}

.lp-drawer-footer-left,
.lp-drawer-footer-right {
    display: flex;
    gap: 8px;
}

.lp-drawer-btn {
    padding: 8px 18px;
    border-radius: var(--radius, 8px);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: inherit;
    transition: filter 120ms ease, background 120ms ease, border-color 120ms ease;
}

.lp-drawer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lp-drawer-btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.lp-drawer-btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.lp-drawer-btn-primary:hover:not(:disabled) {
    background: var(--accent-hover, var(--accent));
    filter: brightness(1.05);
}

.lp-drawer-btn-delete {
    color: #ef4444;
    border-color: transparent;
    background: transparent;
}

.lp-drawer-btn-delete:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.12);
}

/* ── Confirm dialog (delete) ────────────────────────────────── */
/*
 * Base overlay/card chrome lives in controls/dialog.css. Only the
 * descriptive body paragraph needs custom styling here.
 */

.lp-confirm-overlay .kanban-dialog { max-width: 420px; }

.lp-confirm-overlay .lp-confirm-body {
    margin: 0 0 6px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}
