:root {
    color-scheme: light dark;
    --border: #d0d0d0;
    --error: #b3261e;
}

body {
    font-family: system-ui, sans-serif;
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.disclosure {
    background: #fff3cd;
    color: #664d03;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.error {
    color: var(--error);
    font-weight: 600;
}

form label {
    display: block;
    margin-bottom: 0.75rem;
}

form input {
    display: block;
    width: 100%;
    max-width: 320px;
    padding: 0.4rem;
    margin-top: 0.25rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    text-align: left;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

button {
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.message {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    white-space: pre-wrap;
}

.message.user {
    color: #1a4d8f;
}

.explainer ul {
    padding-left: 1.2rem;
}

.budget {
    font-size: 0.9rem;
    color: #555;
}

.budget-warning {
    background: #fff3cd;
    color: #664d03;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.coaching-tip {
    background: #eaf4ea;
    color: #2e5c2e;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0 0.75rem;
    font-size: 0.9rem;
}

.message.flagged {
    background: #fdeaea;
}

.flag-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    background: var(--error);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.escalation.unacknowledged {
    border-color: var(--error);
    border-width: 2px;
}

.escalation .message {
    white-space: pre-wrap;
    font-style: italic;
}

/* Chat on top, artifacts below — not side-by-side, so the full page width is available
   to each (a code block or web app preview benefits from width more than from being
   narrower-but-next-to-the-chat). */
.chat-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.chat-column {
    min-width: 0; /* allow children to shrink below their content size instead of overflowing */
}

.artifacts-column {
    min-width: 0;
    overflow-x: hidden; /* a long unwrapped code line must scroll inside its own <pre>,
                            not stretch this column (and the whole page) wider than the
                            viewport */
}

.chat-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem;
}

.chat-list li {
    padding: 0.3rem 0;
}

.chat-list li.current strong {
    color: #1a4d8f;
}

.new-chat-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.new-chat-form input {
    margin: 0;
    max-width: 220px;
}

.artifacts-column h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.empty-artifacts {
    color: #777;
    font-size: 0.9rem;
}

.artifact {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.artifact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f3f3f3;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.artifact-header .copy-btn {
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
    font-weight: normal;
}

.artifact pre {
    margin: 0;
    padding: 0.75rem;
    overflow-x: auto;
    background: #fafafa;
}

.artifact code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    white-space: pre;
}

.artifact-preview {
    display: block;
    width: 100%;
    height: 320px;
    border: 0;
    border-top: 1px solid var(--border);
    background: #fff;
}

.artifact-code summary {
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    color: #555;
    background: #f3f3f3;
    border-top: 1px solid var(--border);
}

.artifact-code pre {
    margin: 0;
    padding: 0.75rem;
    overflow-x: auto;
    background: #fafafa;
}

