:root {
    --bg: #0f1224;
    --bg-panel: #161a2f;
    --bg-panel-alt: #1c2036;
    --accent: #7dd3fc;
    --accent-strong: #22d3ee;
    --text: #e6e9f5;
    --muted: #9aa4c2;
    --border: #262c44;
    --bubble-user: #202a44;
    --bubble-assistant: #131a30;
    --shadow: 0 15px 50px rgba(0, 0, 0, 0.35);
    --radius: 14px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.1), transparent 25%), radial-gradient(circle at 80% 0%, rgba(124, 58, 237, 0.12), transparent 20%), var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

p {
    margin: 0;
}

code {
    background: #0c1020;
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--accent);
    font-size: 0.9rem;
}

.eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.9rem;
}

.chat-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 18px;
}

.chat-sidebar {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.history {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.history-item {
    background: var(--bg-panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
}

.history-item.active {
    border-color: var(--accent);
    box-shadow: 0 5px 25px rgba(34, 211, 238, 0.1);
}

.history-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-meta {
    font-size: 0.95rem;
    color: var(--muted);
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 10px;
}

.chat-main {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    flex: 1;
    overflow: hidden;
}

.chat-header {
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-panel-alt);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--muted);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot.online {
    background: #4ade80;
    box-shadow: 0 0 0 6px rgba(74, 222, 128, 0.15);
}

.chat-transcript {
    flex: 1;
    padding: 14px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    border-radius: var(--radius);
    padding: 12px 14px;
    border: 1px solid var(--border);
    max-width: 780px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--bubble-user);
    border-color: #2d3b63;
}

.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bubble-assistant);
}

.bubble-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.bubble-meta .role {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.chat-input {
    padding: 14px 20px 20px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    background: var(--bg-panel);
    border-radius: 0 0 var(--radius) var(--radius);
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

textarea {
    width: 100%;
    resize: vertical;
    min-height: 96px;
    max-height: 200px;
    background: var(--bg-panel-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

.btn {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    color: var(--text);
    background: var(--bg-panel-alt);
}

.btn.primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    color: #041223;
    border-color: transparent;
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.35);
}

.btn.ghost {
    background: transparent;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.btn:active {
    transform: translateY(0);
}

.text-danger {
    color: #fca5a5;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.02);
}

.input-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.toggle input {
    accent-color: var(--accent);
}

@media (max-width: 1024px) {
    .chat-shell {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-sidebar {
        order: 2;
    }
}