:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --incoming: #dbeafe;
    --outgoing: #dcfce7;
    --accent: #0f172a;
    --border: #cbd5e1;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: var(--text);
}

.chat-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.chat-header h1 {
    margin: 0;
    font-size: 28px;
}

.chat-header p {
    margin: 8px 0 20px;
    color: var(--muted);
}

.auth-card,
.chat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

input,
button {
    font: inherit;
}

input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
}

button {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

.error {
    color: #b91c1c;
}

.session-history {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.session-history h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.session-history ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-history li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: #f8fafc;
}

.history-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}

.history-main code {
    font-size: 12px;
    word-break: break-all;
    color: var(--text);
}

button.secondary {
    background: #fff;
    color: var(--accent);
}

.session-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.session-actions {
    display: flex;
    gap: 8px;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 320px;
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: var(--bg);
}

.message {
    border-radius: 10px;
    padding: 10px;
    border: 1px solid var(--border);
}

.message header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}

.message.incoming {
    background: var(--incoming);
}

.message.outgoing {
    background: var(--outgoing);
}

.message p {
    margin: 0;
    white-space: pre-wrap;
}

.empty {
    color: var(--muted);
}

.composer {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.composer input {
    flex: 1;
}

#blazor-error-ui {
    display: none;
    background: #b91c1c;
    color: #fff;
    padding: 10px;
}

#blazor-error-ui .reload {
    color: #fff;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 8px;
}

@media (max-width: 640px) {
    .session-history li {
        flex-direction: column;
    }

    .messages {
        min-height: 260px;
    }

    .composer {
        flex-direction: column;
    }
}
