:root {
    --bg: #0b0d0f;
    --panel: #111417;
    --panel-2: #15191d;
    --panel-3: #1a1f24;

    --text: #f2efe8;
    --muted: #8d949b;
    --muted-2: #626a72;

    --line: rgba(255, 255, 255, 0.08);

    --accent: #57e6ff;
    --accent-soft: rgba(87, 230, 255, 0.10);

    --violet: #9b8cff;
    --amber: #e6bd69;

    --radius: 18px;
    --sidebar-width: 245px;
    --evidence-width: 350px;
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;

    background:
        radial-gradient(
            circle at 52% 20%,
            rgba(87, 230, 255, 0.05),
            transparent 28%
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Tahoma,
        Arial,
        sans-serif;
}

button,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}


/* ===================================== */
/* APP */
/* ===================================== */

.app-shell {
    width: 100%;
    height: 100%;

    display: grid;

    grid-template-columns:
        var(--sidebar-width)
        minmax(500px, 1fr)
        var(--evidence-width);

    background:
        linear-gradient(
            90deg,
            rgba(255,255,255,0.015),
            transparent 25%,
            transparent 75%,
            rgba(255,255,255,0.015)
        );
}


/* ===================================== */
/* SIDEBAR */
/* ===================================== */

.sidebar {
    border-left: 1px solid var(--line);

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,0.02),
            rgba(255,255,255,0)
        );

    display: flex;
    flex-direction: column;

    padding: 24px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 4px 8px 25px;
}

.brand-mark {
    width: 35px;
    height: 35px;

    display: grid;
    place-items: center;

    border: 1px solid rgba(87,230,255,.22);
    border-radius: 11px;

    color: var(--accent);

    background:
        radial-gradient(
            circle,
            rgba(87,230,255,.13),
            transparent 70%
        );

    box-shadow:
        0 0 30px rgba(87,230,255,.08);
}

.brand-name {
    font-weight: 800;
    letter-spacing: .09em;
    font-size: 14px;
}

.brand-subtitle {
    margin-top: 2px;

    color: var(--muted);

    font-size: 9px;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.new-chat-btn {
    border: 1px solid rgba(87,230,255,.18);

    border-radius: 12px;

    padding: 11px 13px;

    display: flex;
    align-items: center;
    gap: 9px;

    background: var(--accent-soft);
    color: var(--text);

    font-size: 13px;

    transition: .2s ease;
}

.new-chat-btn:hover {
    border-color: rgba(87,230,255,.42);
    background: rgba(87,230,255,.15);
}

.new-chat-btn span {
    color: var(--accent);
    font-size: 17px;
}

.nav-section {
    margin-top: 26px;
}

.nav-label {
    padding: 0 10px 8px;

    color: var(--muted-2);

    font-size: 9px;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.nav-item {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 11px;

    border: 0;
    border-radius: 10px;

    padding: 10px;

    background: transparent;

    color: var(--muted);

    text-align: right;
    font-size: 12px;

    transition: .2s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,.035);
    color: var(--text);
}

.nav-item.active {
    background: rgba(255,255,255,.045);
    color: var(--text);
}

.nav-item.active span {
    color: var(--accent);
}

.nav-item span {
    width: 17px;
    display: inline-flex;
    justify-content: center;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.conversation-empty {
    padding: 9px 10px;

    color: var(--muted-2);

    font-size: 11px;
}

.sidebar-footer {
    margin-top: auto;

    display: flex;
    flex-direction: column;
    gap: 10px;

    padding: 15px 8px 0;

    border-top: 1px solid var(--line);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 7px;

    color: var(--muted);

    font-size: 10px;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #62e6a9;

    box-shadow: 0 0 10px rgba(98,230,169,.45);
}

.version {
    color: var(--muted-2);
    font-size: 9px;
    letter-spacing: .08em;
}


/* ===================================== */
/* MAIN */
/* ===================================== */

.main-panel {
    min-width: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.012),
            transparent 20%
        );
}

.topbar {
    min-height: 74px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 24px;

    border-bottom: 1px solid var(--line);
}

.workspace-title {
    font-size: 13px;
    font-weight: 700;
}

.workspace-subtitle {
    margin-top: 3px;

    color: var(--muted);

    font-size: 10px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.mode-pill {
    display: flex;
    align-items: center;
    gap: 7px;

    border: 1px solid var(--line);
    border-radius: 999px;

    padding: 7px 10px;

    color: var(--muted);

    font-size: 8px;
    letter-spacing: .12em;
}

.mode-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: var(--accent);

    box-shadow: 0 0 10px rgba(87,230,255,.55);
}

.icon-btn {
    width: 31px;
    height: 31px;

    border: 1px solid var(--line);
    border-radius: 9px;

    background: rgba(255,255,255,.02);

    color: var(--muted);

    transition: .2s ease;
}

.icon-btn:hover {
    border-color: rgba(87,230,255,.25);
    color: var(--accent);
}


/* ===================================== */
/* PULSE */
/* ===================================== */

.pulse-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 9px;

    padding: 15px 20px 0;
}

.pulse-card {
    padding: 13px 15px;

    border: 1px solid var(--line);
    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.025),
            rgba(255,255,255,.012)
        );
}

.pulse-label {
    color: var(--muted-2);

    font-size: 8px;
    letter-spacing: .14em;
}

.pulse-value {
    margin-top: 7px;

    font-size: 22px;
    font-weight: 700;

    letter-spacing: -.02em;
}

.index-value {
    color: var(--accent);
}

.pulse-meta {
    margin-top: 2px;

    color: var(--muted-2);

    font-size: 8px;
}


/* ===================================== */
/* HERO */
/* ===================================== */

.hero {
    padding: 44px 20px 22px;
}

.hero-kicker {
    color: var(--accent);

    font-size: 9px;
    letter-spacing: .15em;

    opacity: .85;
}

.hero h1 {
    margin: 12px 0 0;

    font-size: clamp(32px, 4vw, 54px);

    line-height: 1.02;
    letter-spacing: -.04em;

    font-weight: 750;
}

.hero h1 span {
    color: transparent;

    background:
        linear-gradient(
            100deg,
            var(--accent),
            var(--violet)
        );

    background-clip: text;
    -webkit-background-clip: text;
}

.hero p {
    max-width: 580px;

    margin: 16px 0 0;

    color: var(--muted);

    font-size: 13px;

    line-height: 1.8;
}

.hero-tags {
    display: flex;
    gap: 7px;

    margin-top: 18px;
}

.hero-tags span {
    border: 1px solid var(--line);
    border-radius: 999px;

    padding: 6px 8px;

    color: var(--muted);

    font-size: 8px;
}


/* ===================================== */
/* CHAT */
/* ===================================== */

.chat-container {
    min-height: 0;
    flex: 1;

    overflow-y: auto;

    padding: 4px 20px 20px;
}

.messages {
    max-width: 900px;

    margin: 0 auto;

    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message-row {
    display: flex;
}

.message-row.user {
    justify-content: flex-start;
}

.message-row.assistant {
    justify-content: flex-end;
}

.message {
    max-width: 78%;

    padding: 13px 15px;

    border-radius: 16px;

    line-height: 1.85;

    font-size: 13px;
}

.message.user-message {
    background: #181d21;
    border: 1px solid var(--line);
    color: var(--text);
}

.message.assistant-message {
    background:
        linear-gradient(
            145deg,
            rgba(87,230,255,.045),
            rgba(155,140,255,.035)
        );

    border: 1px solid rgba(87,230,255,.13);

    color: #eceae5;
}

.message-meta {
    margin-bottom: 7px;

    color: var(--muted-2);

    font-size: 8px;
    letter-spacing: .08em;
}

.citation {
    display: inline-flex;
    align-items: center;

    margin: 0 2px;
    padding: 1px 6px;

    border: 1px solid rgba(87,230,255,.22);
    border-radius: 6px;

    background: rgba(87,230,255,.08);

    color: var(--accent);

    font-size: 10px;

    cursor: pointer;

    transition: .15s ease;
}

.citation:hover,
.citation.active {
    background: rgba(87,230,255,.17);
    border-color: rgba(87,230,255,.44);
}

.typing {
    color: var(--muted);

    font-size: 12px;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    margin-right: 5px;
}

.typing-dots span {
    width: 4px;
    height: 4px;

    border-radius: 50%;

    background: var(--accent);

    animation: pulse 1.2s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: .15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: .30s;
}

@keyframes pulse {
    0%, 100% {
        opacity: .25;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-2px);
    }
}


/* ===================================== */
/* COMPOSER */
/* ===================================== */

.composer-wrapper {
    padding: 0 20px 20px;
}

.composer {
    max-width: 900px;

    margin: 0 auto;

    padding: 12px;

    border: 1px solid rgba(255,255,255,.10);
    border-radius: 17px;

    background:
        linear-gradient(
            150deg,
            rgba(255,255,255,.035),
            rgba(255,255,255,.018)
        );

    box-shadow:
        0 20px 50px rgba(0,0,0,.22),
        inset 0 1px rgba(255,255,255,.025);

    backdrop-filter: blur(14px);
}

.composer:focus-within {
    border-color: rgba(87,230,255,.25);

    box-shadow:
        0 20px 50px rgba(0,0,0,.26),
        0 0 0 1px rgba(87,230,255,.04);
}

.composer-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.composer-badge {
    color: var(--accent);

    font-size: 8px;
    font-weight: 700;
    letter-spacing: .12em;
}

.composer-hint {
    color: var(--muted-2);

    font-size: 9px;
}

.composer textarea {
    width: 100%;

    margin-top: 10px;

    resize: none;

    border: 0;
    outline: 0;

    background: transparent;

    color: var(--text);

    font-size: 13px;

    line-height: 1.7;
}

.composer textarea::placeholder {
    color: var(--muted-2);
}

.composer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-top: 8px;
}

.composer-tools {
    display: flex;
    gap: 9px;

    color: var(--muted-2);

    font-size: 8px;
    letter-spacing: .08em;
}

.composer-tools span:first-child {
    color: var(--violet);
}

.send-btn {
    display: flex;
    align-items: center;
    gap: 8px;

    border: 0;
    border-radius: 10px;

    padding: 8px 12px;

    background: var(--text);
    color: #101214;

    font-size: 11px;
    font-weight: 700;

    transition: .18s ease;
}

.send-btn:hover {
    transform: translateY(-1px);
}

.send-btn:disabled {
    cursor: not-allowed;
    opacity: .5;
}


/* ===================================== */
/* EVIDENCE */
/* ===================================== */

.evidence-panel {
    border-right: 1px solid var(--line);

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.018),
            rgba(255,255,255,.008)
        );

    padding: 20px;

    overflow-y: auto;
}

.evidence-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    padding-bottom: 16px;

    border-bottom: 1px solid var(--line);
}

.evidence-kicker {
    color: var(--muted-2);

    font-size: 8px;
    letter-spacing: .15em;
}

.evidence-header h2 {
    margin: 5px 0 0;

    font-size: 18px;
}

.evidence-live {
    display: flex;
    align-items: center;
    gap: 5px;

    color: var(--muted-2);

    font-size: 8px;
}

.evidence-live span {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: var(--accent);
}

.evidence-empty {
    min-height: 300px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;

    padding: 25px;
}

.evidence-icon {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    border: 1px solid var(--line);
    border-radius: 14px;

    color: var(--accent);

    background: rgba(87,230,255,.04);

    font-size: 20px;
}

.evidence-empty h3 {
    margin: 15px 0 4px;

    font-size: 13px;
}

.evidence-empty p {
    margin: 0;

    color: var(--muted);

    font-size: 10px;

    line-height: 1.7;
}

.evidence-content {
    padding-top: 20px;
}

.source-header {
    display: flex;
    gap: 10px;
    align-items: center;
}

.source-number {
    width: 35px;
    height: 35px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background: rgba(87,230,255,.08);

    color: var(--accent);

    font-size: 11px;
    font-weight: 700;
}

.source-name {
    color: var(--text);

    font-size: 12px;
    font-weight: 700;
}

.source-document {
    margin-top: 2px;

    color: var(--muted-2);

    font-size: 9px;
}

.evidence-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 8px;

    margin-top: 16px;
}

.evidence-stats > div {
    border: 1px solid var(--line);
    border-radius: 10px;

    padding: 10px;

    background: rgba(255,255,255,.018);
}

.evidence-stats span {
    display: block;

    color: var(--muted-2);

    font-size: 8px;
    letter-spacing: .08em;
}

.evidence-stats strong {
    display: block;

    margin-top: 5px;

    font-size: 12px;
}

.evidence-divider {
    margin: 18px 0;

    height: 1px;

    background: var(--line);
}

.evidence-label {
    color: var(--muted-2);

    font-size: 8px;
    letter-spacing: .12em;
}

.evidence-text {
    margin-top: 10px;

    padding: 13px;

    border: 1px solid var(--line);
    border-radius: 12px;

    background:
        linear-gradient(
            140deg,
            rgba(255,255,255,.025),
            rgba(255,255,255,.01)
        );

    color: #d8d6d0;

    font-size: 11px;

    line-height: 1.85;

    white-space: pre-wrap;
}

.hidden {
    display: none !important;
}


/* ===================================== */
/* SCROLLBARS */
/* ===================================== */

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.09);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(87,230,255,.22);
}


/* ===================================== */
/* RESPONSIVE */
/* ===================================== */

@media (max-width: 1200px) {

    .app-shell {
        grid-template-columns:
            215px
            minmax(400px, 1fr)
            300px;
    }

}

@media (max-width: 900px) {

    body {
        overflow: auto;
    }

    .app-shell {
        min-height: 100vh;

        grid-template-columns:
            1fr;
    }

    .sidebar {
        display: none;
    }

    .evidence-panel {
        display: none;
    }

    .main-panel {
        min-height: 100vh;
    }

    .pulse-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

}

@media (max-width: 600px) {

    .hero {
        padding-top: 28px;
    }

    .hero h1 {
        font-size: 38px;
    }

    .pulse-grid {
        padding-left: 14px;
        padding-right: 14px;
    }

    .topbar {
        padding: 15px;
    }

    .chat-container,
    .composer-wrapper {
        padding-left: 14px;
        padding-right: 14px;
    }

    .message {
        max-width: 92%;
    }
}