:root { --bg:#0b0f14; --panel:#121821; --muted:#9fb0c3; --text:#e9eef4; --accent:#7cc4ff; }

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0; background: var(--bg); color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

h1 { font-weight: 600; font-size: 20px; margin: 0 0 12px; letter-spacing: .2px; }

.bar {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto auto;
    gap: 8px;
    background: var(--panel); padding: 10px; border-radius: 12px; border: 1px solid #223043;
    position: sticky; top: 0; z-index: 3;
}

input[type="text"] {
    width: 100%; background: #0f1520; border: 1px solid #223043; color: var(--text);
    border-radius: 10px; padding: 10px 12px; outline: none;
}

button {
    background: #1a2434; color: var(--text); border: 1px solid #223043;
    border-radius: 10px; padding: 10px 14px; cursor: pointer;
}

button:hover { background: #1e2a3e; }

.chat {
    margin-top: 12px; background: var(--panel); border: 1px solid #223043; border-radius: 12px;
    height: 70vh; overflow-y: auto; padding: 16px;
}

.msg { margin: 0 0 16px; }

.role { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.bubble {
    background: #0f1520; border: 1px solid #223043; border-radius: 12px; padding: 12px; white-space: pre-wrap;
}

.you .bubble { border-color: #2a3d57; }

.assistant .bubble { border-color: #314764; }

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    margin-top: 6px;
}
.status .left {
    flex: 0 1 auto;
}
.status .right {
    margin-left: auto;
    color: var(--muted);
    white-space: nowrap;
}

.muted { color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; }
.hidden { display: none; }

.sources-title { margin: 12px 0 6px; font-size: 12px; color: var(--muted); }
.sources-list  { margin: 0; padding-left: 18px; }
.sources-list li { margin: 2px 0; }

.blink {
    animation: fadepulse 1.6s ease-in-out infinite;
}

@keyframes fadepulse {
    0%   { opacity: 0.35; }
    50%  { opacity: 1; }
    100% { opacity: 0.35; }
}

sup.cite {
    font-size: 0.72em;
    line-height: 0;
    vertical-align: super;
    opacity: 0.85;
}

select {
    background: #0f1520; border: 1px solid #223043; color: var(--text);
    border-radius: 10px; padding: 10px 12px; outline: none;
}

/* Make content sit a bit higher and centred */
.layout {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.wrap {
    flex: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 32px;
    display: flex;
    flex-direction: column;
}


/* Slightly smaller top margin on the main title */
.wrap h1 {
    margin-top: 4px;
    margin-bottom: 12px;
}

/* Sidebar header spacing */
.sidebar-header {
    padding-top: 8px;
    padding-bottom: 8px;
}

.sidebar {
    width: 260px;
    background: #05070c;
    border-right: 1px solid #171f2b;
    padding: 16px 12px;
}

/* Scrollable session list area */
.session-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.session-item {
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
}

.session-item:hover {
    background: #151d29;
    color: var(--text);
}

/* Container that holds chat messages + composer + audio */
.chat-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 12px;
    gap: 12px;
}

/* Chat area now just fills remaining height in chat-shell */
.chat {
    background: var(--panel);
    border: 1px solid #223043;
    border-radius: 12px;
    padding: 16px;
    flex: 1;                      /* grow to fill space */
    min-height: 200px;
    max-height: none;
    overflow-y: auto;
}

/* Composer bar at the bottom, no sticky top */
.bar {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto auto;
    gap: 8px;
    background: var(--panel);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #223043;
    position: static;             /* remove sticky */
    box-shadow: 0 -2px 12px rgba(0,0,0,0.45);
}

/* Just to differentiate the composer if you want */
.bar.composer {
    margin-top: 4px;
}

/* Audio row compact */
.audio-row {
    font-size: 12px;
    color: var(--muted);
}

.audio-row audio {
    width: 100%;
    max-height: 32px;
}

.wrap h1 {
    margin-top: 4px;
    margin-bottom: 8px;
}

.auth-info {
    margin-top: 4px;
}

/* Login layout: centre the card */
.login-layout {
    justify-content: center;
    align-items: center;
}

/* Login card */
.auth-card {
    background: var(--panel);
    border-radius: 16px;
    border: 1px solid #223043;
    padding: 24px 28px 22px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
    min-width: 320px;
    max-width: 380px;
}

/* Login title + subtitle */
.auth-card h1 {
    font-size: 22px;
    margin: 0 0 4px;
}

.auth-subtitle {
    margin: 0 0 16px;
    font-size: 13px;
}

/* Stack login inputs vertically with spacing */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
}

.auth-form button {
    margin-top: 6px;
}

#login-status {
    font-size: 12px;
    min-height: 16px;
}
