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

:root {
    --bg: #080808;
    --sidebar: #0d0d0d;
    --panel: #151515;
    --border: #292929;
    --white: #f4f4f4;
    --silver: #c7c7c7;
    --muted: #898989;
}

body {
    background: var(--bg);
    color: var(--white);
    font-family: Arial, Helvetica, sans-serif;
}

button, textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
    width: 255px;
    min-width: 255px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 25px 17px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1.5px;
    margin-bottom: 35px;
}

.brand strong {
    color: var(--silver);
}

.brand-symbol {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid #777;
    border-radius: 50%;
    color: var(--silver);
    font-size: 23px;
}

.new-research {
    background: #e3e3e3;
    color: #080808;
    border: none;
    border-radius: 6px;
    padding: 13px;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    margin-bottom: 35px;
}

.new-research:hover {
    background: white;
}

.sidebar-label {
    color: #777;
    font-size: 9px;
    letter-spacing: 2px;
    margin: 0 0 13px 10px;
}

.sidebar-link {
    display: block;
    padding: 12px 11px;
    color: #a3a3a3;
    font-size: 12px;
    border-radius: 5px;
    margin-bottom: 5px;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: #202020;
    color: white;
}

.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.sidebar-status {
    font-size: 9px;
    color: #aaa;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #b8c8b8;
    border-radius: 50%;
    margin-right: 7px;
}

.sidebar-bottom p {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1.5px;
}

.sidebar-bottom span:last-child {
    color: #777;
    font-size: 10px;
}

/* MAIN AREA */

.main-area {
    margin-left: 255px;
    width: calc(100% - 255px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 65px;
    padding: 0 35px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    font-size: 12px;
    color: #ccc;
}

.topbar-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.system-indicator {
    color: #aebfae;
    font-size: 9px;
    letter-spacing: 1px;
}

.version {
    color: #666;
    font-size: 9px;
}

/* WORKSPACE */

.workspace {
    width: 100%;
    max-width: 1050px;
    margin: auto;
    padding: 45px 35px 180px;
    flex: 1;
}

.welcome-screen {
    max-width: 760px;
    margin: 35px auto 0;
    text-align: center;
}

.welcome-emblem {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 20px;
}

.welcome-eyebrow {
    font-size: 10px;
    letter-spacing: 3px;
    color: #999;
    font-weight: bold;
}

.welcome-screen h1 {
    font-size: clamp(37px, 5vw, 58px);
    line-height: 1.15;
    letter-spacing: -2px;
    margin: 20px 0;
    font-weight: 800;
}

.welcome-screen h1 span {
    color: var(--silver);
}

.welcome-description {
    color: var(--muted);
    max-width: 540px;
    margin: auto;
    font-size: 13px;
    line-height: 1.8;
}

.suggestion-heading {
    margin: 55px 0 15px;
    text-align: left;
    font-size: 10px;
    color: #aaa;
    letter-spacing: 1.5px;
}

.suggestion-heading span {
    color: #ddd;
    margin-right: 7px;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.suggestion-card {
    min-height: 105px;
    padding: 16px;
    text-align: left;
    color: white;
    background: #111;
    border: 1px solid var(--border);
    border-radius: 7px;
    transition: .2s;
}

.suggestion-card:hover {
    background: #1a1a1a;
    border-color: #777;
    transform: translateY(-2px);
}

.suggestion-card span {
    display: block;
    font-size: 19px;
    margin-bottom: 8px;
}

.suggestion-card strong {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
}

.suggestion-card small {
    color: #888;
    font-size: 10px;
}

/* FIXED INPUT */

.input-area {
    position: fixed;
    bottom: 0;
    left: 255px;
    width: calc(100% - 255px);
    padding: 18px 35px 12px;
    background: linear-gradient(transparent, #080808 17%);
    z-index: 5;
}

.input-container {
    max-width: 850px;
    margin: auto;
    padding: 15px 17px 12px;
    background: #151515;
    border: 1px solid #383838;
    border-radius: 11px;
    box-shadow: 0 8px 35px #000;
}

.input-container:focus-within {
    border-color: #888;
}

.input-container textarea {
    width: 100%;
    min-height: 48px;
    max-height: 150px;
    resize: vertical;
    border: none;
    outline: none;
    background: transparent;
    color: white;
    font-size: 13px;
    line-height: 1.6;
}

.input-container textarea::placeholder {
    color: #777;
}

.input-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid #292929;
}

.input-bottom span {
    color: #858585;
    font-size: 10px;
}

#research-button {
    padding: 10px 17px;
    background: #e3e3e3;
    border: none;
    border-radius: 5px;
    color: #080808;
    font-size: 11px;
    font-weight: bold;
}

#research-button:hover {
    background: white;
}

#research-button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.input-disclaimer,
#message {
    text-align: center;
    color: #777;
    font-size: 9px;
    margin-top: 8px;
}

/* CONVERSATION */

.conversation {
    max-width: 850px;
    margin: 0 auto;
}

.chat-message {
    margin: 30px 0;
}

.message-label {
    font-size: 9px;
    letter-spacing: 2px;
    font-weight: bold;
    color: #aaa;
    margin-bottom: 10px;
}

.message-body {
    padding: 15px 18px;
    border-radius: 8px;
    background: #141414;
    border: 1px solid #292929;
    color: #ddd;
    font-size: 13px;
    line-height: 1.8;
}

.chat-message.user .message-body {
    background: #1b1b1b;
}

.research-report {
    margin-top: 35px;
    padding-bottom: 150px;
}

.report-eyebrow {
    color: #999;
    font-size: 10px;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.research-report h2 {
    font-size: 28px;
    margin-bottom: 25px;
}

.report-section {
    margin: 25px 0;
}

.report-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #eee;
}

.report-section > p {
    color: #aaa;
    font-size: 12px;
    line-height: 1.8;
}

.publication-card {
    background: #121212;
    border: 1px solid #303030;
    border-radius: 7px;
    padding: 19px;
    margin: 13px 0;
}

.publication-number {
    font-size: 9px;
    color: #888;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.publication-card h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

.publication-evidence,
.publication-note {
    color: #aaa;
    font-size: 12px;
    line-height: 1.8;
    margin-bottom: 12px;
}

.verification-label {
    display: block;
    color: #aaa;
    font-size: 10px;
    margin: 10px 0;
}

.source-link {
    display: inline-block;
    color: #ddd;
    font-size: 11px;
    text-decoration: underline;
    margin-top: 5px;
}

.verification-detail {
    margin: 8px 0;
}

.report-disclaimer {
    margin-top: 30px;
    padding: 14px;
    background: #171717;
    border-left: 2px solid #888;
    color: #999;
    font-size: 11px;
    line-height: 1.7;
}

/* THINKING HISTORY */

.history-panel {
    display: none;
    width: 100%;
    max-width: 900px;
    margin: 35px auto;
    padding: 30px;
    background: #0d0d0d;
    border: 1px solid #292929;
    border-radius: 14px;
}

.history-panel.visible {
    display: block;
}

.history-header {
    margin-bottom: 28px;
}

.history-header h2 {
    color: #f1f1f1;
    font-size: 30px;
    margin: 12px 0;
}

.history-header > p:last-child {
    color: #888;
    font-size: 13px;
}

.history-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 25px;
}

.history-search input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    color: #fff;
    background: #151515;
    border: 1px solid #303030;
    border-radius: 7px;
    outline: none;
}

.history-search input:focus {
    border-color: #888;
}

.history-search button {
    height: 44px;
    padding: 0 20px;
    color: #fff;
    background: #202020;
    border: 1px solid #383838;
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
}

.history-search button:hover {
    background: #303030;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

[hidden] {
    display: none !important;
}

/* RESPONSIVE */

@media (max-width: 760px) {
    .sidebar {
        width: 65px;
        min-width: 65px;
        padding: 20px 8px;
        align-items: center;
    }

    .brand {
        margin-bottom: 30px;
    }

    .brand > span:last-child,
    .sidebar-label,
    .sidebar-link:not(.active),
    .sidebar-bottom {
        display: none;
    }

    .new-research {
        width: 45px;
        height: 42px;
        overflow: hidden;
        white-space: nowrap;
        font-size: 0;
        text-align: center;
    }

    .new-research::before {
        content: "+";
        font-size: 22px;
    }

    .sidebar-link.active {
        font-size: 0;
    }

    .sidebar-link.active::first-letter {
        font-size: 20px;
    }

    .main-area {
        margin-left: 65px;
        width: calc(100% - 65px);
    }

    .input-area {
        left: 65px;
        width: calc(100% - 65px);
        padding: 12px;
    }

    .topbar {
        padding: 0 15px;
    }

    .workspace {
        padding: 35px 15px 180px;
    }

    .suggestion-grid {
        grid-template-columns: 1fr;
    }

    .welcome-screen {
        margin-top: 15px;
    }

    .version {
        display: none;
    }

    .history-panel {
        padding: 18px;
    }

    .history-search {
        flex-wrap: wrap;
    }

    .history-search input {
        flex-basis: 100%;
    }

    .history-search button {
        flex: 1;
    }
}

@media (max-width: 430px) {
    .welcome-screen h1 {
        font-size: 36px;
    }

    .welcome-description {
        font-size: 12px;
    }

    .input-bottom span {
        display: none;
    }

    #research-button {
        width: 100%;
    }

    .input-bottom {
        display: block;
    }
}

/* ==========================================
   EVIDENCE BASED — NOTEBOOK APPEARANCE
   These styles affect Evidence Based only.
========================================== */

/* Notebook paper */

#evidence-panel {
    background-color: #f7f1df;
    background-image:
        linear-gradient(
            90deg,
            transparent 0,
            transparent 43px,
            rgba(190, 85, 85, 0.28) 44px,
            rgba(190, 85, 85, 0.28) 45px,
            transparent 46px
        ),
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 31px,
            rgba(90, 135, 180, 0.20) 32px,
            transparent 33px
        );
    color: #292820;
    border: 1px solid #ded4bb;
    border-radius: 5px;
    padding: 34px 32px 45px 65px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
    min-height: 400px;
}

/* Keep the hidden state working */

#evidence-panel[hidden],
#evidence-input-area[hidden] {
    display: none !important;
}

/* Notebook heading */

#evidence-panel .evidence-header {
    margin-bottom: 35px;
    padding-bottom: 18px;
    border-bottom: 1px dashed rgba(80, 75, 60, 0.35);
}

#evidence-panel .welcome-eyebrow {
    color: #77705e;
    letter-spacing: 2px;
}

#evidence-panel h1 {
    color: #24231e;
    margin: 12px 0;
    font-family: "Segoe Print", "Bradley Hand", cursive;
    font-size: clamp(30px, 4vw, 43px);
    letter-spacing: -1px;
}

#evidence-panel .evidence-header > p:last-child {
    color: #625e51;
    line-height: 1.8;
}

/* Research answer */

#evidence-panel .evidence-answer {
    color: #292820;
    margin: 25px 0;
}

#evidence-panel h2,
#evidence-panel h3 {
    color: #292820;
    font-family: "Segoe Print", "Bradley Hand", cursive;
    line-height: 1.6;
    margin-bottom: 13px;
}

#evidence-panel h2 {
    font-size: 21px;
}

#evidence-panel h3 {
    font-size: 17px;
}

/* Marker-style heading highlight */

#evidence-panel .evidence-answer h2,
#evidence-panel .supporting-evidence h2,
#evidence-panel .publication-evidence h2 {
    display: inline;
    padding: 2px 5px;
    background: linear-gradient(
        transparent 45%,
        rgba(255, 220, 105, 0.72) 45%,
        rgba(255, 220, 105, 0.72) 90%,
        transparent 90%
    );
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Handwritten-style research text */

#evidence-panel .evidence-paragraph,
#evidence-panel .supporting-evidence,
#evidence-panel .publication-evidence,
#evidence-panel .evidence-source-venue {
    color: #343126;
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    font-size: 13px;
    line-height: 2.1;
}

/* Status and explanation */

#evidence-panel .evidence-status {
    display: inline-block;
    color: #655b3f;
    background: rgba(255, 224, 130, 0.30);
    border: 1px solid rgba(145, 119, 58, 0.25);
    border-radius: 4px;
    padding: 5px 9px;
    font-size: 10px;
    margin: 10px 0;
}

#evidence-panel .evidence-answer-basis {
    color: #6a6557;
    font-size: 11px;
    line-height: 1.8;
}

/* Supporting evidence */

#evidence-panel .supporting-evidence {
    margin-top: 30px;
}

#evidence-panel .evidence-source-card {
    background: rgba(255, 255, 255, 0.30);
    border: 1px solid rgba(100, 90, 65, 0.20);
    border-left: 3px solid #b69c58;
    border-radius: 3px;
    padding: 17px 18px;
    margin: 15px 0;
    color: #302e26;
    box-shadow: 2px 3px 7px rgba(80, 70, 45, 0.06);
}

#evidence-panel .evidence-source-card h3,
#evidence-panel .evidence-source-card h4 {
    color: #292820;
    font-family: "Segoe Print", "Bradley Hand", cursive;
    font-size: 14px;
    margin-bottom: 9px;
}

#evidence-panel .evidence-source-card p {
    color: #454133;
    font-size: 12px;
    line-height: 1.9;
}

#evidence-panel .evidence-source-link {
    color: #245b91;
    text-decoration: underline;
    font-size: 11px;
    overflow-wrap: anywhere;
}

#evidence-panel .evidence-source-venue {
    color: #77705e;
    font-size: 11px;
}

/* Retrieved publication records */

#evidence-panel .publication-evidence {
    margin-top: 30px;
}

#evidence-panel .evidence-warning {
    color: #76551b;
    background: rgba(255, 220, 140, 0.25);
    border-left: 3px solid #b99542;
    padding: 12px 15px;
    font-size: 11px;
    line-height: 1.8;
    margin: 15px 0;
}

#evidence-panel .evidence-error {
    color: #8a3028;
    background: rgba(190, 80, 70, 0.08);
    border-left: 3px solid #b75c50;
    padding: 12px 15px;
    font-size: 12px;
    line-height: 1.8;
    margin: 15px 0;
}

/* Evidence Based input area */

#evidence-input-area {
    background: linear-gradient(
        transparent,
        rgba(8, 8, 8, 0.96) 18%
    );
}

#evidence-input-area .input-container {
    background: #f7f1df;
    border: 1px solid #d8ceb5;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

#evidence-input-area .input-container:focus-within {
    border-color: #a9976d;
}

#evidence-question {
    color: #292820;
    font-family: "Segoe Print", "Bradley Hand", cursive;
}

#evidence-question::placeholder {
    color: #8a826f;
}

#evidence-input-area .input-bottom {
    border-top: 1px solid #ded4bb;
}

#evidence-input-area .input-bottom span,
#evidence-message {
    color: #77705e;
}

#evidence-button {
    padding: 10px 17px;
    background: #292820;
    border: none;
    border-radius: 4px;
    color: #f7f1df;
    font-size: 11px;
    font-weight: bold;
}

#evidence-button:hover {
    background: #454133;
}

#evidence-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile notebook spacing */

@media (max-width: 760px) {
    #evidence-panel {
        padding: 25px 16px 35px 48px;
        background-image:
            linear-gradient(
                90deg,
                transparent 0,
                transparent 29px,
                rgba(190, 85, 85, 0.25) 30px,
                rgba(190, 85, 85, 0.25) 31px,
                transparent 32px
            ),
            repeating-linear-gradient(
                to bottom,
                transparent 0,
                transparent 31px,
                rgba(90, 135, 180, 0.18) 32px,
                transparent 33px
            );
    }

    #evidence-panel .evidence-source-card {
        padding: 13px;
    }
}
