
        :root {
            --bg-base: #f9fafb; --bg-surface: #ffffff; --bg-hover: #f3f4f6;
            --text-main: #111827; --text-muted: #6b7280; --border: #e5e7eb;
            --accent: var(--paco-accent); --accent-hover: var(--paco-accent-strong);
            --badge-active: #dcfce7; --badge-active-text: #166534;
            --badge-waiting: #fef08a; --badge-waiting-text: #854d0e;
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            margin: 0; background: var(--bg-base); color: var(--text-main); height: 100vh; display: flex; flex-direction: column;
        }
        #app-header {
            background: var(--bg-surface); padding: 0.75rem 2rem; border-bottom: 1px solid var(--border);
            display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); gap: 1rem;
        }
        .header-brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.5px; flex-shrink: 0; }

        /* Filter & Search Bar */
        .search-container { display: flex; flex: 1; gap: 0.5rem; align-items: center; position: relative; }
        .filter-area { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
        .filter-pill {
            background: var(--bg-hover); border: 1px solid var(--border); padding: 0.2rem 0.5rem;
            border-radius: 6px; font-size: 0.75rem; font-weight: 500; display: flex; align-items: center; gap: 0.3rem;
        }
        .filter-pill span { cursor: pointer; opacity: 0.5; }
        .filter-pill span:hover { opacity: 1; color: red; }
        .search-bar, .filter-input {
            padding: 0.4rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; outline: none; font-size: 0.85rem;
        }
        .search-wrap { position: relative; flex: 1; max-width: 300px; min-width: 0; }
        .search-bar { width: 100%; box-sizing: border-box; padding-right: 2rem; }
        .filter-input { width: 150px; }
        .search-bar:focus, .filter-input:focus { border-color: var(--accent); }
        .search-clear-btn {
            position: absolute; right: 0.3rem; top: 50%; transform: translateY(-50%);
            width: 1.35rem; height: 1.35rem; border: 0; border-radius: 4px;
            background: transparent; color: var(--text-muted); opacity: 0.55;
            font-size: 0.95rem; font-weight: 600;
            line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
        }
        .search-clear-btn:hover { opacity: 1; color: #ef4444; background: var(--bg-hover); }
        .search-clear-btn[hidden] { display: none; }
        .search-clear-btn svg { width: 0.82rem; height: 0.82rem; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }
        .autocomplete-dropdown {
            position: absolute; top: 100%; left: 0; background: white; border: 1px solid var(--border);
            border-radius: 6px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 250px; max-height: 200px; overflow-y: auto; z-index: 100; display: none;
        }
        .ac-item { padding: 0.5rem; font-size: 0.8rem; cursor: pointer; border-bottom: 1px solid var(--bg-hover); }
        .ac-item:hover { background: var(--bg-hover); }

        input[type="file"] { display: none; }
        .btn {
            background: var(--accent); color: white; padding: 0.4rem 0.8rem; border-radius: 6px; cursor: pointer;
            font-weight: 500; font-size: 0.8rem; border: none; flex-shrink: 0;
        }

        main {
            display: grid;
            grid-template-columns: var(--atlas-width, 300px) 6px minmax(320px, 1fr) 6px var(--detail-width, 350px);
            flex: 1; overflow: hidden;
        }
        .panel { padding: 1rem; overflow-y: auto; background: var(--bg-base); min-width: 0; }
        .panel:last-child { background: var(--bg-surface); }
        .panel-resizer {
            background: var(--border); cursor: col-resize; width: 6px;
            transition: background 0.12s ease; touch-action: none;
        }
        .panel-resizer:hover, .panel-resizer.dragging { background: #cbd5e1; }
        h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-top: 0; margin-bottom: 0.75rem; }

        /* Ultra-Compact Tree UI */
        .tree-item {
            cursor: pointer; padding: 0.15rem 0.25rem; border-radius: 4px; margin-bottom: 1px;
            font-size: 0.8rem; display: flex; align-items: center; gap: 0.3rem; line-height: 1.2;
        }
        .tree-item:hover { background: var(--bg-hover); }
        .tree-item.selected { background: var(--paco-accent-soft); color: var(--accent-hover); font-weight: 500; }
        .tree-chevron { width: 12px; text-align: center; font-size: 0.7rem; opacity: 0.5; transition: transform 0.1s; }
        .tree-chevron.open { transform: rotate(90deg); }
        .tree-children { display: block; }
        .tree-children.collapsed { display: none; }
        .tree-count { font-size: 0.65rem; opacity: 0.5; margin-left: auto; font-family: monospace; }
        .tree-count.filtered { color: var(--accent); opacity: 0.9; }
        .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
        .panel-heading h2 { margin-bottom: 0; }
        .atlas-controls { display: flex; gap: 0.4rem; margin-bottom: 0; }
        .atlas-control-btn {
            border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-muted);
            border-radius: 6px; padding: 0.25rem 0.5rem; font-size: 0.72rem; cursor: pointer;
        }
        .atlas-control-btn:hover { background: var(--bg-hover); color: var(--text-main); }
        .atlas-control-btn.active { background: var(--paco-accent-soft); border-color: var(--paco-accent-border); color: var(--accent-hover); }
        .action-sort-controls { flex-wrap: wrap; justify-content: flex-end; }

        /* Cards & Breadcrumbs */
        .card {
            background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px;
            padding: 0.75rem 1rem; margin-bottom: 0.75rem; box-shadow: 0 1px 2px rgba(0,0,0,0.03); cursor: pointer;
        }
        .card.selected { border-color: var(--accent); outline: 1px solid var(--accent); }
        .actions-divider {
            margin: 12px 0 8px; padding-top: 10px; border-top: 1px solid var(--border);
            color: var(--text-muted); font-size: 0.72rem; font-weight: 700;
            letter-spacing: 0.08em; text-transform: uppercase;
        }
        .action-section-divider {
            margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--border);
            color: var(--text-muted); font-size: 0.75rem; font-weight: 700;
            letter-spacing: 0.05em; text-transform: uppercase;
            cursor: pointer; display: flex; align-items: center; gap: 0.35rem;
            user-select: none;
        }
        .action-section-divider:first-child { margin-top: 0; padding-top: 0; border-top: none; }
        .action-section-divider::before {
            content: "\25BE"; display: inline-block; width: 0.65rem;
            font-size: 0.72rem; line-height: 1; color: var(--text-muted);
        }
        .action-section-divider.collapsed::before { content: "\25B8"; }
        .action-section-divider:focus-visible {
            outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
        }
        .action-section-empty {
            color: var(--text-muted); font-size: 0.8rem; padding: 0.15rem 0 0.8rem;
        }
        .search-section-divider {
            margin: 14px 0 8px; padding-top: 9px; border-top: 1px solid var(--border);
            color: var(--text-muted); font-size: 0.68rem; font-weight: 700;
            letter-spacing: 0.08em; text-transform: uppercase;
        }
        .search-section-divider:first-child { margin-top: 0; padding-top: 0; border-top: none; }
        .search-section-divider.collapsible {
            cursor: pointer; display: flex; align-items: center; gap: 0.35rem;
            user-select: none;
        }
        .search-section-divider.collapsible::before {
            content: "▾"; display: inline-block; width: 0.65rem;
            font-size: 0.72rem; line-height: 1; color: var(--text-muted);
        }
        .search-section-divider.collapsible.collapsed::before { content: "▸"; }
        .search-section-divider.collapsible:focus-visible {
            outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
        }
        .project-result-card {
            padding: 0.55rem 0.7rem; margin-bottom: 0.5rem; border-radius: 6px;
        }
        .project-result-crumb {
            display: grid; grid-template-columns: minmax(0, 1fr) minmax(6.5rem, 32%);
            align-items: start; gap: 0.45rem;
        }
        .project-result-card .project-result-path {
            min-width: 0; overflow: visible; text-overflow: clip;
            text-wrap: balance; overflow-wrap: break-word;
        }
        .project-result-count {
            justify-self: end; color: var(--text-muted); opacity: 0.65;
            font-size: 0.65rem; font-family: monospace; white-space: nowrap;
        }
        .search-match-label {
            font-size: 0.58rem; padding: 0.1rem 0.28rem; border-radius: 4px;
            background: #eef2ff; color: #3730a3; font-weight: 700; text-transform: uppercase;
        }
        mark.search-highlight {
            background: #fef08a; color: inherit; padding: 0 0.08em; border-radius: 2px;
        }
        .breadcrumb { font-size: 0.65rem; color: var(--text-muted); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.02em; }
        .action-crumb, .action-line {
            display: grid; grid-template-columns: minmax(0, 1fr) minmax(10rem, 44%);
            align-items: start; gap: 0.45rem;
        }
        .action-crumb { margin-bottom: 0.25rem; }
        .action-path {
            min-width: 0; overflow: visible; text-overflow: clip;
            text-wrap: balance; overflow-wrap: break-word;
        }
        .action-top-meta {
            display: flex; align-items: center; gap: 0.35rem; min-width: 0;
            flex-wrap: wrap; justify-content: flex-end; align-content: flex-start;
            font-size: 0.72rem; text-transform: none; letter-spacing: 0;
        }
        .hier-link {
            appearance: none; border: 0; padding: 0; margin: 0; background: transparent;
            color: inherit; font: inherit; cursor: pointer; text-transform: inherit; letter-spacing: inherit;
        }
        .hier-link:hover { text-decoration: underline; }
        .hier-separator { opacity: 0.5; margin: 0 0.2rem; }
        .action-context { color: var(--text-main); font-weight: 600; text-transform: none; letter-spacing: 0; }
        .action-meta { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; min-width: 0; flex-shrink: 1; font-size: 0.72rem; color: var(--text-muted); }
        .due-label { color: #d97706; white-space: normal; text-align: right; }
        .estimate-label { color: var(--text-muted); white-space: nowrap; }
        .active-since-label { color: #64748b; white-space: nowrap; }
        .card-header { display: flex; justify-content: space-between; margin-bottom: 0.4rem; align-items: flex-start;}
        .card-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; min-width: 0; text-wrap: balance; overflow-wrap: break-word;}
        .badge { font-size: 0.6rem; padding: 0.15rem 0.3rem; border-radius: 4px; font-weight: 600; text-transform: uppercase; }
        button.badge {
            border: 0; font-family: inherit; font-size: 0.6rem; font-weight: 600;
            text-transform: uppercase; line-height: 1; cursor: pointer;
            appearance: none; white-space: nowrap;
        }
        button.badge:hover { filter: brightness(0.96); box-shadow: 0 0 0 1px rgba(0,0,0,0.08) inset; }
        button.badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
        .badge.active, .badge.next { background: var(--badge-active); color: var(--badge-active-text); }
        .badge.waiting { background: var(--badge-waiting); color: var(--badge-waiting-text); }
        .badge.context { background: #eef2ff; color: #3730a3; }
        .badge.someday { background: #f3f4f6; color: #4b5563; }
        .badge.scheduled { background: #ede9fe; color: #5b21b6; }
        .badge.blocked { background: #ffedd5; color: #9a3412; }
        .badge.urgent { background: #fee2e2; color: #991b1b; }
        .badge.important { background: #dbeafe; color: #1e40af; }

        /* Context / Sources (Email Mockup) */
        .detail-header { margin-bottom: 0.9rem; }
        .detail-type { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; }
        .detail-title { font-size: 1.05rem; font-weight: 700; line-height: 1.25; margin-bottom: 0.45rem; }
        .detail-path { font-size: 0.72rem; color: var(--text-muted); line-height: 1.35; margin-bottom: 0.55rem; }
        .detail-path-row + .detail-path-row { margin-top: 0.18rem; }
        .detail-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.8rem; }
        .detail-key-context { font-size: 0.84rem; line-height: 1.45; color: var(--text-main); background: var(--bg-base); border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem; margin-bottom: 1rem; }
        .action-tooltip {
            position: fixed; z-index: 1000; max-width: min(520px, calc(100vw - 28px));
            background: #111827; color: #f9fafb; border: 1px solid rgba(255,255,255,0.14);
            border-radius: 8px; box-shadow: 0 18px 40px rgba(15,23,42,0.32);
            padding: 0.75rem 0.85rem; font-size: 0.78rem; line-height: 1.35;
            pointer-events: none; opacity: 0; transform: translateY(4px);
            transition: opacity 0.08s ease, transform 0.08s ease;
        }
        .action-tooltip.visible { opacity: 1; transform: translateY(0); }
        .action-tooltip-title { font-weight: 700; font-size: 0.86rem; line-height: 1.3; margin-bottom: 0.55rem; }
        .action-tooltip-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.22rem 0.6rem; margin-bottom: 0.6rem; }
        .action-tooltip-label { color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.62rem; }
        .action-tooltip-value { color: #f8fafc; min-width: 0; overflow-wrap: anywhere; }
        .action-tooltip-section-title { color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.62rem; margin: 0.55rem 0 0.25rem; }
        .action-tooltip-evidence { margin: 0.2rem 0 0; padding-left: 1rem; }
        .action-tooltip-evidence li { margin: 0.12rem 0; }
        .action-tooltip-evidence-type { color: #cbd5e1; font-weight: 700; }
        .action-tooltip .rich-text { color: #f8fafc; }
        .action-tooltip .rich-text p { margin-bottom: 0.35rem; }
        .action-tooltip .rich-text ul { margin: 0.2rem 0 0 1rem; padding-left: 0.75rem; }
        .action-tooltip .rich-text li { margin: 0.12rem 0; }
        .action-tooltip .rich-text a { color: var(--paco-accent-on-dark); }
        .action-tooltip .rich-text code { background: rgba(255,255,255,0.12); color: #f8fafc; border-color: rgba(255,255,255,0.18); }
        .detail-section-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 1rem 0 0.65rem; }
        .detail-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
        .rich-text p { margin: 0 0 0.45rem; }
        .rich-text p:last-child { margin-bottom: 0; }
        .rich-text ul { margin: 0.25rem 0 0.55rem 1rem; padding-left: 1rem; }
        .rich-text li { margin: 0.18rem 0; }
        .rich-text h1, .rich-text h2, .rich-text h3, .rich-text h4 {
            margin: 0.65rem 0 0.35rem; line-height: 1.25; color: var(--text-main);
        }
        .rich-text h1 { font-size: 1rem; }
        .rich-text h2 { font-size: 0.92rem; }
        .rich-text h3 { font-size: 0.86rem; }
        .rich-text h4 { font-size: 0.82rem; }
        .rich-text a { color: var(--accent); text-decoration: underline; word-break: break-word; }
        .rich-text strong { font-weight: 700; }
        .rich-text em { font-style: italic; }
        .rich-text code {
            font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
            font-size: 0.92em; background: var(--paco-accent-code); color: #111827;
            border: 1px solid #e2e8f0; border-radius: 4px;
            padding: 0.05rem 0.22rem; white-space: break-spaces;
        }
        .source-item { font-size: 0.8rem; background: var(--bg-base); border-radius: 6px; margin-bottom: 0.75rem; border: 1px solid var(--border); overflow: hidden;}
        .source-item.source-match {
            border-color: #facc15;
            box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.45), 0 0 0.85rem rgba(250, 204, 21, 0.24);
        }
        .source-details summary { list-style: none; cursor: pointer; }
        .source-details summary::-webkit-details-marker { display: none; }
        .source-summary { background: var(--bg-surface); padding: 0.6rem 0.7rem; border-bottom: 1px solid transparent; }
        .source-details[open] .source-summary { border-bottom-color: var(--border); }
        .source-kicker { font-size:0.65rem; color:var(--text-muted); margin-bottom:0.25rem; text-transform:uppercase; }
        .source-title { font-weight:600; margin-bottom:0.35rem; }
        .source-person { font-size:0.72rem; color:var(--text-muted); margin-bottom:0.35rem; }
        .source-summary-text { color:var(--text-muted); line-height:1.4; }
        .copy-btn {
            display: inline-flex; align-items: center; justify-content: center; vertical-align: text-bottom;
            width: 1.15rem; height: 1.15rem; margin-left: 0.3rem; padding: 0; border: 1px solid transparent;
            border-radius: 4px; background: transparent; color: var(--text-muted); cursor: pointer;
        }
        .copy-btn:hover { background: var(--bg-hover); border-color: var(--border); color: var(--text-main); }
        .copy-btn.copied { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
        .copy-btn svg { width: 0.78rem; height: 0.78rem; stroke: currentColor; fill: none; stroke-width: 2; }
        .email-header { background: var(--bg-surface); padding: 0.5rem; border-bottom: 1px solid var(--border); }
        .email-row { display: flex; gap: 0.5rem; margin-bottom: 0.2rem; }
        .email-label { color: var(--text-muted); font-size: 0.65rem; text-transform: uppercase; width: 40px; text-align: right; }
        .email-val { font-weight: 500; }
        .email-attachments { margin: 0; padding-left: 1rem; }
        .email-attachments li { margin: 0.12rem 0; }
        .email-body { padding: 0.75rem; color: var(--text-main); line-height: 1.4; background: #fafafa;}
        .calendar-body { padding: 0.75rem; color: var(--text-main); line-height: 1.4; background: #fafafa; }
        .calendar-occurrences { margin: 0.65rem 0 0; padding-left: 1.1rem; color: var(--text-muted); }
        .calendar-occurrences li { margin: 0.2rem 0; }
        .teams-body { padding: 0.75rem; background: #fafafa; line-height: 1.45; color: var(--text-main); }
        .mock-hint { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.35rem; }
        .source-divider { margin: 1.5rem 0; border: none; border-top: 1px dashed var(--border); text-align: center; position: relative; }
        .source-divider::after { content: "Inherited Evidence"; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: var(--bg-surface); padding: 0 0.5rem; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase;}

        .empty-state { text-align: center; color: var(--text-muted); margin-top: 2rem; font-size: 0.85rem; }

        .mobile-nav { display: none; }

        @media (max-width: 760px) {
            body { height: 100svh; }
            #app-header {
                padding: 0.55rem 0.65rem; flex-wrap: nowrap; align-items: stretch;
                gap: 0.45rem; flex-shrink: 0; z-index: 20;
            }
            .header-brand { display: none; }
            .search-container {
                order: 1; flex: 1 1 auto; min-width: 0; gap: 0.4rem;
                display: grid; grid-template-columns: minmax(7.5rem, 0.8fr) minmax(9rem, 1fr);
                align-items: start;
            }
            .filter-area {
                grid-column: 1 / -1; min-height: 0; max-height: 4.2rem; overflow-y: auto;
            }
            .filter-input, .search-bar { width: 100%; box-sizing: border-box; min-width: 0; }
            .search-wrap { width: 100%; max-width: none; min-width: 0; }
            .autocomplete-dropdown { width: min(92vw, 320px); z-index: 60; }
            #app-header .btn { order: 2; margin-left: 0; padding: 0.38rem 0.65rem; align-self: flex-end; white-space: nowrap; }

            .mobile-nav {
                display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.65rem;
                background: var(--bg-surface); border-bottom: 1px solid var(--border);
                box-shadow: 0 1px 2px rgba(0,0,0,0.04); flex-shrink: 0; z-index: 19;
            }
            .mobile-back, .mobile-tab {
                border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-muted);
                border-radius: 6px; padding: 0.38rem 0.55rem; font-size: 0.78rem; font-weight: 600;
                cursor: pointer;
            }
            .mobile-back:disabled { opacity: 0.35; cursor: default; }
            .mobile-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem; flex: 1; }
            .mobile-tab.active { background: var(--paco-accent-soft); border-color: var(--paco-accent-border); color: var(--accent-hover); }

            main {
                display: block; flex: 1; min-height: 0; overflow: hidden;
                grid-template-columns: none;
            }
            .panel-resizer { display: none; }
            .panel {
                display: none; height: 100%; box-sizing: border-box; overflow-y: auto;
                padding: 0.75rem; -webkit-overflow-scrolling: touch;
            }
            main.mobile-view-atlas #panel-areas,
            main.mobile-view-actions #panel-actions,
            main.mobile-view-detail #panel-context {
                display: block;
            }
            .panel-heading { gap: 0.5rem; align-items: flex-start; }
            .atlas-controls { gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }
            .atlas-control-btn { padding: 0.22rem 0.42rem; }
            .card { padding: 0.7rem 0.75rem; margin-bottom: 0.6rem; }
            .action-crumb, .action-line, .project-result-crumb { grid-template-columns: minmax(0, 1fr) minmax(8.5rem, 44%); }
            .action-top-meta { row-gap: 0.12rem; }
            .card-title { font-size: 0.92rem; }
            .detail-title { font-size: 1rem; }
            .email-row { align-items: flex-start; }
            .email-val { min-width: 0; overflow-wrap: anywhere; }
        }

        @media (max-width: 430px) {
            .action-crumb, .action-line, .project-result-crumb { grid-template-columns: 1fr; }
            .action-top-meta, .action-meta { justify-content: flex-start; }
            .project-result-count { justify-self: start; }
            .due-label { text-align: left; }
        }
