/* ============================================================
   Star Atom — Frosted Glass Theme
   Inspired by early macOS Aqua + Obsidian navigation
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Panels */
    --glass-bg: #ffffff;
    --glass-bg-solid: #f8f9fb;
    --glass-rail: #eef1f5;
    --glass-sidebar: #f3f5f8;
    --glass-blur: 0px;

    /* Surfaces */
    --bg-body: #ebeef2;
    --bg-content: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.03);
    --bg-active: rgba(0, 0, 0, 0.06);
    --bg-selected: rgba(56, 152, 224, 0.10);
    --bg-secondary: var(--glass-bg-solid);

    /* Borders & shadows */
    --border: rgba(0, 0, 0, 0.07);
    --border-strong: rgba(0, 0, 0, 0.13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.09);

    /* Text */
    --text: #1a1d24;
    --text-primary: #1a1d24;
    --text-secondary: #5f6b7a;
    --text-tertiary: #99a4b2;
    --text-inverse: #ffffff;

    /* Accent */
    --accent: #3898e0;
    --accent-hover: #2b7ec0;
    --accent-light: rgba(56, 152, 224, 0.10);
    --timeline-active: #c0d4e2;

    /* Rail */
    --rail-gradient: linear-gradient(180deg, #4da8e8 0%, #3a8ed4 40%, #2d78be 100%);
    --rail-text: rgba(255, 255, 255, 0.7);
    --rail-text-active: #ffffff;
    --rail-hover-bg: rgba(255, 255, 255, 0.15);
    --rail-active-bg: rgba(255, 255, 255, 0.2);

    /* Entity colors */
    --color-firm: #3a7fc7;
    --color-strategy: #6e5bb8;
    --color-vehicle: #4898c0;
    --color-person: #3d8a60;
    --color-note: #7e8a96;
    --color-material: #8868a8;
    --color-extraction: #2e9088;

    /* Layout */
    --rail-w: 44px;
    --sidebar-w: 220px;
    --context-w: 190px;

    /* Charts */
    --chart-line: #2a2a2a;
    --chart-line-pos: #2d7a4f;
    --chart-line-neg: #b04040;
    --chart-grid: rgba(0, 0, 0, 0.06);
    --chart-crosshair: rgba(0, 0, 0, 0.25);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --radius: 2px;
    --radius-sm: 1px;
    --transition: 80ms ease;
}

/* ---- Theme: Navy & Sand ---- */
[data-theme="navy-sand"] {
    --glass-bg: #faf8f5;
    --glass-bg-solid: #f5f2ed;
    --glass-rail: #f0ece6;
    --glass-sidebar: #f5f2ed;
    --bg-body: #ece8e1;
    --bg-content: #faf8f5;
    --bg-hover: rgba(0, 0, 0, 0.03);
    --bg-active: rgba(0, 0, 0, 0.06);
    --bg-selected: rgba(30, 58, 95, 0.08);
    --bg-secondary: #f5f2ed;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.14);
    --text: #2c3040;
    --text-primary: #2c3040;
    --text-secondary: #5e6272;
    --text-tertiary: #8e9099;
    --accent: #1e3a5f;
    --accent-hover: #15304f;
    --accent-light: rgba(30, 58, 95, 0.08);
    --timeline-active: #2a5a8a;
    --rail-gradient: linear-gradient(180deg, #2a4a70 0%, #1e3a5f 40%, #152d4a 100%);
    --color-firm: #1e3a5f;
    --color-strategy: #5a4b8a;
    --color-vehicle: #3a7080;
    --color-person: #4a7a5a;
    --color-note: #7a7060;
    --color-material: #705888;
    --color-extraction: #2a7a6a;
}

/* ---- Theme: Slate ---- */
[data-theme="slate"] {
    --glass-bg: #f4f5f7;
    --glass-bg-solid: #eceef1;
    --glass-rail: #e4e6ea;
    --glass-sidebar: #eceef1;
    --bg-body: #dfe1e6;
    --bg-content: #f4f5f7;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(0, 0, 0, 0.07);
    --bg-selected: rgba(80, 95, 120, 0.10);
    --bg-secondary: #eceef1;
    --border: rgba(0, 0, 0, 0.09);
    --border-strong: rgba(0, 0, 0, 0.15);
    --text: #1c2433;
    --text-primary: #1c2433;
    --text-secondary: #4a5568;
    --text-tertiary: #8492a6;
    --accent: #505f78;
    --accent-hover: #3d4d66;
    --accent-light: rgba(80, 95, 120, 0.10);
    --timeline-active: #5a7090;
    --rail-gradient: linear-gradient(180deg, #5a6a80 0%, #4a5a70 40%, #3a4a60 100%);
    --color-firm: #4a6080;
    --color-strategy: #605088;
    --color-vehicle: #407080;
    --color-person: #407050;
    --color-note: #606870;
    --color-material: #685888;
    --color-extraction: #307068;
}

/* ---- Theme: Midnight ---- */
[data-theme="midnight"] {
    --glass-bg: #1e2028;
    --glass-bg-solid: #252830;
    --glass-rail: #1a1c24;
    --glass-sidebar: #22242c;
    --bg-body: #16181e;
    --bg-content: #1e2028;
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(255, 255, 255, 0.07);
    --bg-selected: rgba(100, 160, 220, 0.12);
    --bg-secondary: #252830;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
    --text: #d8dce4;
    --text-primary: #d8dce4;
    --text-secondary: #8a90a0;
    --text-tertiary: #5a6070;
    --text-inverse: #1a1d24;
    --accent: #64a0dc;
    --accent-hover: #7ab0e8;
    --accent-light: rgba(100, 160, 220, 0.12);
    --timeline-active: #5090c8;
    --rail-gradient: linear-gradient(180deg, #2a3040 0%, #1e2430 40%, #161a24 100%);
    --rail-text: rgba(255, 255, 255, 0.5);
    --rail-hover-bg: rgba(255, 255, 255, 0.08);
    --rail-active-bg: rgba(255, 255, 255, 0.12);
    --color-firm: #5090c0;
    --color-strategy: #7868b0;
    --color-vehicle: #5898b0;
    --color-person: #4d9a70;
    --color-note: #7888a0;
    --color-material: #8878b0;
    --color-extraction: #3ea098;
    --chart-line: #a0b0c8;
    --chart-line-pos: #4db87a;
    --chart-line-neg: #d06060;
    --chart-grid: rgba(255, 255, 255, 0.06);
    --chart-crosshair: rgba(255, 255, 255, 0.25);
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%; width: 100%;
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.35;
    color: var(--text);
    background: var(--bg-body);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.006em;
}

/* ---- Layout Grid ---- */
#app {
    display: grid;
    grid-template-columns: var(--rail-w) var(--sidebar-w) 1fr var(--context-w);
    grid-template-rows: 1fr;
    height: 100vh;
    width: 100vw;
}

#app.context-hidden {
    grid-template-columns: var(--rail-w) var(--sidebar-w) 1fr 0px;
}
#app.context-hidden #context-panel { display: none; }

/* ---- Icon Rail ---- */
#rail {
    background: var(--rail-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 2px;
}

.rail-logo {
    width: 28px; height: 28px;
    margin-bottom: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 18px;
    opacity: 0.95;
}

.rail-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: transparent;
    color: var(--rail-text);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.rail-btn:hover {
    background: var(--rail-hover-bg);
    color: var(--rail-text-active);
}
.rail-btn.active {
    background: var(--rail-active-bg);
    color: var(--rail-text-active);
}

.rail-spacer { flex: 1; }

/* ---- Material Icons ---- */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-size: 20px;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

/* ---- Left Sidebar ---- */
#sidebar {
    background: var(--glass-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border-right: 1px solid var(--border);
}

.sidebar-header {
    padding: 10px 12px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    user-select: none;
}

.sidebar-search {
    margin: 4px 8px 6px;
    padding: 5px 8px 5px 26px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 11px;
    font-family: var(--font-sans);
    outline: none;
    width: calc(100% - 16px);
    transition: border-color var(--transition), background var(--transition);
}
.sidebar-search:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.6);
}
.sidebar-search::placeholder { color: var(--text-tertiary); }

.sidebar-search-wrap {
    position: relative;
}
.sidebar-search-wrap .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 8px;
}

/* ---- Sidebar Tree Items ---- */
.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 0;
    cursor: pointer;
    font-size: 12px;
    color: var(--text);
    transition: background var(--transition);
    gap: 5px;
    user-select: none;
}
.tree-item:hover { background: var(--bg-hover); }
.tree-item.active { background: var(--bg-selected); color: var(--accent); }



.tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-meta {
    font-size: 10px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    letter-spacing: 0;
}


.tree-count {
    display: none;
}

/* ---- Main Content Area ---- */
#main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-content);
    box-shadow: var(--shadow-sm);
}

/* Tab bar — tabs shrink to fit */
#tab-bar {
    display: flex;
    align-items: flex-end;
    background: var(--glass-rail);
    min-height: 34px;
    padding: 4px 0 0 0;
    overflow: hidden;
    gap: 0;
    position: relative;
}

.tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px 5px;
    font-size: 11px;
    font-weight: 450;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--transition), background var(--transition);
    min-width: 0;
    max-width: 180px;
    flex-shrink: 1;
    overflow: hidden;
    border-radius: 3px 3px 0 0;
    background: transparent;
    position: relative;
}
.tab span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
}
.tab.active {
    color: var(--text);
    background: var(--bg-content);
    font-weight: 500;
    flex-shrink: 0;
    z-index: 1;
}
/* Sigmoid curves on active tab */
.tab.active::before,
.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 8px;
    height: 8px;
    pointer-events: none;
}
.tab.active::before {
    left: -8px;
    background: radial-gradient(circle at 0 0, transparent 8px, var(--bg-content) 8px);
}
.tab.active::after {
    right: -8px;
    background: radial-gradient(circle at 100% 0, transparent 8px, var(--bg-content) 8px);
}

.tab-dot {
    display: none;
}

.tab-close {
    width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    color: var(--text-tertiary);
    border: none; background: none; cursor: pointer;
    border-radius: 3px;
    line-height: 1;
    opacity: 0;
    flex-shrink: 0;
    transition: opacity var(--transition);
}
.tab:hover .tab-close { opacity: 1; }
.tab-close:hover { background: var(--bg-hover); color: var(--text); }

/* Tab overflow dropdown */
.tab-overflow-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: none; background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 18px;
    flex-shrink: 0;
    margin-left: auto;
    margin-bottom: 1px;
}
.tab-overflow-btn:hover { background: var(--bg-hover); color: var(--text); }
.tab-overflow-btn.visible { display: flex; }

.tab-dropdown {
    position: absolute;
    top: 100%;
    right: 4px;
    background: var(--bg-content);
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    max-width: 320px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    padding: 4px;
    display: none;
}
.tab-dropdown.open { display: block; }
.tab-dropdown-search {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    font-family: var(--font-sans);
    margin-bottom: 4px;
    outline: none;
}
.tab-dropdown-search:focus { border-color: var(--accent); }
.tab-dropdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tab-dropdown-item:hover { background: var(--bg-hover); color: var(--text); }
.tab-dropdown-item.active { color: var(--accent); font-weight: 500; }

/* Content pane */
#content {
    flex: 1;
    overflow: auto;
    padding: 0;
}

/* ---- Right Context Panel ---- */
#context-panel {
    background: var(--glass-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.context-header {
    padding: 10px 10px 6px;
}

.context-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.context-sections {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.context-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 0;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    user-select: none;
}
.context-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.context-item.active {
    background: var(--bg-selected);
    color: var(--accent);
}

.context-item-icon {
    font-size: 15px;
    flex-shrink: 0;
    opacity: 0.7;
}
.context-item.active .context-item-icon {
    opacity: 1;
}

.context-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 14px;
}

.context-tools {
    padding: 0 6px 12px;
}
.context-tools.has-strategies {
    min-height: 120px;
    max-height: 180px;
    overflow-y: auto;
}

.context-tools-label {
    padding: 6px 10px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    user-select: none;
}

/* ---- Strategy Selector in Sidebar ---- */
.context-strategy-item.active {
    color: var(--color-strategy);
}
.context-strategy-item.active .context-item-icon {
    color: var(--color-strategy);
}
.context-strategy-item.disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
}

/* ---- Context Documents Table ---- */
.context-doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}
.context-doc-table thead th {
    text-align: left;
    padding: 2px 6px;
    font-weight: 600;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.context-doc-table thead th:hover {
    color: var(--text-primary);
}
.context-doc-table thead th.sort-asc::after { content: ' \25B4'; }
.context-doc-table thead th.sort-desc::after { content: ' \25BE'; }
.context-doc-table tbody tr {
    cursor: pointer;
    transition: background var(--transition);
}
.context-doc-table tbody tr:hover {
    background: var(--bg-hover);
}
.context-doc-table td {
    padding: 3px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-title-cell {
    max-width: 120px;
    font-weight: 500;
}
.doc-type-cell {
    color: var(--text-secondary);
    font-size: 9px;
}
.doc-date-cell {
    color: var(--text-tertiary);
    font-size: 9px;
    text-align: right;
}
.context-docs {
    padding: 0 4px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
}

/* ---- Entity Detail Card ---- */
.entity-detail {
    max-width: 720px;
    margin: 10px auto;
    padding: 0 16px;
}

.entity-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.entity-detail-header .dot {
    display: none;
}

.entity-detail-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.entity-detail-header .type-badge {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 10px;
    border-radius: 2px;
}

/* Property rows */
.entity-props {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1px 0;
    margin-bottom: 16px;
}

.entity-prop-key {
    padding: 2px 8px 2px 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.entity-prop-val {
    padding: 2px 0;
    font-size: 11px;
    color: var(--text);
    font-family: var(--font-sans);
}

.entity-prop-val.mono {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

/* ---- Section Wrap (main pane section content) ---- */
.section-wrap {
    max-width: 900px;
    margin: 10px auto;
    padding: 0 16px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.section-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.015em;
}

.section-count {
    display: none;
}

.section-subheader {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 14px 0 6px;
    letter-spacing: -0.01em;
}

.section-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
}

.pending-section {
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}
.pending-toggle .section-count {
    display: inline-block;
    font-size: 11px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0 6px;
    min-width: 18px;
    text-align: center;
}
tr.reidentifying {
    opacity: 0.7;
    animation: reidentify-pulse 1.5s ease-in-out infinite;
}
@keyframes reidentify-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.4; }
}

.section-error {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #b04040;
}

.section-action-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.section-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ---- Entity Card Grid (Team, Strategies, Vehicles) ---- */
.entity-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.entity-card {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
}
.entity-card:hover {
    background: var(--bg-hover);
    box-shadow: var(--shadow-sm);
}

.entity-card-name {
    flex: 1;
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-card-meta {
    font-size: 10px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    margin-left: 6px;
}

.entity-card-title-tag {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-right: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ---- Materials List ---- */
.materials-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.material-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    cursor: pointer;
    transition: background var(--transition);
}
.material-card:hover {
    background: var(--bg-hover);
}

.material-card-icon {
    font-size: 18px;
    color: var(--color-material);
    flex-shrink: 0;
}

.material-card-body {
    flex: 1;
    min-width: 0;
}

.material-card-title {
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.material-card-meta {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.material-view-btn {
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
}
.material-view-btn:hover {
    color: var(--accent);
    background: var(--accent-light);
}

/* ---- Notes List ---- */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.note-card {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    cursor: pointer;
    transition: background var(--transition);
}
.note-card:hover {
    background: var(--bg-hover);
}

.note-card-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.note-card-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.note-card-meta {
    margin-top: 6px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* ---- PDF Viewer ---- */
.pdf-viewer-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
}

.pdf-viewer-iframe {
    width: 100%;
    flex: 1;
    border: none;
    min-height: 0;
    background: var(--bg-body);
}

/* ---- Empty / placeholder states ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
    gap: 8px;
}
.empty-state .icon {
    font-size: 48px;
    opacity: 0.25;
    color: var(--text-secondary);
}
.empty-state .label { font-size: 14px; font-weight: 400; }

/* ---- Tables ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--glass-bg-solid);
    padding: 4px 8px;
    text-align: left;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 1px 8px;
    color: var(--text);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr.stripe { background: rgba(0, 0, 0, 0.015); }
.data-table tbody tr.stripe:hover { background: var(--bg-hover); }
.data-table thead th.sort-asc::after { content: ' \25B4'; }
.data-table thead th.sort-desc::after { content: ' \25BE'; }

/* ---- Entity type badges ---- */
.entity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.entity-badge.firm { background: rgba(58, 127, 199, 0.12); color: var(--color-firm); }
.entity-badge.strategy { background: rgba(110, 91, 184, 0.12); color: var(--color-strategy); }
.entity-badge.vehicle { background: rgba(72, 152, 192, 0.12); color: var(--color-vehicle); }
.entity-badge.person { background: rgba(61, 138, 96, 0.12); color: var(--color-person); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* ---- Loading spinner ---- */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Sidebar section labels ---- */
.sidebar-section-label {
    padding: 8px 10px 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    user-select: none;
}

/* ---- Upload View ---- */
.upload-view {
    max-width: 640px;
    margin: 20px auto;
    padding: 0 20px;
}

.upload-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.015);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-icon {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}
.upload-drop-zone:hover .upload-icon,
.upload-drop-zone.drag-over .upload-icon {
    color: var(--accent);
}

.upload-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.upload-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 16px;
}

.upload-browse-btn {
    display: inline-block;
    padding: 7px 20px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}
.upload-browse-btn:hover { background: var(--accent-hover); }

/* Upload progress cards */
.upload-card {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--glass-bg-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.upload-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.upload-card-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-card-status {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
}

.upload-card-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.upload-card-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
}
.upload-card-fill.pulsing {
    animation: pulse-bar 1.5s ease-in-out infinite;
}
@keyframes pulse-bar {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.upload-card-summary {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}
.upload-retry-btn {
    margin-top: 6px;
    font-size: 11px;
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-content);
    color: var(--text-primary);
    cursor: pointer;
}
.upload-retry-btn:hover { background: var(--bg-hover); }

/* Usage bar */
.usage-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius);
    font-size: 11px;
    color: var(--text-secondary);
}

.usage-cost {
    font-weight: 600;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

/* ---- Data sections ---- */
.data-section {
    margin-bottom: 24px;
}

.table-scroll {
    overflow-x: auto;
    margin-top: 4px;
}

/* Returns year×month grid */
.returns-grid {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.returns-grid th {
    font-family: var(--font-sans);
    text-align: center;
    padding: 3px 4px;
}
.returns-grid td {
    text-align: center;
    padding: 2px 4px;
    min-width: 38px;
}
.returns-grid td.year-label {
    text-align: left;
    font-weight: 600;
    font-family: var(--font-sans);
    font-size: 11px;
    color: var(--text-secondary);
    padding-right: 8px;
}
.returns-grid td.ytd {
    font-weight: 600;
}

/* Positive / negative coloring — muted, not screaming */
td.positive { color: #2d7a4f; }
td.negative { color: #b04040; }

/* Returns cumulative chart */
.returns-chart {
    margin-bottom: 12px;
    padding: 6px 0;
}
.returns-chart-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}
.returns-chart-label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}
.returns-chart-value {
    font-size: 12px;
    font-weight: 600;
}
.chart-hover-info {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: auto;
}

/* Compact data tables (exposures, attributions, positions) */
.data-table.compact {
    font-size: 11px;
}
.data-table.compact td {
    padding: 1px 6px;
}

/* ---- Grouped table rows ---- */
.group-expand-link {
    font-size: 11px;
    color: var(--accent, #5b8dd9);
    cursor: pointer;
    white-space: nowrap;
}
.group-expand-link:hover { text-decoration: underline; }
.group-detail-cell { padding: 2px 0 6px 20px !important; border-bottom: none !important; }
.group-detail-wrap { background: none !important; }
.group-detail-wrap.stripe { background: none !important; }
.group-sub-table { margin: 0; }
.group-sub-table thead th {
    font-size: 10px;
    color: var(--text-tertiary);
    padding: 2px 6px;
    border-bottom: 1px solid var(--border-subtle);
}

/* ---- Column filter dropdowns ---- */
.col-filterable { position: relative; white-space: nowrap; }
.col-filter-icon {
    display: inline-block;
    font-size: 10px;
    color: var(--text-tertiary);
    cursor: pointer;
    margin-left: 4px;
    padding: 2px 4px;
    opacity: 0.6;
    vertical-align: middle;
    border-radius: 3px;
}
.col-filter-icon:hover, .col-filter-icon.active {
    opacity: 1;
    color: var(--accent, #5b8dd9);
    background: var(--bg-hover, rgba(0,0,0,0.04));
}
.col-filter-dropdown {
    position: fixed;
    z-index: 1000;
    background: var(--glass-bg-solid, #fff);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 6px;
    min-width: 160px;
    max-width: 260px;
    font-size: 11px;
}
.col-filter-search {
    width: 100%;
    box-sizing: border-box;
    padding: 3px 6px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    margin-bottom: 4px;
}
.col-filter-search:focus { border-color: var(--accent); }
.col-filter-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    padding: 0 2px;
}
.col-filter-action {
    font-size: 10px;
    color: var(--accent, #5b8dd9);
    cursor: pointer;
}
.col-filter-action:hover { text-decoration: underline; }
.col-filter-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 6px;
}
.col-filter-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 1px 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.col-filter-option:hover { background: var(--bg-hover); }
.col-filter-option input { margin: 0; flex-shrink: 0; }
.col-filter-apply {
    width: 100%;
    padding: 3px 0;
    font-size: 11px;
    background: var(--accent, #5b8dd9);
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
.col-filter-apply:hover { opacity: 0.9; }

/* ---- Resize handles ---- */
.resize-handle {
    position: absolute;
    top: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}
.resize-handle:hover,
.resize-handle.dragging {
    background: var(--accent);
    opacity: 0.3;
}
.resize-handle.right { right: 0; }
.resize-handle.left { left: 0; }

/* ---- Command Palette / Quick Switcher ---- */
#palette-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}
#palette-overlay.visible { display: block; }

.palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(2px);
}

.palette-container {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    width: 520px;
    max-width: 90vw;
    background: var(--bg-content);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    animation: palette-in 100ms ease;
}

@keyframes palette-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.palette-input {
    width: 100%;
    padding: 14px 18px;
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 400;
    color: var(--text);
    background: transparent;
    letter-spacing: -0.01em;
}
.palette-input::placeholder { color: var(--text-tertiary); }

.palette-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 6px 6px;
    border-top: 1px solid var(--border);
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background 60ms;
}
.palette-item:hover,
.palette-item.selected {
    background: var(--bg-hover);
}

.palette-item-icon {
    font-size: 18px;
    color: var(--text-tertiary);
    width: 20px;
    text-align: center;
}

.palette-dot {
    display: none;
}

.palette-item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.palette-item-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: capitalize;
}

.palette-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ---- Note Editor (Obsidian-style with edit/lock toggle) ---- */
.note-editor {
    margin-top: 4px;
}

.note-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.note-tag {
    display: inline-block;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 2px;
    letter-spacing: 0.02em;
}

.note-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.note-toggle-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
}
.note-toggle-btn.editing {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}
.note-toggle-btn .material-symbols-outlined {
    font-size: 16px;
}

.note-rendered {
    min-height: 120px;
    padding: 4px 0;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text);
}

.note-rendered h1 { font-size: 22px; font-weight: 600; margin: 16px 0 8px; letter-spacing: -0.02em; }
.note-rendered h2 { font-size: 18px; font-weight: 600; margin: 14px 0 6px; letter-spacing: -0.015em; }
.note-rendered h3 { font-size: 15px; font-weight: 600; margin: 12px 0 4px; }
.note-rendered p { margin: 4px 0; }
.note-rendered ul { margin: 4px 0 4px 20px; }
.note-rendered li { margin: 2px 0; }
.note-rendered blockquote {
    border-left: 3px solid var(--border-strong);
    padding: 2px 0 2px 14px;
    color: var(--text-secondary);
    margin: 8px 0;
}
.note-rendered a { color: var(--accent); text-decoration: none; }
.note-rendered a:hover { text-decoration: underline; }
.note-rendered strong { font-weight: 600; }
.note-rendered mark {
    background: rgba(56, 152, 224, 0.18);
    color: var(--text);
    padding: 1px 2px;
    border-radius: 2px;
}

/* Structured transcript */
.transcript-container .note-rendered { font-size: 13px; line-height: 1.5; }
.transcript-container .note-rendered p { margin: 6px 0; }
.transcript-prose { margin: 0 0 14px; }
.transcript-prose.highlight-chunk { background: var(--accent-bg, rgba(255,200,50,0.12)); border-left: 3px solid var(--accent, #e8a820); padding: 8px 12px; border-radius: 4px; }
.transcript-prose + .transcript-prose,
.transcript-prose + .transcript-table-block { margin-top: 14px; }
.transcript-toc {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    padding: 6px 8px;
    background: var(--bg-content);
    border-bottom: 1px solid var(--border);
}
.transcript-toc-label {
    font-size: 9px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-tertiary);
    margin-right: 4px;
}
.transcript-toc-link {
    font-size: 11px; padding: 2px 8px; border-radius: 10px;
    border: 1px solid var(--border); color: var(--text-secondary);
    background: transparent; cursor: pointer; white-space: nowrap;
    transition: all 0.15s;
}
.transcript-toc-link:hover {
    border-color: var(--accent); color: var(--accent);
    background: var(--bg-selected);
}
.transcript-section-heading {
    font-size: 15px; font-weight: 600; letter-spacing: -0.02em;
    margin: 20px 0 6px; padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--text);
}
.transcript-section-heading:first-of-type { border-top: none; margin-top: 4px; padding-top: 0; }
.transcript-table-block {
    background: var(--glass-bg-solid); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px; margin: 10px 0;
}
.transcript-table-cat-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-tertiary);
    margin: 10px 0 4px;
}
.transcript-table-cat-label:first-child { margin-top: 0; }

.note-placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

.note-textarea {
    width: 100%;
    min-height: 200px;
    padding: 8px 2px;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text);
    background: transparent;
    letter-spacing: -0.01em;
}

.note-status {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 4px 0;
    min-height: 20px;
    transition: color 0.2s;
}

.note-code-block {
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text);
}

.note-inline-code {
    background: rgba(0, 0, 0, 0.05);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.note-wikilink {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px dashed var(--accent);
    padding-bottom: 0px;
}
.note-wikilink:hover {
    border-bottom-style: solid;
}

/* ---- Hierarchy Chart (firm overview) ---- */
.hierarchy-chart {
    padding: 16px 20px;
    margin-bottom: 4px;
}
.hier-root {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}
.hier-node {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-content);
    white-space: nowrap;
}
.hier-firm {
    font-size: 13px;
    font-weight: 600;
    border-color: var(--color-firm);
    color: var(--color-firm);
}
.hier-strategy { border-color: var(--color-strategy); color: var(--color-strategy); }
.hier-vehicle { border-color: var(--color-vehicle); color: var(--color-vehicle); }
.hier-person { border-color: var(--color-person); color: var(--color-person); }
.hier-group { border-color: var(--text-tertiary); color: var(--text-secondary); }

.hier-branches {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 16px;
    margin-top: 2px;
}
.hier-branch {
    display: flex;
    align-items: flex-start;
    gap: 0;
    flex-direction: column;
}
.hier-branch > .hier-node {
    margin-left: 16px;
}
.hier-connector {
    width: 16px;
    height: 14px;
    border-left: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border-strong);
    border-radius: 0 0 0 4px;
    margin-left: 0;
    flex-shrink: 0;
    align-self: flex-start;
}
.hier-branch {
    position: relative;
}
.hier-branch > .hier-connector {
    position: absolute;
    top: 0;
    left: 0;
}
.hier-branch > .hier-node {
    margin-top: 2px;
}
.hier-children {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-left: 32px;
    margin-top: 1px;
}
.hier-child {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}
.hier-connector-h {
    width: 12px;
    border-top: 1px solid var(--border-strong);
    flex-shrink: 0;
}
.hier-subtitle {
    font-weight: 400;
    font-size: 10px;
    color: var(--text-tertiary);
    margin-left: 4px;
}

/* ---- Firm Overview Dashboard ---- */
.firm-overview {
    max-width: 800px;
    margin: 0 auto;
    padding: 6px 16px 24px;
}
.firm-overview .hierarchy-chart {
    padding: 8px 0;
    margin-bottom: 0;
}
.firm-overview .entity-detail {
    margin: 0;
    padding: 0;
    max-width: none;
}
.firm-top-row {
    display: flex;
    gap: 0;
    align-items: flex-start;
}
.firm-top-detail {
    flex: 0 1 auto;
    min-width: 0;
}
.firm-top-team {
    flex-shrink: 0;
    padding-top: 28px;
    margin-left: 32px;
    border-left: 1px solid var(--border);
    padding-left: 16px;
}
.firm-top-team .entity-props {
    grid-template-columns: auto 1fr;
}
.firm-top-desc {
    flex: 1 1 0;
    min-width: 0;
    padding-top: 28px;
    margin-left: 24px;
    border-left: 1px solid var(--border);
    padding-left: 16px;
}
.firm-desc-text {
    font-size: 11px;
    line-height: 1.55;
    color: var(--text-secondary);
    max-width: 340px;
}
.overview-section {
    margin-top: 14px;
    padding-top: 0;
}
.overview-section .section-header {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 0;
}
.overview-section .section-header::before {
    content: '';
    width: 16px;
    height: 1px;
    background: var(--border);
    flex-shrink: 0;
}
.overview-section .section-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.overview-section .section-header h2 {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    white-space: nowrap;
    padding: 0 6px;
    font-family: 'Inter', -apple-system, sans-serif;
    font-stretch: condensed;
}
.overview-section .entity-card-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.overview-section .entity-card {
    padding: 4px 0;
    background: none;
    border-radius: 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.overview-section .entity-card:hover {
    background: none;
    box-shadow: none;
    color: var(--accent);
}
.overview-section .entity-card:last-child {
    border-bottom: none;
}
.overview-section .materials-list {
    gap: 0;
}
.overview-section .material-card {
    background: none;
    border-radius: 0;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.overview-section .material-card:hover { background: none; }
.overview-section .material-card:last-child { border-bottom: none; }
.overview-returns-row {
    display: flex;
    gap: 1px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.overview-return-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3px 6px;
    border-radius: 0;
    background: none;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    min-width: 38px;
    border-right: 1px solid var(--border);
}
.overview-return-cell:last-child { border-right: none; }
.overview-return-cell.positive { color: #2d7a4f; }
.overview-return-cell.negative { color: #b04040; }
.overview-return-month {
    font-size: 9px;
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---- Collapsible Sidebar Sections ---- */
.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 6px 3px;
    cursor: pointer;
    user-select: none;
}
.sidebar-section-header:hover {
    background: var(--bg-hover);
}
.sidebar-section-chevron {
    font-size: 16px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}
.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    flex: 1;
}
.sidebar-section-count {
    font-size: 9px;
    color: var(--text-tertiary);
    padding-right: 4px;
}

/* ---- PDF Viewer (PDF.js) ---- */
.pdf-back-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--glass-bg-solid);
    flex-shrink: 0;
}
.pdf-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-sans);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}
.pdf-back-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.pdf-title {
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pdf-scroll-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    gap: 0;
    background: #e0e0e0;
}
.pdf-page {
    position: relative;
    overflow: hidden;
}
.pdf-page canvas {
    display: block;
    width: 100%;
    height: auto;
}
.pdf-text-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    line-height: 1;
}
.pdf-text-layer span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}
.pdf-text-layer ::selection {
    background: rgba(0, 100, 255, 0.3);
}

/* ---- Exposure / Attribution multi-table layout ---- */
.section-wrap .exposure-tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* ---- Exposure View ---- */
.exposure-date-bar {
    display: flex;
    gap: 4px;
    margin: 6px 0;
    flex-wrap: wrap;
}
.exposure-date-btn {
    padding: 2px 10px;
    font-size: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.exposure-date-btn:hover { background: var(--bg-hover); }
.exposure-date-btn.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}

.gics-toggle {
    padding: 1px 8px;
    font-size: 9px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.gics-toggle:hover { background: var(--bg-hover); }
.gics-toggle.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}

.exposure-cat-bar {
    display: flex;
    gap: 0;
    margin: 4px 0 8px;
    border-bottom: 1px solid var(--border);
}
.exposure-cat-btn {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.exposure-cat-btn:hover { color: var(--text); }
.exposure-cat-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Exposure horizontal bar chart */
.exposure-chart {
    margin-top: 4px;
}
.exp-chart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}
.exp-chart-label {
    width: 180px;
    flex-shrink: 0;
    font-size: 11px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}
.exp-chart-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.exp-chart-bar {
    height: 14px;
    border-radius: 1px;
    display: flex;
    align-items: center;
    min-width: 2px;
    transition: width 0.3s ease;
}
.exp-chart-bar.gross {
    background: rgba(56, 152, 224, 0.25);
}
.exp-chart-bar.net {
    background: rgba(61, 138, 96, 0.25);
}
.exp-chart-bar.net.negative {
    background: rgba(176, 64, 64, 0.2);
}
.exp-chart-val {
    font-size: 9px;
    padding-left: 4px;
    white-space: nowrap;
    color: var(--text-secondary);
}
.exp-chart-legend {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 10px;
    color: var(--text-tertiary);
}
.exp-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.exp-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 1px;
}
.exp-legend-dot.gross { background: rgba(56, 152, 224, 0.5); }
.exp-legend-dot.net { background: rgba(61, 138, 96, 0.5); }

/* ---- Breadcrumb Bar ---- */
.breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 16px;
    font-size: 11px;
    border-bottom: 1px solid var(--border);
    background: var(--glass-bg-solid);
    flex-shrink: 0;
}
.breadcrumb-link {
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
}
.breadcrumb-link:hover {
    text-decoration: underline;
}
.breadcrumb-sep {
    color: var(--text-tertiary);
    font-size: 10px;
}
.breadcrumb-current {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---- Context Menu (right-click) ---- */
.ctx-menu {
    position: fixed;
    z-index: 2000;
    min-width: 140px;
    background: var(--bg-content);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 3px 0;
    font-size: 12px;
}
.ctx-item {
    padding: 5px 12px;
    cursor: pointer;
    color: var(--text);
}
.ctx-item:hover {
    background: var(--bg-hover);
}
.ctx-label {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}
.ctx-divider {
    height: 1px;
    background: var(--border);
    margin: 3px 0;
}
.ctx-item-warn, .ctx-item-danger {
    color: #d32f2f;
}
.ctx-item-warn:hover, .ctx-item-danger:hover {
    background: rgba(211, 47, 47, 0.08);
}

/* ---- Manage Data Zone ---- */
.manage-zone {
    padding: 24px;
    max-width: 560px;
}
.manage-zone-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
}
.manage-zone-locked .material-symbols-outlined {
    font-size: 36px;
    color: var(--text-tertiary);
}
.manage-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
}
.manage-card h4 {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
}
.manage-card p {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.manage-card-danger {
    border-color: #d32f2f40;
}
.manage-card-danger h4 {
    color: #d32f2f;
}
.manage-card .btn {
    font-size: 11px;
}
.manage-confirm-input {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-content);
    color: var(--text);
    margin-top: 8px;
    box-sizing: border-box;
}
.manage-confirm-input:focus {
    outline: none;
    border-color: var(--accent);
}
.modal-btn-danger {
    background: #d32f2f !important;
    border-color: #d32f2f !important;
    color: #fff !important;
}
.modal-btn-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Modal Overlay ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modal-fade-in 100ms ease;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
}
.modal-container {
    position: relative;
    width: 460px;
    max-width: 90vw;
    background: var(--bg-content);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    animation: modal-slide-in 120ms ease;
}
@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modal-slide-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px 10px;
}
.modal-header h3 {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}
.modal-close {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 18px;
    line-height: 1;
}
.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.modal-body {
    padding: 0 18px 14px;
}
.modal-body label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.modal-body textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text);
    background: var(--glass-bg-solid);
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
}
.modal-body textarea:focus {
    border-color: var(--accent);
}
.modal-body textarea::placeholder {
    color: var(--text-tertiary);
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 18px 14px;
}
.modal-btn {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-sans);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.modal-btn-cancel {
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
}
.modal-btn-cancel:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.modal-btn-primary {
    border: none;
    background: var(--accent);
    color: white;
}
.modal-btn-primary:hover {
    background: var(--accent-hover);
}
.modal-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-content);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-size: 12px;
    color: var(--text);
    min-width: 240px;
    max-width: 360px;
    pointer-events: auto;
    animation: toast-in 200ms ease;
}
.toast.toast-exit {
    animation: toast-out 150ms ease forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateX(16px); }
}
.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.toast-icon.success { color: #2d7a4f; }
.toast-icon.error { color: #b04040; }
.toast-icon.info { color: var(--accent); }
.toast-icon.running { color: var(--accent); }
.toast-body {
    flex: 1;
    min-width: 0;
}
.toast-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.toast-detail {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.toast-close {
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 2px;
    font-size: 14px;
    flex-shrink: 0;
}
.toast-close:hover {
    color: var(--text);
    background: var(--bg-hover);
}

/* ---- Rail badge (job indicator) ---- */
.rail-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background: #7a8594;
    color: white;
}
.rail-badge-running {
    background: #d4a017;
    color: white;
}
.rail-badge-error {
    background: #e04040;
    color: white;
}
.rail-badge-success {
    background: #3d8a60;
    color: white;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.rail-btn {
    position: relative;
}

/* ---- Search View ---- */
.search-view {
    max-width: 720px;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.search-view-bar {
    position: relative;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.search-view-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-view-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text);
    background: var(--glass-bg-solid);
    outline: none;
    transition: border-color var(--transition);
}
.search-view-input:focus {
    border-color: var(--accent);
}
.search-view-input::placeholder {
    color: var(--text-tertiary);
}

.search-view-modes {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    flex-shrink: 0;
}

.search-mode-btn {
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.search-mode-btn:hover {
    color: var(--text);
}
.search-mode-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.search-view-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.search-view-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 13px;
    text-align: center;
}

.search-summary {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 0 0 8px;
    margin-bottom: 4px;
}

/* Entity result groups */
.search-result-group {
    margin-bottom: 16px;
}

.search-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    margin-bottom: 2px;
}

.search-group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}

.search-group-count {
    font-size: 10px;
    color: var(--text-tertiary);
}

.search-result-list {
    display: flex;
    flex-direction: column;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}
.search-result-item:hover {
    background: var(--bg-hover);
}
.search-result-item:last-child {
    border-bottom: none;
}

.search-result-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    font-size: 10px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-result-breadcrumb {
    font-size: 11px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-result-sep {
    font-size: 11px;
    color: var(--text-tertiary);
    margin: 0 2px;
    flex-shrink: 0;
}

.search-result-arrow {
    font-size: 14px;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity var(--transition);
    flex-shrink: 0;
}
.search-result-item:hover .search-result-arrow {
    opacity: 1;
}

/* Document search results */
.search-doc-result {
    padding: 10px 10px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-doc-result:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.search-doc-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.search-doc-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-doc-score {
    font-size: 10px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-doc-snippet {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.search-doc-snippet mark {
    background: rgba(56, 152, 224, 0.15);
    color: var(--text);
    padding: 0 1px;
    border-radius: 1px;
}

/* ============================================================
   IAPD & 13F — Polished page styles
   ============================================================ */

/* Page hero header */
.tool-page-header {
    margin-bottom: 20px;
}
.tool-page-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    margin: 0;
}
.tool-page-header .subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

/* Tab toggle (Manager / Security) */
.tool-tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.tool-tab-btn {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-sans);
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.tool-tab-btn:hover { color: var(--text); }
.tool-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Search input row */
.tool-search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.tool-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    color: var(--text);
    font-size: 13px;
    font-family: var(--font-sans);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tool-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(56, 152, 224, 0.12);
}
.tool-search-input::placeholder {
    color: var(--text-tertiary);
}

/* Autocomplete dropdown */
.tool-autocomplete {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-content);
    border: 1px solid var(--border-strong);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 320px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.tool-ac-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.tool-ac-item:last-child { border-bottom: none; }
.tool-ac-item:hover { background: var(--bg-hover); }
.tool-ac-item .name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
}
.tool-ac-item .meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

/* Detail page header (back + title) */
.tool-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.tool-detail-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.015em;
    margin: 0;
}
.tool-detail-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.tool-detail-meta .sep { color: var(--text-tertiary); margin: 0 4px; }

/* Stat pills / badges */
.tool-stat-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.tool-stat {
    display: flex;
    flex-direction: column;
    padding: 8px 14px;
    background: var(--glass-bg-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 100px;
}
.tool-stat .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    font-weight: 500;
}
.tool-stat .value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

/* Quarter selector */
.tool-quarter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.tool-quarter-row label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tool-quarter-row select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    color: var(--text);
    font-size: 12px;
    font-family: var(--font-sans);
}

/* Result count badge */
.result-count {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

/* Value formatting helpers */
.val-positive { color: #2d7a4f; }
.val-negative { color: #b04040; }
.val-muted { color: var(--text-tertiary); }
.val-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.badge-put, .badge-call { display: inline-block; font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 3px; letter-spacing: 0.3px; vertical-align: middle; margin-left: 4px; }
.badge-put { background: rgba(176, 64, 64, 0.10); color: #b04040; }
.badge-call { background: rgba(45, 122, 79, 0.10); color: #2d7a4f; }

.tool-ac-section { padding: 4px 12px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-tertiary); background: var(--bg-subtle); border-bottom: 1px solid var(--border-subtle); }
.result-section-header { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-bottom: 8px; }

.thirteenf-breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.thirteenf-breadcrumb .bc-link { color: var(--accent); cursor: pointer; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thirteenf-breadcrumb .bc-link:hover { text-decoration: underline; }
.thirteenf-breadcrumb .bc-sep { color: var(--text-tertiary); margin: 0 2px; }
.thirteenf-breadcrumb .bc-current { color: var(--text-secondary); font-weight: 500; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Button System ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--glass-bg-solid);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
    line-height: 1.3;
}
.btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    opacity: 0.88;
    color: #fff;
    border-color: var(--accent);
}
.btn-sm {
    padding: 3px 10px;
    font-size: 11px;
}
.btn .material-symbols-outlined {
    font-size: 14px;
}
.btn-sm .material-symbols-outlined {
    font-size: 13px;
}

/* ---- Library Group Edit (lock/unlock) ---- */
.group-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px 4px;
}
.group-header-label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    flex: 1;
}
.group-header-label .material-symbols-outlined {
    font-size: 12px;
    vertical-align: -2px;
}
.group-edit-btn {
    display: flex;
    align-items: center;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}
.group-edit-btn:hover {
    color: var(--accent);
    background: var(--bg-hover);
}
.group-edit-btn .material-symbols-outlined {
    font-size: 14px;
}
.group-edit-btn.editing {
    color: var(--accent);
}
.group-remove-btn {
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0 2px;
    margin-left: auto;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
    flex-shrink: 0;
}
.group-remove-btn:hover {
    color: #b04040;
}
.group-remove-btn .material-symbols-outlined {
    font-size: 13px;
}
.group-editing .group-remove-btn {
    display: flex;
}

/* Group add PM */
.group-add-row {
    padding: 4px 8px 4px 28px;
}
.group-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px dashed var(--border);
    background: none;
    color: var(--text-tertiary);
    font-size: 11px;
    font-family: var(--font-sans);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.group-add-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.group-add-search {
    margin-top: 4px;
}
.group-add-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--glass-bg-solid);
    color: var(--text);
    font-size: 11px;
    font-family: var(--font-sans);
    outline: none;
}
.group-add-input:focus {
    border-color: var(--accent);
}
.group-add-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: var(--glass-bg-solid);
}
.group-add-item {
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.1s;
}
.group-add-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ---- Team Strategy Label (firm overview top team) ---- */
.team-strategy-label {
    display: block;
    font-size: 9px;
    font-weight: 400;
    color: var(--color-strategy);
    margin-top: 1px;
    line-height: 1.2;
    opacity: 0.85;
}

/* ---- Team Page (right rail Teams tab) ---- */
.team-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 8px 16px 32px;
}
.team-group {
    margin-bottom: 24px;
}
.team-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.team-group-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.team-group-count {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-tertiary);
    margin-left: 2px;
}
.team-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.team-card {
    background: var(--glass-bg-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: box-shadow var(--transition), border-color var(--transition);
}
.team-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.team-card-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 4px;
}
.team-card-toprow {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: visible;
}
.team-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    flex-shrink: 0;
    white-space: nowrap;
}
.team-card-title {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}
.team-card-strategy-badge {
    display: inline-block;
    align-self: flex-start;
    font-size: 10px;
    font-weight: 500;
    color: var(--color-strategy);
    background: rgba(110, 91, 184, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 3px;
    letter-spacing: 0.02em;
}
.team-card-coverages {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
    font-style: italic;
}
.team-card-email {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}
.team-card-bio {
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    white-space: pre-line;
}
.team-card-history { display:flex; gap:2px; width:40%; flex-shrink:0; margin-left:auto; min-width:0; align-items:flex-start; overflow:visible; }
.history-cell-wrap { display:flex; flex-direction:column; align-items:center; gap:2px; min-width:0; overflow:visible; }
.history-bar { height:42px; border-radius:6px; background:var(--bg-hover); cursor:default; transition:background var(--transition); width:100%; position:relative; overflow:visible; }
.history-bar:hover { background:color-mix(in srgb, var(--text-tertiary) 20%, var(--bg-hover)); }
.history-cell-current .history-bar { background:var(--timeline-active); }
.history-cell-current .history-bar:hover { background:color-mix(in srgb, var(--timeline-active) 85%, #fff); }
.history-bar-linked { cursor:pointer; }
.history-bar-linked:hover { outline:2px solid var(--accent); outline-offset:-2px; }
.history-firm { font-size:7px; font-weight:500; color:var(--text-tertiary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; text-align:center; line-height:1; }
.history-tip { display:none; position:absolute; left:50%; transform:translateX(-50%); background:var(--bg-secondary); border:1px solid var(--border); border-radius:4px; padding:6px 10px; white-space:nowrap; box-shadow:0 2px 8px rgba(0,0,0,.15); z-index:100; pointer-events:none; }
.history-tip-below { top:calc(100% + 6px); }
.history-tip-above { bottom:calc(100% + 6px); }
.history-tip-firm { font-size:11px; font-weight:600; color:var(--text-primary); }
.history-tip-roles { font-size:10px; color:var(--text-secondary); margin-top:2px; }
.history-tip-years { font-size:10px; color:var(--accent); margin-top:2px; }
.team-card-stale {
    opacity: 0.55;
}
.team-card-stale-label {
    font-size: 10px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 2px;
}

/* ============================================================
   Entity Audit / Data Quality UI
   ============================================================ */
.audit-status-line {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    min-height: 16px;
}
.audit-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 12px 0;
}
.audit-summary-counts {
    display: flex;
    gap: 16px;
    align-items: center;
}
.audit-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}
.audit-count-open { color: #c87f0a; }
.audit-count-pending { color: #c87f0a; }
.audit-count-applied { color: #2d7a4f; }
.audit-count-dismissed { color: var(--text-tertiary); }
.audit-last-run {
    font-size: 11px;
    color: var(--text-tertiary);
}
.audit-badge {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
}
.audit-badge-critical { background: rgba(220, 53, 69, 0.15); color: #c0392b; }
.audit-badge-warning { background: rgba(243, 156, 18, 0.15); color: #c87f0a; }

.audit-findings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.audit-finding-item {
    background: var(--bg-content);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    transition: border-color 0.15s;
}
.audit-finding-item:hover {
    border-color: var(--border-strong);
}
.audit-finding-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.audit-severity {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1.4;
}
.severity-critical {
    background: rgba(220, 53, 69, 0.12);
    color: #c0392b;
}
.severity-warning {
    background: rgba(243, 156, 18, 0.12);
    color: #c87f0a;
}
.severity-info {
    background: rgba(56, 152, 224, 0.12);
    color: var(--accent);
}
.audit-type {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: capitalize;
}
.audit-date {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: auto;
}
.audit-finding-desc {
    font-size: 12.5px;
    color: var(--text-primary);
    line-height: 1.5;
}
.audit-finding-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.audit-finding-pending {
    border-left: 3px solid #c87f0a;
}
.audit-finding-resolved {
    opacity: 0.55;
}
.audit-status {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: capitalize;
    margin-left: auto;
}
/* Action preview box — shows what fix will do */
.audit-action-preview {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}
.audit-action-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-primary);
}
.audit-action-explain {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}
.audit-action-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}
/* Confidence badges */
.audit-confidence {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    letter-spacing: 0.02em;
}
.conf-high { background: rgba(45, 122, 79, 0.15); color: #2d7a4f; }
.conf-med { background: rgba(200, 127, 10, 0.15); color: #c87f0a; }
.conf-low { background: rgba(176, 64, 64, 0.15); color: #b04040; }
/* Fix timeline */
.audit-fix-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}
.audit-fix-group {
    padding: 10px 14px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 8px;
    border-left: 3px solid #2d7a4f;
}
.audit-fix-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #2d7a4f;
    margin-bottom: 4px;
}
.audit-fix-step {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 2px 0 2px 22px;
    font-family: 'JetBrains Mono', monospace;
}
.audit-fix-arrow {
    color: #2d7a4f;
    margin-right: 4px;
}
.audit-source {
    font-size: 10px;
    color: var(--text-tertiary);
    background: var(--bg-sidebar);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

/* Coverage tags on career Gantt */
.coverage-tag {
    display: inline-block;
    font-size: 8px;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
    white-space: nowrap;
    line-height: 1.2;
}
.coverage-tag-region {
    display: inline-block;
    font-size: 8px;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--text-secondary) 15%, transparent);
    color: var(--text-secondary);
    white-space: nowrap;
    line-height: 1.2;
}
.history-tip-coverages {
    font-size: 9px;
    color: var(--text-tertiary);
    margin-top: 2px;
    font-style: italic;
}
