/**
 * NS ASISTENTE — GLOBAL STYLES
 * Dark theme · Cyan accent · Inter font
 */

/* ─────────────────────────────────────────────
   VARIABLES
───────────────────────────────────────────── */
:root {
    --bg-base:    #09090f;
    --bg-surface: #111120;
    --bg-card:    rgba(17, 17, 32, 0.85);
    --bg-glass:   rgba(17, 17, 32, 0.65);
    --bg-hover:   rgba(255, 255, 255, 0.04);

    --text-1: #f0f0f6;
    --text-2: #8b8ba8;
    --text-3: #52526a;

    --cyan:       #00d4ff;
    --cyan-soft:  rgba(0, 212, 255, 0.12);
    --cyan-glow:  rgba(0, 212, 255, 0.25);
    --cyan-dim:   rgba(0, 212, 255, 0.06);

    --purple:     #a855f7;
    --purple-soft:rgba(168, 85, 247, 0.15);

    --border:     rgba(255, 255, 255, 0.07);
    --border-hi:  rgba(0, 212, 255, 0.2);

    --ok:   #00ff88;
    --warn: #ffaa00;
    --err:  #ff4466;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;

    --shadow: 0 4px 24px rgba(0,0,0,0.35);
    --glow:   0 0 24px rgba(0, 212, 255, 0.2);

    --sidebar-w: 260px;
    --topbar-h:  56px;
}

/* ─────────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-1);
    line-height: 1.6;
    min-height: 100%;
}

a { color: inherit; text-decoration: none; }

/* Background ambient glows */
.bg-glow {
    position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0;
}
.bg-glow::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    top: -200px; left: 20%;
    background: var(--cyan);
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.06;
}
.bg-glow::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    bottom: -150px; right: 15%;
    background: var(--purple);
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.05;
}

/* ─────────────────────────────────────────────
   GLASS & CARDS
───────────────────────────────────────────── */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

/* ─────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 7px; padding: 10px 20px;
    border: none; border-radius: var(--r-sm);
    font-family: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.18s ease;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    color: #020c18;
    font-weight: 700;
}
.btn-primary:hover { box-shadow: var(--glow); transform: translateY(-1px); }
.btn-primary svg { width: 16px; height: 16px; }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-1);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-hi); }
.btn-secondary.active {
    background: var(--cyan-soft);
    border-color: var(--border-hi);
    color: var(--cyan);
}
.btn-secondary.is-off {
    background: rgba(255,170,0,0.08);
    border-color: rgba(255,170,0,0.2);
    color: var(--warn);
}

.btn-ghost {
    background: transparent; border: none; color: var(--text-2);
    padding: 8px 12px; border-radius: var(--r-sm); font-size: 13px;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); }

.btn-icon {
    width: 38px; height: 38px; padding: 0;
    border-radius: var(--r-sm);
    background: transparent; border: none;
    color: var(--text-2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.18s;
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover { background: var(--cyan-soft); color: var(--cyan); }
.btn-icon.active { background: var(--cyan-soft); color: var(--cyan); }
.btn-icon.recording { background: rgba(255,68,102,0.15); color: var(--err); }

.btn-suggestion {
    padding: 8px 16px; border-radius: 20px;
    border: 1px solid var(--border-hi);
    background: var(--cyan-dim);
    color: var(--cyan); font-size: 13px;
    cursor: pointer; transition: all 0.18s;
    font-family: inherit;
}
.btn-suggestion:hover { background: var(--cyan-soft); }

/* ─────────────────────────────────────────────
   PILLS & BADGES
───────────────────────────────────────────── */
.pill {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500;
}
.pill-cyan { background: var(--cyan-soft); color: var(--cyan); border: 1px solid var(--border-hi); }
.pill-ok   { background: rgba(0,255,136,0.1); color: var(--ok); }
.pill-warn { background: rgba(255,170,0,0.1); color: var(--warn); }
.pill-muted{ background: var(--bg-hover); color: var(--text-2); }

/* ─────────────────────────────────────────────
   FORMS (shared)
───────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field input, .field textarea, .field select {
    padding: 11px 14px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-1);
    font-family: inherit; font-size: 14px;
    transition: border-color 0.18s;
}
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--cyan);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field .hint { font-size: 11px; color: var(--text-3); }

/* ─────────────────────────────────────────────
   MODAL
───────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 28px;
    width: 100%; max-width: 480px;
    box-shadow: var(--shadow);
    animation: scaleIn 0.2s ease;
}
.modal-box.modal-lg { max-width: 680px; }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close {
    width: 32px; height: 32px; border-radius: 50%;
    background: none; border: none; color: var(--text-2);
    font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-1); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ─────────────────────────────────────────────
   TOAST / ALERTS
───────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 80px; left: 50%;
    transform: translateX(-50%);
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    border-radius: var(--r-md);
    font-size: 13px; z-index: 600;
    animation: slideUp 0.25s ease;
    max-width: 420px;
}
.toast.hidden { display: none; }
.toast-err {
    background: rgba(255,68,102,0.12);
    border: 1px solid rgba(255,68,102,0.3);
    color: var(--err);
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-close {
    background: none; border: none; color: inherit;
    font-size: 18px; cursor: pointer; margin-left: 4px; opacity: 0.7;
}
.toast-close:hover { opacity: 1; }

/* ─────────────────────────────────────────────
   ██████╗ ██╗  ██╗ █████╗ ████████╗
   ██╔════╝██║  ██║██╔══██╗╚══██╔══╝
   ██║     ███████║███████║   ██║
   ██║     ██╔══██║██╔══██║   ██║
   ╚██████╗██║  ██║██║  ██║   ██║
    ╚═════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝
───────────────────────────────────────────── */

/* Layout: full-screen flex */
.chat-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #0c0c18;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: transform 0.25s ease;
}

.sidebar-head {
    padding: 18px 16px 14px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
}
.sidebar-logo {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--glow);
    flex-shrink: 0;
}
.sidebar-logo svg { width: 18px; height: 18px; color: white; }
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; display: block; }
.sidebar-brand-name {
    font-size: 15px; font-weight: 700; color: var(--text-1);
    line-height: 1.2;
}
.sidebar-brand-tag {
    font-size: 10px; color: var(--text-3); font-weight: 400;
}

.btn-new-chat {
    margin: 12px; flex-shrink: 0;
    width: calc(100% - 24px);
    border: 1px dashed var(--border-hi);
    color: var(--cyan);
    background: var(--cyan-dim);
    border-radius: var(--r-sm);
    padding: 10px;
    font-size: 13px; font-weight: 500;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; gap: 8px;
    transition: all 0.18s;
}
.btn-new-chat:hover { background: var(--cyan-soft); }
.btn-new-chat svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-section-label {
    padding: 12px 16px 4px;
    font-size: 10px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-3);
    flex-shrink: 0;
}

.sidebar-history {
    flex: 1; overflow-y: auto; padding: 4px 8px;
}
.sidebar-history::-webkit-scrollbar { width: 4px; }
.sidebar-history::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.history-item {
    display: flex; align-items: center;
    border-radius: var(--r-sm);
    font-size: 13px; color: var(--text-2);
    transition: all 0.15s;
    gap: 2px;
}
.history-item:hover { background: var(--bg-hover); color: var(--text-1); }
.history-item:hover .history-item-del { opacity: 1; }
.history-item.active { background: var(--cyan-dim); color: var(--cyan); }

.history-item-body {
    flex: 1; min-width: 0;
    padding: 9px 6px 9px 10px;
    cursor: pointer;
}
.history-item-label {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 13px;
}
.history-item-date {
    font-size: 10px; color: var(--text-3); margin-top: 2px;
}

.history-item-del {
    flex-shrink: 0;
    width: 28px; height: 28px;
    background: none; border: none;
    color: var(--text-3); cursor: pointer;
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: all 0.15s;
    margin-right: 4px;
}
.history-item-del:hover { background: rgba(255,68,102,0.15); color: var(--err); }
.history-item-del svg { width: 13px; height: 13px; }

.history-empty {
    padding: 12px 10px;
    font-size: 12px; color: var(--text-3);
    font-style: italic;
}

/* Sidebar Drive status row */
.sidebar-drive-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-2);
    flex-shrink: 0;
}
.drive-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-3);
    transition: background 0.2s;
}
.drive-status-dot.connected    { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.drive-status-dot.disconnected { background: var(--text-3); }
.drive-status-label { flex: 1; }
.drive-connect-link {
    font-size: 11px;
    color: var(--cyan);
    text-decoration: none;
    padding: 2px 7px;
    border: 1px solid var(--cyan);
    border-radius: 5px;
    transition: all 0.15s;
}
.drive-connect-link:hover { background: var(--cyan-soft); }
.drive-disconnect-btn {
    font-size: 11px;
    color: var(--text-3);
    background: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 7px;
    cursor: pointer;
    transition: all 0.15s;
}
.drive-disconnect-btn:hover { color: var(--err); border-color: var(--err); }

/* Sidebar controls (web search, autospeak) */
.sidebar-controls {
    padding: 8px;
    border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 4px;
    flex-shrink: 0;
}
.sidebar-control-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--r-sm);
    background: transparent; border: none; color: var(--text-2);
    font-family: inherit; font-size: 13px; cursor: pointer;
    text-align: left; transition: all 0.15s;
    width: 100%;
}
.sidebar-control-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.sidebar-control-btn.active { color: var(--cyan); }
.sidebar-control-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-control-label { flex: 1; }
.sidebar-control-status {
    font-size: 10px; padding: 2px 6px; border-radius: 4px;
    background: var(--cyan-soft); color: var(--cyan);
}
.sidebar-control-status.off {
    background: rgba(255,170,0,0.1); color: var(--warn);
}

/* Sidebar footer: user */
.sidebar-user {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}
.sidebar-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), #5b21b6);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: white;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 13px; font-weight: 500; color: var(--text-1);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-plan {
    font-size: 11px; color: var(--cyan);
}
.sidebar-user-actions { display: flex; gap: 2px; }

/* ── Main chat area ── */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-base);
}

/* Chat topbar (inside main) */
.chat-topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 10px;
}
.chat-topbar-left { display: flex; align-items: center; gap: 10px; }
.chat-topbar-title {
    font-size: 14px; font-weight: 500; color: var(--text-2);
}
.chat-topbar-right { display: flex; align-items: center; gap: 6px; }

/* Sidebar toggle (mobile) */
.btn-sidebar-toggle {
    display: none;
    width: 38px; height: 38px; padding: 0;
    border: none; background: transparent; color: var(--text-2);
    border-radius: var(--r-sm); cursor: pointer;
    align-items: center; justify-content: center;
}
.btn-sidebar-toggle svg { width: 20px; height: 20px; }

/* Messages area */
.chat-messages-wrap {
    flex: 1; overflow-y: auto; padding: 24px 20px;
}
.chat-messages-wrap::-webkit-scrollbar { width: 6px; }
.chat-messages-wrap::-webkit-scrollbar-track { background: transparent; }
.chat-messages-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.chat-messages-wrap::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* Messages inner (centered) */
.messages-inner {
    max-width: 720px; margin: 0 auto;
    display: flex; flex-direction: column; gap: 20px;
}

/* Welcome */
.welcome-screen {
    text-align: center; padding: 60px 20px 30px;
    animation: fadeIn 0.4s ease;
}
.welcome-icon {
    width: 72px; height: 72px; margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    border-radius: var(--r-xl);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--glow);
}
.welcome-icon svg { width: 36px; height: 36px; color: white; }
.welcome-screen h2 { font-size: 26px; font-weight: 700; margin-bottom: 10px; }
.welcome-screen p { color: var(--text-2); font-size: 15px; max-width: 380px; margin: 0 auto 28px; }
.welcome-suggestions {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}

/* Messages */
.messages { display: flex; flex-direction: column; gap: 20px; }

.message { display: flex; gap: 12px; animation: msgIn 0.25s ease; }
.message.user { flex-direction: row-reverse; }

.msg-avatar {
    width: 34px; height: 34px; border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.message.assistant .msg-avatar { background: linear-gradient(135deg, var(--cyan), #0080e0); }
.message.user .msg-avatar { background: linear-gradient(135deg, var(--purple), #5b21b6); }
.msg-avatar svg { width: 17px; height: 17px; color: white; }

.msg-body { max-width: 78%; display: flex; flex-direction: column; gap: 4px; }

.msg-content {
    padding: 13px 17px;
    border-radius: var(--r-lg);
    font-size: 14px; line-height: 1.65;
}
.message.assistant .msg-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}
.message.user .msg-content {
    background: var(--purple-soft);
    border: 1px solid rgba(168,85,247,0.25);
    border-top-right-radius: 4px;
}

.msg-text { word-break: break-word; }
.msg-text a { color: var(--cyan); text-decoration: underline; }

.msg-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 0 2px;
}
.msg-time { font-size: 11px; color: var(--text-3); }

/* Message attachments */
.msg-attachments { display: flex; flex-direction: column; gap: 8px; }
.msg-attachment {
    padding: 10px 12px; border-radius: 12px;
    background: rgba(255,255,255,0.03); border: 1px solid var(--border);
}
.message.user .msg-attachment { border-color: rgba(168,85,247,0.25); }
.msg-attachment-row { display: flex; align-items: center; gap: 10px; }
.msg-file-icon {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--cyan-soft); display: flex; align-items: center; justify-content: center;
    font-size: 17px; flex-shrink: 0;
}
.msg-file-info { flex: 1; min-width: 0; }
.msg-file-name { font-weight: 600; font-size: 13px; word-break: break-word; }
.msg-file-meta { font-size: 11px; color: var(--text-2); }

.msg-image-preview {
    display: block; width: auto; max-width: 100%; max-height: 220px;
    margin-top: 10px; border-radius: 10px;
    border: 1px solid var(--border); object-fit: contain;
}

.msg-action-btn {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent; color: var(--text-2);
    font-size: 11px; cursor: pointer; text-decoration: none;
    transition: all 0.15s; font-family: inherit;
}
.msg-action-btn:hover { background: var(--cyan-soft); border-color: var(--border-hi); color: var(--cyan); }

/* Tool indicators */
.msg-tools { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.tool-indicator { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.tool-indicator svg { width: 13px; height: 13px; }
.tool-indicator.success svg { color: var(--ok); }
.tool-indicator.error svg { color: var(--err); }

/* Loading */
.chat-loading { display: flex; align-items: center; gap: 12px; animation: fadeIn 0.2s ease; }
.loading-avatar {
    width: 34px; height: 34px; border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    display: flex; align-items: center; justify-content: center;
}
.loading-avatar svg { width: 17px; height: 17px; color: white; }
.loading-dots {
    display: flex; gap: 5px; padding: 14px 18px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.loading-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--cyan); animation: bounce 1s ease-in-out infinite;
}
.loading-dots span:nth-child(1) { animation-delay: 0ms; }
.loading-dots span:nth-child(2) { animation-delay: 140ms; }
.loading-dots span:nth-child(3) { animation-delay: 280ms; }

/* Confirmation dialog */
.confirm-dialog { animation: fadeIn 0.2s ease; }
.confirm-box {
    padding: 20px; border-radius: var(--r-lg);
    background: var(--bg-card); border: 1px solid rgba(255,170,0,0.25);
    max-width: 400px;
}
.confirm-icon { width: 36px; height: 36px; color: var(--warn); margin-bottom: 10px; }
.confirm-icon svg { width: 100%; height: 100%; }
.confirm-box p { font-size: 14px; margin-bottom: 14px; }
.confirm-actions { display: flex; gap: 10px; }

/* ── Input area ── */
.chat-input-area {
    padding: 14px 20px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.input-box {
    max-width: 720px; margin: 0 auto;
}
.input-shell {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 10px;
    transition: border-color 0.18s;
}
.input-shell:focus-within { border-color: var(--border-hi); }

.input-shell textarea {
    width: 100%; min-height: 46px; max-height: 180px;
    background: transparent; border: none;
    color: var(--text-1); font-family: inherit; font-size: 14px;
    resize: none; outline: none; line-height: 1.5; padding: 4px 6px;
}
.input-shell textarea::placeholder { color: var(--text-3); }
.input-shell textarea:disabled { opacity: 0.4; }
.chat-storage {
    margin-bottom: 10px;
    padding: 8px 10px 10px;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
}
.chat-storage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.chat-storage-title,
.chat-storage-label {
    font-size: 12px;
    color: var(--text-2);
}
.chat-storage-label {
    font-weight: 600;
    color: var(--text-1);
}
.chat-storage-track {
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}
.chat-storage-fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg,var(--cyan),#0080e0);
    transition: width 0.25s ease, background 0.25s ease;
}

.input-actions-row {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 8px; border-top: 1px solid var(--border); margin-top: 4px;
}
.input-left { display: flex; align-items: center; gap: 4px; }
.input-right { display: flex; align-items: center; gap: 6px; }

.recording-pill {
    display: flex; align-items: center; gap: 7px;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(255,68,102,0.12); color: var(--err); font-size: 12px;
}
.recording-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--err); animation: pulse 1s ease-in-out infinite;
}

.input-hint {
    text-align: center; font-size: 11px; color: var(--text-3); margin-top: 10px;
}

/* Plans in chat (modal-style overlay) */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.plan-card {
    padding: 18px; border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    display: flex; flex-direction: column; gap: 6px;
}
.plan-card.current { border-color: var(--border-hi); box-shadow: var(--glow); }
.plan-card.popular { border-color: rgba(255, 190, 80, 0.30); box-shadow: 0 0 0 1px rgba(255, 190, 80, 0.10) inset; }
.plan-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plan-eyebrow { font-size: 10px; color: var(--cyan); letter-spacing: 0.08em; text-transform: uppercase; }
.plan-card h3 { font-size: 17px; }
.plan-subtitle { font-size: 12px; color: var(--text-3); }
.plan-price { font-size: 20px; font-weight: 700; }
.plan-price small { font-size: 12px; color: var(--text-2); font-weight: 400; }
.plan-desc { font-size: 13px; color: var(--text-2); flex: 1; }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--text-2); }
.plan-feature::before { content: '✓ '; color: var(--ok); }
.plan-storage-note { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.plan-status { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--bg-hover); color: var(--text-2); display: inline-flex; width: fit-content; }
.plan-status.current { background: var(--cyan-soft); color: var(--cyan); }
.plan-status-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 4px 10px; border-radius: 999px; background: var(--bg-hover); color: var(--text-2); }
.plan-status-badge.current { background: var(--cyan-soft); color: var(--cyan); }
.plan-status-badge.highlight { background: rgba(255,255,255,0.08); color: var(--text-1); }
.plan-status-badge.popular { background: rgba(255, 190, 80, 0.12); color: #ffd36a; }
.plan-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.empty-plans { text-align: center; padding: 20px; color: var(--text-3); font-size: 13px; border: 1px dashed var(--border); border-radius: var(--r-md); }

/* Knowledge form in chat */
.knowledge-form { display: flex; flex-direction: column; gap: 8px; }
.knowledge-input {
    width: 100%; padding: 9px 12px;
    background: rgba(0,0,0,0.25); border: 1px solid var(--border);
    border-radius: var(--r-sm); color: var(--text-1); font-size: 13px;
    font-family: inherit;
}
.knowledge-input:focus { outline: none; border-color: var(--cyan); }
.knowledge-feedback { font-size: 12px; color: var(--text-2); padding: 8px 0; }
.knowledge-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.knowledge-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 12px; border-radius: var(--r-sm);
    background: rgba(255,255,255,0.02); border: 1px solid var(--border);
    font-size: 13px;
}

/* ─────────────────────────────────────────────
   LANDING PAGE
───────────────────────────────────────────── */
.landing-body { overflow: auto; height: auto; }

/* Navbar */
.landing-nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(9,9,15,0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 40px; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
}
.landing-nav .brand {
    display: flex; align-items: center; gap: 12px;
}
.brand-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--glow);
}
.brand-logo svg { width: 20px; height: 20px; color: white; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; display: block; }
.brand-name { font-size: 17px; font-weight: 700; }
.landing-nav-links { display: flex; align-items: center; gap: 8px; }

/* Hero */
.hero {
    min-height: calc(100vh - 64px);
    display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 80px 24px;
}
.hero-inner { max-width: 720px; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 16px; border-radius: 999px;
    background: var(--cyan-soft); border: 1px solid var(--border-hi);
    color: var(--cyan); font-size: 13px; margin-bottom: 28px;
}
.hero-badge span { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: pulse 2s ease-in-out infinite; }
.hero h1 {
    font-size: clamp(36px, 6vw, 62px);
    font-weight: 800; line-height: 1.1;
    letter-spacing: -0.02em; margin-bottom: 22px;
}
.hero h1 em { font-style: normal; color: var(--cyan); }
.hero p {
    font-size: 18px; color: var(--text-2); line-height: 1.7;
    max-width: 520px; margin: 0 auto 40px;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Section */
.landing-section { padding: 100px 24px; }
.landing-section.alt { background: rgba(255,255,255,0.015); }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-tag {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--cyan); margin-bottom: 14px;
}
.section-title { font-size: clamp(26px, 4vw, 40px); font-weight: 700; margin-bottom: 16px; }
.section-sub { font-size: 16px; color: var(--text-2); max-width: 560px; line-height: 1.7; }

/* Features grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px; margin-top: 52px;
}
.feature-card {
    padding: 28px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover { border-color: var(--border-hi); transform: translateY(-2px); }
.feature-icon {
    width: 48px; height: 48px; border-radius: var(--r-md);
    background: var(--cyan-soft);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 18px;
}
.feature-icon svg { width: 24px; height: 24px; color: var(--cyan); }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* Pricing */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px; margin-top: 52px;
}
.pricing-card {
    padding: 32px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--r-xl);
    display: flex; flex-direction: column; gap: 8px;
    position: relative;
}
.pricing-card.featured {
    border-color: var(--border-hi);
    background: linear-gradient(180deg, rgba(0,212,255,0.04), var(--bg-card));
}
.pricing-card.featured::before {
    content: 'Popular';
    position: absolute; top: -1px; right: 24px;
    padding: 3px 12px; border-radius: 0 0 8px 8px;
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    color: #020c18; font-size: 11px; font-weight: 700;
}
.pricing-name { font-size: 14px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.pricing-price { font-size: 38px; font-weight: 800; line-height: 1; margin: 8px 0; }
.pricing-price span { font-size: 18px; font-weight: 500; color: var(--text-2); }
.pricing-period { font-size: 13px; color: var(--text-3); }
.pricing-desc { font-size: 14px; color: var(--text-2); margin: 12px 0; line-height: 1.6; }
.pricing-features { list-style: none; display: flex; flex-direction: column; gap: 8px; flex: 1; margin-bottom: 24px; }
.pricing-feature { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-2); }
.pricing-feature::before { content: ''; flex-shrink: 0; width: 16px; height: 16px; background: var(--ok); border-radius: 50%; margin-top: 2px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 10px; background-repeat: no-repeat; background-position: center; }

/* Landing CTA bottom */
.landing-cta {
    text-align: center; padding: 100px 24px;
    background: radial-gradient(ellipse at center, rgba(0,212,255,0.05) 0%, transparent 70%);
}
.landing-cta h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 700; margin-bottom: 16px; }
.landing-cta p { font-size: 16px; color: var(--text-2); margin-bottom: 36px; }

/* Footer */
.landing-footer {
    padding: 30px 40px; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; color: var(--text-3);
}

/* ─────────────────────────────────────────────
   AUTH PAGE
───────────────────────────────────────────── */
.auth-body { overflow: auto; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }

.auth-wrap { width: 100%; max-width: 420px; }

.auth-logo {
    display: flex; align-items: center; gap: 12px;
    justify-content: center; margin-bottom: 36px;
}
.auth-logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--glow);
}
.auth-logo-icon svg { width: 22px; height: 22px; color: white; }
.auth-logo-name { font-size: 20px; font-weight: 700; }

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 32px;
}

/* Tab toggle */
.auth-tabs {
    display: flex; gap: 4px; padding: 4px;
    background: rgba(0,0,0,0.2); border-radius: var(--r-sm);
    margin-bottom: 28px;
}
.auth-tab {
    flex: 1; padding: 9px; border-radius: 6px;
    background: transparent; border: none; color: var(--text-2);
    font-family: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.15s;
}
.auth-tab.active {
    background: var(--bg-surface); color: var(--text-1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form-panel { display: none; }
.auth-form-panel.active { display: flex; flex-direction: column; gap: 16px; }

.auth-feedback {
    font-size: 13px; min-height: 20px; padding: 0 2px;
    color: var(--text-2);
}
.auth-feedback.err { color: var(--err); }
.auth-feedback.ok { color: var(--ok); }

.auth-footer {
    text-align: center; margin-top: 20px;
    font-size: 13px; color: var(--text-3);
}
.auth-footer a { color: var(--cyan); }

/* ─────────────────────────────────────────────
   USER DASHBOARD
───────────────────────────────────────────── */
.dashboard-body { overflow: auto; min-height: 100vh; }

/* Dashboard topbar */
.dashboard-topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(9,9,15,0.9); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 32px; height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px;
}
.dashboard-topbar .brand { display: flex; align-items: center; gap: 10px; }
.dashboard-topbar .brand-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.dashboard-topbar .brand-icon svg { width: 17px; height: 17px; color: white; }
.dashboard-topbar .brand-label { font-size: 15px; font-weight: 700; }

/* Tab nav */
.dash-tabs {
    display: flex; gap: 2px;
    background: rgba(0,0,0,0.2);
    padding: 4px; border-radius: var(--r-sm);
}
.dash-tab {
    padding: 7px 16px; border-radius: 6px;
    background: transparent; border: none; color: var(--text-2);
    font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.dash-tab.active {
    background: var(--bg-surface); color: var(--text-1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.dashboard-topbar-right { display: flex; align-items: center; gap: 8px; }

/* Dashboard content */
.dashboard-content { max-width: 1000px; margin: 0 auto; padding: 32px 24px 60px; }

.dash-panel { display: none; }
.dash-panel.active { display: block; }

/* Panel header */
.panel-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.panel-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.panel-sub { font-size: 14px; color: var(--text-2); }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Info cards */
.info-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr));
    gap: 12px; margin-bottom: 24px;
}
.info-card {
    padding: 18px; border-radius: var(--r-md);
    background: var(--bg-card); border: 1px solid var(--border);
}
.info-card-val { font-size: 24px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
.info-card-label { font-size: 12px; color: var(--text-3); }
.info-card.highlight { border-color: var(--border-hi); background: var(--cyan-dim); }
.info-card.highlight .info-card-val { color: var(--cyan); }

/* Data table */
.data-table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3); border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}
.data-table td {
    padding: 14px 16px; font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.data-table .cell-name { font-weight: 500; }
.data-table .cell-meta { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* Empty state */
.empty-state {
    text-align: center; padding: 48px 20px;
    color: var(--text-3); font-size: 14px;
    border: 1px dashed var(--border); border-radius: var(--r-md);
}
.empty-state-icon { font-size: 32px; margin-bottom: 12px; }

/* Subscription card */
.sub-card {
    padding: 24px; border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; flex-wrap: wrap; margin-bottom: 20px;
}
.sub-card.active-plan { border-color: var(--border-hi); background: var(--cyan-dim); }
.sub-card-left {}
.sub-plan-name { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.sub-plan-meta { font-size: 13px; color: var(--text-2); }
.sub-card-right { display: flex; gap: 8px; flex-wrap: wrap; }

/* Usage bars */
.usage-list { display: flex; flex-direction: column; gap: 10px; }
.usage-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--r-sm); background: rgba(255,255,255,0.02); border: 1px solid var(--border); }
.usage-label { font-size: 13px; }
.usage-val { font-size: 13px; font-weight: 600; color: var(--text-1); }

/* Feedback bar */
.feedback-bar {
    padding: 12px 16px; border-radius: var(--r-sm);
    font-size: 13px; min-height: 20px;
    background: var(--cyan-dim); color: var(--cyan);
    border: 1px solid var(--border-hi);
    display: none;
}
.feedback-bar.visible { display: block; }
.feedback-bar.err { background: rgba(255,68,102,0.08); color: var(--err); border-color: rgba(255,68,102,0.25); }

/* ─────────────────────────────────────────────
   UTILITIES
───────────────────────────────────────────── */
.hidden { display: none !important; }
.muted { color: var(--text-2); font-size: 13px; }

/* ─────────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ─────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────── */

/* Sidebar collapse on tablet */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; left: 0; top: 0;
        z-index: 200; transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        position: fixed; inset: 0; z-index: 199;
        background: rgba(0,0,0,0.5); display: none;
    }
    .sidebar-overlay.open { display: block; }
    .btn-sidebar-toggle { display: flex; }

    .landing-nav { padding: 0 20px; }
    .landing-nav-links .btn:not(:last-child) { display: none; }

    .dashboard-topbar { padding: 0 16px; }
    .dash-tabs { overflow-x: auto; }
    .dash-tab { padding: 7px 12px; font-size: 12px; }
    .dashboard-content { padding: 20px 16px 48px; }

    .auth-body { align-items: flex-start; padding: 20px 16px; }
}

@media (max-width: 540px) {
    .hero h1 { font-size: 30px; }
    .hero p { font-size: 15px; }
    .hero-cta { flex-direction: column; align-items: stretch; }
    .pricing-grid { grid-template-columns: 1fr; }
    .features-grid { grid-template-columns: 1fr; }
    .sub-card { flex-direction: column; }
    .panel-header { flex-direction: column; }
    .chat-topbar { padding: 0 12px; }
    .chat-input-area { padding: 10px 12px 16px; }
}

/* ─────────────────────────────────────────────
   CHAT MESSAGES — clases originales de app.js
───────────────────────────────────────────── */

/* Contenedor de cada mensaje */
.message {
    display: flex;
    gap: 12px;
    animation: msgIn 0.25s ease;
}
.message.user {
    flex-direction: row-reverse;
}

/* Avatar */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--cyan), #0080e0);
}
.message.user .message-avatar {
    background: linear-gradient(135deg, var(--purple), #5b21b6);
}
.message-avatar svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Burbuja */
.message-content {
    max-width: 78%;
    padding: 13px 17px;
    border-radius: var(--r-lg);
    font-size: 14px;
    line-height: 1.65;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.message.assistant .message-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}
.message.user .message-content {
    background: var(--purple-soft);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-top-right-radius: 4px;
}

/* Texto del mensaje */
.message-text {
    word-break: break-word;
}
.message-text a {
    color: var(--cyan);
    text-decoration: underline;
}
.message-text p { margin-bottom: 8px; }
.message-text p:last-child { margin-bottom: 0; }
.message-text ul, .message-text ol { padding-left: 20px; margin: 6px 0; }
.message-text li { margin-bottom: 4px; }
.message-text pre {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 12px;
    overflow-x: auto;
    font-size: 13px;
    margin: 8px 0;
}
.message-text code:not(pre code) {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
}

/* Footer del mensaje (copiar + hora) */
.message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.message-time {
    font-size: 11px;
    color: var(--text-3);
}
.message-copy-btn {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-3);
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.message-copy-btn:hover {
    background: var(--cyan-soft);
    border-color: var(--border-hi);
    color: var(--cyan);
}

/* Botones de descarga de artefactos */
.message-artifacts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0 4px;
}
.artifact-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.artifact-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--cyan);
    background: var(--cyan-soft);
    color: var(--cyan);
    font-size: 13px;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}
.artifact-download-btn:hover {
    background: var(--cyan);
    color: #000;
}
.artifact-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.artifact-delete-btn:hover {
    background: rgba(255,68,102,0.12);
    border-color: var(--err);
    color: var(--err);
}
.artifact-delete-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Botón de voz por burbuja */
.message-voice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-3);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    gap: 4px;
}
.message-voice-btn:hover {
    background: var(--cyan-soft);
    border-color: var(--border-hi);
    color: var(--cyan);
}
.message-voice-btn.tts-playing {
    background: rgba(255,68,102,0.12);
    border-color: var(--err);
    color: var(--err);
    animation: pulse 1.2s ease-in-out infinite;
}

/* Botón detener TTS en input */
.btn-stop-tts {
    color: var(--err) !important;
    background: rgba(255,68,102,0.1) !important;
}
.btn-stop-tts:hover {
    background: rgba(255,68,102,0.2) !important;
}

/* Controles de voz en sidebar */
.voice-controls {
    padding: 8px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border);
    margin-top: -4px;
}
.voice-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.voice-controls-label {
    font-size: 11px;
    color: var(--text-3);
    flex-shrink: 0;
}
.voice-speed-group,
.voice-gender-group {
    display: flex;
    gap: 4px;
}
.voice-speed-btn {
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.voice-speed-btn:hover,
.voice-speed-btn.active {
    background: var(--cyan-soft);
    border-color: var(--cyan);
    color: var(--cyan);
}
.voice-gender-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.voice-gender-btn:hover,
.voice-gender-btn.active {
    background: var(--cyan-soft);
    border-color: var(--cyan);
    color: var(--cyan);
}

/* Source */
.message-source {
    font-size: 11px;
    color: var(--text-3);
    padding-top: 4px;
    font-style: italic;
}

/* Tools usadas */
.message-tools {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.tool-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-3);
}
.tool-indicator svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}
.tool-indicator.success svg { color: var(--ok); }
.tool-indicator.error  svg { color: var(--err); }

/* Archivos adjuntos */
.message-attachments,
.message-inline-images {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.message-attachment {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
}
.message.user .message-attachment {
    border-color: rgba(168, 85, 247, 0.25);
}
.message-attachment-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.message-file-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--cyan-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.message-file-info {
    flex: 1;
    min-width: 0;
}
.message-file-name {
    font-weight: 600;
    font-size: 13px;
    word-break: break-word;
}
.message-file-meta {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 2px;
}

/* Imágenes en mensajes */
.message-image-link {
    display: inline-block;
}
.message-image-preview {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 240px;
    margin-top: 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    object-fit: contain;
}

/* Botón de descarga en archivos */
.message-download-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    font-size: 11px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.message-download-btn:hover {
    background: var(--cyan-soft);
    border-color: var(--border-hi);
    color: var(--cyan);
}

.limit-error-bubble {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--r-md);
    padding: 16px 20px;
    color: var(--text);
    max-width: 480px;
}

/* Footer publico NS Asistente */
.site-footer {
    border-top: 1px solid var(--border);
    background: radial-gradient(circle at top left, rgba(0,212,255,0.08), transparent 34%), rgba(5,7,14,0.92);
    color: var(--text-2);
    padding: 42px 24px 22px;
}
.site-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(260px, 1.2fr) minmax(320px, 1.8fr);
    gap: 40px;
}
.site-footer-brand { display: flex; align-items: flex-start; gap: 14px; }
.site-footer-logo {
    width: 44px; height: 44px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--cyan), #0080e0);
    color: #020c18; font-weight: 800; box-shadow: var(--glow);
}
.site-footer-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; display: block; }
.site-footer h2 { color: var(--text-1); font-size: 20px; margin-bottom: 8px; }
.site-footer p { color: var(--text-2); line-height: 1.6; margin: 0 0 8px; }
.site-footer span { color: var(--text-3); font-size: 13px; }
.site-footer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.site-footer-col { display: flex; flex-direction: column; gap: 10px; }
.site-footer-col h3 {
    color: var(--text-1); font-size: 13px;
    text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px;
}
.site-footer a {
    color: var(--text-2); text-decoration: none; font-size: 14px;
    transition: color 0.15s ease;
}
.site-footer a:hover { color: var(--cyan); }
.site-footer-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
}
.site-footer-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,212,255,0.10);
    border: 1px solid rgba(0,212,255,0.18);
    color: var(--cyan);
    font-size: 13px;
    font-weight: 800;
    flex: 0 0 auto;
}
.site-footer-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}
.site-footer-social {
    min-width: 42px;
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}
.site-footer-social:hover {
    background: rgba(0,212,255,0.10);
    border-color: rgba(0,212,255,0.24);
}
.site-footer-social span {
    width: 24px;
    height: 24px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0,212,255,0.22), rgba(0,128,224,0.16));
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
}
.site-footer-social strong {
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}
.site-footer-bottom {
    max-width: 1180px; margin: 30px auto 0; padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

@media (max-width: 860px) {
    .site-footer-inner { grid-template-columns: 1fr; }
    .site-footer-grid { grid-template-columns: 1fr; }
}
