
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #080b10;
    --surface: #0d1117;
    --surface2: #131920;
    --border: #1e2730;
    --text: #c9d1d9;
    --text-dim: #556070;
    --text-bright: #e6edf3;
    --green: #3fb950;
    --blue: #58a6ff;
    --red: #f85149;
    --sidebar-w: 260px;
}

body {
    font-family: 'Syne', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* ── LOGIN ── */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg);
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 380px;
    max-width: 90vw;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-dot {
    width: 10px;
    height: 10px;
    background: var(--green);
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

.login-logo-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: 0.1em;
}

.login-subtitle {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-top: 6px;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus { border-color: var(--blue); }

.btn-login {
    width: 100%;
    padding: 13px;
    background: var(--blue);
    border: none;
    border-radius: 8px;
    color: #000;
    font-family: 'Syne', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.btn-login:hover { background: #79b8ff; }

.login-error {
    background: #3a1a1a;
    border: 1px solid var(--red);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--red);
    margin-top: 16px;
    display: none;
}

/* ── APP LAYOUT ── */
.app-layout {
    display: none;
    height: 100vh;
    flex-direction: row;
}

.app-layout.active { display: flex; }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-logo-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: 0.08em;
}

.sidebar-agents {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 8px 8px 4px;
}

.agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
}

.agent-item:hover { background: var(--surface2); }
.agent-item.active { background: var(--surface2); border: 1px solid var(--border); }

.agent-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1a3a4a, #0d2040);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.agent-info { flex: 1; min-width: 0; }
.agent-name { font-size: 0.85rem; font-weight: 600; color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-model { font-size: 0.68rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.agent-status {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 600;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    color: var(--text-dim);
    font-size: 0.72rem;
    cursor: pointer;
    font-family: 'Syne', sans-serif;
    transition: all 0.2s;
}

.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── CHAT AREA ── */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
}

.chat-agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1a3a4a, #0d2040);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.chat-agent-name { font-size: 1rem; font-weight: 700; color: var(--text-bright); }
.chat-agent-status { font-size: 0.72rem; color: var(--green); }

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    gap: 12px;
}

.chat-empty-icon { font-size: 3rem; opacity: 0.3; }
.chat-empty-text { font-size: 0.9rem; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.message.user { flex-direction: row-reverse; align-self: flex-end; }
.message.agent { align-self: flex-start; }

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.message.user .message-avatar { background: var(--blue); }
.message.agent .message-avatar { background: linear-gradient(135deg, #1a3a4a, #0d2040); }

.message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.message.user .message-bubble {
    background: var(--blue);
    color: #000;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

.message.agent .message-bubble {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 4px;
    text-align: right;
}

.message.agent .message-time { text-align: left; }

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── INPUT ── */
.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within { border-color: var(--blue); }

.chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: 'Syne', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    resize: none;
    max-height: 120px;
    line-height: 1.5;
}

.chat-input::placeholder { color: var(--text-dim); }

.btn-send {
    background: var(--blue);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
    color: #000;
    font-size: 1rem;
}

.btn-send:hover { background: #79b8ff; }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ── MOBILE ── */
@media (max-width: 640px) {
    :root { --sidebar-w: 100vw; }
    .sidebar { position: fixed; z-index: 100; height: 100vh; transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .chat-header { padding: 12px 16px; }
    .chat-messages { padding: 16px; }
    .chat-input-area { padding: 12px 16px; }
    .message { max-width: 90%; }
}
