/* ════════════════════════════════════════════════════
   top-bar — breadcrumb (Org/Workspace/Space), search center, notifications, user
   ════════════════════════════════════════════════════ */

.shell-top-bar {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 20;
    gap: 0;
}

/* ── Left section (breadcrumb) ──────────────────── */
.topbar-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    min-width: 0;
    padding-right: 8px;
}

/* ── Center section (search) ────────────────────── */
.topbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

/* ── Right section (notif, signin, user) ────────── */
.topbar-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
    padding-left: 8px;
}

/* Dissolve the mount wrapper so the bell is a direct flex child */
#notif-charm-mount {
    display: contents;
}

/* ── Breadcrumb ─────────────────────────────────── */
.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
}
.topbar-bc-sep {
    color: var(--text-muted);
    font-weight: 300;
    opacity: 0.4;
    font-size: 14px;
    margin: 0 1px;
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
}
.topbar-bc-segment {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
    white-space: nowrap;
    min-width: 0;
    max-width: 160px;
}
.topbar-bc-segment:hover { background: var(--bg-hover); }
.topbar-bc-segment svg { flex-shrink: 0; color: var(--text-muted); }
.topbar-bc-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-bc-org-icon {
    width: 16px; height: 16px;
    border-radius: 3px;
    background: #10b981;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700;
    flex-shrink: 0;
}
.topbar-bc-space-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

/* Non-interactive workspace segment (local = "Local", linked = "Personal") */
.topbar-bc-fixed {
    cursor: default;
    color: var(--text-muted);
    opacity: 0.75;
}
.topbar-bc-fixed:hover { background: none; }

/* ── Search bar ─────────────────────────────────── */
.topbar-search {
    width: 100%;
    max-width: 460px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: border-color 0.15s;
}
.topbar-search:hover { border-color: var(--text-muted); }
.topbar-search-text { flex: 1; text-align: left; }
.topbar-search-kbd {
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-muted);
    font-family: inherit;
    flex-shrink: 0;
}

/* ── Get Free Credits CTA button ────────────────── */
.topbar-signin {
    background: linear-gradient(90deg, #24CDFF, #ED1A77);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 3px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: opacity 0.15s, filter 0.15s;
    white-space: nowrap;
    margin-right: 6px;
}
.topbar-signin:hover {
    opacity: 0.88;
    filter: brightness(1.08);
}

/* ── Credits widget ────────────────────────────── */
#credits-widget-mount {
    display: flex; align-items: center;
}

.credits-widget {
    background: none; border: none; cursor: pointer; padding: 4px 12px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    user-select: none;
    height: 28px;
}

.credits-widget:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.credits-widget.good { color: #10b981; }
.credits-widget.low { color: #f59e0b; }
.credits-widget.empty { color: #ef4444; }
.credits-widget.error { color: #f59e0b; }
/* When user isn't signed in, the topbar's "Get Free Credits" CTA owns the
   call-to-action — hide the widget's signin state so we don't double up. */
.credits-widget.signin { display: none; }
.credits-widget.loading { opacity: 0.7; }

/* Shimmer fill used while credits are loading. Replaces the static
   em-dash placeholder so the loading state looks like an actual progress
   bar rather than a broken value. Width:100% so the gradient sweep covers
   the full bar; background-size:200% lets keyframes pan a wider gradient
   without clipping. */
.credits-bar-shimmer {
    width: 100%;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.08) 100%
    );
    background-size: 200% 100%;
    animation: credits-shimmer 1.4s ease-in-out infinite;
}

@keyframes credits-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.credits-text {
    display: flex; align-items: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.credits-bar {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.credits-bar-fill {
    height: 100%;
    background: currentColor;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.credits-amount {
    display: flex; align-items: center;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 32px;
}

/* ── User avatar ────────────────────────────────── */
.topbar-user {
    background: none; border: none; cursor: pointer; padding: 5px;
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.topbar-right .notif-charm:hover,
.topbar-user:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── Generic icon button (join workspace, etc.) ─── */
.topbar-icon-btn {
    background: none; border: none; cursor: pointer; padding: 4px 6px;
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.topbar-icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.topbar-assistant.active { color: var(--accent, var(--text-primary)); background: var(--bg-hover); }

/* ── Breadcrumb dropdown menus ──────────────────── */
.topbar-bc-menu {
    position: fixed;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    width: 240px;
    z-index: 500;
    padding: 8px;
    animation: topbar-menu-in 0.12s ease-out;
}
@keyframes topbar-menu-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.topbar-bc-menu-header {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 6px 10px;
}
.topbar-bc-menu-icon {
    width: 32px; height: 32px;
    border-radius: 6px;
    background: #10b981;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    flex-shrink: 0;
}
.topbar-bc-menu-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.topbar-bc-menu-meta { font-size: 11px; color: var(--text-muted); }
.topbar-bc-menu-separator { height: 1px; background: var(--border); margin: 4px 0; }
.topbar-bc-menu-label {
    font-size: 10px; font-weight: 500; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 6px 8px 4px;
}
.topbar-bc-menu-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; font-weight: 500;
    color: var(--text-primary);
    transition: background 0.1s;
}
.topbar-bc-menu-item:hover { background: var(--bg-hover); }
.topbar-bc-menu-item.active { background: rgba(255,255,255,0.04); }
.topbar-bc-menu-check { margin-left: auto; color: var(--accent); font-size: 13px; }
.topbar-bc-menu-create { color: var(--text-muted); }
.topbar-bc-menu-create:hover { color: var(--text-primary); }
.topbar-bc-menu-body { max-height: 280px; overflow-y: auto; }
.topbar-bc-menu-loading { padding: 10px 8px; color: var(--text-muted); font-size: 13px; }
.topbar-bc-menu-empty { padding: 8px 8px; color: var(--text-muted); font-size: 13px; font-style: italic; }
.topbar-bc-space-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.topbar-bc-space-avatar {
    width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff; text-transform: uppercase;
    line-height: 1; background: var(--accent);
}

/* ── Unified search/AI/command modal ─────────────── */
.usearch-overlay {
    position: fixed; inset: 0; z-index: 600;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 60px;
}
.usearch-dialog {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 640px; max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    overflow: hidden;
    display: flex; flex-direction: column;
    max-height: 70vh;
}
.usearch-input-row {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.usearch-mode-badge {
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px;
    background: var(--bg-surface); color: var(--text-muted);
    flex-shrink: 0; white-space: nowrap;
}
.usearch-mode-ai { background: rgba(168,85,247,0.15); color: #a855f7; }
.usearch-mode-command { background: rgba(59,130,246,0.15); color: #3b82f6; }
.usearch-input {
    flex: 1; border: none; background: none;
    color: var(--text-primary); font-size: 15px;
    outline: none; font-family: inherit;
}
.usearch-input::placeholder { color: var(--text-muted); }
.usearch-input:disabled { opacity: 0.5; }
.usearch-ai-btn {
    background: none; border: 1px solid rgba(168,85,247,0.3);
    color: #a855f7; padding: 3px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 500; cursor: pointer;
    white-space: nowrap; transition: all 0.15s;
}
.usearch-ai-btn:hover { background: rgba(168,85,247,0.1); }
.usearch-tabs {
    display: flex; gap: 4px;
    padding: 6px 16px;
    border-bottom: 1px solid var(--border);
}
.usearch-tab {
    padding: 4px 12px; border-radius: 6px;
    border: none; background: none;
    color: var(--text-muted); font-size: 13px;
    cursor: pointer; transition: all 0.1s;
}
.usearch-tab:hover { color: var(--text-primary); }
.usearch-tab.active { background: var(--bg-surface); color: var(--text-primary); font-weight: 500; }
.usearch-results {
    flex: 1; overflow-y: auto;
    padding: 8px; min-height: 180px;
}
.usearch-hint {
    color: var(--text-muted); font-size: 14px;
    text-align: center; padding: 40px 0;
}
.usearch-footer {
    display: flex; align-items: center;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-muted);
}
.usearch-footer kbd {
    padding: 1px 5px; border: 1px solid var(--border);
    border-radius: 3px; font-size: 11px; margin: 0 2px;
}

/* Search results */
.usearch-result-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    cursor: pointer; transition: background 0.1s;
}
.usearch-result-item:hover { background: var(--bg-hover); }
.usearch-result-icon { font-size: 16px; flex-shrink: 0; }
.usearch-result-name { font-size: 14px; color: var(--text-primary); }
.usearch-result-meta { font-size: 12px; color: var(--text-muted); }

/* Command items */
.usearch-section-label {
    font-size: 11px; font-weight: 500; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 8px 10px 4px;
}
.usearch-cmd-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    cursor: pointer; transition: background 0.1s;
}
.usearch-cmd-item:hover { background: var(--bg-hover); }
.usearch-cmd-icon { font-size: 16px; flex-shrink: 0; }
.usearch-cmd-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.usearch-cmd-desc { font-size: 12px; color: var(--text-muted); }

/* AI mini-chat */
.usearch-ai-exchange { padding: 8px; }
.usearch-ai-user {
    font-size: 14px; color: var(--text-primary);
    padding: 8px 12px; background: var(--bg-surface);
    border-radius: 8px; margin-bottom: 12px;
}
.usearch-ai-response {
    font-size: 14px; line-height: 1.6;
    color: var(--text-primary);
    padding: 0 4px;
}
.usearch-ai-response p { margin: 6px 0; }
.usearch-ai-response code { background: rgba(255,255,255,0.06); padding: 2px 5px; border-radius: 4px; font-size: 13px; }
.usearch-ai-response pre { background: #09090b; border-radius: 8px; padding: 12px; margin: 8px 0; overflow-x: auto; }
.usearch-ai-response pre code { background: none; padding: 0; }
.usearch-ai-thinking {
    color: var(--text-muted); font-style: italic; font-size: 13px;
    padding: 12px 0;
    animation: usearch-pulse 1.5s ease-in-out infinite;
}
@keyframes usearch-pulse { 0%,100%{ opacity:1; } 50%{ opacity:0.4; } }
.usearch-ai-error { color: #f87171; font-size: 13px; padding: 8px 0; }
.usearch-ai-actions {
    display: flex; justify-content: flex-end;
    margin-top: 12px; padding-top: 8px;
    border-top: 1px solid var(--border);
}
.usearch-ai-open-chat {
    background: none; border: 1px solid var(--border);
    color: var(--text-secondary); padding: 6px 14px;
    border-radius: 6px; font-size: 13px; cursor: pointer;
    transition: all 0.15s;
}
.usearch-ai-open-chat:hover { border-color: var(--accent); color: var(--accent); }

/* Responsive rules for top bar are in core.css alongside other shell breakpoints */

/* ════════════════════════════════════════════════════
   Modal Animations
   ════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── ⌘K scope toggle + workspace chips + Ask-Lani row (spec-v2 §D) ── */
.usearch-scope {
    display: inline-flex;
    gap: 3px;
    margin-left: auto;
    padding: 3px;
    border-radius: 9px;
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}
.usearch-scope-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 7px;
    cursor: pointer;
}
.usearch-scope-btn.active {
    background: rgba(59, 130, 246, 0.22);
    color: var(--text-primary, #fff);
}
.usearch-result-chip {
    flex: 0 0 auto;
    align-self: center;
    margin-left: 8px;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-secondary, #9ca3af);
    font-size: 11px;
}
/* Dense comprehension-artifact count on any Sanity card hit. */
.usearch-artifacts {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 8px;
    font-size: 10.5px;
    color: #b9a6ff;
    border: 1px solid rgba(139, 108, 255, 0.35);
    border-radius: 6px;
    padding: 3px 7px;
    white-space: nowrap;
}
.usearch-artifacts-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #8b6cff;
}
.usearch-ask-lani {
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    margin-top: 6px;
    cursor: pointer;
}
.usearch-ask-lani .usearch-result-icon { color: #8b6cff; }
