body {
    background-color: #020617;
    color: #e2e8f0;
    font-family: 'ui-monospace', 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 10px #3b82f6;
    animation: scan 3s linear infinite;
    opacity: 0.3;
    pointer-events: none;
    z-index: 50;
}

@keyframes scan {
    0% {
        top: 0%;
    }

    100% {
        top: 100%;
    }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.typing-cursor::after {
    content: '█';
    animation: blink 1s step-start infinite;
    color: #10b981;
    margin-left: 4px;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 0.5rem;
    width: 800px;
    max-width: 95vw;
    height: 650px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Auth Styles */
#auth-overlay {
    background: radial-gradient(circle at 50% 10%, #1e293b 0%, #020617 80%);
}

#auth-overlay>div {
    /* The card */
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(51, 65, 85, 0.5);
    box-shadow: 0 0 40px -10px rgba(0, 0, 0, 0.7), 0 0 10px rgba(59, 130, 246, 0.1);
    animation: authCardEntrance 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes authCardEntrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        filter: blur(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Chat Progress — Reasoning Group */
.reasoning-group {
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    background: rgba(30, 27, 75, 0.25);
    overflow: hidden;
}

.reasoning-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(99, 102, 241, 0.08);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a5b4fc;
}

.reasoning-header .reasoning-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #818cf8;
    animation: reasoningPulse 1.5s ease-in-out infinite;
}

@keyframes reasoningPulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

.reasoning-body {
    padding: 4px 0;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
    background-color: #0f172a;
}

.reasoning-entry {
    padding: 2px 10px 2px 18px;
    font-size: 10px;
    color: #c7d2fe;
    line-height: 1.3;
    animation: reasoningEntryIn 0.2s ease-out;
    position: relative;
}

.reasoning-entry::before {
    content: '•';
    position: absolute;
    left: 8px;
    color: #818cf8;
}

.reasoning-entry+.reasoning-entry {
    border-top: 1px solid rgba(99, 102, 241, 0.08);
}



@keyframes reasoningEntryIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #334155 #0f172a;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #0f172a;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

#node-detail-panel.open,
#subgraph-node-detail-panel.open {
    transform: translateX(0) !important;
}

.ndp-section-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 4px;
}

.ndp-value {
    color: #cbd5e1;
    word-break: break-word;
    line-height: 1.4;
}

.ndp-chip {
    display: inline-block;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 2px 6px;
    margin: 1px 2px;
    font-size: 9px;
    color: #94a3b8;
}

.ndp-edge-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 0;
    border-bottom: 1px solid #1e293b;
    color: #94a3b8;
    line-height: 1.3;
}

.ndp-edge-label {
    background: #1e293b;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 9px;
    color: #60a5fa;
    white-space: nowrap;
}

.ndp-edge-node {
    font-size: 10px;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.ndp-edge-arrow {
    color: #475569;
    font-size: 10px;
}

.ndp-category-badge {
    display: inline-block;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#scroll-to-bottom-btn {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#scroll-to-bottom-btn:hover {
    transform: scale(1.1);
}

.edge-popover {
    position: absolute;
    z-index: 50;
    width: 320px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.08);
    animation: edgePopoverIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: auto;
    overflow: hidden;
}

.edge-popover.hidden {
    display: none;
}

@keyframes edgePopoverIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.edge-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.08);
    border-bottom: 1px solid rgba(245, 158, 11, 0.15);
}

.edge-popover-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fbbf24;
}

.edge-popover-close {
    color: #64748b;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.15s;
    background: none;
    border: none;
    display: flex;
    align-items: center;
}

.edge-popover-close:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.edge-popover-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.edge-popover-entities {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 6px;
    font-size: 11px;
    color: #e2e8f0;
    font-weight: 600;
}

.edge-popover-entity-name {
    color: #93c5fd;
    font-family: 'ui-monospace', 'SF Mono', monospace;
    font-size: 10px;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edge-popover-arrow {
    color: #f59e0b;
    font-size: 12px;
    flex-shrink: 0;
}

.edge-popover-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edge-popover-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.edge-popover-text {
    font-size: 11px;
    color: #cbd5e1;
    line-height: 1.5;
    padding: 6px 8px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 4px;
    border-left: 2px solid rgba(245, 158, 11, 0.3);
    max-height: 100px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
    word-break: break-word;
}

.edge-popover-text:empty {
    display: none;
}

.edge-popover-text + .edge-popover-label {
    display: none;
}

.edge-popover-confidence-bar {
    height: 6px;
    background: #1e293b;
    border-radius: 3px;
    overflow: hidden;
}

.edge-popover-confidence-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

.edge-popover-confidence-value {
    font-size: 13px;
    font-weight: 700;
    font-family: 'ui-monospace', monospace;
}

.edge-popover-footer {
    padding: 8px 12px;
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    display: flex;
    justify-content: flex-end;
}

.edge-popover-split-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 10px;
    font-weight: 700;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}

.edge-popover-split-btn:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.6);
    border-color: #ef4444;
}

