:root {
    --background: #ffffff;
    --surface: #ffffff;
    --text: #0a0a0a;
    --muted: #666666;
    --border: #dddddd;
    --accent: #444444;
    --cta: #ff3019;
    --danger: #b42318;
    --sans: "rig-sans", "Helvetica Neue", Arial, sans-serif;
    --serif: "miller-display", Georgia, "Times New Roman", serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text);
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
}

button,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

.shell {
    display: grid;
    grid-template-rows: 64px minmax(0, 1fr);
    height: 100dvh;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 28px;
    color: var(--text);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    text-decoration: none;
    color: var(--text);
}

.eyebrow { display: block; margin-bottom: 18px; color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.welcome .source-summary { margin-top: 22px; font-size: 11px; line-height: 1.8; }
.suggestions button:disabled { cursor: not-allowed; opacity: .55; }

.brand-logo {
    display: block;
    width: 170px;
    height: auto;
    max-height: 48px;
}

.header-actions,
.index-status {
    display: flex;
    align-items: center;
}

.header-actions {
    gap: 18px;
}

.index-status {
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #888;
    border-radius: 50%;
}

.status-dot.ready {
    background: #6fa571;
}

.new-chat {
    padding: 8px 12px;
    color: var(--accent);
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.new-chat:hover {
    background: #ededed;
    border-color: #aaa;
}

.workspace {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-width: 0;
    overflow: hidden;
}

.conversation {
    overflow-y: auto;
    scroll-behavior: smooth;
}

.welcome,
.messages,
.composer,
.composer-note {
    width: min(760px, calc(100% - 40px));
    margin-right: auto;
    margin-left: auto;
}

.welcome {
    margin-top: clamp(72px, 15vh, 150px);
    margin-bottom: 48px;
    text-align: center;
}

.welcome h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 46px);
    line-height: 1.1;
    letter-spacing: normal;
}

.welcome > p {
    max-width: 560px;
    margin: 18px auto 32px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    text-align: left;
}

.suggestions button {
    min-height: 82px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}

.suggestions button:hover {
    border-color: #aaa;
    background: #f6f6f6;
}

.messages {
    margin-top: 28px;
    margin-bottom: 36px;
}

.message {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.message-label {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.message.user .message-label {
    color: var(--accent);
}

.message-content {
    min-width: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 17px;
    line-height: 1.7;
}

.message.assistant .message-content {
    font-size: 16px;
}

.message.assistant .message-content p {
    margin: 0 0 .8em;
}

.message.assistant .message-content p:last-child {
    margin-bottom: 0;
}

.message.assistant .message-content ul,
.message.assistant .message-content ol {
    margin: .65em 0 .9em;
    padding-left: 1.5em;
}

.message.assistant .message-content li {
    padding-left: .15em;
}

.message.assistant .message-content li + li {
    margin-top: .4em;
}

.message.assistant .message-content h2,
.message.assistant .message-content h3,
.message.assistant .message-content h4 {
    margin: 1em 0 .45em;
    line-height: 1.3;
}

.message.assistant .message-content h2:first-child,
.message.assistant .message-content h3:first-child,
.message.assistant .message-content h4:first-child {
    margin-top: 0;
}

.message.assistant .message-content strong {
    font-weight: 700;
}

.message.assistant .message-content em {
    font-style: italic;
}

.message.assistant .message-content code {
    padding: .16em .38em;
    color: var(--accent);
    background: #f6f6f6;
    border: 1px solid var(--border);
    border-radius: 4px;
    font: .88em/1.5 var(--mono);
}

.message.assistant .message-content pre {
    max-width: 100%;
    margin: 14px 0;
    padding: 15px 17px;
    overflow-x: auto;
    color: #f6f6f6;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    white-space: pre;
    tab-size: 4;
}

.message.assistant .message-content pre code {
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 13px;
}

.message.error .message-content {
    color: var(--danger);
}

.typing::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 14px;
    margin-left: 3px;
    vertical-align: -2px;
    background: var(--accent);
    animation: blink .8s step-end infinite;
}

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

.sources {
    margin-top: 20px;
}

.demo-notice {
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid #d6dfe3;
    border-left: 4px solid #607884;
    border-radius: 7px;
    background: #f2f6f7;
    color: #344954;
    font-size: 13px;
    line-height: 1.6;
}

.demo-notice strong {
    display: block;
    margin-bottom: 4px;
}

.demo-notice p {
    margin: 0;
}

.sources-title {
    margin: 0 0 9px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.source {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 8px 10px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 12px;
    text-decoration: none;
}

.source:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.source-number {
    color: var(--accent);
    font-family: var(--mono);
    font-weight: 700;
}

.composer-wrap {
    padding: 18px 20px 16px;
    background: linear-gradient(transparent, var(--background) 18%);
}

.composer {
    display: flex;
    align-items: flex-end;
    padding: 8px 8px 8px 16px;
    background: var(--surface);
    border: 2px solid #aaa;
    border-radius: 12px;
    box-shadow: 0 3px 14px rgba(20, 20, 18, .06);
}

.composer:focus-within {
    border-color: var(--accent);
    box-shadow: 0 3px 14px rgba(68, 68, 68, .09);
}

.composer textarea {
    flex: 1;
    min-height: 42px;
    max-height: 160px;
    padding: 10px 10px 8px 0;
    resize: none;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
    line-height: 1.5;
}

.composer textarea::placeholder {
    color: #777;
}

.send {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    color: #fff;
    background: var(--cta);
    border: 0;
    border-radius: 9px;
    cursor: pointer;
}

.send:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.send:hover:not(:disabled) {
    background: #d92715;
}

.send-arrow {
    font-size: 21px;
    line-height: 1;
}

.stop-square {
    display: none;
    width: 10px;
    height: 10px;
    background: #fff;
}

.streaming .send-arrow {
    display: none;
}

.streaming .stop-square {
    display: block;
}

.composer-note {
    margin-top: 10px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .shell {
        grid-template-rows: 58px minmax(0, 1fr);
    }

    .site-header {
        padding: 0 16px;
    }

    .brand-logo {
        width: 145px;
        max-height: 40px;
    }

    .header-actions {
        gap: 8px;
    }

    .index-status {
        display: none;
    }

    #index-status {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .welcome,
    .messages {
        width: calc(100% - 32px);
    }

    .welcome {
        margin-top: 54px;
    }

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

    .suggestions button {
        min-height: 0;
    }

    .composer-wrap {
        padding: 12px;
    }

    .message.assistant .message-content pre {
        margin-right: -4px;
        margin-left: -4px;
        padding: 13px;
    }

    .composer,
    .composer-note {
        width: 100%;
    }

    .composer-note {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
