/* ═══════════════════════════════════════════════════
   stil.css — ai.ciocan.info
   Corporate Modern Palette 2026 — Clarity
   ═══════════════════════════════════════════════════ */

:root {
    --bg:          #F8FAFC;
    --bg2:         #FFFFFF;
    --bg3:         #F1F5F9;
    --bg4:         #E2E8F0;
    --border:      #E2E8F0;
    --border2:     #CBD5E1;
    --primary:     #2563EB;
    --primary2:    #1E40AF;
    --primary3:    #1E3A8A;
    --primary-bg:  #EFF6FF;
    --primary-brd: #BFDBFE;
    --green:       #16A34A;
    --green2:      #15803D;
    --amber:       #B45309;
    --cyan:        #0284C7;
    --red:         #DC2626;
    --red2:        #B91C1C;
    --text:        #0F172A;
    --text2:       #334155;
    --text3:       #64748B;
    --white:       #FFFFFF;
    --glow:        0 0 0 3px rgba(37,99,235,0.15);
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow:      0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg:   0 20px 35px -8px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
    --transition:  all 0.18s ease;
    --radius:      12px;
    --radius-sm:   8px;
    --font-mono:   'JetBrains Mono', 'Courier New', monospace;
    --font-ui:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
    --bg:          #0A0F1C;
    --bg2:         #111827;
    --bg3:         #1F2937;
    --bg4:         #2D3748;
    --border:      #2D3748;
    --border2:     #4A5568;
    --primary:     #3B82F6;
    --primary2:    #2563EB;
    --primary3:    #1D4ED8;
    --primary-bg:  #1e2a3a;
    --primary-brd: #2d4a6b;
    --green:       #34D399;
    --green2:      #10B981;
    --amber:       #F59E0B;
    --cyan:        #38BDF8;
    --red:         #EF4444;
    --red2:        #DC2626;
    --text:        #F1F5F9;
    --text2:       #CBD5E1;
    --text3:       #94A3B8;
    --white:       #FFFFFF;
    --glow:        0 0 0 3px rgba(59,130,246,0.25);
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.5);
    --shadow:      0 4px 12px rgba(0,0,0,0.6);
    --shadow-lg:   0 8px 24px rgba(0,0,0,0.8);
}

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

@keyframes blink    { 0%,100%{opacity:1} 50%{opacity:0} }
@keyframes float    { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.5} }
@keyframes slideIn  { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:translateY(0)} }
@keyframes bounce   { 0%,80%,100%{transform:scale(.5);opacity:.3} 40%{transform:scale(1);opacity:1} }
@keyframes shake    { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

/* ══════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════ */

body.page-login {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}

body.page-login::before {
    content: '';
    position: fixed; inset: 0;
    background:
        radial-gradient(ellipse at 25% 25%, rgba(37,99,235,0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 75%, rgba(22,163,74,0.04) 0%, transparent 55%);
    pointer-events: none;
}

[data-theme="dark"] body.page-login::before {
    background:
        radial-gradient(ellipse at 25% 25%, rgba(59,130,246,0.1) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 75%, rgba(52,211,153,0.05) 0%, transparent 55%);
}

.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px 36px 36px;
    width: 100%;
    max-width: 390px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary3), var(--primary), #60A5FA);
    border-radius: 24px 24px 0 0;
}

.robot {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 4px 14px rgba(37,99,235,0.15));
}

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

.logo-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
    font-family: var(--font-ui);
}

.logo-name span { color: var(--primary); }
.logo-name::after { content: '_'; animation: blink 1s step-end infinite; color: var(--primary); }

.logo-sub {
    font-size: 0.78rem;
    color: var(--text3);
    margin-top: 5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.page-login label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 6px;
    margin-top: 18px;
    font-family: var(--font-ui);
}

.page-login input[type="text"],
.page-login input[type="password"] {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-ui);
    outline: none;
    transition: var(--transition);
}

.page-login input:focus {
    border-color: var(--primary);
    background: var(--bg2);
    box-shadow: var(--glow);
}

.page-login input::placeholder { color: var(--text3); }

.btn-login {
    width: 100%;
    margin-top: 22px;
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 13px;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(37,99,235,0.3);
    letter-spacing: 0.01em;
}

.btn-login:hover {
    background: var(--primary2);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.4);
}

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

.error-box {
    margin-top: 14px;
    background: rgba(220,38,38,0.05);
    border: 1px solid rgba(220,38,38,0.2);
    color: var(--red2);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    text-align: center;
    animation: shake 0.3s ease;
    font-family: var(--font-ui);
}

/* ══════════════════════════════════════════════════
   CHAT APP
══════════════════════════════════════════════════ */

body.page-chat {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.55;
    transition: background 0.2s, color 0.2s;
}

/* ── Header ── */
.header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 10;
}

.header .logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.03em;
    white-space: nowrap;
    font-family: var(--font-ui);
}

.header .logo span   { color: var(--primary); font-weight: 400; }
.header .logo::after { content: '_'; animation: blink 1s step-end infinite; color: var(--primary); }

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.status-pill {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text3);
    transition: var(--transition);
    height: 34px;
}

.status-pill.online {
    border-color: #BBF7D0;
    background: #F0FDF4;
    color: var(--green2);
}

[data-theme="dark"] .status-pill.online {
    border-color: rgba(52,211,153,0.3);
    background: rgba(52,211,153,0.08);
    color: var(--green);
}

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

.status-dot.online {
    background: var(--green);
    box-shadow: 0 0 5px rgba(22,163,74,0.5);
    animation: pulse-dot 2s infinite;
}

select.model-select {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-family: var(--font-mono);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    max-width: 200px;
    height: 34px;
}

select.model-select:hover,
select.model-select:focus {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--glow);
}

select.model-select option { background: var(--bg2); }

.btn-websearch {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text3);
    padding: 0 14px;
    height: 34px;
    border-radius: 99px;
    font-size: 12px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap;
    font-weight: 500;
}

.btn-websearch:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(2,132,199,0.05); }

.btn-websearch.active {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(2,132,199,0.08);
}

[data-theme="dark"] .btn-websearch.active {
    border-color: #38BDF8;
    color: #38BDF8;
    background: rgba(56,189,248,0.08);
}

.speed-badge {
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 5px 14px;
    border-radius: 99px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--amber);
    display: flex; align-items: center; gap: 5px;
    white-space: nowrap;
    height: 34px;
    font-weight: 600;
    min-width: 90px;
}

.user-badge {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text2);
    white-space: nowrap;
    height: 34px;
}

.user-badge .user-icon { color: var(--primary); font-size: 11px; }

.btn-logout {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text3);
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    text-decoration: none;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover { border-color: var(--red); color: var(--red); background: rgba(220,38,38,0.05); }

.btn-theme {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text3);
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-theme:hover { border-color: var(--primary); color: var(--primary); }
.btn-theme::after                  { content: '☀'; }
[data-theme="dark"] .btn-theme::after { content: '☽'; }

/* ── Layout ── */
.app-body { display: flex; flex: 1; min-height: 0; }

/* ── Sidebar ── */
.sidebar {
    width: 225px;
    flex-shrink: 0;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════
   HAMBURGER BUTTON
══════════════════════════════════════════════════ */

.btn-hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--text2);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    line-height: 1;
    transition: var(--transition);
}

.btn-hamburger:hover { color: var(--primary); }

/* Close button în sidebar — ascuns pe desktop */
.sidebar-close {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text3);
    width: 24px; height: 24px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.sidebar-close:hover { border-color: var(--red); color: var(--red); }

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.visible { display: block; }

/* ══════════════════════════════════════════════════
   MOBILE
══════════════════════════════════════════════════ */

@media (max-width: 700px) {

    /* Header — un singur rând compact */
    .header {
        padding: 6px 10px;
        gap: 5px;
        flex-wrap: nowrap;
        min-height: 48px;
    }

    .header .logo { font-size: 0.85rem; }
    .header-right { gap: 5px; }

    /* Arată hamburger */
    .btn-hamburger { display: flex; }

    /* Ascunde pe mobil elementele secundare */
    .speed-badge    { display: none; }
    .user-badge     { display: none; }
    .status-pill    { display: none; }

    /* Model select mai compact */
    select.model-select {
        max-width: 140px;
        min-width: 0;
        font-size: 11px;
        padding: 4px 6px;
        height: 30px;
        flex-shrink: 1;
    }

    /* Butoane header mai mici */
    .btn-systemprompt,
    .btn-theme,
    .btn-logout { width: 28px; height: 28px; font-size: 13px; }

    /* Header right nu permite wrap */
    .header-right {
        overflow: hidden;
        flex-wrap: nowrap;
        flex-shrink: 1;
        min-width: 0;
    }

    /* Logo nu se micșorează */
    .header .logo { flex-shrink: 0; }
    .btn-hamburger { flex-shrink: 0; }

    /* Sidebar — drawer lateral */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 280px;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open { transform: translateX(0); }

    /* Arată butonul close în sidebar */
    .sidebar-close { display: flex; }

    /* Layout normal row */
    .app-body { flex-direction: row; }

    /* Mesaje mai late */
    .message { max-width: 96%; }

    /* Footer compact */
    .footer { padding: 8px 10px 10px; }
    .input-row { gap: 6px; }
    .btn-send { padding: 0 14px; min-width: 60px; font-size: 12px; }
    .btn-stop { padding: 0 10px; min-width: 60px; font-size: 12px; }
    .btn-attach { width: 34px; height: 34px; font-size: 15px; }

    textarea.msg-input { font-size: 13px; }

    /* System prompt panel compact */
    .systemprompt-panel.visible { flex-direction: column; gap: 8px; }
    .systemprompt-controls { flex-wrap: wrap; }

    /* Token counter */
    .sidebar-footer { padding: 4px 10px; }
    .token-counter  { font-size: 9px; }
}

.sidebar-header {
    padding: 9px 12px 9px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text3);
    text-transform: uppercase;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-ui);
}

.btn-new-chat {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    width: 24px; height: 24px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    padding: 0;
    font-weight: 400;
    line-height: 1;
}

.btn-new-chat:hover { background: var(--primary-bg); border-color: var(--primary-brd); }

.chat-list { overflow-y: auto; flex: 1; padding: 6px; }

.chat-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    margin-bottom: 2px;
}

.chat-item:hover { background: var(--bg3); }

.chat-item.active {
    background: var(--primary-bg);
    border-color: var(--primary-brd);
    border-left: 2px solid var(--primary);
}

.chat-item-icon { font-size: 12px; flex-shrink: 0; color: var(--text3); }
.chat-item.active .chat-item-icon { color: var(--primary); }

.chat-item-label {
    flex: 1;
    font-size: 12.5px;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-ui);
}

.chat-item.active .chat-item-label { color: var(--primary); font-weight: 600; }

.chat-item-del {
    opacity: 0;
    color: var(--red);
    font-size: 15px; padding: 1px 4px;
    border-radius: 4px;
    transition: var(--transition);
    cursor: pointer;
}

.chat-item:hover .chat-item-del { opacity: 1; }
.chat-item-del:hover { background: rgba(220,38,38,0.08); }

/* ── Chat area ── */
.chat-area {
    flex: 1; display: flex;
    flex-direction: column;
    min-width: 0; min-height: 0;
    background: var(--bg);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) { .messages { padding: 22px 28px; gap: 10px; } }

/* ── Empty state ── */
.empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 100%; gap: 12px;
    text-align: center; padding: 24px;
}

.robot-wrap {
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 4px 16px rgba(37,99,235,0.12));
}

.empty-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
    font-family: var(--font-ui);
}

.empty-sub { font-size: 0.85rem; color: var(--text3); max-width: 300px; font-family: var(--font-ui); }

.model-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--primary);
    background: var(--primary-bg);
    border: 1px solid var(--primary-brd);
    padding: 4px 14px;
    border-radius: 99px;
    font-weight: 600;
}

/* ── Messages ── */
.message {
    display: flex; gap: 10px;
    max-width: 88%;
    animation: slideIn 0.15s ease;
}

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

.avatar {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: #fff;
    font-weight: 700;
    font-family: var(--font-mono);
    box-shadow: var(--shadow-sm);
}

.message.user .avatar {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    box-shadow: none;
}

.bubble {
    padding: 11px 15px;
    border-radius: var(--radius);
    line-height: 1.55;
    font-size: 14px;
    word-wrap: break-word;
    flex: 1; min-width: 0;
    box-shadow: var(--shadow-sm);
    font-family: var(--font-ui);
}

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

.message.user .bubble {
    background: var(--primary);
    border: 1px solid var(--primary2);
    border-bottom-right-radius: 4px;
    color: #fff;
    box-shadow: 0 3px 12px rgba(37,99,235,0.25);
}

.message.user .bubble .bubble-time { color: rgba(255,255,255,0.55); }

.bubble-time {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text3);
    margin-top: 6px;
    display: block;
}

/* ── Code blocks ── */
.code-wrap {
    margin: 10px 0 4px;
    background: #0f1117;
    border: 1px solid #2a3347;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.code-bar {
    background: #161b26;
    padding: 5px 12px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #2a3347;
}

.code-lang {
    font-family: var(--font-mono);
    font-size: 10px;
    color: #6b8bff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}

.btn-copy {
    background: transparent;
    border: 1px solid #2a3347;
    color: #8f9ab8;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 10px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy:hover { border-color: #6b8bff; color: #6b8bff; }

.code-body {
    padding: 13px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #a8d8b9;
    white-space: pre-wrap;
    overflow-x: auto;
    line-height: 1.55;
}

/* ── Typing ── */
.typing-dots { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }

.dot {
    width: 6px; height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
    opacity: 0.6;
}

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

/* ── Footer ── */
.footer {
    padding: 10px 16px 12px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

@media (min-width: 768px) { .footer { padding: 10px 24px 12px; } }

.input-row {
    display: flex; gap: 8px;
    max-width: 900px; margin: 0 auto;
    align-items: center;
}

textarea.msg-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-ui);
    resize: none;
    min-height: 36px;
    max-height: 120px;
    outline: none;
    transition: var(--transition);
    line-height: 1.5;
}

textarea.msg-input::placeholder { color: var(--text3); }

textarea.msg-input:focus {
    border-color: var(--primary);
    background: var(--bg2);
    box-shadow: var(--glow);
}

.btn-group { display: flex; flex-direction: row; gap: 6px; align-items: center; }

.btn-send {
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 0 22px;
    height: 36px;
    min-width: 80px;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
    box-sizing: border-box;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary2);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37,99,235,0.4);
}

.btn-send:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-stop {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text3);
    padding: 0 18px;
    height: 36px;
    min-width: 80px;
    border-radius: 40px;
    font-size: 13px;
    font-family: var(--font-ui);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-sizing: border-box;
}

.btn-stop:hover { border-color: var(--red); color: var(--red); background: rgba(220,38,38,0.05); }

/* ── Attach ── */
.btn-attach {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text3);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-attach:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.btn-attach.active { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

/* ── File preview ── */
.file-preview {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--primary-bg);
    border: 1px solid var(--primary-brd);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    animation: slideIn 0.15s ease;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.file-preview.visible { display: flex; }
.file-preview-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.file-preview-icon { font-size: 15px; flex-shrink: 0; }
.file-preview-name { color: var(--primary); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.file-preview-size { color: var(--text3); flex-shrink: 0; }

.file-preview-img {
    max-width: 80px; max-height: 50px;
    border-radius: 4px;
    border: 1px solid var(--primary-brd);
    object-fit: cover; flex-shrink: 0;
}

.file-preview-remove {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text3);
    width: 20px; height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0; padding: 0;
}

.file-preview-remove:hover { border-color: var(--red); color: var(--red); }

/* ── Download ── */
.btn-download {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text3);
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 10px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
}

.btn-download:hover { border-color: var(--primary); color: var(--primary); }

/* ── Liste ── */
.bubble ul, .bubble ol { margin: .2em 0; padding: 0; }
.bubble li { margin: 0 !important; padding: 0; line-height: 1.5; }
.bubble br { line-height: 0.3; }
.bubble p  { margin: .2em 0; }

/* ══════════════════════════════════════════════════
   MARKDOWN TABLES
══════════════════════════════════════════════════ */

.tbl-wrap {
    overflow-x: auto;
    margin: .5em 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.md-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 12px;
}

.md-table th {
    background: var(--bg3);
    color: var(--primary);
    font-weight: 700;
    padding: 8px 12px;
    text-align: left;
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--primary-brd);
    white-space: nowrap;
}

.md-table td {
    padding: 7px 12px;
    color: var(--text);
    border: 1px solid var(--border);
    vertical-align: top;
}

.md-table tr:nth-child(even) td { background: var(--bg3); }
.md-table tr:hover td { background: var(--primary-bg); }

/* ══════════════════════════════════════════════════
   ROBOT ANIMATIONS
══════════════════════════════════════════════════ */

.robot-antenna-light, .ant { animation: antennaBlink 2s ease-in-out infinite; }

@keyframes antennaBlink {
    0%,45%,55%,100% { opacity:1; }
    50%             { opacity:.15; }
}

.robot-eye-l, .eye-l { animation: eyeScan 3s ease-in-out infinite; }
.robot-eye-r, .eye-r { animation: eyeScan 3s ease-in-out infinite .4s; }

@keyframes eyeScan {
    0%,100% { transform:translateX(0); }
    30%     { transform:translateX(3px); }
    70%     { transform:translateX(-3px); }
}

.robot-mouth { animation: mouthIdle 2.5s ease-in-out infinite; }

@keyframes mouthIdle {
    0%,100% { d: path("M40 78 Q55 84 70 78"); }
    50%     { d: path("M40 78 Q55 88 70 78"); }
}

.robot-glow { animation: glowPulse 3s ease-in-out infinite; }

@keyframes glowPulse {
    0%,100% { opacity:.1; }
    50%     { opacity:.3; }
}

.robot-chest-led { animation: chestBlink 1.8s ease-in-out infinite; }

@keyframes chestBlink {
    0%,100% { fill: #2563EB; opacity:.9; }
    50%     { fill: #60A5FA; opacity:.3; }
}

[data-theme="dark"] .robot-chest-led {
    animation: chestBlinkDark 1.8s ease-in-out infinite;
}

@keyframes chestBlinkDark {
    0%,100% { fill: #3B82F6; opacity:.9; }
    50%     { fill: #60A5FA; opacity:.3; }
}

.robot-arm-r {
    transform-origin: 85px 95px;
    animation: armWave 4s ease-in-out infinite;
}

@keyframes armWave {
    0%,60%,100% { transform:rotate(0deg); }
    70%         { transform:rotate(-18deg); }
    80%         { transform:rotate(8deg); }
    90%         { transform:rotate(-12deg); }
}

/* ══════════════════════════════════════════════════
   SYSTEM PROMPT PANEL
══════════════════════════════════════════════════ */

.btn-systemprompt {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text3);
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-systemprompt:hover { border-color: var(--primary); color: var(--primary); }
.btn-systemprompt.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.systemprompt-panel {
    display: none;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px 12px;
    animation: slideIn 0.15s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 9;
}

.systemprompt-panel.visible { display: flex; align-items: flex-start; gap: 12px; }

.systemprompt-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-family: var(--font-mono);
    white-space: nowrap;
    padding-top: 2px;
}

.systemprompt-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text3);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.systemprompt-close:hover { border-color: var(--red); color: var(--red); }

.systemprompt-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.systemprompt-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-ui);
    resize: none;
    height: 58px;
    outline: none;
    transition: var(--transition);
    line-height: 1.5;
}

.systemprompt-input:focus {
    border-color: var(--primary);
    background: var(--bg2);
    box-shadow: var(--glow);
}

.systemprompt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.systemprompt-hint {
    font-size: 11px;
    color: var(--text3);
    font-family: var(--font-mono);
}

.systemprompt-save {
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 4px 16px;
    border-radius: 40px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.systemprompt-save:hover { background: var(--primary2); }

/* ══════════════════════════════════════════════════
   SIDEBAR SEARCH + TOKEN COUNTER
══════════════════════════════════════════════════ */

.sidebar-search {
    padding: 5px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
}

.search-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font-mono);
    outline: none;
    transition: var(--transition);
}

.search-input:focus { border-color: var(--primary); box-shadow: var(--glow); }
.search-input::placeholder { color: var(--text3); }

.sidebar-footer {
    padding: 5px 10px;
    border-top: 1px solid var(--border);
    background: var(--bg3);
    flex-shrink: 0;
}

.token-counter {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text3);
    display: block;
    text-align: center;
    letter-spacing: .02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════
   TYPING INDICATOR
══════════════════════════════════════════════════ */

.typing-indicator-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-model {
    font-size: 11px;
    color: var(--text3);
    font-family: var(--font-mono);
    font-style: italic;
}

/* ── System prompt controls ── */
.systemprompt-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sp-ctrl-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text3);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.sp-ctrl-select {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font-mono);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.sp-ctrl-select:focus { border-color: var(--primary); }

/* ── Save project button ── */
.sp-ctrl-btn {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text2);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sp-ctrl-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.sp-ctrl-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Version badge ── */
.version-badge {
    display: block;
    text-align: center;
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--border2);
    letter-spacing: .04em;
    margin-top: 2px;
    transition: color 0.2s;
}

.version-badge:hover { color: var(--text3); }

/* ── Provider select ── */
.provider-select {
    background: var(--bg3);
    border: 1px solid var(--primary-brd);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-family: var(--font-mono);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    height: 34px;
    font-weight: 600;
}

.provider-select:hover,
.provider-select:focus {
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.provider-select option { background: var(--bg2); }

/* ══════════════════════════════════════════════════
   BUBBLE ACTIONS — copy button
══════════════════════════════════════════════════ */

.bubble-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.bubble:hover .bubble-actions { opacity: 1; }

.btn-bubble-action {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text3);
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-mono);
}

.btn-bubble-action:hover { border-color: var(--primary); color: var(--primary); }

/* ══════════════════════════════════════════════════
   REGENERATE BUTTON
══════════════════════════════════════════════════ */

.regen-wrap {
    display: flex;
    justify-content: center;
    padding: 4px 0 8px;
}

.btn-regen {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text3);
    padding: 5px 16px;
    border-radius: 99px;
    font-size: 12px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-regen:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

/* ══════════════════════════════════════════════════
   SCROLL TO BOTTOM BUTTON
══════════════════════════════════════════════════ */

.btn-scroll-bottom {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg2);
    border: 1px solid var(--border2);
    color: var(--text2);
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.btn-scroll-bottom:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

.chat-area { position: relative; }

/* ══════════════════════════════════════════════════
   TEMPERATURE SLIDER
══════════════════════════════════════════════════ */

.sp-ctrl-range {
    width: 80px;
    accent-color: var(--primary);
    cursor: pointer;
}

.sp-ctrl-range-val {
    font-size: 11px;
    color: var(--primary);
    font-family: var(--font-mono);
    font-weight: 600;
    min-width: 28px;
}

/* ══════════════════════════════════════════════════
   VOICE INPUT BUTTON
══════════════════════════════════════════════════ */

.btn-voice {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text3);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-voice:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

.btn-voice.recording {
    border-color: var(--red);
    background: rgba(220,38,38,0.08);
    color: var(--red);
    animation: pulse-rec 1s ease-in-out infinite;
}

@keyframes pulse-rec {
    0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.3); }
    50%      { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}
