@import url('ghost-design-system.css');

/* ==========================================================================
   STYLE.CSS — GHOST CACHE Main UI Styles (Redesigned v2.0)
   ========================================================================== */

:root {
    --bg: #000000;
    --panel: #161618;
    --panel-2: #242427;
    --panel-3: #2C2C30;
    --border: rgba(255, 255, 255, 0.05);
    --border-soft: rgba(255, 255, 255, 0.03);
    --text: #E3E3E6;
    --text-muted: #8F8F94;
    --text-faint: #5A5A5F;
    --accent: #0071E3;
    --accent-hover: #0077ED;
    --accent-2: #0071E3;
    --accent-grad: #0071E3;
    --danger: #EF4444;
    --danger-soft: rgba(239, 68, 68, 0.10);
    --success: #22C55E;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    --glow: none;
    --sidebar-width: 220px;
    --radius: 8px;
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Base (supplemental to design-system reset) ──────────────────────────── */
button,
input,
textarea { font: inherit; }
button { color: inherit; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.asset-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* ==========================================================================
   APP SHELL — 2-Column Grid
   ========================================================================== */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    width: 100%;
    height: 100%;
    background: var(--bg);
    transition: grid-template-columns 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

body.scroll-expanded .app-shell {
    grid-template-columns: 46px minmax(0, 1fr);
}

/* ==========================================================================
   SIDEBAR — Modern Navigation Panel
   ========================================================================== */
.sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 12px 8px 8px;
    background: var(--panel);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
    z-index: 20;
    transition: width 400ms cubic-bezier(0.25, 0.1, 0.25, 1),
                padding 400ms cubic-bezier(0.25, 0.1, 0.25, 1),
                box-shadow 350ms ease,
                border-color 350ms ease;
}

/* Smooth Icon Rail Mode on Scroll */
body.scroll-expanded .sidebar {
    width: 46px;
    padding: 10px 4px !important;
}

body.scroll-expanded .sidebar:not(:hover) .brand-copy,
body.scroll-expanded .sidebar:not(:hover) .header-control-capsule,
body.scroll-expanded .sidebar:not(:hover) .history-name,
body.scroll-expanded .sidebar:not(:hover) .folder-action,
body.scroll-expanded .sidebar:not(:hover) .cloud-source-name,
body.scroll-expanded .sidebar:not(:hover) .cloud-tier-tag,
body.scroll-expanded .sidebar:not(:hover) .cloud-packages-button,
body.scroll-expanded .sidebar:not(:hover) .sidebar-footer,
body.scroll-expanded .sidebar:not(:hover) .cloud-primary-head span,
body.scroll-expanded .sidebar:not(:hover) .cloud-primary-head .cloud-caret,
body.scroll-expanded .sidebar:not(:hover) .cloud-primary-head .cloud-source-badge {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 200ms ease, visibility 200ms ease;
}

body.scroll-expanded .sidebar:not(:hover) .sidebar-topbar {
    justify-content: center !important;
    padding: 0 !important;
}

body.scroll-expanded .sidebar:not(:hover) .brand-row {
    justify-content: center !important;
    width: 100% !important;
}

body.scroll-expanded .sidebar:not(:hover) .cloud-primary-head {
    justify-content: center !important;
    padding: 0 !important;
}

body.scroll-expanded .sidebar:not(:hover) .cloud-primary-head img {
    margin-right: 0 !important;
}

/* Mouse Hover over Collapsed Rail -> Smooth Floating Drawer Reveal */
body.scroll-expanded .sidebar:hover {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width) !important;
    z-index: 500;
    padding: 12px 8px 8px !important;
    background: var(--panel) !important;
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.85) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.scroll-expanded .sidebar:hover .brand-copy,
body.scroll-expanded .sidebar:hover .header-control-capsule,
body.scroll-expanded .sidebar:hover .folder-history,
body.scroll-expanded .sidebar:hover .cloud-primary-body,
body.scroll-expanded .sidebar:hover .sidebar-footer,
body.scroll-expanded .sidebar:hover .cloud-primary-head span,
body.scroll-expanded .sidebar:hover .cloud-primary-head .cloud-caret,
body.scroll-expanded .sidebar:hover .cloud-source-badge {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: opacity 250ms ease 80ms;
}

body.scroll-expanded .sidebar:hover .sidebar-topbar {
    justify-content: space-between !important;
}

body.scroll-expanded .sidebar:hover .brand-row {
    justify-content: flex-start !important;
    width: auto !important;
}

body.scroll-expanded .sidebar:hover .cloud-primary-head {
    justify-content: flex-start !important;
    padding: 0 10px !important;
}

body.scroll-expanded .sidebar:hover .cloud-primary-head img {
    margin-right: 6px !important;
}

/* Subtle top-edge highlight for depth */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    pointer-events: none;
}

/* ── Sidebar Topbar (Brand + Menu) ───────────────────────────────────────── */
.sidebar-topbar {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    margin-bottom: 12px;
    padding: 0 4px;
}

.brand-row {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
}

.brand-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 6px;
}

.brand-copy { min-width: 0; }

.brand-title {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.brand-subtitle {
    margin-top: 1px;
    color: var(--ghost-text-muted, var(--text-faint));
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.2;
}

/* ── Icon Buttons ────────────────────────────────────────────────────────── */
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ghost-text-secondary, #9D9DA5);
    cursor: pointer;
    transition: all 100ms var(--ghost-ease, ease);
}

.header-control-capsule {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    padding: 0;
    gap: 0;
    flex-shrink: 0;
}

.icon-button:hover,
.icon-button.active {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.icon-button:active {
    transform: scale(0.92);
    transition-duration: 50ms;
}

.more-button {
    width: 28px;
    height: 28px;
    font-size: 15px;
    letter-spacing: 1px;
    line-height: 1;
}

/* ── Popover Menu (Glassmorphism) ────────────────────────────────────────── */
.popover-menu {
    position: absolute;
    top: 40px;
    left: 0;
    right: auto;
    display: none;
    width: 240px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(30, 30, 34, 0.94);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 16px 48px -12px rgba(0, 0, 0, 0.55),
                0 0 0 1px rgba(0, 0, 0, 0.15);
    z-index: 100;
    animation: ghost-scale-in 120ms var(--ghost-ease, ease);
    transform-origin: top left;
}

.popover-menu.open { display: block; }

.popover-menu button[role="menuitem"],
.context-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ghost-text-secondary, #9D9DA5);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 80ms ease;
}

.popover-menu button[role="menuitem"]:hover,
.context-menu button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.popover-menu button[role="menuitem"]:active,
.context-menu button:active {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.98);
}

.popover-menu button:disabled {
    opacity: 0.32;
    cursor: not-allowed;
}
.popover-menu button:disabled:hover {
    background: transparent;
    transform: none;
}

.popover-menu button span[aria-hidden] {
    width: 16px;
    text-align: center;
    font-size: 14px;
    opacity: 0.65;
    flex-shrink: 0;
}

.menu-separator {
    height: 1px;
    margin: 4px 8px;
    background: rgba(255, 255, 255, 0.06);
}

/* ── Folder Section ──────────────────────────────────────────────────────── */
.folder-section {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}
.folder-section.collapsed .folder-history {
    display: none;
}
.folder-section.collapsed .cloud-caret {
    transform: rotate(-90deg);
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    padding: 0 6px;
    height: 24px;
}

.sources-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--ghost-text-muted, var(--text-faint));
    font-size: 12px;
    cursor: pointer;
    transition: transform 150ms var(--ghost-ease, ease),
                color 100ms ease;
    flex-shrink: 0;
}

.sources-toggle:hover { color: var(--ghost-text-primary, #fff); }

.section-label {
    color: var(--ghost-text-muted, var(--text-faint));
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex: 1;
    margin-left: 4px;
}

.folder-count {
    min-width: 18px;
    padding: 1px 5px;
    background: transparent;
    color: var(--ghost-text-muted, #64646C);
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.02em;
}

/* ── Folder History / Source List ─────────────────────────────────────────── */
.folder-history {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 2px;
}

.history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px 24px;
    align-items: center;
    width: 100%;
    height: 34px;
    margin: 1px 0;
    padding: 0 4px 0 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--ghost-text-secondary, #9D9DA5);
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    transition: all 100ms var(--ghost-ease, ease);
}
.all-sources {
    margin-bottom: 8px !important;
    position: relative;
}
.all-sources::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 8px;
    right: 8px;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ghost-text-primary, #fff);
}

.history-item.active {
    background: transparent !important;
    border-color: transparent !important;
    color: var(--ghost-accent, var(--accent)) !important;
}

.history-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
    text-align: left;
    line-height: 1.3;
}

.history-item.active .history-name {
    font-weight: 400 !important;
    color: var(--ghost-accent, var(--accent)) !important;
}

.folder-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ghost-text-muted, #64646C);
    cursor: pointer;
    opacity: 0;
    transition: opacity 120ms ease, background 80ms ease, color 80ms ease;
}

.history-item:hover .folder-action,
.history-item.active .folder-action {
    opacity: 1;
}

.folder-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.folder-action.delete:hover {
    background: var(--danger-soft);
    color: #ff7070;
}

.history-empty {
    padding: 24px 12px;
    color: var(--ghost-text-muted, var(--text-faint));
    font-size: 11px;
    line-height: 1.6;
    text-align: center;
}

/* ── Cloud Section ───────────────────────────────────────────────────────── */
.cloud-primary {
    flex: 0 0 auto;
    margin: 8px 0 0;
    padding: 0;
    overflow: hidden;
    border: none !important;
    background: transparent !important;
}

.cloud-primary:hover {
    border-color: rgba(255, 255, 255, 0.06);
}

.cloud-primary-head {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 0;
    background: transparent !important;
    color: var(--ghost-text-primary, var(--text));
    font-size: 11px;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    transition: background 80ms ease;
}

.cloud-primary-head:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

.cloud-primary-head .cloud-source-badge {
    margin-left: auto;
}

.cloud-caret {
    color: var(--ghost-text-muted, var(--text-muted));
    font-size: 11px;
    transition: transform 150ms var(--ghost-ease, ease);
}

.cloud-primary.collapsed .cloud-caret {
    transform: rotate(-90deg);
}

.cloud-primary-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 4px 6px;
}

.cloud-primary.collapsed .cloud-primary-body {
    display: none;
}

.cloud-packages-button {
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    transition: all 120ms ease;
}

.cloud-packages-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.cloud-packages-button:active {
    transform: scale(0.97);
}

.cloud-source-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ghost-text-secondary, #9D9DA5);
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    transition: all 80ms ease;
}

.cloud-source-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ghost-text-primary, #fff);
}

.cloud-source-icon {
    width: 16px;
    text-align: center;
    font-size: 13px;
    opacity: 0.6;
    flex-shrink: 0;
}

.cloud-source-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cloud-tier-tag {
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cloud-tier-tag.unset {
    color: var(--ghost-text-muted, #64646C);
}

.cloud-new-button {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: none;
    border-radius: 6px;
    background: var(--ghost-accent-subtle, rgba(59, 130, 246, 0.10));
    color: var(--ghost-accent, var(--accent));
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 80ms ease;
}

.cloud-new-button:hover {
    background: rgba(59, 130, 246, 0.18);
}

/* ── Sidebar Footer ──────────────────────────────────────────────────────── */
.sidebar-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 8px 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.scan-status,
.library-summary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-status {
    color: var(--ghost-text-secondary, var(--text-muted));
    font-size: 11px;
    font-weight: 500;
}

.library-summary {
    margin-top: 2px;
    color: var(--ghost-text-muted, var(--text-faint));
    font-size: 10px;
}

/* ── Sidebar Resizer ─────────────────────────────────────────────────────── */
.sidebar-resizer {
    position: absolute;
    top: 0;
    right: -2px;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    z-index: 30;
    transition: background 120ms ease;
}

.sidebar-resizer:hover,
.is-resizing-sidebar .sidebar-resizer {
    background: var(--ghost-accent, var(--accent));
    opacity: 0.5;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-area {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    background: var(--bg);
}

/* ==========================================================================
   TOOLBAR — Compact 40px Header
   ========================================================================== */
.toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    height: 40px;
    min-height: 40px;
    padding: 0 12px;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: var(--ghost-bg, var(--bg));
    overflow: hidden;
    flex-shrink: 0;
}

.toolbar-spacer {
    flex: 1 1 auto;
    min-width: 0;
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-toggle {
    font-size: 18px;
    color: var(--ghost-text-secondary, #9D9DA5);
}

.search-wrap {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    flex: 0 1 240px;
    width: 240px;
    max-width: 35vw;
    opacity: 1;
    transform-origin: left center;
    transition: width 180ms var(--ghost-ease, ease),
                flex-basis 180ms var(--ghost-ease, ease),
                opacity 120ms ease;
}

.search-wrap.collapsed {
    flex-basis: 0;
    width: 0;
    opacity: 0;
    pointer-events: none;
}

.search-wrap input {
    width: 100%;
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ghost-text-primary, #eee);
    font-size: 12px;
    transition: border-color 120ms ease,
                background 120ms ease,
                box-shadow 120ms ease;
}

.search-wrap input::placeholder {
    color: var(--ghost-text-muted, #64646C);
}

.search-wrap input:focus {
    border-color: var(--ghost-accent, var(--accent));
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px var(--ghost-accent-subtle, rgba(59, 130, 246, 0.10));
}

.clear-search {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--ghost-text-muted, #888);
    cursor: pointer;
    font-size: 14px;
    transition: color 80ms ease, background 80ms ease;
}

.search-wrap.has-value .clear-search { display: flex; align-items: center; justify-content: center; }
.clear-search:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

/* ── Filter Bar (Pill Chips) ─────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-button {
    flex: 0 0 auto;
    height: 28px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--ghost-text-secondary, #9D9DA5);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 100ms var(--ghost-ease, ease);
}

.filter-button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--ghost-text-primary, #fff);
}

.filter-button.active {
    background: transparent !important;
    color: var(--ghost-accent, var(--accent)) !important;
    font-weight: 600;
    border-color: transparent !important;
    box-shadow: none !important;
}

.favorite-filter {
    min-width: 28px;
    padding-inline: 6px;
    color: var(--ghost-warning, #F59E0B);
}

.favorite-filter.active {
    background: transparent !important;
    color: var(--ghost-warning, #F59E0B) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.content-area {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding-top: 52px;
}

.asset-viewport {
    position: absolute;
    inset: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--ghost-bg, #1B1B1D);
}
.asset-viewport.hidden { display: none; }
.asset-canvas { position: relative; width: 100%; min-height: 100%; }

.asset-card {
    position: absolute;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: var(--ghost-radius-md, 8px);
    background: transparent;
    cursor: default;
    box-shadow: none;
    transition: border-color 150ms var(--ghost-ease, ease),
                background-color 150ms var(--ghost-ease, ease),
                box-shadow 150ms var(--ghost-ease, ease),
                transform 150ms var(--ghost-ease, ease),
                opacity 100ms ease;
}
.asset-card:hover {
    border-color: var(--border-soft);
    background-color: var(--panel-2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}
.asset-card.selected {
    border-color: var(--ghost-accent, var(--accent));
    background-color: var(--panel-2);
    box-shadow: 0 0 0 1px var(--ghost-accent, var(--accent)),
                0 4px 16px rgba(0, 113, 227, 0.15);
}
.asset-card.importing { opacity: .55; }
.asset-card.dragging { opacity: .35; }

.asset-preview {
    position: relative;
    flex: 0 0 auto;
    overflow: hidden;
    background: transparent;
    opacity: 1;
    visibility: visible;
    border-radius: var(--ghost-radius-md, 8px);
}
.asset-thumbnail,
.asset-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    transform: scale(var(--asset-source-scale, 1));
    transition: transform 200ms var(--ghost-ease, ease), opacity 180ms ease;
    border-radius: var(--ghost-radius-md, 8px);
}
.asset-card:hover .asset-thumbnail,
.asset-card:hover .asset-video {
    transform: scale(calc(var(--asset-source-scale, 1) * 1.04));
}
.asset-thumbnail { opacity: 0; transition: opacity 180ms ease, transform 250ms var(--ghost-ease, ease); border-radius: var(--ghost-radius-md, 8px); }
.asset-thumbnail.loaded { opacity: 1; }
.asset-video { z-index: 2; background: #000; border-radius: var(--ghost-radius-md, 8px); }

.thumbnail-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, #1A1A1D 25%, #232326 42%, #1A1A1D 60%);
    background-size: 400% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: var(--ghost-radius-md, 8px);
}

.type-pill,
.type-badge,
.ghost-badge,
.folder-count {
    display: none !important;
}

.duration-pill {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 5;
    min-height: 20px;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(0,0,0,.72);
    color: #eee;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

.favorite-button,
.sound-button,
.zoom-button {
    position: absolute;
    z-index: 7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 120ms ease, background 100ms ease, transform 80ms ease;
}
.asset-card:hover .favorite-button,
.asset-card:hover .sound-button,
.asset-card:hover .zoom-button,
.favorite-button.active { opacity: 1; }
.favorite-button { top: 6px; right: 6px; font-size: 15px; color: var(--ghost-warning, #F59E0B); }
.sound-button { bottom: 32px; right: 6px; font-size: 12px; }
.zoom-button { top: 6px; left: 6px; font-size: 14px; }
.favorite-button:hover,
.sound-button:hover,
.zoom-button:hover {
    background: var(--ghost-accent, var(--accent));
    transform: scale(1.08);
}

.asset-meta {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    padding: 4px 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 120ms ease, visibility 120ms ease;
}
.asset-card:hover .asset-meta,
.asset-card.selected .asset-meta {
    opacity: 1;
    visibility: visible;
}
.asset-name {
    overflow: hidden;
    color: var(--ghost-text-primary, #ededef);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.asset-details {
    display: none !important;
}
.asset-size { text-transform: none; }

.audio-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    padding: 24px 20px;
    background: transparent;
    transition: background 150ms var(--ghost-ease, ease);
}
.asset-card:hover .audio-preview,
.asset-card.selected .audio-preview {
    background: radial-gradient(circle at 50% 35%, #34343a, #171719 72%);
}
.audio-icon { width: 42px; height: 42px; opacity: .85; }
.waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    gap: 2px;
    overflow: hidden;
}
.wave-bar { display: block; flex: 1 1 auto; max-width: 4px; min-width: 1px; border-radius: 2px; background: #707078; }
.audio-progress-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    height: 3px;
    background: rgba(255,255,255,.1);
}
.audio-progress-fill { width: 0; height: 100%; background: var(--accent); }

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 32px;
    text-align: center;
    background: var(--ghost-bg, #1B1B1D);
}
.empty-state.hidden { display: none; }
.empty-state img { width: 100px; height: 82px; margin-bottom: 16px; opacity: .55; }
.empty-state h1 { margin: 0; color: var(--ghost-text-primary, #ededef); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.empty-state p { max-width: 360px; margin: 8px 0 0; color: var(--ghost-text-secondary, #9D9DA5); font-size: 12px; line-height: 1.6; }

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 100ms var(--ghost-ease, ease);
}
.primary-button {
    background: var(--ghost-accent, var(--accent));
    color: #fff;
    font-weight: 600;
}
.primary-button:hover {
    background: var(--ghost-accent-hover, var(--accent-hover));
    box-shadow: 0 2px 8px -2px rgba(59, 130, 246, 0.3);
}
.primary-button:active { transform: scale(0.97); }
.secondary-button {
    background: var(--ghost-card, #232326);
    border-color: var(--ghost-border, rgba(255,255,255,0.06));
    color: var(--ghost-text-primary, #ededef);
}
.secondary-button:hover {
    background: var(--ghost-card-hover, #2A2A2E);
    border-color: var(--ghost-border-strong, rgba(255,255,255,0.10));
}
.secondary-button:active { transform: scale(0.97); }
.primary-button.compact { margin-top: 12px; }
.auto-width { width: auto; }

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: rgba(27, 27, 29, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--ghost-text-secondary, #9D9DA5);
    font-size: 12px;
}
.loading-overlay.visible { display: flex; }
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--ghost-accent, var(--accent));
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.modal-backdrop,
.preview-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.60);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-backdrop.open,
.preview-backdrop.open {
    display: flex;
    animation: ghost-fade-in 150ms ease-out;
}
.dialog {
    width: min(600px, 100%);
    max-height: 90vh;
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--ghost-border-strong, rgba(255,255,255,0.10));
    border-radius: var(--ghost-radius-lg, 12px);
    background: var(--ghost-bg-elevated, #202023);
    box-shadow: var(--ghost-shadow-xl, 0 24px 48px -8px rgba(0,0,0,.60));
    animation: ghost-slide-up 200ms var(--ghost-ease, ease);
}
.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.dialog-header h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-header p { margin: 4px 0 0; color: var(--ghost-text-secondary, #9D9DA5); font-size: 12px; line-height: 1.5; }
.dialog-close { font-size: 18px; color: var(--ghost-text-muted, #64646C); }
.dialog-close:hover { color: var(--ghost-text-primary, #fff); }
.multi-folder-dialog textarea {
    display: block;
    width: 100%;
    min-height: 240px;
    resize: vertical;
    padding: 12px;
    border: 1px solid var(--ghost-border, rgba(255,255,255,0.06));
    border-radius: var(--ghost-radius-md, 8px);
    background: rgba(0, 0, 0, 0.25);
    color: var(--ghost-text-primary, #ededef);
    font-size: 12px;
    line-height: 1.6;
    user-select: text;
    transition: border-color 120ms ease;
}
.multi-folder-dialog textarea:focus {
    border-color: var(--ghost-accent, var(--accent));
    box-shadow: 0 0 0 3px var(--ghost-accent-subtle, rgba(59,130,246,0.10));
}
.dialog-input {
    display: block;
    width: 100%;
    height: 36px;
    padding: 7px 10px;
    border: 1px solid #4a4a4a;
    border-radius: 5px;
    background: #171717;
    color: #eee;
    user-select: text;
}
.dialog-note { min-height: 20px; margin-top: 7px; color: #818181; font-size: 10px; }
.dialog-note.error { color: #ff8585; }
.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
}
.split-actions { justify-content: flex-start; }
.action-spacer { flex: 1 1 auto; }

.preview-backdrop { padding: 14px; background: rgba(0,0,0,.88); }
.preview-shell {
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #444;
    border-radius: 9px;
    background: #090909;
    box-shadow: 0 24px 80px #000;
}
.preview-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 7px 10px 7px 14px;
    border-bottom: 1px solid #333;
    background: #202020;
}
.preview-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.preview-close { font-size: 22px; }
.preview-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    background: #080808;
}
.preview-stage img,
.preview-stage video {
    display: block;
    width: auto;
    height: auto;
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.context-menu {
    position: fixed;
    z-index: 700;
    display: none;
    width: 205px;
    padding: 5px;
    border: 1px solid #4a4a4a;
    border-radius: 6px;
    background: #292929;
    box-shadow: 0 12px 30px rgba(0,0,0,.55);
}
.context-menu.open { display: block; }

.toast-region {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 900;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 7px;
    pointer-events: none;
}
.toast {
    max-width: 360px;
    padding: 9px 12px;
    border: 1px solid #4c4c4c;
    border-radius: 6px;
    background: #303030;
    color: #f1f1f1;
    box-shadow: 0 8px 24px rgba(0,0,0,.46);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 150ms ease, transform 150ms ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(235,91,91,.65); background: #432929; }

@media (max-width: 760px) {
    :root { --sidebar-width: 168px; }
    .brand-subtitle { display: none; }
    .brand-icon { width: 30px; height: 30px; }
    .filter-button { padding-inline: 8px; }
}

@media (max-width: 620px) {
    :root { --sidebar-width: 148px; }
    .brand-copy { display: none; }
    .history-item { grid-template-columns: minmax(0,1fr) 23px 23px; padding-left: 7px; }
    .toolbar { padding-inline: 7px; }
    .filter-button { padding-inline: 7px; font-size: 11px; }
}


/* GHOST CACHE v3.1 additions */
.toolbar { overflow: hidden; }
.filter-bar { overflow-x: auto; scrollbar-width: thin; }
.filter-button { flex: 0 0 auto; }

.history-item.all-sources {
    margin-bottom: 5px;
    border-bottom: 1px solid var(--border-soft);
    border-radius: 5px 5px 0 0;
    font-weight: 700;
}
.source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: unset;
    height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent !important;
    border: none !important;
    color: var(--ghost-text-muted, #71717A) !important;
    font-size: 9px !important;
    font-weight: 400 !important;
    opacity: 0.45 !important;
    margin-left: auto;
}

.generic-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    background: radial-gradient(circle at 50% 35%, #292d34, #151619 72%);
}
.generic-preview img {
    width: 74%;
    height: 62%;
    object-fit: contain;
    opacity: .88;
}
.generic-preview strong {
    color: #aeb8c7;
    font-size: 10px;
    letter-spacing: .13em;
}

.asset-card[data-capability="REFERENCE_ONLY"] .type-pill,
.asset-card[data-capability="CONVERT_FIRST"] .type-pill {
    border-color: rgba(255,183,77,.5);
    color: #ffd08a;
}

@media (max-width: 880px) {
    .filter-bar { justify-content: flex-start; }
}


/* GHOST CACHE v3.1 — compact density, zoom controls, and motion polish */
:root {
    --grid-gap: 8px;
    --asset-target-width: 164px;
    --control-size: 28px;
    --toolbar-height: 43px;
}

.sidebar-topbar { padding: 10px 9px 8px; }
.brand-row { gap: 8px; }
.brand-icon { width: 31px; height: 31px; }
.brand-title { font-size: 12px; letter-spacing: .055em; }
.brand-subtitle { margin-top: 1px; font-size: 9px; letter-spacing: .02em; }
.folder-section { padding-inline: 7px; }
.history-item { min-height: 31px; }
.sidebar-footer { padding: 8px 9px 9px; }

.icon-button {
    width: var(--control-size);
    height: var(--control-size);
    min-width: var(--control-size);
    border-radius: 6px;
}
.toolbar {
    min-height: var(--toolbar-height);
    padding: 6px 8px;
    gap: 5px;
}
.toolbar-spacer { flex: 1 1 auto; min-width: 5px; }
.filter-bar { flex: 0 1 auto; gap: 2px; }
.filter-button { min-height: 28px; padding: 5px 8px; border-radius: 6px; }
.search-wrap input { height: 29px; }
.search-toggle { font-size: 18px; }

.grid-size-control {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    height: 30px;
    padding: 1px;
    border: 1px solid #414141;
    border-radius: 7px;
    background: #191919;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.grid-zoom-button {
    width: 27px;
    height: 26px;
    min-width: 27px;
    border: 0;
    background: transparent;
    font-size: 17px;
    line-height: 1;
}
.grid-zoom-button:hover:not(:disabled) { background: #353535; }
.grid-zoom-button:disabled { color: #555; cursor: default; opacity: .6; }
.grid-size-label {
    min-width: 51px;
    padding: 0 4px;
    color: #aaa;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .035em;
    text-align: center;
    text-transform: uppercase;
}

.asset-card {
    border-radius: 7px;
    contain: layout paint;
    transition: border-color 150ms ease, background 150ms ease, box-shadow 170ms ease, opacity 120ms ease;
}
.asset-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.38); }
.asset-thumbnail,
.asset-video { transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.75,.25,1); }
.asset-card:hover .asset-thumbnail,
.asset-card:hover .asset-video { transform: scale(1.025); }
.asset-meta { min-height: 0; padding: 7px 9px 8px; }
.asset-name { font-size: 11px; }
.asset-details { margin-top: 3px; font-size: 9px; }
.type-pill, .duration-pill { bottom: 6px; min-height: 18px; padding: 2px 5px; font-size: 8px; }
.type-pill { left: 6px; }
.duration-pill { right: 6px; }
.favorite-button,
.sound-button,
.zoom-button { width: 26px; height: 26px; border-radius: 6px; }
.favorite-button { top: 6px; right: 6px; font-size: 16px; }
.zoom-button { top: 6px; left: 6px; font-size: 14px; }
.sound-button { right: 6px; bottom: 29px; font-size: 12px; }

.compact-grid .asset-meta { padding: 6px 7px; }
.compact-grid .asset-name { font-size: 10px; }
.compact-grid .asset-details { gap: 4px; font-size: 8px; }
.compact-grid .favorite-button,
.compact-grid .sound-button,
.compact-grid .zoom-button { width: 23px; height: 23px; }
.compact-grid .favorite-button { top: 5px; right: 5px; font-size: 14px; }
.compact-grid .zoom-button { top: 5px; left: 5px; font-size: 12px; }
.compact-grid .sound-button { right: 5px; bottom: 26px; }
.compact-grid .type-pill,
.compact-grid .duration-pill { bottom: 5px; min-height: 16px; font-size: 7px; }
.compact-grid .type-pill { left: 5px; }
.compact-grid .duration-pill { right: 5px; }

.micro-grid .asset-meta { padding: 5px 6px; }
.micro-grid .asset-name { font-size: 9px; line-height: 1.2; }
.micro-grid .asset-details { display: none; }
.micro-grid .favorite-button,
.micro-grid .sound-button,
.micro-grid .zoom-button { width: 20px; height: 20px; border-radius: 5px; }
.micro-grid .favorite-button { font-size: 12px; }
.micro-grid .zoom-button { font-size: 10px; }
.micro-grid .sound-button { display: none; }
.micro-grid .type-pill { max-width: calc(100% - 10px); overflow: hidden; text-overflow: ellipsis; }
.micro-grid .duration-pill { display: none; }

.empty-state h1 { font-size: 18px; }
.empty-state p { max-width: 470px; }
.toast { border-radius: 8px; }

@media (max-width: 880px) {
    .grid-size-label { display: none; }
    .grid-size-control { padding-inline: 0; }
}

@media (max-width: 680px) {
    .toolbar-spacer { display: none; }
    .grid-size-control { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}
.local-update-button{flex:0 0 auto;margin-left:2px;color:#c9bfff}.local-update-button:hover{color:#fff}

/* ============================================================ */
/* v3.4 Enhancements — themes, views, palette, multi-select     */
/* ============================================================ */

/* Theme presets --------------------------------------------- */
:root[data-theme="light"] {
    --bg: #f4f5f9;
    --panel: #ffffff;
    --panel-2: #f0f1f6;
    --panel-3: #e6e8ef;
    --border: #d5d9e4;
    --border-soft: #e2e5ee;
    --text: #12151c;
    --text-muted: #4b5468;
    --text-faint: #8892a5;
    --shadow: rgba(20, 30, 60, 0.10);
    --glow: 0 0 24px rgba(2, 132, 199, 0.15);
}
:root[data-theme="light"] .sidebar { background: #ffffff; border-right-color: #dfe2ec; }
:root[data-theme="light"] html, :root[data-theme="light"] body { background: var(--bg); color: var(--text); }

:root[data-theme="midnight"] {
    --bg: #05060d;
    --panel: #0a0d18;
    --panel-2: #0f1322;
    --panel-3: #171c30;
    --border: #232a44;
    --border-soft: #171c30;
    --text: #e6ebff;
    --text-muted: #8b94b8;
    --shadow: rgba(0, 0, 0, 0.75);
    --glow: 0 0 28px rgba(129, 140, 248, 0.35);
}
:root[data-theme="midnight"] .sidebar { background: #0a0d18; border-right-color: #05060d; }

:root[data-theme="neon"] {
    --bg: #0a0a12;
    --panel: #10101c;
    --panel-2: #171728;
    --panel-3: #1e1e36;
    --border: #2a2a4a;
    --border-soft: #1e1e36;
    --text: #f0fff4;
    --text-muted: #a8b3c7;
    --glow: 0 0 30px rgba(57, 255, 20, 0.35);
}
:root[data-theme="neon"] .sidebar { background: #0d0d1a; border-right-color: #05050a; }

/* View toggle & settings buttons --------------------------- */
.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel-2);
    margin-right: 6px;
}
.view-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s, color 0.15s;
}
.view-button:hover { color: var(--text); }
.view-button.active {
    background: var(--accent);
    color: #000;
}

/* Settings popover ----------------------------------------- */
.settings-popover {
    position: absolute;
    top: 48px;
    right: 12px;
    min-width: 240px;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 40px var(--shadow);
    z-index: 200;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}
.settings-popover.open { opacity: 1; transform: none; pointer-events: auto; }
.settings-section-title {
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.theme-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 12px;
}
.theme-preset {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.theme-preset:hover { border-color: var(--accent); }
.theme-preset.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.theme-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
}
.swatch-dark { background: linear-gradient(135deg, #22d3ee, #a855f7); }
.swatch-light { background: linear-gradient(135deg, #0284c7, #7c3aed); }
.swatch-midnight { background: linear-gradient(135deg, #818cf8, #f472b6); }
.swatch-neon { background: linear-gradient(135deg, #39ff14, #ff10f0); }

.accent-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
#accentColorInput {
    width: 40px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}
.settings-hint {
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
    color: var(--text-faint);
    font-size: 10px;
    line-height: 1.5;
}

/* Drop overlay --------------------------------------------- */
.drop-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 400;
    pointer-events: none;
}
.drop-overlay.active { display: flex; }
.drop-overlay-inner {
    padding: 40px 60px;
    background: var(--panel);
    border: 2px dashed var(--accent);
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 0 60px var(--accent), 0 20px 60px rgba(0,0,0,0.5);
}
.drop-overlay-icon {
    font-size: 44px;
    color: var(--accent);
    margin-bottom: 10px;
}
.drop-overlay-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.drop-overlay-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Command palette ------------------------------------------ */
.palette-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    background: rgba(4, 6, 12, 0.68);
    backdrop-filter: blur(6px);
    z-index: 500;
}
.palette-backdrop.open { display: flex; }
.palette-shell {
    width: min(560px, 92vw);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), var(--glow);
    overflow: hidden;
}
.palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
}
.palette-search-icon {
    color: var(--accent);
    font-size: 15px;
}
.palette-input {
    flex: 1;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    outline: none;
}
.palette-esc-hint {
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 10px;
}
.palette-results {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.palette-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 12px;
    cursor: pointer;
}
.palette-row:hover, .palette-row.active {
    background: var(--panel-2);
}
.palette-row.active {
    box-shadow: inset 3px 0 0 var(--accent);
}
.palette-kind {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-size: 11px;
    color: var(--accent);
    background: var(--panel-2);
}
.palette-kind-asset { color: var(--accent-2); }
.palette-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.palette-hint {
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
}
.palette-empty {
    padding: 24px;
    color: var(--text-faint);
    text-align: center;
    font-size: 12px;
}
.palette-footer {
    display: flex;
    gap: 14px;
    padding: 8px 14px;
    border-top: 1px solid var(--border-soft);
    color: var(--text-faint);
    font-size: 10px;
}

/* Batch bar ------------------------------------------------- */
.batch-bar {
    position: fixed;
    left: 50%;
    bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 999px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.5), var(--glow);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s, opacity 0.2s;
    z-index: 300;
}
.batch-bar.visible {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}
.batch-count {
    padding: 0 4px;
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
}

/* Multi-select marks --------------------------------------- */
.select-checkbox {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1.5px solid rgba(255,255,255,0.6);
    border-radius: 5px;
    background: rgba(0,0,0,0.55);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
}
.asset-card:hover .select-checkbox,
.asset-card.multi-selected .select-checkbox { opacity: 1; }
.select-checkbox.checked {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}
.asset-card.multi-selected {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Recent filter chip --------------------------------------- */
.filter-button.recent-filter { position: relative; }
.filter-button.recent-filter::before {
    content: "⏱";
    margin-right: 4px;
    opacity: 0.8;
}

/* View: List ------------------------------------------------ */
body.view-list .asset-card {
    display: grid !important;
    grid-template-columns: 68px 1fr auto;
    align-items: center;
    padding: 4px 10px 4px 4px;
    background: var(--panel-2);
    border: 1px solid var(--border-soft);
}
body.view-list .asset-preview {
    width: 60px !important;
    height: 52px !important;
    margin: 0;
    border-radius: 4px;
    overflow: hidden;
}
body.view-list .asset-meta {
    padding: 0 12px;
    min-width: 0;
}
body.view-list .asset-name { font-size: 12px; }
body.view-list .asset-details { font-size: 10px; }
body.view-list .type-pill,
body.view-list .duration-pill,
body.view-list .zoom-button,
body.view-list .sound-button { display: none; }
body.view-list .favorite-button { position: static; }

/* View: Masonry -------------------------------------------- */
body.view-masonry .asset-canvas {
    column-count: auto;
    column-width: 220px;
    column-gap: 10px;
    height: auto !important;
    padding: 8px 10px;
}
body.view-masonry .asset-card {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
    display: inline-block;
    break-inside: avoid;
    margin-bottom: 10px;
}
body.view-masonry .asset-preview {
    height: auto !important;
    aspect-ratio: 16 / 10;
}
body.view-masonry .asset-card:nth-child(3n) .asset-preview { aspect-ratio: 4 / 5; }
body.view-masonry .asset-card:nth-child(4n) .asset-preview { aspect-ratio: 1 / 1; }
body.view-masonry .asset-card:nth-child(5n) .asset-preview { aspect-ratio: 3 / 2; }

/* Enlarged hover preview ------------------------------------ */
.hover-preview {
    position: fixed;
    width: 380px;
    max-height: 340px;
    padding: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96);
    transition: opacity 0.18s, transform 0.18s;
    z-index: 350;
    overflow: hidden;
}
.hover-preview.visible {
    opacity: 1;
    transform: scale(1);
}
.hover-preview img {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 6px;
    background: #000;
}
.hover-preview-caption {
    margin-top: 6px;
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ Prompt 07-10: developer tools UI ============ */
.dev-reload-button {
    color: var(--accent, #7cd3ff);
    border: 1px solid rgba(124, 211, 255, 0.35);
    transition: transform 0.2s ease, background 0.2s ease;
}
.dev-reload-button:hover { transform: rotate(90deg); background: rgba(124, 211, 255, 0.12); }
.dev-reload-button:active { transform: rotate(180deg); }

.ghost-cache-warning {
    display: flex; align-items: center; gap: 10px;
    margin: 8px 12px 0; padding: 10px 14px;
    background: linear-gradient(90deg, rgba(255, 90, 90, 0.14), rgba(255, 160, 60, 0.1));
    border: 1px solid rgba(255, 120, 100, 0.45);
    border-radius: 10px;
    font-size: 13px; color: #ffd6cc;
}
.ghost-cache-warning[hidden] { display: none; }
.ghost-cache-warning-icon { font-size: 16px; }
.ghost-cache-warning-text { flex: 1; }
.ghost-cache-warning-action {
    background: rgba(255, 255, 255, 0.08);
    color: #fff; border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 4px 10px; border-radius: 6px; cursor: pointer; font: inherit;
}
.ghost-cache-warning-action:hover { background: rgba(255, 255, 255, 0.15); }

/* ==========================================================================
   SCROLL COLLAPSE INTERACTION
   ========================================================================== */
.toolbar {
    transition: transform 280ms var(--ghost-ease, ease), 
                opacity 280ms var(--ghost-ease, ease) !important;
}

body.scroll-down .toolbar {
    transform: translateY(-40px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
