
/* ============================================================
   PHASE 2: Premium Shell + Motion System
   EVd3x — graph-native EV research workspace
   ============================================================ */

/* ── P2 Design Tokens ────────────────────────────────────────── */
:root {
    --p2-radius-chip: 999px;
    --p2-radius-card: 14px;
    --p2-radius-panel: 12px;
    --p2-radius-input: 10px;
    --p2-transition-micro: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --p2-transition-panel: 260ms cubic-bezier(0.4, 0, 0.2, 1);
    --p2-transition-drawer: 280ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --p2-shadow-float: 0 8px 24px -8px rgba(15,23,42,0.18), 0 2px 6px -2px rgba(15,23,42,0.1);
    --p2-shadow-drawer: -4px 0 32px -8px rgba(15,23,42,0.22);
    --p2-shadow-bar: 0 -2px 16px -4px rgba(15,23,42,0.12);
    --p2-glow-primary: 0 0 0 3px rgba(14,165,165,0.18);
    --header-h: 60px;
    --strip-h: 36px;
--rcd-width: 340px;
}

body.dark-mode {
    --p2-shadow-float: 0 8px 24px -8px rgba(0,0,0,0.45), 0 2px 6px -2px rgba(0,0,0,0.3);
    --p2-shadow-drawer: -4px 0 32px -8px rgba(0,0,0,0.5);
    --p2-shadow-bar: 0 -2px 16px -4px rgba(0,0,0,0.4);
    --p2-glow-primary: 0 0 0 3px rgba(20,184,166,0.22);
}

/* ── P2 App Header (slimmer, cleaner) ────────────────────────── */
.app-header {
    height: var(--header-h);
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--p2-transition-micro), border-color var(--p2-transition-micro);
}

.app-header-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 100%;
    padding: 0 1.25rem;
}

.header-nav-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--p2-transition-micro);
    flex-shrink: 0;
}
.header-nav-toggle:hover { background: var(--body-bg); color: var(--text-color); }

.editable-header {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: var(--text-color) !important;
    padding: 0 !important;
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    flex-shrink: 0;
}

.app-version-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    padding: 0.2rem 0.6rem 0.2rem 0.45rem;
    background: rgba(14, 165, 165, 0.12);
    border: 1px solid rgba(14, 165, 165, 0.28);
    border-radius: 999px;
    user-select: none;
    white-space: nowrap;
}

.app-version-badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0e9fa5;
    flex-shrink: 0;
    animation: evd3x-pulse 2.4s ease-in-out infinite;
}

@keyframes evd3x-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(14, 165, 165, 0.5); }
    50%       { opacity: 0.7; box-shadow: 0 0 0 4px rgba(14, 165, 165, 0); }
}

.app-version-badge__ver {
    color: var(--accent-color, #0e9fa5);
}

.app-version-badge__tag {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(14, 165, 165, 0.75);
    border-radius: 999px;
    padding: 0.05rem 0.35rem;
}

.header-action-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro),
                border-color var(--p2-transition-micro), box-shadow var(--p2-transition-micro);
    text-decoration: none;
}
.header-action-btn.figure-mode-btn {
    width: auto;
    min-width: 72px;
    padding: 0 0.6rem;
    gap: 0.35rem;
}
.header-action-btn.figure-mode-btn .figure-mode-label {
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.header-action-btn:hover {
    background: var(--body-bg);
    color: var(--primary-color);
    border-color: rgba(14,165,165,0.4);
}
.header-action-btn:focus-visible { box-shadow: var(--p2-glow-primary); outline: none; }

body.dark-mode .header-actions .dropdown-menu {
    background: rgba(15,23,42,0.98);
    border-color: rgba(75,85,99,0.65);
}
body.dark-mode .header-actions .dropdown-item { color: #e5e7eb; }
body.dark-mode .header-actions .dropdown-item:hover { background: rgba(30,41,59,0.9); }

.export-menu-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.45rem 0.9rem;
}
.export-menu-logo {
    width: 18px;
    height: 18px;
    display: block;
}

/* ── P2 Sidebar / Left Rail ──────────────────────────────────── */
#sidebar {
    background: var(--panel-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--border-color);
    transition: transform var(--p2-transition-drawer), background var(--p2-transition-micro);
}

.rail-group-label {
    list-style: none;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.9rem 1rem 0.35rem;
    opacity: 0.9;
}

.sidebar-nav .nav-link {
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro),
                transform var(--p2-transition-micro), box-shadow var(--p2-transition-micro);
    position: relative;
}
.sidebar-nav .nav-link:hover {
    background: rgba(14,165,165,0.1);
    color: var(--primary-color);
    transform: translateX(2px);
}
.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(8,145,178,0.18), rgba(14,165,165,0.14));
    color: var(--primary-color);
    border-left: 2px solid var(--primary-color);
    padding-left: calc(1rem - 2px);
}
body.dark-mode .sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(8,145,178,0.28), rgba(14,165,165,0.2));
}

.rail-lens-btn.rail-lens-active {
    background: linear-gradient(135deg, rgba(8,145,178,0.15), rgba(14,165,165,0.1));
    color: var(--primary-color);
    border-left: 2px solid var(--primary-color);
    padding-left: calc(1rem - 2px);
}

/* ── Landing refresh: research-first entry surface ───────────────────────── */
#landing-view {
    text-align: left;
    padding: 1rem 0 2rem;
}

#landing-view .landing-content {
    max-width: min(1320px, calc(100vw - 3rem));
    margin: 0 auto;
    padding: 0 0.2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fade-in-up 0.45s ease both;
}

#landing-view .landing-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

#landing-view .landing-hero-copy {
    min-width: 0;
    max-width: 1040px;
    padding: 0.2rem 0.1rem 0;
    margin: 0 auto;
    text-align: center;
}

#landing-view #landing-logo {
    width: min(1040px, 94vw);
    max-width: 1040px;
    height: auto;
    display: block;
    margin: 0 auto 0.35rem;
}

#landing-view .landing-kicker,
#landing-view .landing-section-kicker {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f766e;
}

#landing-view h1 {
    max-width: 17ch;
    font-size: clamp(2.15rem, 3.6vw, 3.2rem);
    line-height: 1.02;
    margin-bottom: 0;
    color: #0f172a;
    text-wrap: balance;
}

#landing-view .lead {
    max-width: 74ch;
    font-size: 1.35rem;
    line-height: 1.5;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    margin-left: auto;
    margin-right: auto;
}

#landing-view .lead-highlight {
    color: #0f766e;
    font-weight: 700;
}

body.dark-mode #landing-view .lead-highlight {
    color: #2dd4bf;
}

#landing-view .landing-highlight-list {
    display: none !important;
}

#landing-view .landing-highlight-card {
    display: grid;
    grid-template-columns: 2.3rem minmax(0, 1fr);
    gap: 0.8rem;
    align-items: start;
    padding: 0.88rem 0.95rem;
    border-radius: 16px;
    border: 1px solid rgba(14, 165, 165, 0.16);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(240, 249, 255, 0.92));
    box-shadow: 0 10px 28px -22px rgba(15, 23, 42, 0.45);
}

#landing-view .landing-highlight-card i {
    width: 2.3rem;
    height: 2.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(14, 165, 165, 0.12);
    color: #0f766e;
    font-size: 0.98rem;
}

#landing-view .landing-highlight-card strong {
    display: block;
    font-size: 0.95rem;
    color: #0f172a;
    margin-bottom: 0.16rem;
}

#landing-view .landing-highlight-card span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.45;
}

#landing-view .landing-search-card {
    margin-top: 0.5rem;
    overflow: hidden;
    position: static;
    width: 100%;
    border-radius: 20px;
    border: 1px solid rgba(14, 165, 165, 0.28);
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.92));
    box-shadow: 0 24px 58px -44px rgba(14, 116, 144, 0.58);
    transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

#landing-view .landing-search-card .card-body {
    padding: 1.45rem 1.55rem 1.5rem;
}

#landing-view .landing-search-card:hover {
    border-color: rgba(14, 165, 165, 0.5);
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.22), 0 30px 68px -42px rgba(13, 148, 136, 0.5);
    transform: translateY(-1px);
}

#landing-view .landing-search-card:focus-within {
    border-color: rgba(20, 184, 166, 0.58);
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.22), 0 30px 68px -42px rgba(13, 148, 136, 0.54);
}

#landing-view .landing-search-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    min-width: 0;
}

#landing-view .landing-search-copy {
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-break: normal;
}

#landing-view .landing-search-note {
    border-radius: 14px;
    padding: 0.8rem 0.85rem;
    background: linear-gradient(135deg, rgba(14, 165, 165, 0.10), rgba(59, 130, 246, 0.08));
    border: 1px solid rgba(14, 165, 165, 0.14);
    min-width: 0;
}

#landing-view .landing-search-note strong {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #0f766e;
    margin-bottom: 0.25rem;
}

#landing-view .landing-search-note span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: normal;
}

#landing-view .landing-search-card h4 {
    font-size: 1.05rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

#landing-view .prompt-composer {
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    padding: 1.35rem;
}

#landing-view .prompt-composer .form-label {
    font-size: 1rem;
    font-weight: 700;
}

#landing-view #unified-prompt-input {
    font-size: 1.06rem;
    min-height: 144px;
}

#landing-view .chip-btn {
    padding: 0.48rem 0.92rem;
    font-size: 0.9rem;
}

#landing-view .landing-search-helper {
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.86);
    padding: 0.8rem 0.9rem;
}

#landing-view .landing-search-helper__title {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0f766e;
    margin-bottom: 0.5rem;
}

#landing-view .landing-search-helper__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.45;
}

#landing-view .landing-search-helper__grid strong {
    color: #0f172a;
    margin-right: 0.18rem;
}

#landing-view .landing-section-card {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(248,250,252,0.9));
    box-shadow: 0 18px 44px -36px rgba(15, 23, 42, 0.38);
    padding: 1rem 1.05rem;
    margin-top: 0.35rem;
}

#landing-view .landing-section-card.card {
    overflow: hidden;
}

#landing-view .landing-section-card.card .card-body {
    padding: 0;
}

#landing-view .landing-section-head {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

#landing-view .landing-section-head--inline {
    flex-direction: row;
    justify-content: space-between;
    align-items: start;
    gap: 0.8rem;
    flex-wrap: wrap;
}

#landing-view .landing-section-head h4 {
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
}

#landing-view .landing-section-head p {
    color: var(--text-secondary);
    max-width: 72ch;
    font-size: 0.92rem;
    line-height: 1.55;
}

#landing-view .workflow-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

#landing-view .workflow-step {
    min-width: 0;
    min-height: 100%;
    border-radius: 16px;
}

#landing-view .platform-metrics-grid--primary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

#landing-view .platform-metrics-grid--secondary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

#landing-view .metric-card {
    min-width: 0;
    height: 100%;
}

#landing-view .metric-card--compact {
    padding: 0.72rem 0.75rem;
}

#landing-view .metric-value {
    font-size: clamp(1rem, 2vw, 1.2rem);
}

#landing-view .metric-label {
    line-height: 1.3;
}

#landing-view .platform-surface-grid,
#landing-view .platform-bottom-details,
#landing-view .capability-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

#landing-view .landing-agentic-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

#landing-view .landing-agentic-card {
    min-width: 0;
    height: 100%;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    padding: 0.95rem 1rem;
}

#landing-view .landing-agentic-card h6 {
    font-size: 1rem;
    margin: 0 0 0.35rem;
    color: #0f172a;
    font-weight: 700;
}

#landing-view .landing-agentic-card p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.52;
}

#landing-view .surface-card,
#landing-view .capability-card,
#landing-view .platform-detail-card,
#landing-view .landing-agentic-card {
    min-width: 0;
    height: 100%;
}

#landing-view .capability-card {
    padding: 1rem 1.05rem;
    border-radius: 16px;
}

#landing-view .capability-card h6,
#landing-view .platform-detail-card h6 {
    font-size: 0.98rem;
}

#landing-view .landing-mmm-rationale {
    font-size: 0.95rem;
}

#landing-view .landing-mmm-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.4rem 0 0.55rem;
}

#landing-view .landing-mmm-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid rgba(14, 165, 165, 0.26);
    background: rgba(240, 253, 250, 0.9);
    color: #0f766e;
    padding: 0.18rem 0.56rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

#landing-view .landing-mmm-tag--measure {
    border-color: rgba(13, 148, 136, 0.3);
    background: rgba(204, 251, 241, 0.66);
    color: #0f766e;
}

#landing-view .landing-mmm-tag--map {
    border-color: rgba(14, 116, 144, 0.28);
    background: rgba(224, 242, 254, 0.82);
    color: #0c4a6e;
}

#landing-view .landing-mmm-tag--manipulate {
    border-color: rgba(30, 64, 175, 0.25);
    background: rgba(224, 231, 255, 0.78);
    color: #1e3a8a;
}

#landing-view .landing-mmm-tag--validate {
    border-color: rgba(133, 77, 14, 0.25);
    background: rgba(254, 243, 199, 0.85);
    color: #92400e;
}

#landing-view .capability-card p,
#landing-view .surface-copy,
#landing-view .platform-detail-card p {
    color: var(--text-secondary);
    line-height: 1.5;
}

#landing-view .search-container,
#landing-view .platform-strip,
#landing-view .capability-card,
#landing-view .workflow-step {
    backdrop-filter: none;
}

#landing-view .platform-strip,
#landing-view .landing-section-card.card,
#landing-view .surface-card,
#landing-view .capability-card,
#landing-view .platform-detail-card,
#landing-view .metric-card,
#landing-view .workflow-step {
    box-shadow: none;
}

#landing-view .surface-card,
#landing-view .capability-card,
#landing-view .platform-detail-card,
#landing-view .metric-card,
#landing-view .workflow-step,
#landing-view .landing-agentic-card {
    border-color: rgba(148, 163, 184, 0.18);
}

#landing-view .workflow-step,
#landing-view .surface-card,
#landing-view .capability-card,
#landing-view .platform-detail-card,
#landing-view .metric-card,
#landing-view .landing-agentic-card {
    background: rgba(255, 255, 255, 0.74);
}

#landing-view .platform-strip .card-body,
#landing-view .search-container .card-body {
    padding: 0;
}

body.dark-mode #landing-view .landing-kicker,
body.dark-mode #landing-view .landing-section-kicker,
body.dark-mode #landing-view .landing-search-note strong,
body.dark-mode #landing-view .landing-search-helper__title {
    color: #5eead4;
}

body.dark-mode #landing-view h1,
body.dark-mode #landing-view .landing-section-head h4,
body.dark-mode #landing-view .landing-highlight-card strong {
    color: #f8fafc;
}

body.dark-mode #landing-view .lead,
body.dark-mode #landing-view .landing-search-copy,
body.dark-mode #landing-view .landing-section-head p,
body.dark-mode #landing-view .landing-highlight-card span,
body.dark-mode #landing-view .landing-search-note span,
body.dark-mode #landing-view .landing-search-helper__grid,
body.dark-mode #landing-view .capability-card p,
body.dark-mode #landing-view .surface-copy,
body.dark-mode #landing-view .platform-detail-card p {
    color: #cbd5e1;
}

body.dark-mode #landing-view .landing-highlight-card,
body.dark-mode #landing-view .landing-search-card,
body.dark-mode #landing-view .landing-section-card {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.94));
    border-color: rgba(56, 189, 248, 0.16);
}

body.dark-mode #landing-view .landing-highlight-card i {
    background: rgba(45, 212, 191, 0.16);
    color: #5eead4;
}

body.dark-mode #landing-view .prompt-composer,
body.dark-mode #landing-view .landing-search-helper,
body.dark-mode #landing-view .landing-search-note {
    background: rgba(17, 24, 39, 0.82);
    border-color: rgba(75, 85, 99, 0.42);
}

body.dark-mode #landing-view .surface-card,
body.dark-mode #landing-view .platform-detail-card,
body.dark-mode #landing-view .workflow-step,
body.dark-mode #landing-view .capability-card,
body.dark-mode #landing-view .metric-card,
body.dark-mode #landing-view .landing-agentic-card {
    background: rgba(17, 24, 39, 0.88);
    border-color: rgba(71, 85, 105, 0.48);
}

body.dark-mode #landing-view .landing-agentic-card h6 {
    color: #f8fafc;
}

body.dark-mode #landing-view .landing-mmm-tag {
    background: rgba(15, 23, 42, 0.88);
    border-color: rgba(71, 85, 105, 0.7);
    color: #cbd5e1;
}

body.dark-mode #landing-view .landing-mmm-tag--measure {
    color: #5eead4;
    border-color: rgba(45, 212, 191, 0.4);
}

body.dark-mode #landing-view .landing-mmm-tag--map {
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.42);
}

body.dark-mode #landing-view .landing-mmm-tag--manipulate {
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.4);
}

body.dark-mode #landing-view .landing-mmm-tag--validate {
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.4);
}

@media (max-width: 1180px) {
    #landing-view .landing-hero-grid {
        grid-template-columns: 1fr;
    }

    #landing-view .landing-hero-copy {
        padding-top: 0.2rem;
        max-width: none;
    }

    #landing-view .landing-search-card {
        position: static;
    }

    #landing-view .workflow-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    #landing-view {
        padding-top: 1rem;
    }

    #landing-view .landing-content {
        max-width: min(100vw - 1.2rem, 100%);
        padding: 0 0 0.75rem;
    }

    #landing-view h1 {
        max-width: 18ch;
        font-size: clamp(2rem, 6vw, 2.75rem);
    }

    #landing-view .landing-search-header,
    #landing-view .landing-section-head--inline {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    #landing-view .platform-metrics-grid--primary,
    #landing-view .platform-metrics-grid--secondary,
    #landing-view .platform-surface-grid,
    #landing-view .platform-bottom-details,
    #landing-view .capability-grid,
    #landing-view .landing-agentic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    #landing-view .landing-content {
        padding: 0 0 0.7rem;
    }

    #landing-view .landing-section-card,
    #landing-view .landing-search-card .card-body {
        padding: 0.9rem;
    }

    #landing-view .landing-highlight-card {
        padding: 0.82rem 0.88rem;
    }

    #landing-view .landing-search-helper__grid,
    #landing-view .workflow-strip,
    #landing-view .platform-metrics-grid--primary,
    #landing-view .platform-metrics-grid--secondary,
    #landing-view .platform-surface-grid,
    #landing-view .platform-bottom-details,
    #landing-view .capability-grid,
    #landing-view .landing-agentic-grid {
        grid-template-columns: 1fr;
    }

    #landing-view .lead {
        font-size: 1.08rem;
    }

    #landing-view .landing-mmm-rationale {
        font-size: 0.9rem;
        line-height: 1.45;
    }

    #landing-view .landing-mmm-tag {
        font-size: 0.68rem;
    }
}

@media (max-width: 575.98px) {
    #landing-view {
        padding-top: 0.8rem;
    }

    #landing-view #landing-logo {
        width: min(500px, 94vw);
    }

    #landing-view .lead {
        font-size: 1.06rem;
    }

    #landing-view h1 {
        font-size: clamp(1.75rem, 8.6vw, 2.25rem);
        max-width: none;
    }

    #landing-view .landing-highlight-card {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    #landing-view .landing-highlight-card i {
        width: 2rem;
        height: 2rem;
    }
}

.analysis-workspace-header {
    display: flex;
    align-items: center;
    min-width: 0;
}

.analysis-workspace-header__copy {
    min-width: 0;
}

.analysis-workspace-header__eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.analysis-workspace-header__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
}

.analysis-workspace-header__meta {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.analysis-workspace-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.analysis-workspace-layer-controls {
    width: fit-content;
}

.analysis-workspace-section-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.analysis-workspace-layer-controls .btn,
.analysis-workspace-section-controls .btn {
    border-radius: 999px;
}

.cell-context-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.cell-context-summary-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.cell-context-summary-card {
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--panel-bg) 88%, var(--primary-color) 12%);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cell-context-summary-card strong {
    font-size: 1.15rem;
    color: var(--text-color);
}

.cell-context-summary-label {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.cell-context-system-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cell-context-system-chip {
    --cell-system-color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--cell-system-color) 38%, var(--border-color));
    background: color-mix(in srgb, var(--cell-system-color) 16%, var(--panel-bg));
    color: var(--text-color);
    font-size: 0.78rem;
}

.cell-context-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.65rem;
}

.cell-context-metric {
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.cell-context-metric span {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cell-context-metric strong {
    font-size: 0.98rem;
    color: var(--text-color);
}

.cell-specificity-row {
    cursor: pointer;
    transition: background var(--p2-transition-micro), border-color var(--p2-transition-micro), transform var(--p2-transition-micro);
}

.cell-specificity-row:hover {
    background: color-mix(in srgb, var(--primary-color) 8%, var(--panel-bg));
}

.cell-specificity-row.is-selected {
    background: color-mix(in srgb, var(--primary-color) 12%, var(--panel-bg));
    border-left: 3px solid var(--primary-color);
}

.cell-context-chip {
    border-radius: 999px;
}

#cell-comm-source-controls {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    background: color-mix(in srgb, var(--panel-bg) 92%, var(--primary-color) 8%);
}

#cell-comm-rerun-cell-list {
    max-height: 220px;
    overflow: auto;
    padding-right: 0.2rem;
}

#cell-localization-table-container .table td,
#cell-localization-table-container .table th {
    vertical-align: top;
}

@media (max-width: 768px) {
    .cell-context-summary-strip {
        grid-template-columns: 1fr 1fr;
    }
}

.analysis-workspace-layer-controls .btn.active,
.analysis-workspace-section-controls .btn.active {
    background: linear-gradient(135deg, #0891b2, #0ea5a5);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px -8px rgba(8,145,178,0.55);
}

.analysis-workspace-section-controls .btn.is-node {
    border-color: rgba(8,145,178,0.28);
}

.analysis-workspace-section-controls .btn.is-system {
    border-color: rgba(16,185,129,0.22);
}

/* ── P2 App View — flex column so BCB is a true in-flow region ── */
#app-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h));
}
body.query-strip-visible #app-view {
    height: calc(100vh - var(--header-h) - var(--strip-h));
}

/* ── P2 Main container fills remaining space (flex: 1) ────────── */
.main-view-container {
    flex: 1;
    min-height: 0;
    height: auto;
}

/* ── P2 Query State Strip ────────────────────────────────────── */
.query-state-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 0.3rem;
    padding: 0.3rem 1.25rem;
    height: var(--strip-h);
    background: linear-gradient(90deg,
        rgba(14,165,165,0.06) 0%,
        var(--panel-bg) 40%,
        var(--panel-bg) 100%);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    margin-left: -12px;
    margin-right: -12px;
    animation: qss-slide-in 0.22s cubic-bezier(0.4,0,0.2,1) both;
}

@keyframes qss-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.qss-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
}
.qss-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: 0.75rem;
}
.qss-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.32rem;
    flex: 1 1 420px;
    margin-left: 0.7rem;
}
.qss-action-btn {
    border: 1px solid rgba(14, 165, 165, 0.35);
    background: rgba(14, 165, 165, 0.08);
    color: #0f766e;
    border-radius: 999px;
    padding: 0.15rem 0.52rem;
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background var(--p2-transition-micro), border-color var(--p2-transition-micro), color var(--p2-transition-micro);
}
.qss-action-btn:hover,
.qss-action-btn:focus {
    background: rgba(14, 165, 165, 0.16);
    border-color: rgba(14, 165, 165, 0.58);
    color: #115e59;
}
body.dark-mode .qss-action-btn {
    background: rgba(13, 148, 136, 0.18);
    border-color: rgba(45, 212, 191, 0.45);
    color: #99f6e4;
}
body.dark-mode .qss-action-btn:hover,
body.dark-mode .qss-action-btn:focus {
    background: rgba(13, 148, 136, 0.3);
    border-color: rgba(94, 234, 212, 0.65);
    color: #ccfbf1;
}

.qss-divider {
    width: 1px;
    height: 14px;
    background: var(--border-color);
    display: inline-block;
    flex-shrink: 0;
}

.qss-counts {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: 'IBM Plex Mono', monospace;
}

.qss-new-search-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.15rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro),
                border-color var(--p2-transition-micro);
}
.qss-new-search-btn:hover {
    background: var(--body-bg);
    color: var(--primary-color);
    border-color: rgba(14,165,165,0.45);
}
body.dark-mode .qss-new-search-btn { border-color: #374151; }
body.dark-mode .qss-new-search-btn:hover { background: #1f2937; }
@media (max-width: 1200px) {
    .qss-actions {
        margin-left: 0;
        flex: 1 1 100%;
    }
    .qss-right {
        margin-left: auto;
    }
}

/* ── P2 Right Context Drawer ─────────────────────────────────── */
.right-context-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--rcd-width);
    height: 100vh;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid var(--border-color);
    z-index: 1025;
    display: flex;
    flex-direction: column;
    box-shadow: var(--p2-shadow-drawer);
    transform: translateX(100%);
    transition: transform var(--p2-transition-drawer);
    pointer-events: none;
}
.right-context-drawer.rcd-open {
    transform: translateX(0);
    pointer-events: auto;
}

.rcd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(90deg, rgba(14,165,165,0.06), transparent);
    flex-shrink: 0;
}
.rcd-header-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}
.rcd-type-badge {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: rgba(14,165,165,0.14);
    color: var(--primary-color);
    border: 1px solid rgba(14,165,165,0.3);
    flex-shrink: 0;
}
.rcd-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rcd-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
.rcd-action-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro),
                border-color var(--p2-transition-micro);
}
.rcd-action-btn:hover { background: var(--body-bg); color: var(--text-color); border-color: var(--border-color); }
.rcd-action-btn[aria-pressed="true"] { color: var(--primary-color); border-color: rgba(14,165,165,0.4); }

.rcd-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 1rem;
}

@media (max-width: 1200px) {
    .header-action-btn.figure-mode-btn {
        width: 32px;
        min-width: 32px;
        padding: 0;
    }
    .header-action-btn.figure-mode-btn .figure-mode-label {
        display: none;
    }
}

.rcd-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 200px;
    text-align: center;
    padding: 2rem 1.5rem;
}
.rcd-empty-icon {
    font-size: 2rem;
    color: var(--border-color);
    opacity: 0.6;
}
.rcd-empty-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}


.node-overview-shell {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.node-overview-hero,
.node-overview-card,
.node-overview-empty {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.node-overview-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
}

.node-overview-eyebrow,
.node-overview-empty__eyebrow {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f766e;
    margin-bottom: 0.35rem;
}

.node-overview-copy {
    color: #475569;
    max-width: 44rem;
}

.node-overview-query-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.node-overview-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    background: rgba(13, 148, 136, 0.10);
    color: #115e59;
    font-size: 0.78rem;
    font-weight: 600;
}

.node-overview-grid,
.node-overview-columns {
    display: grid;
    gap: 0.9rem;
}

.node-overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.node-overview-columns {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.node-overview-card {
    padding: 1rem 1.1rem;
    overflow: hidden;
}

.node-overview-card__title,
.node-overview-subtitle {
    font-weight: 700;
    color: #0f172a;
}

.node-overview-card__title {
    margin-bottom: 0.85rem;
}

.node-overview-subtitle {
    margin-bottom: 0.7rem;
    font-size: 0.92rem;
}

.node-overview-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.node-overview-metric {
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.08);
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.node-overview-metric__value {
    display: block;
    font-size: 1.1rem;
    line-height: 1.1;
    font-weight: 700;
    color: #0f172a;
}

.node-overview-metric__label {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.76rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.node-overview-stat-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.node-overview-stat-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    font-size: 0.92rem;
    color: #334155;
    min-width: 0;
}

.node-overview-stat-row > span:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.node-overview-stat-row strong {
    color: #0f172a;
    flex: 0 0 auto;
    text-align: right;
}

.node-overview-stat-pending {
    display: inline-block;
    max-width: min(170px, 52%);
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    background: rgba(148, 163, 184, 0.12);
    line-height: 1.25;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    align-self: flex-start;
}

.node-overview-node-grid,
.node-overview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.node-overview-node-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.18rem;
    min-width: 132px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.09);
    background: rgba(248, 250, 252, 0.92);
    padding: 0.7rem 0.8rem;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.node-overview-node-btn:hover,
.node-overview-node-btn:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(13, 148, 136, 0.35);
    box-shadow: 0 8px 22px rgba(13, 148, 136, 0.12);
    background: #ffffff;
}

.node-overview-node-btn__label {
    color: #0f172a;
    font-weight: 700;
}

.node-overview-node-btn__meta {
    color: #475569;
    font-size: 0.78rem;
}

.node-overview-action {
    border-radius: 999px;
}

.node-overview-empty {
    padding: 1.15rem 1.1rem;
}

body.dark-mode .node-overview-hero,
body.dark-mode .node-overview-card,
body.dark-mode .node-overview-empty {
    border-color: rgba(148, 163, 184, 0.14);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.96));
    box-shadow: 0 12px 32px rgba(2, 6, 23, 0.38);
}

body.dark-mode .node-overview-eyebrow,
body.dark-mode .node-overview-empty__eyebrow {
    color: #5eead4;
}

body.dark-mode .node-overview-copy,
body.dark-mode .node-overview-metric__label,
body.dark-mode .node-overview-stat-row,
body.dark-mode .node-overview-node-btn__meta {
    color: #cbd5e1;
}

body.dark-mode .node-overview-chip {
    background: rgba(45, 212, 191, 0.16);
    color: #ccfbf1;
}

body.dark-mode .node-overview-card__title,
body.dark-mode .node-overview-subtitle,
body.dark-mode .node-overview-metric__value,
body.dark-mode .node-overview-stat-row strong,
body.dark-mode .node-overview-node-btn__label,
body.dark-mode .node-overview-empty h6 {
    color: #f8fafc;
}

body.dark-mode .node-overview-metric {
    background: rgba(45, 212, 191, 0.12);
}

body.dark-mode .node-overview-stat-pending {
    color: #dbeafe;
    background: rgba(148, 163, 184, 0.18);
}

body.dark-mode .node-overview-node-btn {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(30, 41, 59, 0.9);
}

body.dark-mode .node-overview-node-btn:hover,
body.dark-mode .node-overview-node-btn:focus-visible {
    border-color: rgba(94, 234, 212, 0.42);
    box-shadow: 0 8px 22px rgba(8, 145, 178, 0.22);
    background: rgba(15, 23, 42, 0.98);
}

.node-guidance-card {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.98));
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    padding: 0.95rem 1rem;
}

.node-guidance-card__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.node-guidance-card__copy {
    font-size: 0.84rem;
    color: #334155;
}

.node-guidance-card__tip {
    font-size: 0.78rem;
    color: #64748b;
}

body.dark-mode .node-guidance-card {
    border-color: rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.97));
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.4);
}

body.dark-mode .node-guidance-card__title {
    color: #f8fafc;
}

body.dark-mode .node-guidance-card__copy {
    color: #cbd5e1;
}

body.dark-mode .node-guidance-card__tip {
    color: #94a3b8;
}

@media (max-width: 768px) {
    .node-overview-hero {
        flex-direction: column;
    }

    .node-overview-query-meta {
        justify-content: flex-start;
    }

    .node-overview-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ── P2 Graph Workspace ──────────────────────────────────────── */
.graph-wrapper {
    background: var(--body-bg);
    border-radius: var(--p2-radius-panel);
    overflow: hidden;
}

#cy {
    position: relative;
    border-radius: var(--p2-radius-panel);
    border: 1px solid var(--border-color) !important;
    transition: border-color var(--p2-transition-micro);
}

#cy-controls .btn {
    border-radius: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro),
                border-color var(--p2-transition-micro), transform var(--p2-transition-micro);
}
#cy-controls .btn:hover {
    color: var(--primary-color);
    border-color: rgba(14,165,165,0.45);
    transform: scale(1.06);
}
#cy-controls .btn:active { transform: scale(0.97); }

.graph-interaction-hint {
    margin-top: 0.4rem;
    font-size: 0.74rem;
    color: #64748b;
    text-align: right;
}

.node-action-menu {
    position: absolute;
    z-index: 12;
    display: flex;
    gap: 0.35rem;
    pointer-events: auto;
}

.node-action-menu .btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

body.dark-mode .graph-interaction-hint {
    color: #94a3b8;
}

.graph-overlay-toggle {
    border-radius: 8px;
    font-size: 0.78rem;
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro),
                border-color var(--p2-transition-micro);
}
.graph-overlay-toggle:hover {
    border-color: rgba(14,165,165,0.45);
    color: var(--primary-color);
}

.graph-overlay-panel {
    animation: overlay-fade-in 0.18s cubic-bezier(0.4,0,0.2,1) both;
    border-radius: var(--p2-radius-panel);
}

.ppi-tree-mode-controls .btn.active {
    background: linear-gradient(135deg, #0891b2, #0ea5a5);
    border-color: transparent;
    color: #fff;
}

.collection-bridge-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.collection-bridge-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    background: rgba(14, 165, 165, 0.10);
    color: #0f766e;
}

.collection-bridge-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.collection-bridge-row {
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.92);
    padding: 0.75rem 0.85rem;
    text-align: left;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.collection-bridge-row:hover,
.collection-bridge-row:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(8, 145, 178, 0.28);
    box-shadow: 0 10px 22px rgba(8, 145, 178, 0.12);
}

.collection-bridge-row.is-active {
    border-color: rgba(14, 165, 165, 0.5);
    background: linear-gradient(180deg, rgba(20, 184, 166, 0.12), rgba(20, 184, 166, 0.06));
    box-shadow: 0 10px 24px rgba(14, 165, 165, 0.14);
}

.collection-bridge-row__top,
.collection-bridge-row__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.collection-bridge-row__label {
    font-weight: 700;
    color: #0f172a;
}

.collection-bridge-row__type {
    font-size: 0.76rem;
    color: #64748b;
}

.collection-bridge-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.collection-bridge-badge--shared_target {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.collection-bridge-badge--direct_query_overlap {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.collection-bridge-badge--protein_product {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.collection-bridge-badge--ppi_mediator {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.collection-bridge-row__reason {
    margin: 0.45rem 0 0.35rem;
    font-size: 0.83rem;
    color: #475569;
}

.collection-bridge-row__seeds {
    font-size: 0.76rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collection-bridge-row__score {
    font-size: 0.76rem;
    font-weight: 700;
    color: #0f766e;
}

.collection-bridge-empty {
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.38);
    background: rgba(248, 250, 252, 0.72);
    padding: 0.85rem 0.95rem;
    color: #64748b;
    font-size: 0.84rem;
}

.collection-bridge-summary-card {
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.9);
    padding: 0.85rem 0.95rem;
}

.collection-bridge-summary-card__title {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.3rem;
}

.collection-bridge-summary-card__copy {
    color: #475569;
    font-size: 0.84rem;
    margin-bottom: 0.6rem;
}

body.dark-mode .collection-bridge-chip {
    background: rgba(45, 212, 191, 0.16);
    color: #ccfbf1;
}

body.dark-mode .collection-bridge-row,
body.dark-mode .collection-bridge-summary-card,
body.dark-mode .collection-bridge-empty {
    border-color: rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.92);
}

body.dark-mode .collection-bridge-row.is-active {
    border-color: rgba(45, 212, 191, 0.55);
    background: linear-gradient(180deg, rgba(20, 184, 166, 0.18), rgba(15, 23, 42, 0.96));
    box-shadow: 0 12px 26px rgba(20, 184, 166, 0.18);
}

body.dark-mode .collection-bridge-row__label,
body.dark-mode .collection-bridge-summary-card__title {
    color: #f8fafc;
}

body.dark-mode .collection-bridge-row__type,
body.dark-mode .collection-bridge-row__reason,
body.dark-mode .collection-bridge-row__seeds,
body.dark-mode .collection-bridge-summary-card__copy,
body.dark-mode .collection-bridge-empty {
    color: #cbd5e1;
}

body.dark-mode .collection-bridge-row__score {
    color: #99f6e4;
}
@keyframes overlay-fade-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── P2 Results Panel ────────────────────────────────────────── */
#results-panel { border-radius: var(--p2-radius-panel); overflow: hidden; }

.card-header.bg-light {
    background: linear-gradient(90deg, rgba(14,165,165,0.05), var(--body-bg)) !important;
}

#main-tabs .nav-link {
    font-size: 0.78rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    font-weight: 500;
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro);
    white-space: nowrap;
}
#main-tabs .nav-link:hover:not(.active) {
    background: rgba(14,165,165,0.08);
    color: var(--primary-color);
}
#main-tabs .nav-link.active {
    background: linear-gradient(135deg, #0891b2, #0ea5a5) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px -3px rgba(14,165,165,0.45);
}

#details-pills-tabs .nav-link {
    font-size: 0.76rem;
    padding: 0.3rem 0.55rem;
    border-radius: 8px;
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro);
}
#details-pills-tabs .nav-link:hover:not(.active) {
    background: rgba(14,165,165,0.08);
    color: var(--primary-color);
}

/* ── P2 Chip Transitions ─────────────────────────────────────── */
.chip-btn {
    border-radius: var(--p2-radius-chip);
    transition: background var(--p2-transition-micro), color var(--p2-transition-micro),
                border-color var(--p2-transition-micro), transform var(--p2-transition-micro),
                box-shadow var(--p2-transition-micro);
}
.chip-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px -4px rgba(14,165,165,0.35); }
.chip-btn:active { transform: translateY(0); }
.chip-btn.active { box-shadow: 0 2px 8px -3px rgba(14,165,165,0.45); }

/* ── P2 Skeleton Loading ─────────────────────────────────────── */
@keyframes skeleton-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton-line {
    border-radius: 4px;
    height: 12px;
    margin-bottom: 8px;
    background: linear-gradient(90deg,
        var(--border-color) 25%,
        var(--panel-bg) 50%,
        var(--border-color) 75%);
    background-size: 400px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.skeleton-line--short  { width: 55%; }
.skeleton-line--medium { width: 78%; }
.skeleton-line--full   { width: 100%; }

/* Loading spinner */
#details-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}
#details-loading .spinner-border-sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
    color: var(--primary-color);
}

/* ── P2 View entrance animation ──────────────────────────────── */
.view-enter {
    animation: fade-in-up 0.24s cubic-bezier(0.4,0,0.2,1) both;
}

/* ── P2 Reduced Motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── P2 Mobile ───────────────────────────────────────────────── */
@media (max-width: 991.98px) {
:root { --rcd-width: 100vw; }
    .right-context-drawer { width: 100vw; }
}

/* ── P2 Dark mode refinements ────────────────────────────────── */
body.dark-mode .rcd-header {
    background: linear-gradient(90deg, rgba(8,145,178,0.1), transparent);
}
body.dark-mode .query-state-strip {
    background: linear-gradient(90deg,
        rgba(8,145,178,0.1) 0%,
        rgba(31,41,55,0.76) 40%,
        rgba(31,41,55,0.76) 100%);
}
body.dark-mode .app-header {
    background: rgba(17,24,39,0.88);
}
body.dark-mode #sidebar {
    background: rgba(17,24,39,0.92);
}
/* END Phase 2 */

/* ============================================================
   PHASE 3: Parse Preview + Collection Builder
   ============================================================ */

/* ── Parse Preview Zone ─────────────────────────────────────── */
.parse-preview {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.55rem;
    padding: 0.5rem 0.7rem;
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    min-height: 36px;
    transition: border-color var(--p2-transition-micro), background var(--p2-transition-micro);
    animation: parse-preview-in 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes parse-preview-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.parse-preview-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
}

.parse-preview-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Mode badge inside parse preview */
.parse-mode-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2em 0.6em;
    border-radius: var(--p2-radius-chip);
    border: 1px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
}

.parse-mode-badge.parse-mode--single {
    background: rgba(14,165,165,0.1);
    border-color: rgba(14,165,165,0.35);
    color: #0e9a9a;
}

.parse-mode-badge.parse-mode--system {
    background: rgba(8,145,178,0.1);
    border-color: rgba(8,145,178,0.38);
    color: #0891b2;
}

.parse-mode-badge.parse-mode--detected {
    background: rgba(22,163,74,0.1);
    border-color: rgba(22,163,74,0.35);
    color: #15803d;
}

.parse-mode-badge.parse-mode--chat {
    background: rgba(99,102,241,0.1);
    border-color: rgba(99,102,241,0.35);
    color: #4f46e5;
}

/* Seed chips in parse preview */
.parse-seed-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
}

.parse-seed-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.18em 0.55em;
    border-radius: var(--p2-radius-chip);
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: chip-pop-in 140ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes chip-pop-in {
    from { opacity: 0; transform: scale(0.82); }
    to   { opacity: 1; transform: scale(1); }
}

.parse-seed-chip.parse-seed-chip--mir {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.35);
    color: #b45309;
}

.parse-seed-chip.parse-seed-chip--overflow {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.7rem;
}

.parse-seed-chip.parse-seed-chip--hint {
    background: rgba(99,102,241,0.08);
    border-color: rgba(99,102,241,0.3);
    color: #4338ca;
    font-family: var(--font-family-base, "Inter", sans-serif);
    max-width: none;
}

/* Count label */
.parse-count-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
}

/* Dark mode parse preview */
body.dark-mode .parse-preview {
    background: rgba(15,23,42,0.55);
    border-color: rgba(75,85,99,0.5);
}

body.dark-mode .parse-mode-badge.parse-mode--single {
    background: rgba(14,165,165,0.14);
    border-color: rgba(14,165,165,0.4);
    color: #2dd4bf;
}

body.dark-mode .parse-mode-badge.parse-mode--system {
    background: rgba(8,145,178,0.14);
    border-color: rgba(8,145,178,0.4);
    color: #38bdf8;
}

body.dark-mode .parse-mode-badge.parse-mode--detected {
    background: rgba(22,163,74,0.2);
    border-color: rgba(22,163,74,0.4);
    color: #4ade80;
}

body.dark-mode .parse-mode-badge.parse-mode--chat {
    background: rgba(99,102,241,0.2);
    border-color: rgba(129,140,248,0.45);
    color: #a5b4fc;
}

body.dark-mode .parse-seed-chip {
    background: rgba(30,41,59,0.8);
    border-color: #374151;
}

body.dark-mode .parse-seed-chip.parse-seed-chip--mir {
    background: rgba(245,158,11,0.12);
    border-color: rgba(245,158,11,0.35);
    color: #fbbf24;
}

body.dark-mode .parse-seed-chip.parse-seed-chip--hint {
    background: rgba(99,102,241,0.18);
    border-color: rgba(129,140,248,0.45);
    color: #c7d2fe;
}

/* Top-N slider — always visible, subtle */
#top-n-slider-container .form-range {
    accent-color: #0ea5e9;
}

/* ── History item text — truncation + mode badge ────────────── */
.history-query {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: var(--text-color);
}

.history-mode {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    line-height: 1;
    margin-top: 2px;
}

/* Suppress animation on overflow chip */
.parse-seed-chip.parse-seed-chip--overflow {
    animation: none;
}

/* END Phase 3 */

/* ============================================================
   PHASE 4: Graph grammar + Drawer + Focus system
   ============================================================ */

/* ── RCD type badge color variants ─────────────────────────── */
.rcd-type-badge.rcd-type--mirna,
.rcd-type-badge.rcd-type--mirna { background: rgba(8,145,178,0.14); border-color: rgba(8,145,178,0.38); color: #0891b2; }
.rcd-type-badge.rcd-type--mrna,
.rcd-type-badge.rcd-type--gene  { background: rgba(22,163,74,0.14); border-color: rgba(22,163,74,0.38); color: #16a34a; }
.rcd-type-badge.rcd-type--protein { background: rgba(220,38,38,0.12); border-color: rgba(220,38,38,0.35); color: #dc2626; }
.rcd-type-badge.rcd-type--edge  { background: rgba(100,116,139,0.12); border-color: rgba(100,116,139,0.3); color: #64748b; }

body.dark-mode .rcd-type-badge.rcd-type--mirna { color: #38bdf8; background: rgba(8,145,178,0.2); border-color: rgba(8,145,178,0.4); }
body.dark-mode .rcd-type-badge.rcd-type--mrna,
body.dark-mode .rcd-type-badge.rcd-type--gene  { color: #4ade80; background: rgba(22,163,74,0.18); border-color: rgba(22,163,74,0.4); }
body.dark-mode .rcd-type-badge.rcd-type--protein { color: #f87171; background: rgba(220,38,38,0.18); border-color: rgba(220,38,38,0.38); }

/* ── RCD body sections ──────────────────────────────────────── */
.rcd-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.85rem;
}

.rcd-stat-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2em 0.6em;
    border-radius: 999px;
    border: 1px solid transparent;
}

.rcd-stat-pill--type { background: rgba(100,116,139,0.1); border-color: rgba(100,116,139,0.3); color: #64748b; }
.rcd-stat-pill--gene  { background: rgba(22,163,74,0.1); border-color: rgba(22,163,74,0.35); color: #16a34a; }
.rcd-stat-pill--mirna { background: rgba(8,145,178,0.1); border-color: rgba(8,145,178,0.35); color: #0891b2; }
.rcd-stat-pill--protein { background: rgba(220,38,38,0.1); border-color: rgba(220,38,38,0.3); color: #dc2626; }
.rcd-stat-pill--ev    { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.4); color: #b45309; }
.rcd-stat-pill--seed  { background: rgba(248,250,252,0.15); border-color: rgba(148,163,184,0.4); color: var(--text-muted); }
.rcd-stat-pill--edge  { background: rgba(100,116,139,0.1); border-color: rgba(100,116,139,0.3); color: var(--text-color); font-size: 0.63rem; }

body.dark-mode .rcd-stat-pill--ev { color: #fbbf24; }
body.dark-mode .rcd-stat-pill--gene { color: #4ade80; }
body.dark-mode .rcd-stat-pill--mirna { color: #38bdf8; }
body.dark-mode .rcd-stat-pill--protein { color: #f87171; }

/* ── RCD sections ───────────────────────────────────────────── */
.rcd-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.rcd-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.rcd-section--ppi { border-color: rgba(245,158,11,0.2); }

.rcd-section-label {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.rcd-section-label-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.7;
}

.rcd-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    padding: 0 4px;
    background: rgba(14,165,165,0.14);
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0;
    text-transform: none;
}

.rcd-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.rcd-muted {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

/* EV evidence row */
.rcd-ev-row {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}
.rcd-ev-count {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
    color: #f59e0b;
    line-height: 1;
}
.rcd-ev-label { font-size: 0.78rem; color: var(--text-muted); }
.rcd-ev-source { font-size: 0.72rem; color: var(--text-muted); padding-left: 0.1rem; }

/* Jump button */
.rcd-jump-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.22rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--primary-color);
    cursor: pointer;
    margin-top: 0.4rem;
    transition: background var(--p2-transition-micro), border-color var(--p2-transition-micro);
    gap: 0.25rem;
}
.rcd-jump-btn:hover {
    background: rgba(14,165,165,0.08);
    border-color: rgba(14,165,165,0.45);
}
body.dark-mode .rcd-jump-btn { border-color: #374151; }
body.dark-mode .rcd-jump-btn:hover { background: rgba(14,165,165,0.12); }

/* List */
.rcd-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.rcd-list-item {
    font-size: 0.78rem;
    color: var(--text-color);
    padding: 0.15rem 0;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Edge display */
.rcd-edge-nodes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    flex-wrap: wrap;
}
.rcd-edge-node {
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.15rem 0.45rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rcd-edge-arrow { color: var(--text-muted); font-size: 0.85rem; }

/* ── PPI section in drawer ──────────────────────────────────── */
.rcd-ppi-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'IBM Plex Mono', monospace;
    margin-bottom: 0.4rem;
}

.rcd-ppi-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.rcd-ppi-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.5rem;
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    cursor: pointer;
    transition: background var(--p2-transition-micro), border-color var(--p2-transition-micro);
}
.rcd-ppi-row:hover {
    background: rgba(245,158,11,0.07);
    border-color: rgba(245,158,11,0.38);
}

.rcd-ppi-partner-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.15rem;
}

.rcd-ppi-partner {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.rcd-ppi-isoform-meta {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    font-size: 0.62rem;
    font-weight: 700;
    color: #92400e;
    background: rgba(251, 191, 36, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 999px;
    padding: 0.08rem 0.42rem;
}

.rcd-ppi-score {
    font-size: 0.68rem;
    font-weight: 700;
    color: #f59e0b;
    font-family: 'IBM Plex Mono', monospace;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

body.dark-mode .rcd-ppi-row { background: rgba(30,41,59,0.7); border-color: #374151; }
body.dark-mode .rcd-ppi-row:hover { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.38); }
body.dark-mode .rcd-ppi-isoform-meta { color: #fde68a; background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.35); }

/* ── Focus system graph overlay (visual) ────────────────────── */
/* These are handled by Cytoscape style rules (cy-dimmed, cy-focused, cy-neighbor).
   No additional CSS needed here — Cytoscape manages canvas rendering. */

/* ── Show-all button refinement ─────────────────────────────── */
#show-all-btn {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* END Phase 4 */

/* ============================================================
   PHASE 5: Lens-by-lens scientific polish
   ============================================================ */

/* ── Lens header ─────────────────────────────────────────── */
.lens-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.lens-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.lens-title {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-color);
    white-space: nowrap;
}

.lens-result-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.28);
    color: #6366f1;
    white-space: nowrap;
}

body.dark-mode .lens-result-chip {
    background: rgba(99,102,241,0.18);
    border-color: rgba(99,102,241,0.4);
    color: #a5b4fc;
}

/* ── Lens filter strip ───────────────────────────────────── */
.lens-filter-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    align-items: flex-end;
    padding: 0.55rem 0.75rem;
    background: var(--sidebar-bg, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

body.dark-mode .lens-filter-strip {
    background: rgba(15,23,42,0.6);
    border-color: #1e293b;
}

.lens-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.lens-filter-group--sources {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.lens-filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0;
}

.lens-filter-input {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    background: var(--card-bg, #fff);
    color: var(--text-color);
    min-width: 160px;
    transition: border-color 0.15s;
}

.lens-filter-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

body.dark-mode .lens-filter-input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.lens-range {
    min-width: 100px;
    max-width: 150px;
}

/* ── Source chips inside filter strip ────────────────────── */
.lens-source-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.lens-source-chips .form-check-inline {
    margin: 0;
}

.lens-source-chips .form-check-label {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-color, #e2e8f0);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.lens-source-chips .form-check-input {
    display: none;
}

.lens-source-chips .form-check-input:checked + .form-check-label {
    background: rgba(99,102,241,0.12);
    border-color: rgba(99,102,241,0.4);
    color: #6366f1;
}

body.dark-mode .lens-source-chips .form-check-input:checked + .form-check-label {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.5);
    color: #a5b4fc;
}

/* ── Lens status bar ──────────────────────────────────────── */
.lens-status-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
    min-height: 1.2rem;
}

.lens-status-text {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.lens-status-text--muted {
    opacity: 0.7;
    font-style: italic;
}

/* ── Lens section title ───────────────────────────────────── */
.lens-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .lens-section-title {
    border-bottom-color: #1e293b;
}

/* ── EV evidence provenance bar ───────────────────────────── */
.ev-prov-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(245,158,11,0.07);
    border: 1px solid rgba(245,158,11,0.22);
    border-radius: 7px;
    margin-bottom: 0.6rem;
}

body.dark-mode .ev-prov-bar {
    background: rgba(245,158,11,0.1);
    border-color: rgba(245,158,11,0.3);
}

.ev-prov-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    background: rgba(245,158,11,0.14);
    border: 1px solid rgba(245,158,11,0.35);
    color: #92400e;
}

body.dark-mode .ev-prov-chip {
    background: rgba(245,158,11,0.18);
    border-color: rgba(245,158,11,0.4);
    color: #fcd34d;
}

.ev-prov-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

.ev-prov-label--track {
    color: #16a34a;
}

body.dark-mode .ev-prov-label--track {
    color: #4ade80;
}

.ev-prov-sep {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* END Phase 5 */

/* ============================================================
   PHASE 6: Figure Mode + Export manifests + Paper pipeline
   ============================================================ */

/* ── Figure Mode toggle button ───────────────────────────── */
.figure-mode-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.figure-mode-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.figure-mode-btn.figure-mode-active {
    background: rgba(99,102,241,0.12);
    border-color: rgba(99,102,241,0.5);
    color: #6366f1;
}

body.dark-mode .figure-mode-btn.figure-mode-active {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.6);
    color: #a5b4fc;
}

/* ── Figure Mode bar ─────────────────────────────────────── */
.figure-mode-bar {
    background: linear-gradient(90deg, rgba(99,102,241,0.06) 0%, rgba(99,102,241,0.03) 100%);
    border-bottom: 1px solid rgba(99,102,241,0.2);
    padding: 0.5rem 2rem;
    transition: all 0.2s;
}

body.dark-mode .figure-mode-bar {
    background: linear-gradient(90deg, rgba(99,102,241,0.1) 0%, rgba(99,102,241,0.05) 100%);
    border-bottom-color: rgba(99,102,241,0.3);
}

.figure-mode-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.figure-meta-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: center;
}

.figure-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
}

.figure-meta-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-size: 0.65rem;
}

.figure-meta-value {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.75rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark-mode .figure-meta-value {
    background: #1e293b;
    border-color: #334155;
}

.figure-mode-actions {
    flex-shrink: 0;
}

/* ── Figure Mode body class effects ─────────────────────── */
body.figure-mode .sidebar-nav {
    /* keep nav readable but de-emphasize */
    opacity: 0.8;
}

body.figure-mode .history-header,
body.figure-mode #history-container {
    display: none !important;
}

body.figure-mode .lens-filter-strip,
body.figure-mode .lens-status-bar {
    /* freeze scroll in figure mode for stable captures */
    overflow: hidden;
}

body.figure-mode .parse-preview {
    /* reduce parse preview visual noise */
    opacity: 0.7;
}

/* Make graph legend more prominent in figure mode */
body.figure-mode #cy-legend-panel {
    border: 1.5px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

/* ── Graph viewer export note ────────────────────────────── */
.graph-viewer-export-note {
    padding: 0.4rem 0.75rem;
    background: rgba(99,102,241,0.06);
    border: 1px solid rgba(99,102,241,0.18);
    border-radius: 7px;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
}

body.dark-mode .graph-viewer-export-note {
    background: rgba(99,102,241,0.1);
    border-color: rgba(99,102,241,0.28);
}

.viewer-export-context {
    color: var(--text-muted);
}

.viewer-export-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Graph viewer toolbar refinement (Phase 6) ───────────── */
.graph-viewer-toolbar {
    padding: 0.5rem;
    background: var(--sidebar-bg, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
}

body.dark-mode .graph-viewer-toolbar {
    background: rgba(15,23,42,0.7);
    border-color: #1e293b;
}

/* ── END Phase 6 ─────────────────────────────────────────── */

/* ============================================================
   PHASE 7: Agent Q&A Layer — Bottom Command Bar + Response Surface
   ============================================================ */

/* ── Agent chip variant in BCB ───────────────────────────── */
.bcb-chip--agent {
    background: linear-gradient(135deg, rgba(14,165,165,0.08), rgba(99,102,241,0.08));
    border-color: rgba(14,165,165,0.3);
    color: var(--teal-accent, #0ea5e9);
}

.bcb-chip--agent:hover {
    background: linear-gradient(135deg, rgba(14,165,165,0.16), rgba(99,102,241,0.14));
    border-color: rgba(14,165,165,0.55);
}

body.dark-mode .bcb-chip--agent {
    background: linear-gradient(135deg, rgba(20,184,166,0.1), rgba(99,102,241,0.1));
    border-color: rgba(20,184,166,0.35);
    color: #2dd4bf;
}

/* ── Agent Response Surface ──────────────────────────────── */
.agent-response-surface {
    background: var(--panel-bg);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    max-height: 320px;
    overflow-y: auto;
    animation: agent-surface-in 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes agent-surface-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.agent-response-inner {
    padding: 0.75rem 1rem 0.6rem;
    max-width: 900px;
    margin: 0 auto;
}

/* ── Agent response header row ───────────────────────────── */
.agent-response-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.agent-response-intent-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(14,165,165,0.1);
    color: var(--teal-accent, #0d9488);
    border: 1px solid rgba(14,165,165,0.25);
    flex-shrink: 0;
}

/* Intent colour variants */
.agent-response-intent-badge.intent--network_lookup   { background: rgba(16,185,129,0.1); color:#059669; border-color:rgba(16,185,129,0.3); }
.agent-response-intent-badge.intent--ev_evidence      { background: rgba(245,158,11,0.1);  color:#d97706; border-color:rgba(245,158,11,0.3); }
.agent-response-intent-badge.intent--ppi              { background: rgba(239,68,68,0.1);   color:#dc2626; border-color:rgba(239,68,68,0.3); }
.agent-response-intent-badge.intent--pathway          { background: rgba(99,102,241,0.1);  color:#6366f1; border-color:rgba(99,102,241,0.3); }
.agent-response-intent-badge.intent--disease          { background: rgba(236,72,153,0.1);  color:#db2777; border-color:rgba(236,72,153,0.3); }
.agent-response-intent-badge.intent--cell_specificity { background: rgba(20,184,166,0.1);  color:#0f766e; border-color:rgba(20,184,166,0.3); }
.agent-response-intent-badge.intent--cell_communication { background: rgba(14,165,233,0.1); color:#0369a1; border-color:rgba(14,165,233,0.3); }
.agent-response-intent-badge.intent--lr_analysis      { background: rgba(168,85,247,0.1);  color:#9333ea; border-color:rgba(168,85,247,0.3); }
.agent-response-intent-badge.intent--figure_export    { background: rgba(234,179,8,0.1);   color:#a16207; border-color:rgba(234,179,8,0.3); }
.agent-response-intent-badge.intent--explain_term     { background: rgba(156,163,175,0.1); color:#6b7280; border-color:rgba(156,163,175,0.3); }

body.dark-mode .agent-response-intent-badge { background: rgba(20,184,166,0.12); color:#2dd4bf; border-color:rgba(20,184,166,0.28); }

.agent-response-strategy {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-response-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color var(--p2-transition-micro), background var(--p2-transition-micro);
}

.agent-response-close:hover {
    color: var(--text-primary);
    background: var(--hover-bg, rgba(0,0,0,0.06));
}

/* ── Agent reply text ────────────────────────────────────── */
.agent-response-body {
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.agent-response-body p { margin: 0 0 0.4em; }
.agent-response-body strong { font-weight: 600; }
.agent-response-body em { font-style: italic; }
.agent-response-body code {
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
    background: rgba(0,0,0,0.05);
    border-radius: 3px;
    padding: 0.1em 0.35em;
}
body.dark-mode .agent-response-body code { background: rgba(255,255,255,0.07); }

/* ── Agent action log ────────────────────────────────────── */
.agent-action-log {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.45rem;
}

.agent-action-tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.12rem 0.45rem;
    border-radius: 5px;
    background: rgba(14,165,165,0.08);
    color: var(--teal-accent, #0d9488);
    border: 1px solid rgba(14,165,165,0.2);
}

.agent-action-tag.done { opacity: 0.65; }
.agent-action-tag.pending { animation: agent-pulse 1.1s ease-in-out infinite; }
.agent-action-tag.failed {
    background: rgba(220, 53, 69, 0.14);
    border-color: rgba(220, 53, 69, 0.34);
    color: #b42330;
}

@keyframes agent-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

/* ── Agent suggestion chips ──────────────────────────────── */
.agent-suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.1rem;
}

.agent-chip {
    font-size: 0.72rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(14,165,165,0.3);
    background: rgba(14,165,165,0.06);
    color: var(--teal-accent, #0d9488);
    cursor: pointer;
    transition: background var(--p2-transition-micro), border-color var(--p2-transition-micro);
    white-space: nowrap;
}

.agent-chip:hover {
    background: rgba(14,165,165,0.14);
    border-color: rgba(14,165,165,0.5);
}

body.dark-mode .agent-chip {
    border-color: rgba(20,184,166,0.32);
    background: rgba(20,184,166,0.08);
    color: #2dd4bf;
}

/* ── Agent warning bar ───────────────────────────────────── */
.agent-warning-bar {
    font-size: 0.73rem;
    color: #92400e;
    background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    margin-top: 0.4rem;
}

body.dark-mode .agent-warning-bar {
    color: #fcd34d;
    background: rgba(251,191,36,0.08);
    border-color: rgba(251,191,36,0.22);
}

/* ── Loading state ───────────────────────────────────────── */
.agent-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.agent-loading-dots {
    display: inline-flex;
    gap: 3px;
}

.agent-loading-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--teal-accent, #0d9488);
    animation: agent-dot 1.2s ease-in-out infinite;
}

.agent-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.agent-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes agent-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* ── Error state ─────────────────────────────────────────── */
.agent-error {
    font-size: 0.78rem;
    color: #dc2626;
    padding: 0.35rem 0.5rem;
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.18);
    border-radius: 6px;
}

body.dark-mode .agent-error {
    color: #f87171;
    background: rgba(239,68,68,0.08);
}

/* ── END Phase 7 ─────────────────────────────────────────── */

/* ── Phase 9: Hide redundant top tab bar — rail is sole nav ── */
#main-tabs {
    display: none !important;
}

/* ── Inline chart containers — flush, no border box ── */
.chart-inline {
    position: relative;
    width: 100%;
    overflow: visible;
}
.chart-inline svg {
    overflow: visible;
}

/* ── Phase 11: Click-to-Detail Inline Panels ──────────────────── */
.detail-panel-inline {
    border-top: 2px solid rgba(14,165,165,0.18);
    padding: 0.75rem 0 0;
    margin-top: 0.75rem;
    animation: fadeSlideIn 0.2s ease;
}
.detail-panel-inline .hint-text {
    font-size: 11px;
    color: var(--text-muted);
}
.hint-text {
    font-size: 11px;
    color: var(--text-muted);
}
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.detail-panel-inline .accordion-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}
.detail-panel-inline .accordion-body {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
}
.detail-panel-inline .badge {
    font-size: 0.72rem;
}
.disease-inline-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.disease-inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.55rem;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.16);
}
body.dark-mode .disease-inline-row {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(100, 116, 139, 0.35);
}
.click-highlight-ring {
    stroke: #0d6efd;
    stroke-width: 2;
}
.flash-highlight {
    animation: flashRow 0.6s ease;
}
@keyframes flashRow {
    0%   { background-color: rgba(14,165,165,0.3); }
    100% { background-color: transparent; }
}

/* ── Cell Specificity: flat grouped list (no accordion) ──────────── */
.cellspec-group-list {
    max-height: 420px;
    overflow-y: auto;
}
.cellspec-group .list-group-item {
    background: transparent;
    border-left: none;
    border-right: none;
    font-size: 0.82rem;
}
.cellspec-group .list-group-item:first-child { border-top: none; }

/* ── D3 chart SVG: theme-aware colours, no JS needed ─────────────── */
/* All SVG text inside .chart-inline inherits theme colour.
   JS must NOT set fill on text elements — let CSS handle it. */
.chart-inline svg text,
.detail-panel-inline svg text {
    fill: #1e293b;
    font-family: inherit;
}
body.dark-mode .chart-inline svg text,
body.dark-mode .detail-panel-inline svg text {
    fill: #e2e8f0;
}
/* Muted text (class="muted-label") */
.chart-inline svg text.muted-label,
.detail-panel-inline svg text.muted-label {
    fill: #64748b;
}
body.dark-mode .chart-inline svg text.muted-label,
body.dark-mode .detail-panel-inline svg text.muted-label {
    fill: #94a3b8;
}
/* Axis domain lines and ticks */
.chart-inline svg .domain,
.chart-inline svg .tick line,
.detail-panel-inline svg .domain,
.detail-panel-inline svg .tick line {
    stroke: #e2e8f0;
}
body.dark-mode .chart-inline svg .domain,
body.dark-mode .chart-inline svg .tick line,
body.dark-mode .detail-panel-inline svg .domain,
body.dark-mode .detail-panel-inline svg .tick line {
    stroke: #334155;
}
/* Grid lines */
.chart-inline svg line.grid {
    stroke: #e2e8f0;
}
body.dark-mode .chart-inline svg line.grid {
    stroke: #334155;
}
/* Minimum readable font size for chart labels */
.chart-inline svg text { font-size: 11px; }
.chart-inline svg text.axis-label { font-size: 10px; fill: #64748b; }
body.dark-mode .chart-inline svg text.axis-label { fill: #94a3b8; }
.chart-inline svg text.tick-label { font-size: 10px; }
.chart-inline svg text.legend-label { font-size: 9px; fill: #64748b; }
body.dark-mode .chart-inline svg text.legend-label { fill: #94a3b8; }

.analysis-legend {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: color-mix(in srgb, var(--panel-bg) 94%, var(--primary-color) 6%);
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.65rem;
}

.analysis-legend__title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.analysis-legend__copy {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.analysis-legend__items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.7rem;
}

.analysis-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.73rem;
    color: var(--text-color);
    line-height: 1.1;
}

.analysis-legend__swatch {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    font-size: 0.67rem;
    font-weight: 700;
    color: #fff;
    background: #64748b;
    flex-shrink: 0;
}

.analysis-legend__swatch--dot {
    border-radius: 999px;
}

.analysis-legend__swatch--source {
    border-radius: 999px;
    border-color: rgba(255, 255, 255, 0.25);
}

.analysis-legend__swatch--line {
    width: 1.2rem;
    height: 0.3rem;
    border-radius: 999px;
}

.analysis-legend__swatch--gradient {
    width: 1.2rem;
    background: linear-gradient(90deg, #94a3b8, #0d9488);
}

.analysis-legend__swatch--gradient-direct {
    background: linear-gradient(90deg, #94a3b8, #0d9488);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.analysis-legend__swatch--ring {
    background: transparent;
    border-style: dashed;
    border-width: 2px;
    border-color: #f59e0b;
}

.analysis-legend__swatch--selected {
    background: color-mix(in srgb, #0ea5e9 18%, #ffffff 82%);
    border: 2px solid #0ea5e9;
}

.analysis-legend__swatch--star {
    background: rgba(148, 163, 184, 0.12);
    color: #334155;
    border-color: rgba(148, 163, 184, 0.4);
}

body.dark-mode .analysis-legend__swatch--star {
    color: #cbd5e1;
}

.analysis-legend__swatch--size {
    border-radius: 4px;
    width: 1.2rem;
    height: 1rem;
    background:
        radial-gradient(circle at 30% 70%, rgba(148, 163, 184, 0.72) 0 28%, transparent 30%),
        radial-gradient(circle at 52% 58%, rgba(148, 163, 184, 0.82) 0 38%, transparent 40%),
        radial-gradient(circle at 76% 42%, rgba(148, 163, 184, 0.95) 0 48%, transparent 50%);
}

.pathway-chart-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}
.pathway-chart-legend__copy {
    font-size: 0.76rem;
    color: var(--text-muted);
}
.pathway-chart-legend__items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.pathway-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    padding: 0.28rem 0.55rem 0.28rem 0.3rem;
    background: rgba(148, 163, 184, 0.06);
    font-size: 0.74rem;
    line-height: 1;
}
.pathway-legend-chip__swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: var(--pathway-source-color, #64748b);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.pathway-legend-chip__count {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.pathway-source-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
}
.pathway-source-card {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-left: 4px solid var(--pathway-source-color, rgba(148, 163, 184, 0.4));
    border-radius: 0.75rem;
    padding: 0.7rem 0.8rem;
    background: rgba(148, 163, 184, 0.06);
}
body.dark-mode .pathway-source-card {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(148, 163, 184, 0.2);
}
.pathway-source-card__title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}
.pathway-source-card__dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    background: var(--pathway-source-color, #64748b);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
}
.pathway-source-card__meta {
    font-size: 0.76rem;
    color: var(--text-muted);
}
.pathway-score-table-wrap .detail-panel-inline {
    margin-top: 0;
}
.pathway-score-table {
    font-size: 0.82rem;
}
.pathway-score-table th {
    white-space: nowrap;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted);
}
.pathway-score-table td {
    vertical-align: top;
}
.pathway-score-link {
    font-size: 0.84rem;
    font-weight: 600;
    text-align: left;
}
.pathway-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.16rem 0.48rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--pathway-source-color, #64748b) 14%, transparent);
    color: inherit;
    border: 1px solid color-mix(in srgb, var(--pathway-source-color, #64748b) 32%, transparent);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.pathway-source-badge::before {
    content: '';
    width: 0.46rem;
    height: 0.46rem;
    border-radius: 999px;
    background: var(--pathway-source-color, #64748b);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
}
.pathway-score-row .small {
    max-width: 34rem;
}

/* ── Node-level pathway list (plist) controls ─────────────────────── */
.plist-controls { padding: 0 0.25rem; }
.plist-source-chip { font-size: 0.72rem; transition: opacity 0.15s; }
.plist-source-chip:not(.active) { opacity: 0.38; }
.plist-count-label { font-size: 0.72rem; color: var(--bs-secondary-color, #6c757d); }
.plist-row-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 20rem;
}
.plist-count-badge {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 1.6rem;
    text-align: center;
    border-radius: 999px;
}

/* ── Combined Location tab section headers ────────────────────────── */
.loc-section-header { border-top: 1px solid var(--border-color); padding-top: 0.75rem; }
.loc-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.tab-export-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.tab-export-btn {
    white-space: nowrap;
}

/* ── HPA Subcellular chips ────────────────────────────────────────── */
.loc-hpa-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.25rem 0;
}
.loc-hpa-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.2rem 0.6rem 0.2rem 0.25rem;
    font-size: 0.78rem;
}
.loc-hpa-cat {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}
.loc-hpa-name {
    color: var(--text-color);
    font-weight: 500;
}
