:root {
    --navy: #0d1b2a;
    --navy-light: #152233;
    --navy-mid: #1e3148;
    --accent: #c8a96e;
    --accent-light: #e8c98e;
    --accent-dim: rgba(200, 169, 110, 0.15);
    --sky: #4a9ebb;
    --sky-dim: rgba(74, 158, 187, 0.15);
    --green: #5aaa7a;
    --green-dim: rgba(90, 170, 122, 0.15);
    --red: #d4655a;
    --red-dim: rgba(212, 101, 90, 0.15);
    --amber: #e8a33a;
    --amber-dim: rgba(232, 163, 58, 0.15);
    --text: #e8e0d4;
    --text-muted: #8a9ab0;
    --text-dim: #5a6a7a;
    --border: rgba(200, 169, 110, 0.18);
    --border-soft: rgba(255, 255, 255, 0.07);
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --radius: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--navy);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ─── TOP BAR ─── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 58px;
    background: var(--navy-light);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.logo svg {
    width: 28px;
    height: 28px;
}

.logo span.sub {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-left: 2px;
}

.topbar-center {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-center strong {
    color: var(--text);
    font-weight: 500;
}

.breadcrumb-sep {
    color: var(--text-dim);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.badge-demo {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 100px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 100px;
    padding: 4px 12px 4px 6px;
    font-size: 13px;
    font-weight: 500;
}

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sky), var(--navy-mid));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

/* ─── MAIN LAYOUT ─── */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ─── SIDEBAR ─── */
.sidebar {
    width: 220px;
    background: var(--navy-light);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-section {
    padding: 18px 14px 8px;
}

.sidebar-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 6px;
    padding-left: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 1px;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 500;
}

.nav-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active svg {
    opacity: 1;
}

/* Asset info in sidebar */
.asset-card-side {
    margin: 0 14px 14px;
    background: var(--navy-mid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.asset-img {
    width: 100%;
    height: 80px;
    background: linear-gradient(160deg, #1e3a52 0%, #0a2035 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.asset-side-info {
    padding: 10px 12px;
}

.asset-name-side {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.asset-meta-side {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

.epc-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    background: var(--green);
    color: white;
    margin-left: 4px;
}

.doc-count-side {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
    font-size: 11px;
    color: var(--text-muted);
}

.doc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* ─── CONTENT AREA ─── */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Asset tabs */
.asset-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 24px;
    background: var(--navy-light);
    border-bottom: 1px solid var(--border);
    height: 44px;
    flex-shrink: 0;
}

.tab {
    padding: 0 16px;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab svg {
    width: 14px;
    height: 14px;
}

/* ─── TWO PANELS ─── */
.panels {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* DOCUMENTS PANEL */
.docs-panel {
    width: 380px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.panel-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Upload zone */
.upload-zone {
    margin: 12px 16px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
    position: relative;
    flex-shrink: 0;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.upload-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.upload-text {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.upload-text strong {
    color: var(--accent);
}

/* Doc list */
.doc-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px 12px;
}

.doc-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    transition: all 0.15s;
    cursor: pointer;
}

.doc-item:hover {
    background: var(--surface-hover);
    border-color: var(--border);
}

.doc-item.active-doc {
    background: var(--accent-dim);
    border-color: rgba(200, 169, 110, 0.4);
}

.doc-icon {
    width: 34px;
    height: 38px;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--navy-mid);
    border: 1px solid var(--border-soft);
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.doc-status {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
}

.status-pill {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.doc-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.doc-item:hover .doc-actions {
    opacity: 1;
}

.doc-delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 5px;
    background: var(--red-dim);
    color: var(--red);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.doc-delete-btn:hover {
    background: var(--red);
    color: var(--navy);
    transform: scale(1.1);
}

.status-indexed {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(90, 170, 122, 0.3);
}

.status-processing {
    background: var(--amber-dim);
    color: var(--amber);
    border: 1px solid rgba(232, 163, 58, 0.3);
}

.status-pending {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
}

.status-failed {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(212, 101, 90, 0.3);
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ai-summary-box {
    margin-top: 6px;
    padding: 7px 9px;
    background: var(--navy-mid);
    border-radius: 6px;
    border-left: 2px solid var(--sky);
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    font-style: italic;
}

/* ─── AI CHAT PANEL ─── */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 14px 22px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.chat-hint {
    font-size: 11.5px;
    color: var(--text-dim);
    font-style: italic;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Welcome state */
.chat-welcome {
    text-align: center;
    padding: 30px 20px;
    margin: auto 0;
}

.welcome-icon {
    font-size: 42px;
    margin-bottom: 14px;
}

.welcome-title {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: var(--text);
    margin-bottom: 8px;
}

.welcome-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto 22px;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 480px;
    margin: 0 auto;
}

.suggestion-btn {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 11px 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-muted);
    font-size: 12.5px;
    font-family: 'DM Sans', sans-serif;
    line-height: 1.4;
}

.suggestion-btn:hover {
    background: var(--navy-mid);
    border-color: var(--accent);
    color: var(--text);
}

.suggestion-btn strong {
    display: block;
    color: var(--text);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 3px;
    font-weight: 600;
}

/* Messages */
.msg {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.msg.user {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.msg-avatar.ai-av {
    background: linear-gradient(135deg, var(--sky), #2a6a8a);
    color: white;
    font-size: 14px;
}

.msg-avatar.user-av {
    background: linear-gradient(135deg, var(--accent), #8a6020);
    color: white;
    font-size: 12px;
}

.msg-bubble {
    max-width: 80%;
    padding: 11px 15px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.65;
}

.msg.ai .msg-bubble {
    background: var(--navy-mid);
    border: 1px solid var(--border-soft);
    color: var(--text);
    border-radius: 4px 12px 12px 12px;
}

.msg.user .msg-bubble {
    background: var(--accent-dim);
    border: 1px solid rgba(200, 169, 110, 0.3);
    color: var(--text);
    border-radius: 12px 4px 12px 12px;
}

.citation {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--sky-dim);
    border: 1px solid rgba(74, 158, 187, 0.3);
    color: var(--sky);
    font-size: 11px;
    font-weight: 500;
    padding: 1px 7px;
    border-radius: 100px;
    cursor: pointer;
    margin: 0 2px;
    vertical-align: middle;
    transition: all 0.15s;
}

.citation:hover {
    background: rgba(74, 158, 187, 0.25);
}

.timeline-inline {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tl-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--surface);
    border-left: 3px solid transparent;
}

.tl-item.historical {
    border-left-color: var(--text-dim);
}

.tl-item.current {
    border-left-color: var(--green);
}

.tl-item.planned {
    border-left-color: var(--amber);
}

.tl-year {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 36px;
}

.tl-desc {
    font-size: 12.5px;
    color: var(--text);
    line-height: 1.5;
    flex: 1;
}

.tl-status-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

.tag-hist {
    background: rgba(90, 106, 122, 0.3);
    color: var(--text-muted);
}

.tag-curr {
    background: var(--green-dim);
    color: var(--green);
}

.tag-plan {
    background: var(--amber-dim);
    color: var(--amber);
}

.current-status-box {
    margin-top: 10px;
    padding: 10px 13px;
    background: var(--green-dim);
    border: 1px solid rgba(90, 170, 122, 0.3);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 14px 16px;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
    animation: typing 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0.7);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Upload processing banner */
.processing-banner {
    margin: 6px 16px;
    padding: 10px 14px;
    background: var(--amber-dim);
    border: 1px solid rgba(232, 163, 58, 0.3);
    border-radius: 8px;
    font-size: 12px;
    color: var(--amber);
    display: flex;
    align-items: center;
    gap: 8px;
    display: none;
}

.processing-banner.visible {
    display: flex;
}

/* Chat input */
.chat-input-area {
    padding: 14px 22px 18px;
    border-top: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.doc-context-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    min-height: 22px;
}

.context-label {
    font-size: 11px;
    color: var(--text-dim);
}

.ctx-tag {
    background: var(--navy-mid);
    border: 1px solid var(--border-soft);
    border-radius: 100px;
    padding: 2px 9px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ctx-tag.active-ctx {
    border-color: rgba(200, 169, 110, 0.4);
    color: var(--accent);
    background: var(--accent-dim);
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-textarea {
    flex: 1;
    background: var(--navy-mid);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    color: var(--text);
    resize: none;
    outline: none;
    min-height: 46px;
    max-height: 120px;
    transition: border-color 0.15s;
    line-height: 1.5;
}

.chat-textarea:focus {
    border-color: rgba(200, 169, 110, 0.5);
}

.chat-textarea::placeholder {
    color: var(--text-dim);
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: var(--accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
    color: var(--navy);
}

.send-btn:hover {
    background: var(--accent-light);
    transform: scale(1.04);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Upload progress overlay */
.upload-progress {
    padding: 4px 16px 0;
    display: none;
}

.upload-progress.visible {
    display: block;
}

.progress-bar-wrap {
    background: var(--navy-mid);
    border-radius: 100px;
    height: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--sky));
    border-radius: 100px;
    transition: width 0.3s ease;
}

.progress-label {
    font-size: 11px;
    color: var(--text-dim);
}

/* No docs state */
.no-docs {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.6;
}

.no-docs-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

/* Tooltip on citation */
.citation-tooltip {
    position: fixed;
    z-index: 100;
    background: var(--navy-mid);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 13px;
    font-size: 12px;
    color: var(--text-muted);
    max-width: 240px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.citation-tooltip.visible {
    opacity: 1;
}

/* ─── TREE MODAL ─── */
.tree-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.tree-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.tree-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.tree-modal.visible {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.tree-modal-content {
    background: var(--navy-mid);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90vw;
    max-width: 700px;
    height: 70vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.tree-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.tree-modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.tree-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    border-radius: 6px;
}

.tree-close-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.tree-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px;
}

.tree-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tree-node {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--navy);
    border: 1px solid var(--border-soft);
    transition: all 0.15s;
}

.tree-node:hover {
    background: var(--surface);
    border-color: var(--border);
}

.tree-node-toggle {
    cursor: pointer;
    user-select: none;
    width: 20px;
    min-width: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.tree-node-content {
    flex: 1;
    min-width: 0;
}

.tree-node-category {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: 100px;
    margin-bottom: 6px;
}

.tree-node-category.historical {
    background: rgba(90, 106, 122, 0.3);
    color: var(--text-muted);
}

.tree-node-category.current {
    background: var(--green-dim);
    color: var(--green);
}

.tree-node-category.planned {
    background: var(--amber-dim);
    color: var(--amber);
}

.tree-node-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.tree-node-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin: 4px 0;
}

.tree-node-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin: 6px 0;
    line-height: 1.5;
}

.tree-node-children {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tree-child {
    padding: 9px 12px;
    border-radius: 6px;
    background: var(--navy);
    border-left: 3px solid var(--sky);
    font-size: 12px;
}

.tree-child-title {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 3px;
}

.tree-child-analysis {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
}

.tree-sources {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tree-source-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--sky-dim);
    border: 1px solid rgba(74, 158, 187, 0.3);
    color: var(--sky);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.15s;
}

.tree-source-tag:hover {
    background: rgba(74, 158, 187, 0.25);
    border-color: rgba(74, 158, 187, 0.5);
}

.ai-analysis-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--navy);
    border: 1px solid rgba(74, 158, 187, 0.2);
    border-radius: 6px;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
    border-left: 3px solid var(--sky);
}

.tree-btn-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    background: var(--sky-dim);
    border: 1px solid rgba(74, 158, 187, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 12px;
    font-weight: 500;
    color: var(--sky);
}

.tree-btn-wrapper:hover {
    background: rgba(74, 158, 187, 0.2);
    border-color: rgba(74, 158, 187, 0.5);
}

.tree-view-btn {
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--sky-dim);
    border: 1px solid rgba(74, 158, 187, 0.3);
    color: var(--sky);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.15s;
    display: block;
}

.tree-view-btn:hover {
    background: rgba(74, 158, 187, 0.2);
    border-color: rgba(74, 158, 187, 0.5);
}
/* --- DELETE CONFIRMATION MODAL --- */
.delete-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--navy-mid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    z-index: 1001;
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
    transition: all 0.2s ease;
}

.delete-modal.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.delete-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.delete-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.delete-modal-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.delete-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.delete-modal-header i {
    color: var(--red);
}

.delete-modal-body {
    padding: 24px;
    flex-grow: 1;
}

.delete-modal-body p {
    margin: 0 0 12px 0;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 14px;
}

.delete-filename {
    font-weight: 600;
    color: var(--red) !important;
    font-size: 15px;
    padding: 12px;
    background: var(--red-dim);
    border-radius: 6px;
    word-break: break-word;
    border-left: 3px solid var(--red);
}

.delete-warning {
    margin-top: 16px;
    padding: 12px;
    background: var(--amber-dim);
    border-left: 3px solid var(--amber);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.delete-warning i {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--amber);
}

.delete-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--navy);
}

.delete-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.delete-modal-btn.cancel-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
}

.delete-modal-btn.cancel-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text);
}

.delete-modal-btn.confirm-btn {
    background: var(--red);
    color: var(--text);
}

.delete-modal-btn.confirm-btn:hover {
    background: #c1453a;
    transform: scale(1.02);
}

.delete-modal-btn.confirm-btn:active {
    transform: scale(0.98);
}

.delete-modal-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ─── DELETE CONFIRMATION MODAL ─── */
.delete-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--navy-mid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    z-index: 1001;
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
    transition: all 0.2s ease;
}

.delete-modal.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.delete-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.delete-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.delete-modal-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.delete-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.delete-modal-header i {
    color: var(--red);
}

.delete-modal-body {
    padding: 24px;
    flex-grow: 1;
}

.delete-modal-body p {
    margin: 0 0 12px 0;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 14px;
}

.delete-filename {
    font-weight: 600;
    color: var(--red) !important;
    font-size: 15px;
    padding: 12px;
    background: var(--red-dim);
    border-radius: 6px;
    word-break: break-word;
    border-left: 3px solid var(--red);
}

.delete-warning {
    margin-top: 16px;
    padding: 12px;
    background: var(--amber-dim);
    border-left: 3px solid var(--amber);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.delete-warning i {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--amber);
}

.delete-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--navy);
}

.delete-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.delete-modal-btn.cancel-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
}

.delete-modal-btn.cancel-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text);
}

.delete-modal-btn.confirm-btn {
    background: var(--red);
    color: var(--text);
}

.delete-modal-btn.confirm-btn:hover {
    background: #c1453a;
    transform: scale(1.02);
}

.delete-modal-btn.confirm-btn:active {
    transform: scale(0.98);
}

.delete-modal-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
